From b9abe4bc67f8d698a4bdccf2ab56b1542eae8ed6 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 12 Aug 2021 15:48:29 +0200
Subject: [PATCH] fix an issue with initialization  of beta and kappa
 parameters in MultiphaseTwoPhaseFieldsPressureFilterLBMKernel after
 restarting, need global refactoring kernel parameters

---
 apps/cpu/Multiphase/Multiphase.cpp                        | 7 +++++++
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp            | 2 ++
 .../Visitors/MultiphaseSetKernelBlockVisitor.cpp          | 8 ++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index e100d4e15..d4f06e6ea 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -101,6 +101,13 @@ void run(string configname)
         kernel->setPhaseFieldRelaxation(tauH);
         kernel->setMobility(mob);
 
+        //nuL, nuG, densityRatio, beta, kappa, theta,
+
+        kernel->setCollisionFactorMultiphase(nuL, nuG);
+        kernel->setDensityRatio(densityRatio);
+        kernel->setMultiphaseModelParameters(beta, kappa);
+        kernel->setContactAngle(theta);
+
         SPtr<BCProcessor> bcProc(new BCProcessor());
         // BCProcessorPtr bcProc(new ThinWallBCProcessor());
 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index fe84de2d1..bbf2a2c50 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -1136,6 +1136,8 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
         // find the nesessary block and fill it
         SPtr<Block3D> block = grid->getBlock(dataSetArray[n].globalID);
         this->lbmKernel->setBlock(block);
+        UbTupleInt3 blockNX = grid->getBlockNX();
+        this->lbmKernel->setNX(std::array<int, 3>{ { val<1>(blockNX), val<2>(blockNX), val<3>(blockNX) } });
         SPtr<LBMKernel> kernel = this->lbmKernel->clone();
         kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth);
         kernel->setCollisionFactor(dataSetArray[n].collFactor);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
index 733c7177d..e42cdb785 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
@@ -36,10 +36,10 @@ void MultiphaseSetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo
 		LBMReal collFactorL = LBMSystem::calcCollisionFactor(nuL, block->getLevel());
 		LBMReal collFactorG = LBMSystem::calcCollisionFactor(nuG, block->getLevel());
 
-		kernel->setCollisionFactorMultiphase(collFactorL, collFactorG);
-		kernel->setDensityRatio(densityRatio);
-		kernel->setMultiphaseModelParameters(beta, kappa);
-		kernel->setContactAngle(contactAngle);
+		//kernel->setCollisionFactorMultiphase(collFactorL, collFactorG);
+		//kernel->setDensityRatio(densityRatio);
+		//kernel->setMultiphaseModelParameters(beta, kappa);
+		//kernel->setContactAngle(contactAngle);
 
 		kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
 		kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
-- 
GitLab