From dc9c79a5bbf4cb6c8e1264afb07beffd055c108d Mon Sep 17 00:00:00 2001
From: Philipp Suffa <philipp.suffa@fau.de>
Date: Thu, 4 Apr 2024 15:43:07 +0200
Subject: [PATCH] Small changes for cluster[skip_ci]

---
 .../ListLBM/HybridBenchmark/HybridBenchmark.cpp    | 14 ++++++++------
 .../ListLBM/HybridBenchmark/HybridBenchmark.py     |  4 ++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.cpp b/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.cpp
index d06124bda..962f38419 100644
--- a/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.cpp
+++ b/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.cpp
@@ -177,7 +177,10 @@ void gatherAndPrintWorkloadStats(weak_ptr<StructuredBlockForest> forest, BlockDa
       if (blockWorkload > maxWorkload) maxWorkload = blockWorkload;
       totalWorkloadOnProcess += blockWorkload;
    }
-   averageWorkloadPerProcess = uint_c(real_c(totalWorkloadOnProcess) / real_c(blocks->getNumberOfBlocks()));
+   if (totalWorkloadOnProcess <= 0 || blocks->size() == 0)
+      totalWorkloadOnProcess = 0;
+   else
+      averageWorkloadPerProcess = uint_c(real_c(totalWorkloadOnProcess) / real_c(blocks->size()));
    WALBERLA_MPI_SECTION() {
       walberla::mpi::reduceInplace(minWorkload, walberla::mpi::MIN);
       walberla::mpi::reduceInplace(maxWorkload, walberla::mpi::MAX);
@@ -212,7 +215,9 @@ void gatherAndPrintPorosityStats(weak_ptr<StructuredBlockForest> forest, BlockDa
       if (blockPorosity > maxPorosity) maxPorosity = blockPorosity;
       averageProcessPorosity += blockPorosity;
    }
-   averageProcessPorosity /= real_c(blocks->size());
+   if (blocks->size() > 0)
+      averageProcessPorosity = averageProcessPorosity/ real_c(blocks->size()) ;
+
    WALBERLA_MPI_SECTION() {
       walberla::mpi::reduceInplace(minPorosity, walberla::mpi::MIN);
       walberla::mpi::reduceInplace(maxPorosity, walberla::mpi::MAX);
@@ -220,9 +225,6 @@ void gatherAndPrintPorosityStats(weak_ptr<StructuredBlockForest> forest, BlockDa
    std::vector<real_t> processPorositiesVec;
    processPorositiesVec = mpi::gather( averageProcessPorosity);
    WALBERLA_ROOT_SECTION() {
-      for (auto p : processPorositiesVec) {
-         WALBERLA_LOG_INFO(p)
-      }
       real_t sum = std::accumulate(processPorositiesVec.begin(), processPorositiesVec.end(), 0.0);
       real_t mean = real_c(sum) / real_c(processPorositiesVec.size());
 
@@ -534,7 +536,7 @@ int main(int argc, char **argv)
          blockforest.allowMultipleRefreshCycles( true ); // otherwise info collections are invalid
          blockforest.setRefreshPhantomBlockDataPackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
          blockforest.setRefreshPhantomBlockDataUnpackFunction( blockforest::WeightAssignmentFunctor::PhantomBlockWeightPackUnpackFunctor() );
-         blockforest.setRefreshPhantomBlockMigrationPreparationFunction( blockforest::DynamicCurveBalance<blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, true ) );
+         blockforest.setRefreshPhantomBlockMigrationPreparationFunction( blockforest::DynamicCurveBalance<blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( true, true, true ) );
 
          shared_ptr<blockforest::InfoCollection> weightsInfoCollection = make_shared<blockforest::InfoCollection>();
          getBlocksWeights(blocks, *weightsInfoCollection, flagFieldId, fluidFlagUID, sweepSelectLowPorosity, sweepSelectHighPorosity);
diff --git a/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.py b/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.py
index de95b67bd..c42de8a1c 100644
--- a/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.py
+++ b/apps/benchmarks/ListLBM/HybridBenchmark/HybridBenchmark.py
@@ -37,8 +37,8 @@ with CodeGeneration() as ctx:
         stencil=stencil,
         relaxation_rate=omega,
         streaming_pattern='pull',
-        force_model=ForceModel.LUO,
-        force=(0.0001, 0, 0)
+        #force_model=ForceModel.LUO,
+        #force=(0.0001, 0, 0)
     )
 
 
-- 
GitLab