From a3dd88c6bc407f371e88166efcb75bf53a25cb23 Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Thu, 13 May 2021 08:30:42 +0200
Subject: [PATCH 001/179] Fix MPIIOMigrationBECoProcessor

---
 .../MPIIOMigrationBECoProcessor.cpp           | 26 ++++++++++++-------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 0e27f03a9..806dee56c 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -972,6 +972,8 @@ void MPIIOMigrationBECoProcessor::blocksExchange(int tagN, int ind1, int ind2, i
 
     MPI_Waitall(requestCount, &requests[0], MPI_STATUSES_IGNORE);
 
+    MPI_Type_free(&sendBlockDoubleType);
+
     delete[] blocksCounterSend;
     delete[] blocksCounterRec;
     delete[] rawDataSend;
@@ -1079,11 +1081,15 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     for (int r = 0; r < size; r++)
         rawDataReceiveF[r].resize(0);
     blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayF, rawDataReceiveF);
+    
 
     std::vector<double>* rawDataReceiveH1 = new std::vector<double>[size];
-    for (int r = 0; r < size; r++)
-        rawDataReceiveH1[r].resize(0);
-    blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayH1, rawDataReceiveH1);
+    if (multiPhase)
+    {
+        for (int r = 0; r < size; r++)
+            rawDataReceiveH1[r].resize(0);
+        blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayH1, rawDataReceiveH1);
+    }
 
     /*    std::vector<double>* rawDataReceiveH2 = new std::vector<double>[size];
         for (int r = 0; r < size; r++)
@@ -1125,14 +1131,14 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
 
             vectorsOfValuesF2.assign(rawDataReceiveF[r].data() + index, rawDataReceiveF[r].data() + index + vectorSize2);
             if (multiPhase)
-                vectorsOfValuesH12.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize1);
-            //vectorsOfValuesH22.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize1);
+                vectorsOfValuesH12.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize2);
+            //vectorsOfValuesH22.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize2);
             index += vectorSize2;
 
             vectorsOfValuesF3.assign(rawDataReceiveF[r].data() + index, rawDataReceiveF[r].data() + index + vectorSize3);
             if (multiPhase)
-                vectorsOfValuesH13.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize1);
-                //vectorsOfValuesH23.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize1);
+                vectorsOfValuesH13.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize3);
+                //vectorsOfValuesH23.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize3);
             index += vectorSize3;
 
             SPtr<DistributionArray3D> mFdistributions(new D3Q27EsoTwist3DSplittedVector());
@@ -1174,7 +1180,6 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);*/
 
-
             // find the nesessary block and fill it
             SPtr<Block3D> block = grid->getBlock(blockID);
             this->lbmKernel->setBlock(block);
@@ -1196,7 +1201,8 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             block->setKernel(kernel);
         }
     }
-    //if (comm->isRoot()) 
+
+    if (comm->isRoot()) 
     {
         UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet end of restore of data, rank = " << rank);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
@@ -1245,7 +1251,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
         readArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
 
     delete[] rawDataReceiveF;
-//    delete[] rawDataReceiveH1;
+    delete[] rawDataReceiveH1;
 //    delete[] rawDataReceiveH2;
 }
 
-- 
GitLab


From 254f9664bc0a7df2fac25e16354686a621b7c8ac Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin7.usr.hlrn.de>
Date: Mon, 14 Jun 2021 07:44:00 +0200
Subject: [PATCH 002/179] simple bounce-back in rheometer

---
 apps/cpu/ViskomatXL/viskomat.cpp              | 145 ++++++------------
 .../SimpleSlipBCAlgorithm.cpp                 |   6 +-
 2 files changed, 47 insertions(+), 104 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 91dfb0509..3beef8dd3 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -19,7 +19,6 @@ void bflow(string configname)
       int             numOfThreads = config.getValue<int>("numOfThreads");
       vector<int>     blocknx = config.getVector<int>("blocknx");
       vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      //double          nuLB = config.getValue<double>("nuLB");
       double          endTime = config.getValue<double>("endTime");
       double          outTime = config.getValue<double>("outTime");
       double          availMem = config.getValue<double>("availMem");
@@ -32,14 +31,10 @@ void bflow(string configname)
       bool            newStart = config.getValue<bool>("newStart");
       double          OmegaLB = config.getValue<double>("OmegaLB");
       double          tau0 = config.getValue<double>("tau0");
-      double          scaleFactor = config.getValue<double>("scaleFactor");
-      double          resolution = config.getValue<double>("resolution");
+      double          N = config.getValue<double>("N");
 
-      ConfigurationFile   viscosity;
-      //viscosity.load(viscosityPath + "/viscosity.cfg");
-      //double nuLB = viscosity.getValue<double>("nuLB");
 
-      //outputPath = outputPath + "/rheometerBingham_" + config.getValue<string>("resolution") + "_" + config.getValue<string>("OmegaLB");
+      ConfigurationFile   viscosity;
 
       SPtr<Communicator> comm = MPICommunicator::getInstance();
       int myid = comm->getProcessID();
@@ -64,39 +59,18 @@ void bflow(string configname)
 
       LBMReal rhoLB = 0.0;
 
-      //akoustic
-       //OmegaLB /= scaleFactor;
-       //nuLB *=scaleFactor;
-       //endTime *= scaleFactor;
-       ////outTime = endTime;
-       //cpStart = endTime;
-       //cpStep  = endTime;
-
-//diffusive
-      //OmegaLB /= scaleFactor * scaleFactor;
-      //tau0 /= scaleFactor * scaleFactor;
-      //endTime *= scaleFactor * scaleFactor;
-      //outTime = endTime;
-      //cpStart = endTime;
-      //cpStep = endTime;
-
-      //double Re = 1.38230076758;
-      double N  = 80; //rpm
+      //double N  = 70; //rpm
       double Omega = 2 * UbMath::PI / 60.0 * N; //rad/s
       double mu    = 1; //Pa s
       double R     = 0.165 / 2.0; //m
       double rho   = 970; //kg/m^3
       double Re    = Omega * R * R * rho / mu;
 
-      double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
+      //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
 
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-      // double uWorld = (N * PI) / 30.0; //0.0037699111843
-      // double rhoWorld = 2350.0; //kg/m^3
-      //double R0 = boundingBox[0] * 0.5;
+      double nuLB = OmegaLB * (R / deltax)*(R / deltax) / Re;
 
-      //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(deltax, uWorld*R0, rhoWorld, 1.0, uLB));
-      //if (myid == 0) UBLOG(logINFO, conv->toString());
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
 
       //bounding box
 
@@ -109,34 +83,6 @@ void bflow(string configname)
       double g_minX3 = boundingBox[4];
       double g_maxX3 = boundingBox[5];
 
-      //double g_minX1 = -boundingBox[0]/2.0;
-      //double g_minX2 = -boundingBox[1] / 2.0;
-      //double g_minX3 = -boundingBox[2]/2.0;
-
-      //double g_maxX1 = boundingBox[0]/2.0;
-      //double g_maxX2 = boundingBox[1]/2.0;
-      //double g_maxX3 = boundingBox[2]/2.0;
-
-//      double blockLength = 3.0 * deltax;
-
-      // double d = 2.0 * radius;
-      // double U = uLB;
-      // double Gamma = U / d;
-
-      // double muWorld = 20; //Pa*s
-      // double k = 0.0015; // muWorld / rhoWorld * conv->getFactorViscosityWToLb(); //(U * d) / (Re);
-
-      // //double k = (U * d) / (Re * std::pow(Gamma, n - 1));
-      // double yielStressWorld = 20; //Pa
-      // double tau0 = 1e-6;// 3e-6;//yielStressWorld * conv->getFactorPressureWToLb(); //Bn * k * std::pow(Gamma, n);
-
-      //double k = 0.05; // (U * d) / (Re * std::pow(Gamma, n - 1));
-      //double tau0 = 3e-6; //Bn * k * std::pow(Gamma, n);
-
-      //double forcing = 8e-7;
-
-      //double omegaMin = 1.0e-8;
-
       SPtr<Rheology> thix = Rheology::getInstance();
       //thix->setPowerIndex(n);
       //thix->setViscosityParameter(k);
@@ -150,6 +96,7 @@ void bflow(string configname)
 
       SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
       slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm()));
+      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
 
       //// rotation around X-axis
       mu::Parser fctVy;
@@ -183,8 +130,8 @@ void bflow(string configname)
       //fctVy.SetExpr("0.0");
 
       SPtr<BCAdapter> velocityBCAdapter(new VelocityBCAdapter(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST));
-      velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm()));
+      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+      velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm()));
       //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
       //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelVelocityBCAlgorithm()));
 
@@ -195,7 +142,7 @@ void bflow(string configname)
 
       //BS visitor
       BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
+      //bcVisitor.addBC(noSlipBCAdapter);
       bcVisitor.addBC(slipBCAdapter);
       bcVisitor.addBC(velocityBCAdapter);
       //bcVisitor.addBC(densityBCAdapter);
@@ -237,26 +184,30 @@ void bflow(string configname)
 
       ////stator
       // rotation around X-axis 
-      SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
-                                               g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-          g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
-
-       // rotation around Y-axis 
-      //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
-      //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
-      //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
-      //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
-
-      SPtr<D3Q27Interactor> statorInt =
-          SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID));
+      // SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+      //                                          g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+      //     g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
+
+      // SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 4.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+      //                                          g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+      //     g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 11.8*0.5));
+
+      //  // rotation around Y-axis 
+      // //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
+      // //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
+      // //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
+      // //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
+
+      // SPtr<D3Q27Interactor> statorInt =
+      //    SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID));
       
-      //SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
-      //stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
-      //stator->translate(4.0, -73.0, -6.0);
+      SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
+      stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
+      stator->translate(4.0, -73.0, -6.0);
       GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance());
       
-      //SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
-      //    new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
+         new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
 
       ////rotor (cylinder)
       // rotation around X-axis 
@@ -285,33 +236,24 @@ void bflow(string configname)
       if (myid == 0) GbSystem3D::writeGeoObject(wallXmax.get(), outputPath + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
 
       //wall interactors
-      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
+      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
       SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
 
       if (myid == 0)
       {
          UBLOG(logINFO, "Parameters:");
-         //UBLOG(logINFO, "forcing = " << forcing);
          UBLOG(logINFO, "N = " << N << " rpm");
          UBLOG(logINFO, "Omega = " << Omega << " rad/s");
          UBLOG(logINFO, "Re = " << Re);
          UBLOG(logINFO, "rho = " << rhoLB);
          UBLOG(logINFO, "uLB = " << OmegaLB);
          UBLOG(logINFO, "nuLB = " << nuLB);
-         // UBLOG(logINFO, "Re = " << (U * d) / (k * std::pow(Gamma, n - 1)));
-         // UBLOG(logINFO, "Bn = " << tau0 /(k * std::pow(Gamma, n)));
-         // UBLOG(logINFO, "k = " << k);
-         // UBLOG(logINFO, "n = " << n);
          UBLOG(logINFO, "tau0 = " << tau0);
-         UBLOG(logINFO, "scaleFactor = " << scaleFactor);
          UBLOG(logINFO, "deltax = " << deltax);
          UBLOG(logINFO, "number of levels = " << refineLevel + 1);
          UBLOG(logINFO, "number of threads = " << numOfThreads);
          UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
          UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
-         UBLOG(logINFO, "resolution = " << resolution);
-         // UBLOG(logINFO, "boundingBox = " << boundingBox[0] << " " << boundingBox[1] << " " << boundingBox[2]);
-         // UBLOG(logINFO, "sphereCenter = " << sphereCenter[0] << " " << sphereCenter[1] << " " << sphereCenter[2]);
          UBLOG(logINFO, "output path = " << outputPath);
          UBLOG(logINFO, "Preprozess - start");
       }
@@ -337,15 +279,16 @@ void bflow(string configname)
 
          ////////////////////////////////////////////
          //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
          ////////////////////////////////////////////
          /////delete solid blocks
          if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
          InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(wallXminInt);
          intHelper.addInteractor(wallXmaxInt);
          intHelper.addInteractor(statorInt);
          intHelper.addInteractor(rotorInt);
+         intHelper.addInteractor(wallXminInt);
+         
          intHelper.selectBlocks();
          if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
          //////////////////////////////////////
@@ -405,14 +348,10 @@ void bflow(string configname)
          restartCoProcessor->restart((int)restartStep);
          grid->setTimeStep(restartStep);
          
-         //SetBcBlocksBlockVisitor v1(wallXminInt);
-         //grid->accept(v1);
-         //wallXminInt->initInteractor();
-         //
-         //SetBcBlocksBlockVisitor v2(wallXmaxInt);
-         //grid->accept(v2);
-         //wallXmaxInt->initInteractor();
-         
+         SetBcBlocksBlockVisitor v2(wallXmaxInt);
+         grid->accept(v2);
+         wallXmaxInt->initInteractor();
+
          SetBcBlocksBlockVisitor v3(statorInt);
          grid->accept(v3);
          statorInt->initInteractor();
@@ -421,7 +360,9 @@ void bflow(string configname)
          grid->accept(v4);
          rotorInt->initInteractor();
 
-
+         SetBcBlocksBlockVisitor v1(wallXminInt);
+         grid->accept(v1);
+         wallXminInt->initInteractor();
       }
       
       omp_set_num_threads(numOfThreads);
@@ -446,7 +387,7 @@ void bflow(string configname)
       SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
       //writeMQCoProcessor->process(100);
 
-      SPtr<UbScheduler> forceSch(new UbScheduler(100));
+      SPtr<UbScheduler> forceSch(new UbScheduler(1000));
       SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
       fp->addInteractor(rotorInt);
       SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
index 8d9317f9d..c22d843f0 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
@@ -61,10 +61,12 @@ void SimpleSlipBCAlgorithm::applyBC()
    LBMReal f[D3Q27System::ENDF+1];
    LBMReal feq[D3Q27System::ENDF+1];
    distributions->getDistributionInv(f, x1, x2, x3);
-   LBMReal vx1, vx2, vx3, drho;
+   LBMReal vx1, vx2, vx3, drho, rho;
    calcMacrosFct(f, drho, vx1, vx2, vx3);
    calcFeqFct(feq, drho, vx1, vx2, vx3);
 
+   rho = 1.0 + drho * compressibleFactor;
+
    UbTupleFloat3 normale = bcPtr->getNormalVector();
    LBMReal amp = vx1*val<1>(normale)+vx2*val<2>(normale)+vx3*val<3>(normale);
 
@@ -109,7 +111,7 @@ void SimpleSlipBCAlgorithm::applyBC()
          case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
          default: throw UbException(UB_EXARGS, "unknown error");
          }
-         LBMReal fReturn = f[invDir] - velocity;;
+         LBMReal fReturn = f[invDir] - velocity * rho;
          distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
       }
    }
-- 
GitLab


From ed091655db0a5411ce6dbcc98bdfac07f1431169 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Tue, 15 Jun 2021 14:23:52 +0200
Subject: [PATCH 003/179] Two phase fields implemented but no energy equation.

---
 apps/cpu/Multiphase/Multiphase.cpp            |   2 +-
 apps/cpu/Multiphase/MultiphaseGeier.cfg       |  60 ++
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |  52 +-
 .../MultiphaseScratchCumulantLBMKernel.cpp    | 522 ++++++++--
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp | 940 +++++++++++++++---
 ...ultiphaseTwoPhaseFieldsCumulantLBMKernel.h |   5 +
 ...ultiphaseInitDistributionsBlockVisitor.cpp |  31 +-
 7 files changed, 1397 insertions(+), 215 deletions(-)
 create mode 100644 apps/cpu/Multiphase/MultiphaseGeier.cfg

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index deb2845f4..a22777658 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -137,7 +137,7 @@ void run(string configname)
         fctF2.SetExpr("vy1");
         fctF2.DefineConst("vy1", uLB);
 
-        double startTime = 500;
+        double startTime = 30;
         SPtr<BCAdapter> velBCAdapterF1(new MultiphaseVelocityBCAdapter(true, false, false, fctF1, phiH, 0.0, startTime));
         SPtr<BCAdapter> velBCAdapterF2(new MultiphaseVelocityBCAdapter(true, false, false, fctF2, phiH, startTime, endTime));
 
diff --git a/apps/cpu/Multiphase/MultiphaseGeier.cfg b/apps/cpu/Multiphase/MultiphaseGeier.cfg
new file mode 100644
index 000000000..bcabb0684
--- /dev/null
+++ b/apps/cpu/Multiphase/MultiphaseGeier.cfg
@@ -0,0 +1,60 @@
+#pathname = E:/Multiphase/HesamCodeWithCumulantsDensRatio
+#pathname = E:/Multiphase/HesamCodeWithCumulantsQuartic
+#pathname = E:/Multiphase/HesamCode
+pathname = E:/Multiphase/HesamCodeCumulantTubeFilter
+pathGeo = C:/Users/geier/Documents/VirtualFluids_dev_Kostya/apps/cpu/Multiphase/backup
+geoFile=tubeTransformed.stl
+#geoFile = JetBreakup2.ASCII.stl
+numOfThreads = 4
+availMem = 10e9
+
+#Grid
+
+#boundingBox = -1.0 121.0 0.5 629.0 -1.0 121.0 #(Jet Breakup) (Original with inlet length)
+#boundingBox = -60.5 60.5 -1.0 -201.0 -60.5 60.5 #(Jet Breakup2) (Original without inlet length)
+#blocknx = 22 20 22
+
+#boundingBox = -60.5 60.5 -1.0 -21.0 -60.5 60.5 #(Jet Breakup2) (Original without inlet length)
+#boundingBox = -60.5 60.5 -21.0 -1.0 -60.5 60.5 #(Jet Breakup2) (Original without inlet length)
+#blocknx = 22 20 22
+
+
+#dx = 0.5
+
+#boundingBox = 6.0e-3 46.0e-3 -5e-3 5e-3 -5e-3 5e-3
+boundingBox = 6.0e-3 16.0e-3 -5e-3 5e-3 -5e-3 5e-3
+blocknx = 60 60 60 #20 20 20
+
+dx = 1.66666666667e-4
+
+refineLevel = 0
+
+#Simulation
+uLB =0.005# 0.0000005 #inlet velocity
+uF2 = 0.0001
+Re = 10
+nuL =1e-6#1e-2# 1.0e-5  #!1e-2
+nuG =1e-6#1e-2# 1.16e-4 #!1e-2
+densityRatio = 10000#1000#1000 #30
+sigma =0# 1e-4 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+interfaceThickness = 5
+radius = 615.0   (Jet Breakup)
+contactAngle = 110.0
+gravity = 0.0
+#gravity = -5.04e-6
+phi_L = 0.0
+phi_H = 1.0
+Phase-field Relaxation = 0.6
+Mobility = 0.1 #0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1 
+
+
+logToFile = false
+
+newStart = true
+restartStep = 100000
+
+cpStart = 100000
+cpStep = 100000
+
+outTime = 100
+endTime = 200000000
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 73034d889..70d2f2b6c 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -155,6 +155,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     datanames.push_back("Vy");
     datanames.push_back("Vz");
     datanames.push_back("P1");
+    datanames.push_back("Phi2");
 
     data.resize(datanames.size());
 
@@ -162,10 +163,12 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     SPtr<BCArray3D> bcArray                  = kernel->getBCProcessor()->getBCArray();
     SPtr<DistributionArray3D> distributionsF = kernel->getDataSet()->getFdistributions();
     SPtr<DistributionArray3D> distributionsH = kernel->getDataSet()->getHdistributions();
+    SPtr<DistributionArray3D> distributionsH2 = kernel->getDataSet()->getH2distributions();
     SPtr<PhaseFieldArray3D> divU             = kernel->getDataSet()->getPhaseField();
 
     LBMReal f[D3Q27System::ENDF + 1];
     LBMReal phi[D3Q27System::ENDF + 1];
+    LBMReal phi2[D3Q27System::ENDF + 1];
     LBMReal vx1, vx2, vx3, rho, p1, beta, kappa;
     LBMReal densityRatio = kernel->getDensityRatio();
 
@@ -202,6 +205,8 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
     CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField(
         new CbArray3D<LBMReal, IndexerX3X2X1>(maxX1, maxX2, maxX3, -999.0));
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2(
+        new CbArray3D<LBMReal, IndexerX3X2X1>(maxX1, maxX2, maxX3, -999.0));
 
     for (int ix3 = minX3; ix3 < maxX3; ix3++) {
         for (int ix2 = minX2; ix2 < maxX2; ix2++) {
@@ -211,8 +216,17 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     (*phaseField)(ix1, ix2, ix3) =
                         ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
                         (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
-                         ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                        ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+                        ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
+                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+                    if (distributionsH2) {
+                    distributionsH2->getDistribution(f, ix1, ix2, ix3);
+                    (*phaseField2)(ix1, ix2, ix3) =
+                        ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
+                        (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
+                        ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
+                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+                }
+                    else { (*phaseField2)(ix1, ix2, ix3) = 999.0; }
                 }
             }
         }
@@ -244,6 +258,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                                                   float(worldCoordinates[2])));
 
                     phi[REST] = (*phaseField)(ix1, ix2, ix3);
+                    phi2[REST] = (*phaseField2)(ix1, ix2, ix3);
 
                     if ((ix1 == 0) || (ix2 == 0) || (ix3 == 0)) {
                         dX1_phi = 0.0;
@@ -284,6 +299,38 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         dX2_phi  = 0.0 * gradX2_phi(phi);
                         dX3_phi  = 0.0 * gradX3_phi(phi);
                         mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi(phi);
+
+                        //phi2[E] = (*phaseField2)(ix1 + DX1[E], ix2 + DX2[E], ix3 + DX3[E]);
+                        //phi2[N] = (*phaseField2)(ix1 + DX1[N], ix2 + DX2[N], ix3 + DX3[N]);
+                        //phi2[T] = (*phaseField2)(ix1 + DX1[T], ix2 + DX2[T], ix3 + DX3[T]);
+                        //phi2[W] = (*phaseField2)(ix1 + DX1[W], ix2 + DX2[W], ix3 + DX3[W]);
+                        //phi2[S] = (*phaseField2)(ix1 + DX1[S], ix2 + DX2[S], ix3 + DX3[S]);
+                        //phi2[B] = (*phaseField2)(ix1 + DX1[B], ix2 + DX2[B], ix3 + DX3[B]);
+                        //phi2[NE] = (*phaseField2)(ix1 + DX1[NE], ix2 + DX2[NE], ix3 + DX3[NE]);
+                        //phi2[NW] = (*phaseField2)(ix1 + DX1[NW], ix2 + DX2[NW], ix3 + DX3[NW]);
+                        //phi2[TE] = (*phaseField2)(ix1 + DX1[TE], ix2 + DX2[TE], ix3 + DX3[TE]);
+                        //phi2[TW] = (*phaseField2)(ix1 + DX1[TW], ix2 + DX2[TW], ix3 + DX3[TW]);
+                        //phi2[TN] = (*phaseField2)(ix1 + DX1[TN], ix2 + DX2[TN], ix3 + DX3[TN]);
+                        //phi2[TS] = (*phaseField2)(ix1 + DX1[TS], ix2 + DX2[TS], ix3 + DX3[TS]);
+                        //phi2[SW] = (*phaseField2)(ix1 + DX1[SW], ix2 + DX2[SW], ix3 + DX3[SW]);
+                        //phi2[SE] = (*phaseField2)(ix1 + DX1[SE], ix2 + DX2[SE], ix3 + DX3[SE]);
+                        //phi2[BW] = (*phaseField2)(ix1 + DX1[BW], ix2 + DX2[BW], ix3 + DX3[BW]);
+                        //phi2[BE] = (*phaseField2)(ix1 + DX1[BE], ix2 + DX2[BE], ix3 + DX3[BE]);
+                        //phi2[BS] = (*phaseField2)(ix1 + DX1[BS], ix2 + DX2[BS], ix3 + DX3[BS]);
+                        //phi2[BN] = (*phaseField2)(ix1 + DX1[BN], ix2 + DX2[BN], ix3 + DX3[BN]);
+                        //phi2[BSW] = (*phaseField2)(ix1 + DX1[BSW], ix2 + DX2[BSW], ix3 + DX3[BSW]);
+                        //phi2[BSE] = (*phaseField2)(ix1 + DX1[BSE], ix2 + DX2[BSE], ix3 + DX3[BSE]);
+                        //phi2[BNW] = (*phaseField2)(ix1 + DX1[BNW], ix2 + DX2[BNW], ix3 + DX3[BNW]);
+                        //phi2[BNE] = (*phaseField2)(ix1 + DX1[BNE], ix2 + DX2[BNE], ix3 + DX3[BNE]);
+                        //phi2[TNE] = (*phaseField2)(ix1 + DX1[TNE], ix2 + DX2[TNE], ix3 + DX3[TNE]);
+                        //phi2[TNW] = (*phaseField2)(ix1 + DX1[TNW], ix2 + DX2[TNW], ix3 + DX3[TNW]);
+                        //phi2[TSE] = (*phaseField2)(ix1 + DX1[TSE], ix2 + DX2[TSE], ix3 + DX3[TSE]);
+                        //phi2[TSW] = (*phaseField2)(ix1 + DX1[TSW], ix2 + DX2[TSW], ix3 + DX3[TSW]);
+
+                       // mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi(phi);
+
+
+
                     }
 
                     distributionsF->getDistribution(f, ix1, ix2, ix3);
@@ -361,6 +408,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     data[index++].push_back(vx2);
                     data[index++].push_back(vx3);
                     data[index++].push_back(p1);
+                    data[index++].push_back(phi2[REST]);
                 }
             }
         }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
index 505007e0c..77695179c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
@@ -39,6 +39,7 @@
 #include "DataSet3D.h"
 #include "LBMKernel.h"
 #include <cmath>
+#include <iostream>
 
 #define PROOF_CORRECTNESS
 
@@ -163,6 +164,16 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
             new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
 
 
+		/////For velocity filter
+
+		//CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr velocityX(
+		//	new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+		//CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr velocityY(
+		//	new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+		//CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr velocityZ(
+		//	new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+
+
         for (int x3 = 0; x3 <= maxX3; x3++) {
             for (int x2 = 0; x2 <= maxX2; x2++) {
                 for (int x1 = 0; x1 <= maxX1; x1++) {
@@ -207,7 +218,63 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 						//	(mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
 						//	(mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) +
 						//	(mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+						///Velocity filter
+
+
+						LBMReal rhoH = 1.0;
+						LBMReal rhoL = 1.0 / densityRatio;
+
+						LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+
+						LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH);
+
+						mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) / rho * c3;
+						mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) / rho * c3;
+						mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) / rho * c3;
+						mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) / rho * c3;
+						mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) / rho * c3;
+						mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) / rho * c3;
+						mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) / rho * c3;
+						mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) / rho * c3;
+						mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) / rho * c3;
+						mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) / rho * c3;
+						mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) / rho * c3;
+						mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) / rho * c3;
+						mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) / rho * c3;
+
+						mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) / rho * c3;
+						mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) / rho * c3;
+						mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) / rho * c3;
+						mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) / rho * c3;
+						mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) / rho * c3;
+						mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) / rho * c3;
+						mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) / rho * c3;
+						mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) / rho * c3;
+						mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) / rho * c3;
+						mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) / rho * c3;
+						mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) / rho * c3;
+						mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) / rho * c3;
+						mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) / rho * c3;
+
+						mfbbb = (*this->zeroDistributionsF)(x1, x2, x3) / rho * c3;
+
+						//(*velocityX)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+						//	(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+						//	(mfcbb - mfabb)) ;
+						//(*velocityY)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+						//	(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+						//	(mfbcb - mfbab)) ;
+						//(*velocityZ)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+						//	(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+						//	(mfbbc - mfbba)) ;
+
+
+
+
                     }
+					else { (*phaseField)(x1, x2, x3) = 0; }
                 }
             }
         }
@@ -218,6 +285,10 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
         for (int x3 = minX3; x3 < maxX3; x3++) {
             for (int x2 = minX2; x2 < maxX2; x2++) {
                 for (int x1 = minX1; x1 < maxX1; x1++) {
+
+					//for (int x3 = minX3+1; x3 < maxX3-1; x3++) {
+					//	for (int x2 = minX2+1; x2 < maxX2-1; x2++) {
+					//		for (int x1 = minX1+1; x1 < maxX1-1; x1++) {
                     if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
                         int x1p = x1 + 1;
                         int x2p = x2 + 1;
@@ -245,7 +316,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
                         //-1 0 1
 
                         findNeighbors(phaseField, x1, x2, x3);
-
+						//// reading distributions here appears to be unnecessary!
                         LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
                         LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
                         LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
@@ -284,6 +355,62 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
                         LBMReal dX2_phi = gradX2_phi();
                         LBMReal dX3_phi = gradX3_phi();
 
+						//LBMReal dX1_phi = 3.0*((
+						//	WEIGTH[TNE]*((((*phaseField)(x1 + 1, x2+1, x3+1)- (*phaseField)(x1 - 1, x2 - 1, x3 - 1))+ ((*phaseField)(x1 + 1, x2 - 1, x3 + 1) - (*phaseField)(x1 - 1, x2 + 1, x3 - 1)))
+						//	+ (((*phaseField)(x1 + 1, x2 - 1, x3 - 1) - (*phaseField)(x1 - 1, x2 + 1, x3 + 1)) + ((*phaseField)(x1 + 1, x2 + 1, x3 - 1) - (*phaseField)(x1 - 1, x2 - 1, x3 + 1))))
+						//	+WEIGTH[NE]* ((((*phaseField)(x1 + 1, x2 + 1, x3) - (*phaseField)(x1 - 1, x2 - 1, x3)) + ((*phaseField)(x1 + 1, x2 - 1, x3) - (*phaseField)(x1 - 1, x2 + 1, x3 )))
+						//	+ (((*phaseField)(x1 + 1, x2, x3 - 1) - (*phaseField)(x1 - 1, x2, x3 + 1)) + ((*phaseField)(x1 + 1, x2, x3 + 1) - (*phaseField)(x1 - 1, x2, x3 - 1)))))
+						//	+WEIGTH[N]*((*phaseField)(x1 + 1, x2, x3 ) - (*phaseField)(x1 - 1, x2, x3))
+						//	); 
+						////if (dX1_phi != NdX1_phi) {std::cout<<dX1_phi<<" "<< NdX1_phi<<std::endl;}
+
+						//LBMReal dX2_phi = 3.0 * ((
+						//	WEIGTH[TNE] * ((((*phaseField)(x1 + 1, x2 + 1, x3 + 1) - (*phaseField)(x1 - 1, x2 - 1, x3 - 1)) + ((*phaseField)(x1 -1, x2 + 1, x3 + 1) - (*phaseField)(x1 + 1, x2 - 1, x3 - 1)))
+						//	+ (((*phaseField)(x1 - 1, x2 + 1, x3 - 1) - (*phaseField)(x1 + 1, x2 - 1, x3 + 1)) + ((*phaseField)(x1 + 1, x2 + 1, x3 - 1) - (*phaseField)(x1 - 1, x2 - 1, x3 + 1))))
+						//	+ WEIGTH[NE] * ((((*phaseField)(x1 + 1, x2 + 1, x3) - (*phaseField)(x1 - 1, x2 - 1, x3)) + ((*phaseField)(x1 - 1, x2 + 1, x3) - (*phaseField)(x1 + 1, x2 - 1, x3)))
+						//		+ (((*phaseField)(x1, x2+1, x3 - 1) - (*phaseField)(x1 , x2-1, x3 + 1)) + ((*phaseField)(x1 , x2+1, x3 + 1) - (*phaseField)(x1 , x2-1, x3 - 1)))))
+						//	+ WEIGTH[N] * ((*phaseField)(x1 , x2+1, x3) - (*phaseField)(x1 , x2-1, x3))
+						//	);
+
+						//LBMReal dX3_phi = 3.0 * ((
+						//	WEIGTH[TNE] * ((((*phaseField)(x1 + 1, x2 + 1, x3 + 1) - (*phaseField)(x1 - 1, x2 - 1, x3 - 1)) + ((*phaseField)(x1 - 1, x2 + 1, x3 + 1) - (*phaseField)(x1 + 1, x2 - 1, x3 - 1)))
+						//	+ (((*phaseField)(x1 - 1, x2 - 1, x3 + 1) - (*phaseField)(x1 + 1, x2 + 1, x3 - 1)) + ((*phaseField)(x1 + 1, x2 - 1, x3 + 1) - (*phaseField)(x1 - 1, x2 + 1, x3 - 1))))
+						//	+ WEIGTH[NE] * ((((*phaseField)(x1 + 1, x2, x3+1) - (*phaseField)(x1 - 1, x2, x3-1)) + ((*phaseField)(x1 - 1, x2, x3+1) - (*phaseField)(x1 + 1, x2, x3-1)))
+						//		+ (((*phaseField)(x1, x2 - 1, x3 + 1) - (*phaseField)(x1, x2 + 1, x3 - 1)) + ((*phaseField)(x1, x2 + 1, x3 + 1) - (*phaseField)(x1, x2 - 1, x3 - 1)))))
+						//	+ WEIGTH[N] * ((*phaseField)(x1, x2, x3+1) - (*phaseField)(x1, x2, x3-1))
+						//	);
+
+						///////////////////////////////////////
+
+						//LBMReal dX1_phi2 = 1.5 * ((
+						//	WEIGTH[TNE] * ((((*phaseField)(x1 + 2, x2 + 2, x3 + 2) - (*phaseField)(x1 - 2, x2 - 2, x3 - 2)) + ((*phaseField)(x1 + 2, x2 - 2, x3 + 2) - (*phaseField)(x1 - 2, x2 + 2, x3 - 2)))
+						//		+ (((*phaseField)(x1 + 2, x2 - 2, x3 - 2) - (*phaseField)(x1 - 2, x2 + 2, x3 + 2)) + ((*phaseField)(x1 + 2, x2 + 2, x3 - 2) - (*phaseField)(x1 - 2, x2 - 2, x3 + 2))))
+						//	+ WEIGTH[NE] * ((((*phaseField)(x1 + 2, x2 + 2, x3) - (*phaseField)(x1 - 2, x2 - 2, x3)) + ((*phaseField)(x1 + 2, x2 - 2, x3) - (*phaseField)(x1 - 2, x2 + 2, x3)))
+						//		+ (((*phaseField)(x1 + 2, x2, x3 - 2) - (*phaseField)(x1 - 2, x2, x3 + 2)) + ((*phaseField)(x1 + 2, x2, x3 + 2) - (*phaseField)(x1 - 2, x2, x3 - 2)))))
+						//	+ WEIGTH[N] * ((*phaseField)(x1 + 2, x2, x3) - (*phaseField)(x1 - 2, x2, x3))
+						//	);
+						////if (dX1_phi != NdX1_phi) {std::cout<<dX1_phi<<" "<< NdX1_phi<<std::endl;}
+
+						//LBMReal dX2_phi2 = 1.5 * ((
+						//	WEIGTH[TNE] * ((((*phaseField)(x1 + 2, x2 + 2, x3 + 2) - (*phaseField)(x1 - 2, x2 - 2, x3 - 2)) + ((*phaseField)(x1 - 2, x2 + 2, x3 + 2) - (*phaseField)(x1 + 2, x2 - 2, x3 - 2)))
+						//		+ (((*phaseField)(x1 - 2, x2 + 2, x3 - 2) - (*phaseField)(x1 + 2, x2 - 2, x3 + 2)) + ((*phaseField)(x1 + 2, x2 + 2, x3 - 2) - (*phaseField)(x1 - 2, x2 - 2, x3 + 2))))
+						//	+ WEIGTH[NE] * ((((*phaseField)(x1 + 2, x2 + 2, x3) - (*phaseField)(x1 - 2, x2 - 2, x3)) + ((*phaseField)(x1 - 2, x2 + 2, x3) - (*phaseField)(x1 + 2, x2 - 2, x3)))
+						//		+ (((*phaseField)(x1, x2 + 2, x3 - 2) - (*phaseField)(x1, x2 - 2, x3 + 2)) + ((*phaseField)(x1, x2 + 2, x3 + 2) - (*phaseField)(x1, x2 - 2, x3 - 2)))))
+						//	+ WEIGTH[N] * ((*phaseField)(x1, x2 + 2, x3) - (*phaseField)(x1, x2 - 2, x3))
+						//	);
+
+						//LBMReal dX3_phi2 = 1.5 * ((
+						//	WEIGTH[TNE] * ((((*phaseField)(x1 + 2, x2 + 2, x3 + 2) - (*phaseField)(x1 - 2, x2 - 2, x3 - 2)) + ((*phaseField)(x1 - 2, x2 + 2, x3 + 2) - (*phaseField)(x1 + 2, x2 - 2, x3 - 2)))
+						//		+ (((*phaseField)(x1 - 2, x2 - 2, x3 + 2) - (*phaseField)(x1 + 2, x2 + 2, x3 - 2)) + ((*phaseField)(x1 + 2, x2 - 2, x3 + 2) - (*phaseField)(x1 - 2, x2 + 2, x3 - 2))))
+						//	+ WEIGTH[NE] * ((((*phaseField)(x1 + 2, x2, x3 + 2) - (*phaseField)(x1 - 2, x2, x3 - 2)) + ((*phaseField)(x1 - 2, x2, x3 + 2) - (*phaseField)(x1 + 2, x2, x3 - 2)))
+						//		+ (((*phaseField)(x1, x2 - 2, x3 + 2) - (*phaseField)(x1, x2 + 2, x3 - 2)) + ((*phaseField)(x1, x2 + 2, x3 + 2) - (*phaseField)(x1, x2 - 2, x3 - 2)))))
+						//	+ WEIGTH[N] * ((*phaseField)(x1, x2, x3 + 2) - (*phaseField)(x1, x2, x3 - 2))
+						//	);
+
+						//dX1_phi = (2*dX1_phi -1*dX1_phi2);// 2 * dX1_phi - dX1_phi2;
+						//dX2_phi = (2*dX2_phi -1*dX2_phi2);// 2 * dX2_phi - dX2_phi2;
+						//dX3_phi = (2*dX3_phi -1*dX3_phi2);// 2 * dX3_phi - dX3_phi2;
+
 
                         LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
                         LBMReal normX1 = dX1_phi/denom;
@@ -312,20 +439,20 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
                         //----------- Calculating Macroscopic Values -------------
                         LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
-                        if (withForcing) {
-                            // muX1 = static_cast<double>(x1-1+ix1*maxX1);
-                            // muX2 = static_cast<double>(x2-1+ix2*maxX2);
-                            // muX3 = static_cast<double>(x3-1+ix3*maxX3);
-
-                            forcingX1 = muForcingX1.Eval();
-                            forcingX2 = muForcingX2.Eval();
-                            forcingX3 = muForcingX3.Eval();
+						if (withForcing) {
+							// muX1 = static_cast<double>(x1-1+ix1*maxX1);
+							// muX2 = static_cast<double>(x2-1+ix2*maxX2);
+							// muX3 = static_cast<double>(x3-1+ix3*maxX3);
 
-                            LBMReal rho_m = 1.0 / densityRatio;
-                            forcingX1     = forcingX1 * (rho - rho_m);
-                            forcingX2     = forcingX2 * (rho - rho_m);
-                            forcingX3     = forcingX3 * (rho - rho_m);
+							forcingX1 = muForcingX1.Eval();
+							forcingX2 = muForcingX2.Eval();
+							forcingX3 = muForcingX3.Eval();
 
+							LBMReal rho_m = 1.0 / densityRatio;
+							forcingX1 = forcingX1 * (rho - rho_m);
+							forcingX2 = forcingX2 * (rho - rho_m);
+							forcingX3 = forcingX3 * (rho - rho_m);
+						}
                             			   ////Incompressible Kernal
 
 			    mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)/rho*c3;
@@ -387,69 +514,272 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   vvz += mu * dX3_phi * c1o2;
 			  
 
+
+			   ////Velocity filter 14.04.2021
+			  // LBMReal lap_vx, lap_vy,lap_vz;
+			  // {
+				 //  LBMReal sum = 0.0;
+				 //  sum += WEIGTH[TNE] * (((((*velocityX)(x1+1, x2+1, x3+1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2 - 1, x3 - 1) - (*velocityX)(x1, x2, x3))) + (((*velocityX)(x1 + 1, x2 + 1, x3 - 1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 + 1, x2 - 1, x3 + 1) - (*velocityX)(x1, x2, x3))))
+					//   + ((((*velocityX)(x1 + 1, x2 - 1, x3 + 1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2 + 1, x3 - 1) - (*velocityX)(x1, x2, x3))) + (((*velocityX)(x1 - 1, x2 + 1, x3 + 1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 + 1, x2 - 1, x3 - 1) - (*velocityX)(x1, x2, x3)))));
+				 //  sum += WEIGTH[TN] * (
+					//   ((((*velocityX)(x1 + 1, x2 + 1, x3 ) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2 - 1, x3) - (*velocityX)(x1, x2, x3))) + (((*velocityX)(x1 + 1, x2 - 1, x3) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2 + 1, x3) - (*velocityX)(x1, x2, x3))))
+					//   + ((((*velocityX)(x1 + 1, x2 , x3+1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2 , x3-1) - (*velocityX)(x1, x2, x3))) + (((*velocityX)(x1 +1 , x2 , x3-1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 - 1, x2, x3 + 1) - (*velocityX)(x1, x2, x3))))
+					//   + ((((*velocityX)(x1 , x2+1, x3 + 1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1, x2 - 1, x3 - 1) - (*velocityX)(x1, x2, x3))) + (((*velocityX)(x1, x2 + 1, x3 - 1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1, x2 - 1, x3 + 1) - (*velocityX)(x1, x2, x3))))
+					//   );
+				 //  sum += WEIGTH[T] * (
+					//   (((*velocityX)(x1-1, x2 , x3 ) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1 + 1, x2, x3) - (*velocityX)(x1, x2, x3)))
+					//   + (((*velocityX)(x1 , x2-1, x3) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1, x2 + 1, x3) - (*velocityX)(x1, x2, x3)))
+					//   + (((*velocityX)(x1, x2, x3-1) - (*velocityX)(x1, x2, x3)) + ((*velocityX)(x1, x2, x3+1) - (*velocityX)(x1, x2, x3)))
+					//   );
+				 //  //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+				 //  //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
+				 //  //}
+				 //   lap_vx=6.0 * sum;
+
+					//sum = 0.0;
+					//sum += WEIGTH[TNE] * (((((*velocityY)(x1 + 1, x2 + 1, x3 + 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2 - 1, x3 - 1) - (*velocityY)(x1, x2, x3))) + (((*velocityY)(x1 + 1, x2 + 1, x3 - 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 + 1, x2 - 1, x3 + 1) - (*velocityY)(x1, x2, x3))))
+					//	+ ((((*velocityY)(x1 + 1, x2 - 1, x3 + 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2 + 1, x3 - 1) - (*velocityY)(x1, x2, x3))) + (((*velocityY)(x1 - 1, x2 + 1, x3 + 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 + 1, x2 - 1, x3 - 1) - (*velocityY)(x1, x2, x3)))));
+					//sum += WEIGTH[TN] * (
+					//	((((*velocityY)(x1 + 1, x2 + 1, x3) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2 - 1, x3) - (*velocityY)(x1, x2, x3))) + (((*velocityY)(x1 + 1, x2 - 1, x3) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2 + 1, x3) - (*velocityY)(x1, x2, x3))))
+					//	+ ((((*velocityY)(x1 + 1, x2, x3 + 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2, x3 - 1) - (*velocityY)(x1, x2, x3))) + (((*velocityY)(x1 + 1, x2, x3 - 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 - 1, x2, x3 + 1) - (*velocityY)(x1, x2, x3))))
+					//	+ ((((*velocityY)(x1, x2 + 1, x3 + 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1, x2 - 1, x3 - 1) - (*velocityY)(x1, x2, x3))) + (((*velocityY)(x1, x2 + 1, x3 - 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1, x2 - 1, x3 + 1) - (*velocityY)(x1, x2, x3))))
+					//	);
+					//sum += WEIGTH[T] * (
+					//	(((*velocityY)(x1 - 1, x2, x3) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1 + 1, x2, x3) - (*velocityY)(x1, x2, x3)))
+					//	+ (((*velocityY)(x1, x2 - 1, x3) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1, x2 + 1, x3) - (*velocityY)(x1, x2, x3)))
+					//	+ (((*velocityY)(x1, x2, x3 - 1) - (*velocityY)(x1, x2, x3)) + ((*velocityY)(x1, x2, x3 + 1) - (*velocityY)(x1, x2, x3)))
+					//	);
+
+					//lap_vy = 6.0 * sum;
+
+					//sum = 0.0;
+					//sum += WEIGTH[TNE] * (((((*velocityZ)(x1 + 1, x2 + 1, x3 + 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2 - 1, x3 - 1) - (*velocityZ)(x1, x2, x3))) + (((*velocityZ)(x1 + 1, x2 + 1, x3 - 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 + 1, x2 - 1, x3 + 1) - (*velocityZ)(x1, x2, x3))))
+					//	+ ((((*velocityZ)(x1 + 1, x2 - 1, x3 + 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2 + 1, x3 - 1) - (*velocityZ)(x1, x2, x3))) + (((*velocityZ)(x1 - 1, x2 + 1, x3 + 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 + 1, x2 - 1, x3 - 1) - (*velocityZ)(x1, x2, x3)))));
+					//sum += WEIGTH[TN] * (
+					//	((((*velocityZ)(x1 + 1, x2 + 1, x3) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2 - 1, x3) - (*velocityZ)(x1, x2, x3))) + (((*velocityZ)(x1 + 1, x2 - 1, x3) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2 + 1, x3) - (*velocityZ)(x1, x2, x3))))
+					//	+ ((((*velocityZ)(x1 + 1, x2, x3 + 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2, x3 - 1) - (*velocityZ)(x1, x2, x3))) + (((*velocityZ)(x1 + 1, x2, x3 - 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 - 1, x2, x3 + 1) - (*velocityZ)(x1, x2, x3))))
+					//	+ ((((*velocityZ)(x1, x2 + 1, x3 + 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1, x2 - 1, x3 - 1) - (*velocityZ)(x1, x2, x3))) + (((*velocityZ)(x1, x2 + 1, x3 - 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1, x2 - 1, x3 + 1) - (*velocityZ)(x1, x2, x3))))
+					//	);
+					//sum += WEIGTH[T] * (
+					//	(((*velocityZ)(x1 - 1, x2, x3) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1 + 1, x2, x3) - (*velocityZ)(x1, x2, x3)))
+					//	+ (((*velocityZ)(x1, x2 - 1, x3) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1, x2 + 1, x3) - (*velocityZ)(x1, x2, x3)))
+					//	+ (((*velocityZ)(x1, x2, x3 - 1) - (*velocityZ)(x1, x2, x3)) + ((*velocityZ)(x1, x2, x3 + 1) - (*velocityZ)(x1, x2, x3)))
+					//	);
+
+					//lap_vz = 6.0 * sum;
+
+			  // }
+
+			  // if (lap_vx != 0.0) {
+				 //  lap_vx = lap_vx;
+			  // }
+
 			   ///----Classic source term 8.4.2021
 
+			   LBMReal vvxF, vvyF, vvzF;
+			   vvxF = vvx;//-2*c1o24 * lap_vx;// 
+			   vvyF = vvy;//-2*c1o24 * lap_vy;// 
+			   vvzF = vvz;//-2*c1o24 * lap_vz;// 
+
+//			   vvxF = 1.2* vvx- 0.2*0.5 * ((*velocityX)(x1 - 1, x2, x3) + (*velocityX)(x1 + 1, x2, x3));
+//			   vvyF = 1.2 *vvy- 0.2*0.5* ((*velocityY)(x1 , x2-1, x3) + (*velocityY)(x1 , x2+1, x3));
+//			   vvzF = 1.2 *vvz-0.2*0.5* ((*velocityZ)(x1 , x2, x3-1) + (*velocityZ)(x1 , x2, x3+1));
+			   //if (vvxF != vvx) {
+				  // vvxF = vvxF;
+			   //}
+			   LBMReal weightGrad =  1.0-denom*denom/(denom*denom+0.0001*0.001);
+			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
+			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
+			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+
+			   //dX1_phiF *= 1.2;
+			   //dX2_phiF *= 1.2;
+			   //dX3_phiF *= 1.2;
+
+			   //LBMReal gradFD = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi);
+			   //LBMReal gradPhi = (1.0 - phi[REST]) * (phi[REST]);
+			   //gradPhi = (gradPhi > gradFD) ? gradPhi : gradFD;
+			   //dX1_phiF = gradPhi * normX1;
+				  // dX2_phiF = gradPhi * normX2;
+				  // dX3_phiF = gradPhi * normX3;
+
 			   LBMReal ux2;
 			   LBMReal uy2;
 			   LBMReal uz2;
-			   ux2 = vvx * vvx;
-			   uy2 = vvy * vvy;
-			   uz2 = vvz * vvz;
+			   ux2 = vvxF * vvxF;
+			   uy2 = vvyF * vvyF;
+			   uz2 = vvzF * vvzF;
 			   LBMReal forcingTerm[D3Q27System::ENDF + 1];
 			   for (int dir = STARTF; dir <= (FENDDIR); dir++) {
-				   LBMReal velProd = DX1[dir] * vvx + DX2[dir] * vvy + DX3[dir] * vvz;
+				   LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
 				   LBMReal velSq1 = velProd * velProd;
-				   LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2));
+				   LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
 
 				   LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
 
 				   forcingTerm[dir] = 
-					   (-vvx) * (fac1 * dX1_phi ) +
-					   (-vvy) * (fac1 * dX2_phi ) +
-					   (-vvz) * (fac1 * dX3_phi ) +
-					   (DX1[dir]) * (fac1 * dX1_phi ) +
-					   (DX2[dir]) * (fac1 * dX2_phi ) +
-					   (DX3[dir]) * (fac1 * dX3_phi );
+					   (-vvxF) * (fac1 * dX1_phiF ) +
+					   (-vvyF) * (fac1 * dX2_phiF ) +
+					   (-vvzF) * (fac1 * dX3_phiF ) +
+					   (DX1[dir]) * (fac1 * dX1_phiF ) +
+					   (DX2[dir]) * (fac1 * dX2_phiF ) +
+					   (DX3[dir]) * (fac1 * dX3_phiF );
+
+				   //LBMReal biDif= (-((*phaseField)(x1 + 2 * DX1[dir], x2 + 2 * DX2[dir], x3 + 2 * DX3[dir])) + 4 * ((*phaseField)(x1 + DX1[dir], x2 + DX2[dir], x3 + DX3[dir]))
+					  // - 3*((*phaseField)(x1 , x2 , x3 )) )*0.5;
+				   //LBMReal ceDif = (((*phaseField)(x1 + DX1[dir], x2 + DX2[dir], x3 + DX3[dir])) - ((*phaseField)(x1 - DX1[dir], x2 - DX2[dir], x3 - DX3[dir]))) * 0.5;
+
+				   ////ceDif = ((((*phaseField)(x1 + 2*DX1[dir], x2 + 2*DX2[dir], x3 + 2*DX3[dir])) - ((*phaseField)(x1 , x2 , x3 ))) * biDif < 0) ?
+					  //// (!bcArray->isSolid(x1+2*DX1[dir], x2+2*DX2[dir], x3+2*DX3[dir]) && !bcArray->isUndefined(x1 + 2 * DX1[dir], x2 + 2 * DX2[dir], x3 + 2 * DX3[dir]) && !bcArray->isSolid(x1 + DX1[dir], x2 +  DX2[dir], x3 +  DX3[dir]) && !bcArray->isUndefined(x1 +  DX1[dir], x2 + DX2[dir], x3 + DX3[dir]) && !bcArray->isSolid(x1 - DX1[dir], x2 - DX2[dir], x3 - DX3[dir]) && !bcArray->isUndefined(x1 - DX1[dir], x2 - DX2[dir], x3 - DX3[dir])) ?
+					  //// (biDif+ceDif)*0.5 : ceDif: ceDif;
+
+				   //ceDif = ((((*phaseField)(x1 + 2 * DX1[dir], x2 + 2 * DX2[dir], x3 + 2 * DX3[dir])) - ((*phaseField)(x1, x2, x3))) * biDif < 0) ? biDif : ceDif;
+
+				   //forcingTerm[dir] =
+					  // (-vvxF) * (fac1 * dX1_phiF) +
+					  // (-vvyF) * (fac1 * dX2_phiF) +
+					  // (-vvzF) * (fac1 * dX3_phiF) +
+					  // fac1 * ceDif;//(((*phaseField)(x1 + DX1[dir], x2 + DX2[dir], x3 + DX3[dir])) -  ((*phaseField)(x1 - DX1[dir], x2 - DX2[dir], x3 - DX3[dir]))) * 0.5;
+					  // //( -((*phaseField)(x1 +2* DX1[dir], x2 + 2 * DX2[dir], x3 + 2 * DX3[dir])) + 5*((*phaseField)(x1 + DX1[dir], x2 +  DX2[dir], x3 +  DX3[dir])) 
+						 //  //- 3*((*phaseField)(x1 , x2 , x3 )) - ((*phaseField)(x1 - DX1[dir], x2 - DX2[dir], x3 - DX3[dir])) )*0.25;
+
+
 			   }
 
 			   LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
 			   LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
-			   forcingTerm[REST] = (-vvx) * (fac1 * dX1_phi ) +
-				   (-vvy) * (fac1 * dX2_phi ) +
-				   (-vvz) * (fac1 * dX3_phi );
-
-			   mfcbb += 3.0 * ( 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-			   mfbcb += 3.0 * ( 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-			   mfbbc += 3.0 * ( 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-			   mfccb += 3.0 * ( 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-			   mfacb += 3.0 * ( 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-			   mfcbc += 3.0 * ( 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-			   mfabc += 3.0 * ( 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-			   mfbcc += 3.0 * ( 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-			   mfbac += 3.0 * ( 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-			   mfccc += 3.0 * ( 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-			   mfacc += 3.0 * ( 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-			   mfcac += 3.0 * ( 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-			   mfaac += 3.0 * ( 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-			   mfabb += 3.0 * ( 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-			   mfbab += 3.0 * ( 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-			   mfbba += 3.0 * ( 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-			   mfaab += 3.0 * ( 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-			   mfcab += 3.0 * ( 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-			   mfaba += 3.0 * ( 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-			   mfcba += 3.0 * ( 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-			   mfbaa += 3.0 * ( 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-			   mfbca += 3.0 * ( 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-			   mfaaa += 3.0 * ( 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-			   mfcaa += 3.0 * ( 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-			   mfaca += 3.0 * ( 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-			   mfcca += 3.0 * ( 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-			   mfbbb += 3.0 * ( 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+			   forcingTerm[REST] = (-vvxF) * (fac1 * dX1_phiF ) +
+				   (-vvyF) * (fac1 * dX2_phiF ) +
+				   (-vvzF) * (fac1 * dX3_phiF );
 
-			   //--------------------------------------------------------
+			   ////////
+			  // LBMReal divAfterSource=
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfacb + 3.0 * (0.5 * forcingTerm[NW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcbc + 3.0 * (0.5 * forcingTerm[TE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabc + 3.0 * (0.5 * forcingTerm[TW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbcc + 3.0 * (0.5 * forcingTerm[TN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbac + 3.0 * (0.5 * forcingTerm[TS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccc + 3.0 * (0.5 * forcingTerm[TNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfacc + 3.0 * (0.5 * forcingTerm[TNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfcac + 3.0 * (0.5 * forcingTerm[TSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfaac + 3.0 * (0.5 * forcingTerm[TSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabb + 3.0 * (0.5 * forcingTerm[W]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbab + 3.0 * (0.5 * forcingTerm[S]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbba + 3.0 * (0.5 * forcingTerm[B]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaab + 3.0 * (0.5 * forcingTerm[SW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcab + 3.0 * (0.5 * forcingTerm[SE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfaba + 3.0 * (0.5 * forcingTerm[BW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcba + 3.0 * (0.5 * forcingTerm[BE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbaa + 3.0 * (0.5 * forcingTerm[BS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbca + 3.0 * (0.5 * forcingTerm[BN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaaa + 3.0 * (0.5 * forcingTerm[BSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcaa + 3.0 * (0.5 * forcingTerm[BSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaca + 3.0 * (0.5 * forcingTerm[BNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcca + 3.0 * (0.5 * forcingTerm[BNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbbb + 3.0 * (0.5 * forcingTerm[REST]) / rho)*((vvxF)*(vvxF)+(vvyF)*(vvyF)+(vvzF)*(vvzF)-1);
+
+			  // LBMReal divBeforeSource =
+				 //  (mfcbb)    * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbcb)    * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbbc)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccb)   * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfacb)   * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcbc)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabc)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbcc)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbac)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccc)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfacc)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfcac)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfaac)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabb)    * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbab)    * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbba)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaab)   * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcab)   * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfaba)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcba)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbaa)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbca)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaaa)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcaa)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaca)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcca)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbbb) * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF) * (vvzF)-1);
+			   //if (divAfterSource - divBeforeSource != 0 && phi[REST]>0.0001 && phi[REST]<0.999) {
+				  // std::cout << phi[REST]<<" "<< divAfterSource << " " << divBeforeSource <<" "<< divAfterSource/ divBeforeSource << std::endl;
+			   //}
+
+			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
+				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
+
+				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[N]	 *=scaleDiv;
+				  // forcingTerm[T]	 *=scaleDiv;
+				  // forcingTerm[NE]	 *=scaleDiv;
+				  // forcingTerm[NW]	 *=scaleDiv;
+				  // forcingTerm[TE]	 *=scaleDiv;
+				  // forcingTerm[TW]	 *=scaleDiv;
+				  // forcingTerm[TN]	 *=scaleDiv;
+				  // forcingTerm[TS]	 *=scaleDiv;
+				  // forcingTerm[TNE]	 *=scaleDiv;
+				  // forcingTerm[TNW]	 *=scaleDiv;
+				  // forcingTerm[TSE]	 *=scaleDiv;
+				  // forcingTerm[TSW]	 *=scaleDiv;
+				  // forcingTerm[W]	 *=scaleDiv;
+				  // forcingTerm[S]	 *=scaleDiv;
+				  // forcingTerm[B]	 *=scaleDiv;
+				  // forcingTerm[SW]	 *=scaleDiv;
+				  // forcingTerm[SE]	 *=scaleDiv;
+				  // forcingTerm[BW]	 *=scaleDiv;
+				  // forcingTerm[BE]	 *=scaleDiv;
+				  // forcingTerm[BS]	 *=scaleDiv;
+				  // forcingTerm[BN]	 *=scaleDiv;
+				  // forcingTerm[BSW]	 *=scaleDiv;
+				  // forcingTerm[BSE]	 *=scaleDiv;
+				  // forcingTerm[BNW]	 *=scaleDiv;
+				  // forcingTerm[BNE]	 *=scaleDiv;
+				  // forcingTerm[REST] *=scaleDiv;
+			   //}
+			   ////////
+
+
+			   mfcbb +=3.0 * ( 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfbcb +=3.0 * ( 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc +=3.0 * ( 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb +=3.0 * ( 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfacb +=3.0 * ( 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc +=3.0 * ( 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc +=3.0 * ( 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc +=3.0 * ( 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac +=3.0 * ( 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc +=3.0 * ( 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc +=3.0 * ( 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac +=3.0 * ( 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac +=3.0 * ( 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfabb +=3.0 * ( 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab +=3.0 * ( 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba +=3.0 * ( 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfaab +=3.0 * ( 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab +=3.0 * ( 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba +=3.0 * ( 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba +=3.0 * ( 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa +=3.0 * ( 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca +=3.0 * ( 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa +=3.0 * ( 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa +=3.0 * ( 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca +=3.0 * ( 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca +=3.0 * ( 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfbbb +=3.0 * ( 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
+			   //--------------------------------------------------------
 
 
+			   //////////End classic source term
 			   //forcing 
 			   ///////////////////////////////////////////////////////////////////////////////////////////
 			   if (withForcing)
@@ -753,11 +1083,11 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   /////fourth order parameters; here only for test. Move out of loop!
 
 			   LBMReal OxyyPxzz =  8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
-			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
-			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+			   LBMReal OxyyMxzz =  8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+			   LBMReal Oxyz =  24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			   LBMReal A =  (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
-			   LBMReal BB =  (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+			   LBMReal BB =   (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
 			   //Cum 4.
@@ -802,13 +1132,25 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			  // mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
 
 			   //17.03.2021 attempt for statililization by assymptotically vanishing bias
-			   LBMReal correctionScaling =0.0* rhoToPhi /rho;// +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
-			   mxxPyyPzz += (1.0/3.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz)* correctionScaling; // As in Hesam's code
-			   mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy)* correctionScaling;
-			   mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
-			   mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
-			   mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
-			   mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+			   //LBMReal correctionScaling = rhoToPhi /rho;// +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
+			   //mxxPyyPzz += (1.0/3.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz)* correctionScaling; // As in Hesam's code
+			   //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy)* correctionScaling;
+			   //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+			   //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+			   //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+			   //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+
+			   //14.04.2021 filtered velocity
+
+			   //LBMReal correctionScaling =  rhoToPhi / rho;// +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
+			   //mxxPyyPzz += (1.0 / 3.0) * (dX1_phi * vvxF + dX2_phi * vvyF + dX3_phi * vvzF) * correctionScaling; // As in Hesam's code
+			   //mxxMyy += c1o3 * (dX1_phi * vvxF - dX2_phi * vvyF) * correctionScaling;
+			   //mxxMzz += c1o3 * (dX1_phi * vvxF - dX3_phi * vvzF) * correctionScaling;
+			   //mfabb += c1o6 * (dX2_phi * vvzF + dX3_phi * vvyF) * correctionScaling;
+			   //mfbab += c1o6 * (dX1_phi * vvzF + dX3_phi * vvxF) * correctionScaling;
+			   //mfbba += c1o6 * (dX1_phi * vvyF + dX2_phi * vvxF) * correctionScaling;
+
 
 			   LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
 			   LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
@@ -819,6 +1161,20 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   LBMReal Dyz = -three * collFactorM * mfabb;
 
 			   ////relax unfiltered
+			   //! divergenceFilter 10.05.2021
+			   LBMReal divMag= (1.0 - phi[REST]) * (phi[REST])*10*5*sqrt(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
+			  // LBMReal divMag = 500 *500* 50*(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))))* (fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
+			   //LBMReal divMag = (dX1_phi * dxux) > 0 ? (dX1_phi * dxux) : 0;
+			   //divMag += (dX2_phi * dyuy) > 0 ? (dX2_phi * dyuy) : 0;
+			   //divMag += (dX3_phi * dzuz) > 0 ? (dX3_phi * dzuz) : 0;
+			   //divMag *= 5000;
+			   //divMag+= denom * 10 * 5 * sqrt(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
+			   //LBMReal divMag = 5000 * (fabs(dX1_phi * dxux)+fabs(dX2_phi * dyuy)+fabs(dX3_phi * dzuz));
+			   collFactorM = collFactorM / (1.0 + 3.0 * divMag);
+
+			   collFactorM = (collFactorM > 1.0) ? collFactorM : 1.0;
+
+
 			   mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
 			   mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
 			   mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
@@ -848,15 +1204,29 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 			   //applying phase field gradients second part:
 			   //mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
-			   mxxPyyPzz += (1.0 / 3.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling; // As in Hesam's code
-			   mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
-			   mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
-			   mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
-			   mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
-			   mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+			   //mxxPyyPzz += (1.0 / 3.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling; // As in Hesam's code
+			   //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+			   //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+			   //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+			   //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+			   //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+
+			   //////updated pressure
+			   //mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+
+
+			   //mxxPyyPzz += (1.0 / 3.0) * (dX1_phi * vvxF + dX2_phi * vvyF + dX3_phi * vvzF) * correctionScaling; // As in Hesam's code
+			   //mxxMyy += c1o3 * (dX1_phi * vvxF - dX2_phi * vvyF) * correctionScaling;
+			   //mxxMzz += c1o3 * (dX1_phi * vvxF - dX3_phi * vvzF) * correctionScaling;
+			   //mfabb += c1o6 * (dX2_phi * vvzF + dX3_phi * vvyF) * correctionScaling;
+			   //mfbab += c1o6 * (dX1_phi * vvzF + dX3_phi * vvxF) * correctionScaling;
+			   //mfbba += c1o6 * (dX1_phi * vvyF + dX2_phi * vvxF) * correctionScaling;
+
+
+			   //////updated pressure
+			   //mfaaa += (dX1_phi * vvxF + dX2_phi * vvyF + dX3_phi * vvzF) * correctionScaling;
 
-			   ////updated pressure
-			   mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
 
 			   mxxPyyPzz += mfaaa;//12.03.21 shifted by mfaaa
 			 //  mxxPyyPzz = mfaaa; //12.03.21 reguarized pressure !?
@@ -2542,7 +2912,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
                     }
                 }
             }
-        }
+        
         dataSet->setPhaseField(divU);
 		}
 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index 102af6035..cc90f0fc9 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -289,6 +289,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
                         //-1 0 1
 
                         findNeighbors(phaseField, x1, x2, x3);
+						findNeighbors2(phaseField2, x1, x2, x3);
 
                         LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
                         LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
@@ -328,10 +329,22 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
                         LBMReal dX2_phi = gradX2_phi();
                         LBMReal dX3_phi = gradX3_phi();
 
-                        LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
-                        LBMReal normX1 = dX1_phi/denom;
-						LBMReal normX2 = dX2_phi/denom;
-						LBMReal normX3 = dX3_phi/denom;
+						LBMReal dX1_phi2 = gradX1_phi2();
+						LBMReal dX2_phi2 = gradX2_phi2();
+						LBMReal dX3_phi2 = gradX3_phi2();
+
+
+                        LBMReal denom2 = sqrt(dX1_phi * dX1_phi+ dX1_phi2 * dX1_phi2 + dX2_phi * dX2_phi + dX2_phi2 * dX2_phi2 + dX3_phi * dX3_phi+ dX3_phi2 * dX3_phi2) + 1e-9;
+                        LBMReal normX1 = (dX1_phi-dX1_phi2)/denom2;
+						LBMReal normX2 = (dX2_phi-dX2_phi2)/denom2;
+						LBMReal normX3 = (dX3_phi-dX3_phi2)/denom2;
+
+						//LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
+						//LBMReal normX1 = dX1_phi / denom;
+						//LBMReal normX2 = dX2_phi / denom;
+						//LBMReal normX3 = dX3_phi / denom;
+
+
 
 						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
 
@@ -341,51 +354,38 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
                         //----------- Calculating Macroscopic Values -------------
                         LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
-                        if (withForcing) {
-                            // muX1 = static_cast<double>(x1-1+ix1*maxX1);
-                            // muX2 = static_cast<double>(x2-1+ix2*maxX2);
-                            // muX3 = static_cast<double>(x3-1+ix3*maxX3);
-
-                            forcingX1 = muForcingX1.Eval();
-                            forcingX2 = muForcingX2.Eval();
-                            forcingX3 = muForcingX3.Eval();
-
-                            LBMReal rho_m = 1.0 / densityRatio;
-                            forcingX1     = forcingX1 * (rho - rho_m);
-                            forcingX2     = forcingX2 * (rho - rho_m);
-                            forcingX3     = forcingX3 * (rho - rho_m);
-
                             			   ////Incompressible Kernal
 
-			    mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)/rho;
-			    mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) / rho;
-			    mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) / rho;
-			    mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) / rho;
-			    mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) / rho;
-			    mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) / rho;
-			    mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) / rho;
-			    mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) / rho;
-			    mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) / rho;
-			    mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) / rho;
-			    mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) / rho;
-			    mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) / rho;
-			    mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) / rho;
-
-			    mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) / rho;
-			    mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) / rho;
-			    mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) / rho;
-			    mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) / rho;
-			    mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) / rho;
-			    mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) / rho;
-			    mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) / rho;
-			    mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) / rho;
-			    mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) / rho;
-			    mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) / rho;
-			    mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) / rho;
-			    mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) / rho;
-			    mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) / rho;
-
-			    mfbbb = (*this->zeroDistributionsF)(x1, x2, x3) / rho;
+						mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) / rho * c3;
+						mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) / rho * c3;
+						mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) / rho * c3;
+						mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) / rho * c3;
+						mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) / rho * c3;
+						mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) / rho * c3;
+						mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) / rho * c3;
+						mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) / rho * c3;
+						mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) / rho * c3;
+						mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) / rho * c3;
+						mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) / rho * c3;
+						mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) / rho * c3;
+						mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) / rho * c3;
+
+						mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) / rho * c3;
+						mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) / rho * c3;
+						mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) / rho * c3;
+						mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) / rho * c3;
+						mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) / rho * c3;
+						mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) / rho * c3;
+						mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) / rho * c3;
+						mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) / rho * c3;
+						mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) / rho * c3;
+						mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) / rho * c3;
+						mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) / rho * c3;
+						mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) / rho * c3;
+						mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) / rho * c3;
+
+						mfbbb = (*this->zeroDistributionsF)(x1, x2, x3) / rho * c3;
+
 
 			   LBMReal m0, m1, m2;
 			   LBMReal rhoRef=c1;
@@ -405,11 +405,240 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 				   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
 				   (mfbbc - mfbba))/rhoRef;
 
+
+			   if (withForcing) {
+				   // muX1 = static_cast<double>(x1-1+ix1*maxX1);
+				   // muX2 = static_cast<double>(x2-1+ix2*maxX2);
+				   // muX3 = static_cast<double>(x3-1+ix3*maxX3);
+
+				   forcingX1 = muForcingX1.Eval();
+				   forcingX2 = muForcingX2.Eval();
+				   forcingX3 = muForcingX3.Eval();
+
+				   //LBMReal rho_m = 1.0 / densityRatio;
+				   //forcingX1 = forcingX1 * (rho - rho_m);
+				   //forcingX2 = forcingX2 * (rho - rho_m);
+				   //forcingX3 = forcingX3 * (rho - rho_m);
+				   vvx += forcingX1 * deltaT * 0.5; // X
+				   vvy += forcingX2 * deltaT * 0.5; // Y
+				   vvz += forcingX3 * deltaT * 0.5; // Z
+
+			   }
+
+
 			   ///surface tension force
 			   vvx += mu * dX1_phi*c1o2;
-			   vvy += mu * dX2_phi * c1o2;
+			   vvy += mu * dX2_phi * c1o2 ;
 			   vvz += mu * dX3_phi * c1o2;
 
+			   //////classic source term
+			   ///----Classic source term 8.4.2021
+
+			   LBMReal vvxF, vvyF, vvzF;
+			   vvxF = vvx;//-2*c1o24 * lap_vx;// 
+			   vvyF = vvy;//-2*c1o24 * lap_vy;// 
+			   vvzF = vvz;//-2*c1o24 * lap_vz;// 
+
+//			   vvxF = 1.2* vvx- 0.2*0.5 * ((*velocityX)(x1 - 1, x2, x3) + (*velocityX)(x1 + 1, x2, x3));
+//			   vvyF = 1.2 *vvy- 0.2*0.5* ((*velocityY)(x1 , x2-1, x3) + (*velocityY)(x1 , x2+1, x3));
+//			   vvzF = 1.2 *vvz-0.2*0.5* ((*velocityZ)(x1 , x2, x3-1) + (*velocityZ)(x1 , x2, x3+1));
+			   //if (vvxF != vvx) {
+				  // vvxF = vvxF;
+			   //}
+			   LBMReal weightGrad = 1.0;// -denom * denom / (denom * denom + 0.0001 * 0.001);
+			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
+			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
+			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+
+			   //dX1_phiF *= 1.2;
+			   //dX2_phiF *= 1.2;
+			   //dX3_phiF *= 1.2;
+
+			   //LBMReal gradFD = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi);
+			   //LBMReal gradPhi = (1.0 - phi[REST]) * (phi[REST]);
+			   //gradPhi = (gradPhi > gradFD) ? gradPhi : gradFD;
+			   //dX1_phiF = gradPhi * normX1;
+				  // dX2_phiF = gradPhi * normX2;
+				  // dX3_phiF = gradPhi * normX3;
+
+			   LBMReal ux2;
+			   LBMReal uy2;
+			   LBMReal uz2;
+			   ux2 = vvxF * vvxF;
+			   uy2 = vvyF * vvyF;
+			   uz2 = vvzF * vvzF;
+			   LBMReal forcingTerm[D3Q27System::ENDF + 1];
+			   for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+				   LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
+				   LBMReal velSq1 = velProd * velProd;
+				   LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
+
+				   //LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
+
+				   //forcingTerm[dir] =
+					  // (-vvxF) * (fac1 * dX1_phiF) +
+					  // (-vvyF) * (fac1 * dX2_phiF) +
+					  // (-vvzF) * (fac1 * dX3_phiF) +
+					  // (DX1[dir]) * (fac1 * dX1_phiF) +
+					  // (DX2[dir]) * (fac1 * dX2_phiF) +
+					  // (DX3[dir]) * (fac1 * dX3_phiF);
+
+
+				   LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 ;
+
+				   forcingTerm[dir] =
+					   (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					   (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					   (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL)) +
+					   (DX1[dir]) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					   (DX2[dir]) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					   (DX3[dir]) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+
+
+			   }
+
+			   LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+			   LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
+			   forcingTerm[REST] =	 (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+				   (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+				   (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+			   ////////
+			  // LBMReal divAfterSource=
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfacb + 3.0 * (0.5 * forcingTerm[NW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcbc + 3.0 * (0.5 * forcingTerm[TE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabc + 3.0 * (0.5 * forcingTerm[TW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbcc + 3.0 * (0.5 * forcingTerm[TN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbac + 3.0 * (0.5 * forcingTerm[TS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccc + 3.0 * (0.5 * forcingTerm[TNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfacc + 3.0 * (0.5 * forcingTerm[TNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfcac + 3.0 * (0.5 * forcingTerm[TSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfaac + 3.0 * (0.5 * forcingTerm[TSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabb + 3.0 * (0.5 * forcingTerm[W]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbab + 3.0 * (0.5 * forcingTerm[S]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbba + 3.0 * (0.5 * forcingTerm[B]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaab + 3.0 * (0.5 * forcingTerm[SW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcab + 3.0 * (0.5 * forcingTerm[SE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfaba + 3.0 * (0.5 * forcingTerm[BW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcba + 3.0 * (0.5 * forcingTerm[BE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbaa + 3.0 * (0.5 * forcingTerm[BS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbca + 3.0 * (0.5 * forcingTerm[BN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaaa + 3.0 * (0.5 * forcingTerm[BSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcaa + 3.0 * (0.5 * forcingTerm[BSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaca + 3.0 * (0.5 * forcingTerm[BNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcca + 3.0 * (0.5 * forcingTerm[BNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbbb + 3.0 * (0.5 * forcingTerm[REST]) / rho)*((vvxF)*(vvxF)+(vvyF)*(vvyF)+(vvzF)*(vvzF)-1);
+
+			  // LBMReal divBeforeSource =
+				 //  (mfcbb)    * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbcb)    * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbbc)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccb)   * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfacb)   * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcbc)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabc)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbcc)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbac)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccc)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfacc)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfcac)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfaac)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabb)    * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbab)    * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbba)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaab)   * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcab)   * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfaba)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcba)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbaa)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbca)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaaa)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcaa)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaca)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcca)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbbb) * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF) * (vvzF)-1);
+			   //if (divAfterSource - divBeforeSource != 0 && phi[REST]>0.0001 && phi[REST]<0.999) {
+				  // std::cout << phi[REST]<<" "<< divAfterSource << " " << divBeforeSource <<" "<< divAfterSource/ divBeforeSource << std::endl;
+			   //}
+
+			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
+				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
+
+				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[N]	 *=scaleDiv;
+				  // forcingTerm[T]	 *=scaleDiv;
+				  // forcingTerm[NE]	 *=scaleDiv;
+				  // forcingTerm[NW]	 *=scaleDiv;
+				  // forcingTerm[TE]	 *=scaleDiv;
+				  // forcingTerm[TW]	 *=scaleDiv;
+				  // forcingTerm[TN]	 *=scaleDiv;
+				  // forcingTerm[TS]	 *=scaleDiv;
+				  // forcingTerm[TNE]	 *=scaleDiv;
+				  // forcingTerm[TNW]	 *=scaleDiv;
+				  // forcingTerm[TSE]	 *=scaleDiv;
+				  // forcingTerm[TSW]	 *=scaleDiv;
+				  // forcingTerm[W]	 *=scaleDiv;
+				  // forcingTerm[S]	 *=scaleDiv;
+				  // forcingTerm[B]	 *=scaleDiv;
+				  // forcingTerm[SW]	 *=scaleDiv;
+				  // forcingTerm[SE]	 *=scaleDiv;
+				  // forcingTerm[BW]	 *=scaleDiv;
+				  // forcingTerm[BE]	 *=scaleDiv;
+				  // forcingTerm[BS]	 *=scaleDiv;
+				  // forcingTerm[BN]	 *=scaleDiv;
+				  // forcingTerm[BSW]	 *=scaleDiv;
+				  // forcingTerm[BSE]	 *=scaleDiv;
+				  // forcingTerm[BNW]	 *=scaleDiv;
+				  // forcingTerm[BNE]	 *=scaleDiv;
+				  // forcingTerm[REST] *=scaleDiv;
+			   //}
+			   ////////
+
+
+			   mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+			   //--------------------------------------------------------
+
+
+
+
+
+			   //////end classic source term
+
+
+
+
 			   //forcing 
 			   ///////////////////////////////////////////////////////////////////////////////////////////
 			   if (withForcing)
@@ -418,13 +647,13 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 				   muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
 				   muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
 
-				   forcingX1 = muForcingX1.Eval();
-				   forcingX2 = muForcingX2.Eval();
-				   forcingX3 = muForcingX3.Eval();
+				   //forcingX1 = muForcingX1.Eval();
+				   //forcingX2 = muForcingX2.Eval();
+				   //forcingX3 = muForcingX3.Eval();
 
-				   vvx += forcingX1 * deltaT * 0.5; // X
-				   vvy += forcingX2 * deltaT * 0.5; // Y
-				   vvz += forcingX3 * deltaT * 0.5; // Z
+				   //vvx += forcingX1 * deltaT * 0.5; // X
+				   //vvy += forcingX2 * deltaT * 0.5; // Y
+				   //vvz += forcingX3 * deltaT * 0.5; // Z
 			   }
 
 			   LBMReal vx2;
@@ -697,12 +926,24 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   // Cumulants
 			   ////////////////////////////////////////////////////////////////////////////////////
 			   LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity
-			   LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
-			   LBMReal OxyyMxzz  = 1.;//2+s9;//
+			 //  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+			 //  LBMReal OxyyMxzz  = 1.;//2+s9;//
 			   LBMReal O4 = 1.;
 			   LBMReal O5 = 1.;
 			   LBMReal O6 = 1.;
 
+
+
+			   /////fourth order parameters; here only for test. Move out of loop!
+
+			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+
+
 			   //Cum 4.
 			   //LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
 			   //LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
@@ -744,19 +985,24 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   //applying phase field gradients first part:
 			  // mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
                // 17.03.2021 attempt for statililization by assymptotically vanishing bias
-               LBMReal correctionScaling =
-                   rhoToPhi / rho; // +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
-               mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
-                            correctionScaling; // As in Hesam's code
-               mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
-               mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
-               mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
-               mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
-               mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
-
-			   LBMReal dxux = 0.0;// -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
-			   LBMReal dyuy = 0.0;// dxux + collFactorM * c3o2 * mxxMyy;
-			   LBMReal dzuz = 0.0;// dxux + collFactorM * c3o2 * mxxMzz;
+               //LBMReal correctionScaling =
+               //    rhoToPhi / rho; // +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+			   LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+			   LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+			   LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+
+			   LBMReal Dxy = -three * collFactorM * mfbba;
+			   LBMReal Dxz = -three * collFactorM * mfbab;
+			   LBMReal Dyz = -three * collFactorM * mfabb;
+
 
 			   //relax
 			   mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
@@ -769,16 +1015,16 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 			   //applying phase field gradients second part:
 			   //mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
-               mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
-                            correctionScaling; // As in Hesam's code
-               mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
-               mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
-               mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
-               mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
-               mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
 
                ////updated pressure
-               mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+               //mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
 
                mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
 			   // linear combinations back
@@ -822,13 +1068,19 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
 
 			   //4.
-			   CUMacc += O4 * (-CUMacc);
-			   CUMcac += O4 * (-CUMcac);
-			   CUMcca += O4 * (-CUMcca);
-
-			   CUMbbc += O4 * (-CUMbbc);
-			   CUMbcb += O4 * (-CUMbcb);
-			   CUMcbb += O4 * (-CUMcbb);
+			   //CUMacc += O4 * (-CUMacc);
+			   //CUMcac += O4 * (-CUMcac);
+			   //CUMcca += O4 * (-CUMcca);
+
+			   //CUMbbc += O4 * (-CUMbbc);
+			   //CUMbcb += O4 * (-CUMbcb);
+			   //CUMcbb += O4 * (-CUMcbb);
+			   CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+			   CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+			   CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+			   CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+			   CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+			   CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
 
 			   //5.
 			   CUMbcc += O5 * (-CUMbcc);
@@ -1090,60 +1342,92 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfbcc = m1;
 			   mfccc = m2;
 
+			   /////classical source term 8.4.2021
+
+			   mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+
+
 			   //////////////////////////////////////////////////////////////////////////
 			   //proof correctness
 			   //////////////////////////////////////////////////////////////////////////
-#ifdef  PROOF_CORRECTNESS
-			   LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
-			   //LBMReal dif = fabs(drho - rho_post);
-               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
-#ifdef SINGLEPRECISION
-			   if (dif > 10.0E-7 || dif < -10.0E-7)
-#else
-			   if (dif > 10.0E-15 || dif < -10.0E-15)
-#endif
-			   {
-				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
-					   + " dif=" + UbSystem::toString(dif)
-					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
-				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
-				   //exit(EXIT_FAILURE);
-			   }
-#endif
+//#ifdef  PROOF_CORRECTNESS
+//			   LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+//				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+//				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+//			   //LBMReal dif = fabs(drho - rho_post);
+//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+//#ifdef SINGLEPRECISION
+//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+//#else
+//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+//#endif
+//			   {
+//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+//					   + " dif=" + UbSystem::toString(dif)
+//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+//				   //exit(EXIT_FAILURE);
+//			   }
+//#endif
 			   //////////////////////////////////////////////////////////////////////////
 			   //write distribution
 			   //////////////////////////////////////////////////////////////////////////
-			   (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca * rho;
-			   (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca * rho;
-
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac * rho;
-			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac * rho;
-
-			   (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb * rho;
+			   (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca * rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca * rho * c1o3;
+
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac * rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac * rho * c1o3;
+
+			   (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb * rho * c1o3;
 			   //////////////////////////////////////////////////////////////////////////
 
 			   ////!Incompressible Kernal
@@ -1977,7 +2261,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
                         ////////////////////////////////////////////
 		/////CUMULANT PHASE-FIELD
 				LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
-
+				{
 			   mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
 			   mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
 			   mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
@@ -2134,6 +2418,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   LBMReal Mccb = mfccb - mfaab * c1o9;
 
 			   // collision of 1st order moments
+			  // LBMReal ccx, ccy, ccz;
+			   
+
                cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
                     normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
                cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
@@ -2281,6 +2568,323 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
    (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
 
    (*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+   }
+
+   ////Phasefield 2:
+
+   {
+
+   normX1 *= -1;
+   normX2 *= -1;
+   normX3 *= -1;
+
+   mfcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+   mfbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+   mfbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+   mfccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+   mfacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+   mfcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+   mfabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+   mfbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+   mfbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+   mfccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+   mfacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+   mfcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+   mfaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+   mfabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+   mfbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+   mfbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+   mfaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+   mfcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+   mfaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+   mfcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+   mfbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+   mfbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+   mfaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+   mfcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+   mfaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+   mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+   mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+
+
+   ////////////////////////////////////////////////////////////////////////////////////
+//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//!
+////////////////////////////////////////////////////////////////////////////////////
+// fluid component
+	   //LBMReal drhoFluid =
+		  // ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) +
+		  // (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) +
+			 //  ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb;
+
+	   //LBMReal rhoFluid = c1 + drhoFluid;
+	   //LBMReal OOrhoFluid = c1 / rhoFluid;
+
+
+	   //LBMReal vvx =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) +
+		  // (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) +
+			 //  (fcbb - fabb)) * OOrhoFluid;
+	   //LBMReal vvy =
+		  // ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) +
+		  // (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) +
+			 //  (fbcb - fbab)) * OOrhoFluid;
+	   //LBMReal vvz =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) +
+		  // (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) +
+			 //  (fbbc - fbba)) * OOrhoFluid;
+
+	 //  LBMReal vvx = ux;
+	 //  LBMReal vvy = uy;
+	 //  LBMReal vvz = uz;
+	   ////////////////////////////////////////////////////////////////////////////////////
+	   // second component
+   LBMReal concentration =
+	   ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+	   (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+		   ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //!
+  // LBMReal fx = forces[0];
+  // LBMReal fy = forces[1];
+  // LBMReal fz = -concentration * forces[2];
+  // vvx += fx * c1o2;
+  // vvy += fy * c1o2;
+  // vvz += fz * c1o2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   LBMReal oneMinusRho = c1 - concentration;
+
+   LBMReal cx =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+	   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+		   (mfcbb - mfabb));
+   LBMReal cy =
+	   ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+	   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+		   (mfbcb - mfbab));
+   LBMReal cz =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+	   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+		   (mfbbc - mfbba));
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // calculate the square of velocities for this lattice node
+   LBMReal cx2 = cx * cx;
+   LBMReal cy2 = cy * cy;
+   LBMReal cz2 = cz * cz;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (6)-(14) in \ref
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - experimental Cumulant ... to be published ... hopefully
+   //!
+
+   // linearized orthogonalization of 3rd order central moments
+   LBMReal Mabc = mfabc - mfaba * c1o3;
+   LBMReal Mbca = mfbca - mfbaa * c1o3;
+   LBMReal Macb = mfacb - mfaab * c1o3;
+   LBMReal Mcba = mfcba - mfaba * c1o3;
+   LBMReal Mcab = mfcab - mfaab * c1o3;
+   LBMReal Mbac = mfbac - mfbaa * c1o3;
+   // linearized orthogonalization of 5th order central moments
+   LBMReal Mcbc = mfcbc - mfaba * c1o9;
+   LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+   LBMReal Mccb = mfccb - mfaab * c1o9;
+
+   // collision of 1st order moments
+   cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+
+   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
+   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
+//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
+
+
+   cx2 = cx * cx;
+   cy2 = cy * cy;
+   cz2 = cz * cz;
+
+   // equilibration of 2nd order moments
+   mfbba = zeroReal;
+   mfbab = zeroReal;
+   mfabb = zeroReal;
+
+   mfcaa = c1o3 * concentration;
+   mfaca = c1o3 * concentration;
+   mfaac = c1o3 * concentration;
+
+
+   //LBMReal omega2 = 1.0f;// omegaD;
+   //mfbba *= (c1 - omega2);
+   //mfbab *= (c1 - omega2);
+   //mfabb *= (c1 - omega2);
+
+   //mfcaa = mfcaa*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaca = mfaca*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaac = mfaac*(c1 - omega2) + omega2*c1o3 * concentration;
+
+   // equilibration of 3rd order moments
+   Mabc = zeroReal;
+   Mbca = zeroReal;
+   Macb = zeroReal;
+   Mcba = zeroReal;
+   Mcab = zeroReal;
+   Mbac = zeroReal;
+   mfbbb = zeroReal;
+
+   // from linearized orthogonalization 3rd order central moments to central moments
+   mfabc = Mabc + mfaba * c1o3;
+   mfbca = Mbca + mfbaa * c1o3;
+   mfacb = Macb + mfaab * c1o3;
+   mfcba = Mcba + mfaba * c1o3;
+   mfcab = Mcab + mfaab * c1o3;
+   mfbac = Mbac + mfbaa * c1o3;
+
+   // equilibration of 4th order moments
+   mfacc = c1o9 * concentration;
+   mfcac = c1o9 * concentration;
+   mfcca = c1o9 * concentration;
+
+   mfcbb = zeroReal;
+   mfbcb = zeroReal;
+   mfbbc = zeroReal;
+
+   // equilibration of 5th order moments
+   Mcbc = zeroReal;
+   Mbcc = zeroReal;
+   Mccb = zeroReal;
+
+   // from linearized orthogonalization 5th order central moments to central moments
+   mfcbc = Mcbc + mfaba * c1o9;
+   mfbcc = Mbcc + mfbaa * c1o9;
+   mfccb = Mccb + mfaab * c1o9;
+
+   // equilibration of 6th order moment
+   mfccc = c1o27 * concentration;
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (88)-(96) in
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+   (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3) = mfabb;
+   (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3) = mfbab;
+   (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3) = mfbba;
+   (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;
+   (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;
+   (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;
+
+   (*this->zeroDistributionsH2)(x1, x2, x3) = mfbbb;
+
+   }
+
+
 
 		/////!CUMULANT PHASE-FIELD
 
@@ -2371,8 +2975,8 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
                     }
                 }
             }
-        }
-        dataSet->setPhaseField(divU);
+        
+       // dataSet->setPhaseField(divU);
 		}
 }
 //////////////////////////////////////////////////////////////////////////
@@ -2416,6 +3020,49 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi()
     //return 3.0 * sum;
 }
 
+LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+		+WEIGTH[N] * (phi2[N] - phi2[S]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+		+WEIGTH[N] * (phi2[T] - phi2[B]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+
+
+
+
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
@@ -2504,6 +3151,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal,
 
     phi[REST] = (*ph)(x1, x2, x3);
 
+
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 
         if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
@@ -2514,8 +3162,30 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal,
     }
 }
 
+void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.0;
+		}
+	}
+}
+
 void MultiphaseTwoPhaseFieldsCumulantLBMKernel::swapDistributions()
 {
     LBMKernel::swapDistributions();
     dataSet->getHdistributions()->swap();
+	dataSet->getH2distributions()->swap();
 }
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h
index bc7609a29..a65fe073f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h
@@ -80,18 +80,23 @@ protected:
    LBMReal h2[D3Q27System::ENDF + 1];
    LBMReal g  [D3Q27System::ENDF+1];
    LBMReal phi[D3Q27System::ENDF+1];
+   LBMReal phi2[D3Q27System::ENDF + 1];
    LBMReal pr1[D3Q27System::ENDF+1];
    LBMReal phi_cutoff[D3Q27System::ENDF+1];
 
    LBMReal gradX1_phi();
    LBMReal gradX2_phi();
    LBMReal gradX3_phi();
+   LBMReal gradX1_phi2();
+   LBMReal gradX2_phi2();
+   LBMReal gradX3_phi2();
    //LBMReal gradX1_pr1();
    //LBMReal gradX2_pr1();
    //LBMReal gradX3_pr1();
    //LBMReal dirgradC_phi(int n, int k);
    void computePhasefield();
    void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+   void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
    //void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, int x1, int x2, int x3);
    //void pressureFiltering(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf_filtered /*Pressure-Field*/);
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index 4213e2b79..124e342d6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -224,7 +224,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 
 						feq[dir] = rho*WEIGTH[dir]*(1 + 3*velProd + 4.5*velSq1 - 1.5*(vx1Sq+vx2Sq+vx3Sq));
 						//geq[dir] = p1*WEIGTH1[dir] + gamma;
-						geq[dir] = p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma;
+						geq[dir] = p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma*rho;
 					}
 
 
@@ -291,6 +291,35 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					distributionsH->setDistributionInv(f, ix1, ix2, ix3);
 
 					if (distributionsH2) {
+
+						f[E]    = (1.-phi) * feq[E] / rho;
+						f[W]    = (1.-phi) * feq[W] / rho;
+						f[N]    = (1.-phi) * feq[N] / rho;
+						f[S]    = (1.-phi) * feq[S] / rho;
+						f[T]    = (1.-phi) * feq[T] / rho;
+						f[B]    = (1.-phi) * feq[B] / rho;
+						f[NE]   = (1.-phi) * feq[NE] / rho;
+						f[SW]   = (1.-phi) * feq[SW] / rho;
+						f[SE]   = (1.-phi) * feq[SE] / rho;
+						f[NW]   = (1.-phi) * feq[NW] / rho;
+						f[TE]   = (1.-phi) * feq[TE] / rho;
+						f[BW]   = (1.-phi) * feq[BW] / rho;
+						f[BE]   = (1.-phi) * feq[BE] / rho;
+						f[TW]   = (1.-phi) * feq[TW] / rho;
+						f[TN]   = (1.-phi) * feq[TN] / rho;
+						f[BS]   = (1.-phi) * feq[BS] / rho;
+						f[BN]   = (1.-phi) * feq[BN] / rho;
+						f[TS]   = (1.-phi) * feq[TS] / rho;
+						f[TNE]  = (1.-phi) * feq[TNE] / rho;
+						f[TNW]  = (1.-phi) * feq[TNW] / rho;
+						f[TSE]  = (1.-phi) * feq[TSE] / rho;
+						f[TSW]  = (1.-phi) * feq[TSW] / rho;
+						f[BNE]  = (1.-phi) * feq[BNE] / rho;
+						f[BNW]  = (1.-phi) * feq[BNW] / rho;
+						f[BSE]  = (1.-phi) * feq[BSE] / rho;
+						f[BSW]  = (1.-phi) * feq[BSW] / rho;
+						f[REST] = (1.-phi) * feq[REST] / rho;
+
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
                         distributionsH2->setDistributionInv(f, ix1, ix2, ix3);                    
 					}
-- 
GitLab


From e80e296a5d0169afb6df4da601dbe16011442e74 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Fri, 18 Jun 2021 14:42:41 +0200
Subject: [PATCH 004/179] Velocity fomulation without viscosity correction and
 no output for pressure and wrong output for velocity

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   20 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |   14 +-
 src/cpu/VirtualFluids.h                       |    2 +
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp | 3276 +++++++++++++++++
 ...eTwoPhaseFieldsVelocityCumulantLBMKernel.h |  116 +
 ...eInitDistributionsBlockVisitorVelocity.cpp |  362 ++
 ...aseInitDistributionsBlockVisitorVelocity.h |  102 +
 7 files changed, 3876 insertions(+), 16 deletions(-)
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
 create mode 100644 src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 72c014489..08bc3a435 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,4 +1,5 @@
-pathname = d:/temp/MultiphaseDropletTest
+#pathname = d:/temp/MultiphaseDropletTest
+pathname = E:/Multiphase/DropletTest
 
 numOfThreads = 4
 availMem = 10e9
@@ -6,23 +7,24 @@ availMem = 10e9
 #Grid
 
 boundingBox = 0 128 0 64 0 64
-blocknx = 8 8 8
+#blocknx = 8 8 8
+blocknx= 128 64 64
 
 dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0.005 
+uLB = 0.00001#0.005#0.005 
 Re = 10
-nuL =1e-2# 1.0e-5 #!1e-2
-nuG =1e-2# 1.16e-4 #!1e-2
+nuL =1e-6# 1.0e-5 #!1e-2
+nuG =1e-6# 1.16e-4 #!1e-2
 densityRatio = 1000
-sigma = 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+sigma =0.# 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 5
-radius = 16
+radius = 8#16
 contactAngle = 110.0
-#gravity = 0.0
-gravity = -5.04e-6
+gravity = 0.0
+#gravity = 5.04e-6
 phi_L = 0.0
 phi_H = 1.0
 Phase-field Relaxation = 0.6
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 092d5a16a..99c9e26e1 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -79,8 +79,8 @@ void run(string configname)
         SPtr<LBMKernel> kernel;
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(gr);
@@ -221,7 +221,7 @@ void run(string configname)
             fct2.DefineConst("radius", radius);
             fct2.DefineConst("interfaceThickness", interfaceThickness);
 
-            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio, interfaceThickness, radius);
+            MultiphaseInitDistributionsBlockVisitorVelocity initVisitor(densityRatio, interfaceThickness, radius);
             initVisitor.setPhi(fct1);
             initVisitor.setVx1(fct2);
             grid->accept(initVisitor);
@@ -257,12 +257,12 @@ void run(string configname)
                 UBLOG(logINFO, "Restart - end");
         }
 
-        TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        grid->accept(setConnsVisitor);
-
-        //ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
+        ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
+
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 363c9c046..754c8854d 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -244,6 +244,7 @@
 #include <LBM/MultiphaseCumulantLBMKernel.h>
 #include <LBM/MultiphaseScratchCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h>
+#include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h>
 
 
 
@@ -338,6 +339,7 @@
 #include <Visitors/MultiphaseSetKernelBlockVisitor.h>
 #include <Visitors/MultiphaseBoundaryConditionsBlockVisitor.h>
 #include <Visitors/MultiphaseInitDistributionsBlockVisitor.h>
+#include <Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h>
 #include <Visitors/SetInterpolationConnectorsBlockVisitor.h>
 
 #include <RefineAroundGbObjectHelper.h>
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
new file mode 100644
index 000000000..fd0b7f2a1
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -0,0 +1,3276 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+//! \ingroup LBMKernel
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h"
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "D3Q27System.h"
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include <cmath>
+
+#define PROOF_CORRECTNESS
+
+//////////////////////////////////////////////////////////////////////////
+MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel() { this->compressible = false; }
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::initDataSet()
+{
+    SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9));
+    SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9)); // For phase-field
+    SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9)); // For phase-field
+    SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
+	 pressure= CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
+	 pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
+    dataSet->setFdistributions(f);
+    dataSet->setHdistributions(h); // For phase-field
+    dataSet->setH2distributions(h2); // For phase-field
+    dataSet->setPhaseField(divU);
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::clone()
+{
+    SPtr<LBMKernel> kernel(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+    kernel->setNX(nx);
+    dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->initDataSet();
+    kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+    kernel->setDensityRatio(this->densityRatio);
+    kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+    kernel->setContactAngle(this->contactAngle);
+    kernel->setPhiL(this->phiL);
+    kernel->setPhiH(this->phiH);
+    kernel->setPhaseFieldRelaxation(this->tauH);
+    kernel->setMobility(this->mob);
+
+    kernel->setBCProcessor(bcProcessor->clone(kernel));
+    kernel->setWithForcing(withForcing);
+    kernel->setForcingX1(muForcingX1);
+    kernel->setForcingX2(muForcingX2);
+    kernel->setForcingX3(muForcingX3);
+    kernel->setIndex(ix1, ix2, ix3);
+    kernel->setDeltaT(deltaT);
+
+    return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+    LBMReal m2 = mfa + mfc;
+	LBMReal m1 = mfc - mfa;
+	LBMReal m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += oneMinusRho;
+	mfb = (m1 * Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+    LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+    LBMReal m1 = (mfa + mfc) + mfb;
+	LBMReal m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+	mfb = m2 - vv * m1;
+	mfa = m1;
+}
+
+
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+    LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
+{
+    using namespace D3Q27System;
+    using namespace UbMath;
+
+    forcingX1 = 0.0;
+    forcingX2 = 0.0;
+    forcingX3 = 0.0;
+
+	LBMReal oneOverInterfaceScale = 1.0;
+    /////////////////////////////////////
+
+    localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+    nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+    zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+    localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+    nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+    zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+
+	localDistributionsH2    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getLocalDistributions();
+    nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions();
+    zeroDistributionsH2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions();
+
+    SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+    const int bcArrayMaxX1 = (int)bcArray->getNX1();
+    const int bcArrayMaxX2 = (int)bcArray->getNX2();
+    const int bcArrayMaxX3 = (int)bcArray->getNX3();
+
+    int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+    int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+    int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+
+    //TODO
+	//very expensive !!!!!
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField(
+            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2(
+        new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+        CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU(
+            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+
+
+        for (int x3 = 0; x3 <= maxX3; x3++) {
+            for (int x2 = 0; x2 <= maxX2; x2++) {
+                for (int x1 = 0; x1 <= maxX1; x1++) {
+                    if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+                        int x1p = x1 + 1;
+                        int x2p = x2 + 1;
+                        int x3p = x3 + 1;
+
+                        LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                        LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                        LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                        LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                        LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                        LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                        LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                        LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                        LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                        LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                        LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                        LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                        LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                        LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                        LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                        LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                        LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+                        (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+                                                    (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+                                                    ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+                                                    (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+
+                        mfcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+                        mfbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+                        mfbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+                        mfccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+                        mfacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+                        mfcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+                        mfabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+                        mfbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+                        mfbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+                        mfccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+                        mfacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        mfcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        mfaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        mfabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+                        mfbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+                        mfbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+                        mfaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        mfcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+                        mfaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        mfcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+                        mfbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        mfbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+                        mfaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        mfcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        mfaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+                        (*phaseField2)(x1, x2, x3) =
+                            (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) +
+                            (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+                             ((mfbaa + mfbac) + (mfbca + mfbcc))) +
+                            ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+						//(*phaseField)(x1, x2, x3) = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+						//	(mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+						//	(mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) +
+						//	(mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+////// read F-distributions for velocity formalism
+
+
+						 mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+						 mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+						 mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+						 mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+						 mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+						 mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+						 mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+						 mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+						 mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+						 mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+						 mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+						 mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+						 mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+						 mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+						 mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+						 mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+						 mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+						 mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+						 mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+						 mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+						 mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+						 mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+						 mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+						 mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+						 mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+						 mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+						 mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+						LBMReal rhoH = 1.0;
+						LBMReal rhoL = 1.0 / densityRatio;
+
+						LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+						LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+						LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
+
+						////!!!!!! relplace by pointer swap!
+						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+                    }
+                }
+            }
+        }
+
+        LBMReal collFactorM;
+        //LBMReal forcingTerm[D3Q27System::ENDF + 1];
+
+        for (int x3 = minX3; x3 < maxX3; x3++) {
+            for (int x2 = minX2; x2 < maxX2; x2++) {
+                for (int x1 = minX1; x1 < maxX1; x1++) {
+                    if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+                        int x1p = x1 + 1;
+                        int x2p = x2 + 1;
+                        int x3p = x3 + 1;
+
+                        //////////////////////////////////////////////////////////////////////////
+                        // Read distributions and phase field
+                        ////////////////////////////////////////////////////////////////////////////
+                        //////////////////////////////////////////////////////////////////////////
+
+                        // E   N  T
+                        // c   c  c
+                        //////////
+                        // W   S  B
+                        // a   a  a
+
+                        // Rest ist b
+
+                        // mfxyz
+                        // a - negative
+                        // b - null
+                        // c - positive
+
+                        // a b c
+                        //-1 0 1
+
+                        findNeighbors(phaseField, x1, x2, x3);
+						findNeighbors2(phaseField2, x1, x2, x3);
+
+                        LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+                        LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+                        LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+                        LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+                        LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+                        LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+                        LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+                        LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+                        LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+                        LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+                        LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+                        LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+                        LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+                        LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+                        LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+                        LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+                        LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+                        LBMReal rhoH = 1.0;
+                        LBMReal rhoL = 1.0 / densityRatio;
+
+                        LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+                        LBMReal dX1_phi = gradX1_phi();
+                        LBMReal dX2_phi = gradX2_phi();
+                        LBMReal dX3_phi = gradX3_phi();
+
+						//LBMReal dX1_phi2 = gradX1_phi2();
+						//LBMReal dX2_phi2 = gradX2_phi2();
+						//LBMReal dX3_phi2 = gradX3_phi2();
+
+
+      //                  LBMReal denom2 = sqrt(dX1_phi * dX1_phi+ dX1_phi2 * dX1_phi2 + dX2_phi * dX2_phi + dX2_phi2 * dX2_phi2 + dX3_phi * dX3_phi+ dX3_phi2 * dX3_phi2) + 1e-9;
+      //                  LBMReal normX1 = (dX1_phi-dX1_phi2)/denom2;
+						//LBMReal normX2 = (dX2_phi-dX2_phi2)/denom2;
+						//LBMReal normX3 = (dX3_phi-dX3_phi2)/denom2;
+
+						LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
+						LBMReal normX1 = dX1_phi / denom;
+						LBMReal normX2 = dX2_phi / denom;
+						LBMReal normX3 = dX3_phi / denom;
+
+
+
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+
+
+                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+
+                        //----------- Calculating Macroscopic Values -------------
+                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+
+                            			   ////Incompressible Kernal
+
+						//mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)         ;// / rho * c3;
+						//mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)         ;// / rho * c3;
+						//mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)        ;// / rho * c3;
+						//mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)       ;// / rho * c3;
+						//mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)         ;// / rho * c3;
+						//mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)        ;// / rho * c3;
+						//mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)       ;// / rho * c3;
+						//mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)        ;// / rho * c3;
+						//mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)       ;// / rho * c3;
+						//mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)       ;// / rho * c3;
+						//mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)      ;// / rho * c3;
+						//mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)      ;// / rho * c3;
+						//mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3)     ;// / rho * c3;																								    
+						//mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     ;// / rho * c3;
+						//mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     ;// / rho * c3;
+						//mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     ;// / rho * c3;
+						//mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   ;// / rho * c3;
+						//mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    ;// / rho * c3;
+						//mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   ;// / rho * c3;
+						//mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    ;// / rho * c3;
+						//mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   ;// / rho * c3;
+						//mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    ;// / rho * c3;
+						//mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) ;// / rho * c3;
+						//mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  ;// / rho * c3;
+						//mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  ;// / rho * c3;
+						//mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   ;// / rho * c3;
+
+						//mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);// / rho * c3;
+
+
+			   LBMReal m0, m1, m2;
+			   LBMReal rhoRef=c1;
+
+			  //LBMReal 
+			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+				   (mfcbb - mfabb))/rhoRef;
+			   LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+				   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+				   (mfbcb - mfbab))/rhoRef;
+			   LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+				   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+				   (mfbbc - mfbba))/rhoRef;
+
+			 //  (*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3)+rho*c1o3*drho;
+
+			   //LBMReal gradPx = c1o2 * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3));
+			   //LBMReal gradPy = c1o2 * ((*pressure)(x1, x2 + 1, x3) - (*pressure)(x1, x2 - 1, x3));
+			   //LBMReal gradPz = c1o2 * ((*pressure)(x1, x2, x3 + 1) - (*pressure)(x1, x2, x3 - 1));
+
+			   LBMReal gradPx = 3.0 * (WEIGTH[TNE] * (
+				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1)))
+				   + (((*pressure)(x1 + 1, x2 - 1, x3 - 1) - (*pressure)(x1 - 1, x2 + 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				   + WEIGTH[NE] * (
+				   (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
+					   + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
+				   + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
+
+			   LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
+				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				   + (((*pressure)(x1 - 1, x2 + 1, x3 - 1) - (*pressure)(x1 + 1, x2 - 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				   + WEIGTH[NE] * (
+				   (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
+					   + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
+				   + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
+
+			   LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
+				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				   + (((*pressure)(x1 - 1, x2 - 1, x3 + 1) - (*pressure)(x1 + 1, x2 + 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1))))
+				   + WEIGTH[NE] * (
+				   (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
+					   + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
+				   + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
+
+
+			   //3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+			   //+WEIGTH[N] * (phi2[T] - phi2[B]));
+
+			   if (withForcing) {
+				   // muX1 = static_cast<double>(x1-1+ix1*maxX1);
+				   // muX2 = static_cast<double>(x2-1+ix2*maxX2);
+				   // muX3 = static_cast<double>(x3-1+ix3*maxX3);
+
+				   forcingX1 = muForcingX1.Eval()-gradPx/rho;
+				   forcingX2 = muForcingX2.Eval()-gradPy/rho;
+				   forcingX3 = muForcingX3.Eval()-gradPz/rho;
+
+				   //LBMReal rho_m = 1.0 / densityRatio;
+				   //forcingX1 = forcingX1 * (rho - rho_m);
+				   //forcingX2 = forcingX2 * (rho - rho_m);
+				   //forcingX3 = forcingX3 * (rho - rho_m);
+				   vvx += forcingX1 * deltaT * 0.5; // X
+				   vvy += forcingX2 * deltaT * 0.5; // Y
+				   vvz += forcingX3 * deltaT * 0.5; // Z
+
+			   }
+
+
+			   ///surface tension force
+			   vvx += mu * dX1_phi*c1o2;
+			   vvy += mu * dX2_phi * c1o2 ;
+			   vvz += mu * dX3_phi * c1o2;
+
+			   //////classic source term
+			   ///----Classic source term 8.4.2021
+
+			   //LBMReal vvxF, vvyF, vvzF;
+			   //vvxF = vvx;//-2*c1o24 * lap_vx;// 
+			   //vvyF = vvy;//-2*c1o24 * lap_vy;// 
+			   //vvzF = vvz;//-2*c1o24 * lap_vz;// 
+
+//			   vvxF = 1.2* vvx- 0.2*0.5 * ((*velocityX)(x1 - 1, x2, x3) + (*velocityX)(x1 + 1, x2, x3));
+//			   vvyF = 1.2 *vvy- 0.2*0.5* ((*velocityY)(x1 , x2-1, x3) + (*velocityY)(x1 , x2+1, x3));
+//			   vvzF = 1.2 *vvz-0.2*0.5* ((*velocityZ)(x1 , x2, x3-1) + (*velocityZ)(x1 , x2, x3+1));
+			   //if (vvxF != vvx) {
+				  // vvxF = vvxF;
+			   //}
+			   //LBMReal weightGrad = 1.0;// -denom * denom / (denom * denom + 0.0001 * 0.001);
+			   //LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
+			   //LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
+			   //LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+
+			   //dX1_phiF *= 1.2;
+			   //dX2_phiF *= 1.2;
+			   //dX3_phiF *= 1.2;
+
+			   //LBMReal gradFD = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi);
+			   //LBMReal gradPhi = (1.0 - phi[REST]) * (phi[REST]);
+			   //gradPhi = (gradPhi > gradFD) ? gradPhi : gradFD;
+			   //dX1_phiF = gradPhi * normX1;
+				  // dX2_phiF = gradPhi * normX2;
+				  // dX3_phiF = gradPhi * normX3;
+
+			   //LBMReal ux2;
+			   //LBMReal uy2;
+			   //LBMReal uz2;
+			   //ux2 = vvxF * vvxF;
+			   //uy2 = vvyF * vvyF;
+			   //uz2 = vvzF * vvzF;
+			   //LBMReal forcingTerm[D3Q27System::ENDF + 1];
+			   //for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+				  // LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
+				  // LBMReal velSq1 = velProd * velProd;
+				  // LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
+
+				  // //LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
+
+				  // //forcingTerm[dir] =
+					 // // (-vvxF) * (fac1 * dX1_phiF) +
+					 // // (-vvyF) * (fac1 * dX2_phiF) +
+					 // // (-vvzF) * (fac1 * dX3_phiF) +
+					 // // (DX1[dir]) * (fac1 * dX1_phiF) +
+					 // // (DX2[dir]) * (fac1 * dX2_phiF) +
+					 // // (DX3[dir]) * (fac1 * dX3_phiF);
+
+
+				  // //LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 ;
+
+				  // //forcingTerm[dir] =
+					 // // (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL)) +
+					 // // (DX1[dir]) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (DX2[dir]) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (DX3[dir]) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+
+
+			   //}
+
+			   //LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+			   //LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
+			   //forcingTerm[REST] =	 (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+				  // (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+				  // (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+			   ////////
+			  // LBMReal divAfterSource=
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfacb + 3.0 * (0.5 * forcingTerm[NW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcbc + 3.0 * (0.5 * forcingTerm[TE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabc + 3.0 * (0.5 * forcingTerm[TW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbcc + 3.0 * (0.5 * forcingTerm[TN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbac + 3.0 * (0.5 * forcingTerm[TS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccc + 3.0 * (0.5 * forcingTerm[TNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfacc + 3.0 * (0.5 * forcingTerm[TNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfcac + 3.0 * (0.5 * forcingTerm[TSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfaac + 3.0 * (0.5 * forcingTerm[TSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabb + 3.0 * (0.5 * forcingTerm[W]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbab + 3.0 * (0.5 * forcingTerm[S]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbba + 3.0 * (0.5 * forcingTerm[B]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaab + 3.0 * (0.5 * forcingTerm[SW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcab + 3.0 * (0.5 * forcingTerm[SE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfaba + 3.0 * (0.5 * forcingTerm[BW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcba + 3.0 * (0.5 * forcingTerm[BE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbaa + 3.0 * (0.5 * forcingTerm[BS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbca + 3.0 * (0.5 * forcingTerm[BN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaaa + 3.0 * (0.5 * forcingTerm[BSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcaa + 3.0 * (0.5 * forcingTerm[BSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaca + 3.0 * (0.5 * forcingTerm[BNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcca + 3.0 * (0.5 * forcingTerm[BNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbbb + 3.0 * (0.5 * forcingTerm[REST]) / rho)*((vvxF)*(vvxF)+(vvyF)*(vvyF)+(vvzF)*(vvzF)-1);
+
+			  // LBMReal divBeforeSource =
+				 //  (mfcbb)    * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbcb)    * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbbc)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccb)   * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfacb)   * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcbc)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabc)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbcc)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbac)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccc)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfacc)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfcac)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfaac)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabb)    * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbab)    * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbba)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaab)   * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcab)   * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfaba)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcba)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbaa)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbca)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaaa)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcaa)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaca)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcca)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbbb) * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF) * (vvzF)-1);
+			   //if (divAfterSource - divBeforeSource != 0 && phi[REST]>0.0001 && phi[REST]<0.999) {
+				  // std::cout << phi[REST]<<" "<< divAfterSource << " " << divBeforeSource <<" "<< divAfterSource/ divBeforeSource << std::endl;
+			   //}
+
+			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
+				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
+
+				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[N]	 *=scaleDiv;
+				  // forcingTerm[T]	 *=scaleDiv;
+				  // forcingTerm[NE]	 *=scaleDiv;
+				  // forcingTerm[NW]	 *=scaleDiv;
+				  // forcingTerm[TE]	 *=scaleDiv;
+				  // forcingTerm[TW]	 *=scaleDiv;
+				  // forcingTerm[TN]	 *=scaleDiv;
+				  // forcingTerm[TS]	 *=scaleDiv;
+				  // forcingTerm[TNE]	 *=scaleDiv;
+				  // forcingTerm[TNW]	 *=scaleDiv;
+				  // forcingTerm[TSE]	 *=scaleDiv;
+				  // forcingTerm[TSW]	 *=scaleDiv;
+				  // forcingTerm[W]	 *=scaleDiv;
+				  // forcingTerm[S]	 *=scaleDiv;
+				  // forcingTerm[B]	 *=scaleDiv;
+				  // forcingTerm[SW]	 *=scaleDiv;
+				  // forcingTerm[SE]	 *=scaleDiv;
+				  // forcingTerm[BW]	 *=scaleDiv;
+				  // forcingTerm[BE]	 *=scaleDiv;
+				  // forcingTerm[BS]	 *=scaleDiv;
+				  // forcingTerm[BN]	 *=scaleDiv;
+				  // forcingTerm[BSW]	 *=scaleDiv;
+				  // forcingTerm[BSE]	 *=scaleDiv;
+				  // forcingTerm[BNW]	 *=scaleDiv;
+				  // forcingTerm[BNE]	 *=scaleDiv;
+				  // forcingTerm[REST] *=scaleDiv;
+			   //}
+			   ////////
+
+
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   //mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   //mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   //mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   //mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   //mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   //mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   //mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   //mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   //mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   //mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   //mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   //mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   //mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   //mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   //mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   //mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   //mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   //mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   //mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   //mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   //mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   //mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   //mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+			   //--------------------------------------------------------
+
+
+
+
+
+			   //////end classic source term
+
+
+
+
+			   //forcing 
+			   ///////////////////////////////////////////////////////////////////////////////////////////
+			   if (withForcing)
+			   {
+				   muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
+				   muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
+				   muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
+
+				   //forcingX1 = muForcingX1.Eval();
+				   //forcingX2 = muForcingX2.Eval();
+				   //forcingX3 = muForcingX3.Eval();
+
+				   //vvx += forcingX1 * deltaT * 0.5; // X
+				   //vvy += forcingX2 * deltaT * 0.5; // Y
+				   //vvz += forcingX3 * deltaT * 0.5; // Z
+			   }
+
+			   LBMReal vx2;
+               LBMReal vy2;
+               LBMReal vz2;
+               vx2 = vvx * vvx;
+               vy2 = vvy * vvy;
+               vz2 = vvz * vvz;
+			   ///////////////////////////////////////////////////////////////////////////////////////////               
+			   LBMReal oMdrho;
+
+
+			   oMdrho = mfccc + mfaaa;
+			   m0 = mfaca + mfcac;
+			   m1 = mfacc + mfcaa;
+			   m2 = mfaac + mfcca;
+			   oMdrho += m0;
+			   m1 += m2;
+			   oMdrho += m1;
+			   m0 = mfbac + mfbca;
+			   m1 = mfbaa + mfbcc;
+			   m0 += m1;
+			   m1 = mfabc + mfcba;
+			   m2 = mfaba + mfcbc;
+			   m1 += m2;
+			   m0 += m1;
+			   m1 = mfacb + mfcab;
+			   m2 = mfaab + mfccb;
+			   m1 += m2;
+			   m0 += m1;
+			   oMdrho += m0;
+			   m0 = mfabb + mfcbb;
+			   m1 = mfbab + mfbcb;
+			   m2 = mfbba + mfbbc;
+			   m0 += m1 + m2;
+			   m0 += mfbbb; //hat gefehlt
+			   oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   LBMReal wadjust;
+			   LBMReal qudricLimit = 0.01;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //Hin
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   m2 = mfaaa + mfaac;
+			   m1 = mfaac - mfaaa;
+			   m0 = m2 + mfaab;
+			   mfaaa = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfaab = m1 - m0 * vvz;
+			   mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaba + mfabc;
+			   m1 = mfabc - mfaba;
+			   m0 = m2 + mfabb;
+			   mfaba = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfabb = m1 - m0 * vvz;
+			   mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaca + mfacc;
+			   m1 = mfacc - mfaca;
+			   m0 = m2 + mfacb;
+			   mfaca = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfacb = m1 - m0 * vvz;
+			   mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbaa + mfbac;
+			   m1 = mfbac - mfbaa;
+			   m0 = m2 + mfbab;
+			   mfbaa = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbab = m1 - m0 * vvz;
+			   mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbba + mfbbc;
+			   m1 = mfbbc - mfbba;
+			   m0 = m2 + mfbbb;
+			   mfbba = m0;
+			   m0 += c4o9 * oMdrho;
+			   mfbbb = m1 - m0 * vvz;
+			   mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbca + mfbcc;
+			   m1 = mfbcc - mfbca;
+			   m0 = m2 + mfbcb;
+			   mfbca = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbcb = m1 - m0 * vvz;
+			   mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcaa + mfcac;
+			   m1 = mfcac - mfcaa;
+			   m0 = m2 + mfcab;
+			   mfcaa = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfcab = m1 - m0 * vvz;
+			   mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcba + mfcbc;
+			   m1 = mfcbc - mfcba;
+			   m0 = m2 + mfcbb;
+			   mfcba = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfcbb = m1 - m0 * vvz;
+			   mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcca + mfccc;
+			   m1 = mfccc - mfcca;
+			   m0 = m2 + mfccb;
+			   mfcca = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfccb = m1 - m0 * vvz;
+			   mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   m2 = mfaaa + mfaca;
+			   m1 = mfaca - mfaaa;
+			   m0 = m2 + mfaba;
+			   mfaaa = m0;
+			   m0 += c1o6 * oMdrho;
+			   mfaba = m1 - m0 * vvy;
+			   mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaab + mfacb;
+			   m1 = mfacb - mfaab;
+			   m0 = m2 + mfabb;
+			   mfaab = m0;
+			   mfabb = m1 - m0 * vvy;
+			   mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaac + mfacc;
+			   m1 = mfacc - mfaac;
+			   m0 = m2 + mfabc;
+			   mfaac = m0;
+			   m0 += c1o18 * oMdrho;
+			   mfabc = m1 - m0 * vvy;
+			   mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbaa + mfbca;
+			   m1 = mfbca - mfbaa;
+			   m0 = m2 + mfbba;
+			   mfbaa = m0;
+			   m0 += c2o3 * oMdrho;
+			   mfbba = m1 - m0 * vvy;
+			   mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbab + mfbcb;
+			   m1 = mfbcb - mfbab;
+			   m0 = m2 + mfbbb;
+			   mfbab = m0;
+			   mfbbb = m1 - m0 * vvy;
+			   mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbac + mfbcc;
+			   m1 = mfbcc - mfbac;
+			   m0 = m2 + mfbbc;
+			   mfbac = m0;
+			   m0 += c2o9 * oMdrho;
+			   mfbbc = m1 - m0 * vvy;
+			   mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcaa + mfcca;
+			   m1 = mfcca - mfcaa;
+			   m0 = m2 + mfcba;
+			   mfcaa = m0;
+			   m0 += c1o6 * oMdrho;
+			   mfcba = m1 - m0 * vvy;
+			   mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcab + mfccb;
+			   m1 = mfccb - mfcab;
+			   m0 = m2 + mfcbb;
+			   mfcab = m0;
+			   mfcbb = m1 - m0 * vvy;
+			   mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcac + mfccc;
+			   m1 = mfccc - mfcac;
+			   m0 = m2 + mfcbc;
+			   mfcac = m0;
+			   m0 += c1o18 * oMdrho;
+			   mfcbc = m1 - m0 * vvy;
+			   mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   m2 = mfaaa + mfcaa;
+			   m1 = mfcaa - mfaaa;
+			   m0 = m2 + mfbaa;
+			   mfaaa = m0;
+			   m0 += 1. * oMdrho;
+			   mfbaa = m1 - m0 * vvx;
+			   mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaba + mfcba;
+			   m1 = mfcba - mfaba;
+			   m0 = m2 + mfbba;
+			   mfaba = m0;
+			   mfbba = m1 - m0 * vvx;
+			   mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaca + mfcca;
+			   m1 = mfcca - mfaca;
+			   m0 = m2 + mfbca;
+			   mfaca = m0;
+			   m0 += c1o3 * oMdrho;
+			   mfbca = m1 - m0 * vvx;
+			   mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaab + mfcab;
+			   m1 = mfcab - mfaab;
+			   m0 = m2 + mfbab;
+			   mfaab = m0;
+			   mfbab = m1 - m0 * vvx;
+			   mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfabb + mfcbb;
+			   m1 = mfcbb - mfabb;
+			   m0 = m2 + mfbbb;
+			   mfabb = m0;
+			   mfbbb = m1 - m0 * vvx;
+			   mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfacb + mfccb;
+			   m1 = mfccb - mfacb;
+			   m0 = m2 + mfbcb;
+			   mfacb = m0;
+			   mfbcb = m1 - m0 * vvx;
+			   mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaac + mfcac;
+			   m1 = mfcac - mfaac;
+			   m0 = m2 + mfbac;
+			   mfaac = m0;
+			   m0 += c1o3 * oMdrho;
+			   mfbac = m1 - m0 * vvx;
+			   mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfabc + mfcbc;
+			   m1 = mfcbc - mfabc;
+			   m0 = m2 + mfbbc;
+			   mfabc = m0;
+			   mfbbc = m1 - m0 * vvx;
+			   mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfacc + mfccc;
+			   m1 = mfccc - mfacc;
+			   m0 = m2 + mfbcc;
+			   mfacc = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbcc = m1 - m0 * vvx;
+			   mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Cumulants
+			   ////////////////////////////////////////////////////////////////////////////////////
+
+
+			  // mfaaa = 0.0;
+			   LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity
+			 //  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+			 //  LBMReal OxyyMxzz  = 1.;//2+s9;//
+			   LBMReal O4 = 1.;
+			   LBMReal O5 = 1.;
+			   LBMReal O6 = 1.;
+
+
+
+			   /////fourth order parameters; here only for test. Move out of loop!
+
+			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+
+
+			   //Cum 4.
+			   //LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+			   //LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+			   //LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+			   LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+			   LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+			   LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+			   LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+			   LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+			   LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+
+			   //Cum 5.
+			   LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+			   LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+			   LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+
+			   //Cum 6.
+			   LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+				   - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+				   - 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+				   - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+				   + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+					   + 2. * (mfcaa * mfaca * mfaac)
+					   + 16. * mfbba * mfbab * mfabb)
+				   - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+				   - c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+				   + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+
+			   //2.
+			   // linear combinations
+			   LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+				mxxPyyPzz-=mfaaa;//12.03.21 shifted by mfaaa
+			   LBMReal mxxMyy = mfcaa - mfaca;
+			   LBMReal mxxMzz = mfcaa - mfaac;
+
+			   //applying phase field gradients first part:
+			  // mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
+               // 17.03.2021 attempt for statililization by assymptotically vanishing bias
+               //LBMReal correctionScaling =
+               //    rhoToPhi / rho; // +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+			   LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+			   LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+			   LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+
+			   LBMReal Dxy = -three * collFactorM * mfbba;
+			   LBMReal Dxz = -three * collFactorM * mfbab;
+			   LBMReal Dyz = -three * collFactorM * mfabb;
+
+
+			   //relax
+			   mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+			   mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+			   mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+
+			   mfabb += collFactorM * (-mfabb);
+			   mfbab += collFactorM * (-mfbab);
+			   mfbba += collFactorM * (-mfbba);
+
+			   //applying phase field gradients second part:
+			   //mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+               ////updated pressure
+               //mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+			   mfaaa = 0.0;
+
+               mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+			   // linear combinations back
+			   mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+			   mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+			   mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+
+			   //3.
+			   // linear combinations
+			   LBMReal mxxyPyzz = mfcba + mfabc;
+			   LBMReal mxxyMyzz = mfcba - mfabc;
+
+			   LBMReal mxxzPyyz = mfcab + mfacb;
+			   LBMReal mxxzMyyz = mfcab - mfacb;
+
+			   LBMReal mxyyPxzz = mfbca + mfbac;
+			   LBMReal mxyyMxzz = mfbca - mfbac;
+
+			   //relax
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+			   mfbbb += wadjust * (-mfbbb);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+			   mxxyPyzz += wadjust * (-mxxyPyzz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+			   mxxyMyzz += wadjust * (-mxxyMyzz);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+			   mxxzPyyz += wadjust * (-mxxzPyyz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+			   mxxzMyyz += wadjust * (-mxxzMyyz);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+			   mxyyPxzz += wadjust * (-mxyyPxzz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+			   mxyyMxzz += wadjust * (-mxyyMxzz);
+
+			   // linear combinations back
+			   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+			   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+			   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+			   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+			   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+			   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+			   //4.
+			   //CUMacc += O4 * (-CUMacc);
+			   //CUMcac += O4 * (-CUMcac);
+			   //CUMcca += O4 * (-CUMcca);
+
+			   //CUMbbc += O4 * (-CUMbbc);
+			   //CUMbcb += O4 * (-CUMbcb);
+			   //CUMcbb += O4 * (-CUMcbb);
+			   CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+			   CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+			   CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+			   CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+			   CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+			   CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+
+			   //5.
+			   CUMbcc += O5 * (-CUMbcc);
+			   CUMcbc += O5 * (-CUMcbc);
+			   CUMccb += O5 * (-CUMccb);
+
+			   //6.
+			   CUMccc += O6 * (-CUMccc);
+
+			   //back cumulants to central moments
+			   //4.
+			   //mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+			   //mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+			   //mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+			   mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+			   mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+			   mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+			   mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+			   mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+			   mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+
+			   //5.
+			   mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+			   mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+			   mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+
+			   //6.
+			   mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+				   - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+				   - 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+				   - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+				   + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+					   + 2. * (mfcaa * mfaca * mfaac)
+					   + 16. * mfbba * mfbab * mfabb)
+				   - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+				   - c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+				   + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+
+
+			   ////////
+
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //forcing
+			   mfbaa = -mfbaa;
+			   mfaba = -mfaba;
+			   mfaab = -mfaab;
+			   //////////////////////////////////////////////////////////////////////////////////////
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //back
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+			   m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfaaa = m0;
+			   mfaab = m1;
+			   mfaac = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+			   m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+			   m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+			   mfaba = m0;
+			   mfabb = m1;
+			   mfabc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+			   m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfaca = m0;
+			   mfacb = m1;
+			   mfacc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+			   m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+			   m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+			   mfbaa = m0;
+			   mfbab = m1;
+			   mfbac = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+			   m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+			   m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+			   mfbba = m0;
+			   mfbbb = m1;
+			   mfbbc = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+			   m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+			   m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+			   mfbca = m0;
+			   mfbcb = m1;
+			   mfbcc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+			   m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfcaa = m0;
+			   mfcab = m1;
+			   mfcac = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+			   m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+			   m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+			   mfcba = m0;
+			   mfcbb = m1;
+			   mfcbc = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+			   m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfcca = m0;
+			   mfccb = m1;
+			   mfccc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+			   m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaaa = m0;
+			   mfaba = m1;
+			   mfaca = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+			   m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaab = m0;
+			   mfabb = m1;
+			   mfacb = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+			   m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaac = m0;
+			   mfabc = m1;
+			   mfacc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+			   m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+			   m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+			   mfbaa = m0;
+			   mfbba = m1;
+			   mfbca = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+			   m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+			   m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+			   mfbab = m0;
+			   mfbbb = m1;
+			   mfbcb = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+			   m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+			   m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+			   mfbac = m0;
+			   mfbbc = m1;
+			   mfbcc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+			   m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcaa = m0;
+			   mfcba = m1;
+			   mfcca = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+			   m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcab = m0;
+			   mfcbb = m1;
+			   mfccb = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+			   m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcac = m0;
+			   mfcbc = m1;
+			   mfccc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaaa = m0;
+			   mfbaa = m1;
+			   mfcaa = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaba = m0;
+			   mfbba = m1;
+			   mfcba = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaca = m0;
+			   mfbca = m1;
+			   mfcca = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaab = m0;
+			   mfbab = m1;
+			   mfcab = m2;
+			   ///////////b////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+			   m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfabb = m0;
+			   mfbbb = m1;
+			   mfcbb = m2;
+			   ///////////b////////////////////////////////////////////////////////////////////////
+			   m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfacb = m0;
+			   mfbcb = m1;
+			   mfccb = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaac = m0;
+			   mfbac = m1;
+			   mfcac = m2;
+			   ///////////c////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfabc = m0;
+			   mfbbc = m1;
+			   mfcbc = m2;
+			   ///////////c////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfacc = m0;
+			   mfbcc = m1;
+			   mfccc = m2;
+
+			   /////classical source term 8.4.2021
+
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   //mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   //mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   //mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   //mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   //mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   //mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   //mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   //mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   //mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   //mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   //mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   //mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   //mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   //mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   //mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   //mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   //mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   //mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   //mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   //mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   //mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   //mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   //mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+
+
+			   //////////////////////////////////////////////////////////////////////////
+			   //proof correctness
+			   //////////////////////////////////////////////////////////////////////////
+//#ifdef  PROOF_CORRECTNESS
+//			   LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+//				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+//				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+//			   //LBMReal dif = fabs(drho - rho_post);
+//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+//#ifdef SINGLEPRECISION
+//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+//#else
+//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+//#endif
+//			   {
+//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+//					   + " dif=" + UbSystem::toString(dif)
+//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+//				   //exit(EXIT_FAILURE);
+//			   }
+//#endif
+			   //////////////////////////////////////////////////////////////////////////
+			   //write distribution
+			   //////////////////////////////////////////////////////////////////////////
+			   (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa      ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca      ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc  ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac  ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
+
+			   (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+			   //////////////////////////////////////////////////////////////////////////
+
+			   ////!Incompressible Kernal
+
+                            
+//                            ///////Old Kernel \|/
+//                            // ux += forcingX1*deltaT*0.5; // X
+//                            // uy += forcingX2*deltaT*0.5; // Y
+//                            // uz += forcingX3*deltaT*0.5; // Z
+//                        }
+//
+//                        LBMReal ux = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//                                      (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//                                      (mfcbb - mfabb)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX1_phi + forcingX1) / (2 * rho);
+//
+//                        LBMReal uy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//                                      (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//                                      (mfbcb - mfbab)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX2_phi + forcingX2) / (2 * rho);
+//
+//                        LBMReal uz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//                                      (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//                                      (mfbbc - mfbba)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX3_phi + forcingX3) / (2 * rho);
+//
+//                        //--------------------------------------------------------
+//
+//                        LBMReal ux2 = ux * ux;
+//                        LBMReal uy2 = uy * uy;
+//                        LBMReal uz2 = uz * uz;
+//
+//                        //----------- Calculating Forcing Terms * -------------
+//                        for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+//                            LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
+//                            LBMReal velSq1  = velProd * velProd;
+//                            LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2));
+//
+//                            LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
+//
+//                            forcingTerm[dir] = ((-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                                (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                                (-uz) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3))) +
+//                                               (DX1[dir]) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                               (DX2[dir]) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                               (DX3[dir]) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
+//                        }
+//
+//                        LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+//                        LBMReal fac1      = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
+//                        forcingTerm[REST] = (-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                            (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                            (-uz) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
+//
+//                        //--------------------------------------------------------
+//
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+//                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+//                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+//                        mfacb = 3.0 * (mfacb + 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+//                        mfcbc = 3.0 * (mfcbc + 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+//                        mfabc = 3.0 * (mfabc + 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+//                        mfbcc = 3.0 * (mfbcc + 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+//                        mfbac = 3.0 * (mfbac + 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+//                        mfccc = 3.0 * (mfccc + 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+//                        mfacc = 3.0 * (mfacc + 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+//                        mfcac = 3.0 * (mfcac + 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+//                        mfaac = 3.0 * (mfaac + 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+//                        mfabb = 3.0 * (mfabb + 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+//                        mfbab = 3.0 * (mfbab + 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+//                        mfbba = 3.0 * (mfbba + 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+//                        mfaab = 3.0 * (mfaab + 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+//                        mfcab = 3.0 * (mfcab + 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+//                        mfaba = 3.0 * (mfaba + 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+//                        mfcba = 3.0 * (mfcba + 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+//                        mfbaa = 3.0 * (mfbaa + 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+//                        mfbca = 3.0 * (mfbca + 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+//                        mfaaa = 3.0 * (mfaaa + 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+//                        mfcaa = 3.0 * (mfcaa + 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+//                        mfaca = 3.0 * (mfaca + 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+//                        mfcca = 3.0 * (mfcca + 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+//                        mfbbb = 3.0 * (mfbbb + 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST];
+//
+//                        LBMReal rho1 = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+//                                       (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+//                                       (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) +
+//                                       (mfbba + mfbbc) + mfbbb;
+//
+//
+//                        LBMReal oMdrho, m0, m1, m2;
+//
+//                        oMdrho = mfccc + mfaaa;
+//                        m0     = mfaca + mfcac;
+//                        m1     = mfacc + mfcaa;
+//                        m2     = mfaac + mfcca;
+//                        oMdrho += m0;
+//                        m1 += m2;
+//                        oMdrho += m1;
+//                        m0 = mfbac + mfbca;
+//                        m1 = mfbaa + mfbcc;
+//                        m0 += m1;
+//                        m1 = mfabc + mfcba;
+//                        m2 = mfaba + mfcbc;
+//                        m1 += m2;
+//                        m0 += m1;
+//                        m1 = mfacb + mfcab;
+//                        m2 = mfaab + mfccb;
+//                        m1 += m2;
+//                        m0 += m1;
+//                        oMdrho += m0;
+//                        m0 = mfabb + mfcbb;
+//                        m1 = mfbab + mfbcb;
+//                        m2 = mfbba + mfbbc;
+//                        m0 += m1 + m2;
+//                        m0 += mfbbb; // hat gefehlt
+//                        oMdrho = 1. - (oMdrho + m0);
+//                        // oMdrho = rho - (oMdrho + m0);
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        LBMReal wadjust;
+//                        LBMReal qudricLimit = 0.01;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Hin
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Z - Dir
+//                        m2    = mfaaa + mfaac;
+//                        m1    = mfaac - mfaaa;
+//                        m0    = m2 + mfaab;
+//                        mfaaa = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfaab = m1 - m0 * uz;
+//                        mfaac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaba + mfabc;
+//                        m1    = mfabc - mfaba;
+//                        m0    = m2 + mfabb;
+//                        mfaba = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfabb = m1 - m0 * uz;
+//                        mfabc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaca + mfacc;
+//                        m1    = mfacc - mfaca;
+//                        m0    = m2 + mfacb;
+//                        mfaca = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfacb = m1 - m0 * uz;
+//                        mfacc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbaa + mfbac;
+//                        m1    = mfbac - mfbaa;
+//                        m0    = m2 + mfbab;
+//                        mfbaa = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbab = m1 - m0 * uz;
+//                        mfbac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbba + mfbbc;
+//                        m1    = mfbbc - mfbba;
+//                        m0    = m2 + mfbbb;
+//                        mfbba = m0;
+//                        m0 += c4o9 * oMdrho;
+//                        mfbbb = m1 - m0 * uz;
+//                        mfbbc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbca + mfbcc;
+//                        m1    = mfbcc - mfbca;
+//                        m0    = m2 + mfbcb;
+//                        mfbca = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbcb = m1 - m0 * uz;
+//                        mfbcc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcaa + mfcac;
+//                        m1    = mfcac - mfcaa;
+//                        m0    = m2 + mfcab;
+//                        mfcaa = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfcab = m1 - m0 * uz;
+//                        mfcac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcba + mfcbc;
+//                        m1    = mfcbc - mfcba;
+//                        m0    = m2 + mfcbb;
+//                        mfcba = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfcbb = m1 - m0 * uz;
+//                        mfcbc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcca + mfccc;
+//                        m1    = mfccc - mfcca;
+//                        m0    = m2 + mfccb;
+//                        mfcca = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfccb = m1 - m0 * uz;
+//                        mfccc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Y - Dir
+//                        m2    = mfaaa + mfaca;
+//                        m1    = mfaca - mfaaa;
+//                        m0    = m2 + mfaba;
+//                        mfaaa = m0;
+//                        m0 += c1o6 * oMdrho;
+//                        mfaba = m1 - m0 * uy;
+//                        mfaca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaab + mfacb;
+//                        m1    = mfacb - mfaab;
+//                        m0    = m2 + mfabb;
+//                        mfaab = m0;
+//                        mfabb = m1 - m0 * uy;
+//                        mfacb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaac + mfacc;
+//                        m1    = mfacc - mfaac;
+//                        m0    = m2 + mfabc;
+//                        mfaac = m0;
+//                        m0 += c1o18 * oMdrho;
+//                        mfabc = m1 - m0 * uy;
+//                        mfacc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbaa + mfbca;
+//                        m1    = mfbca - mfbaa;
+//                        m0    = m2 + mfbba;
+//                        mfbaa = m0;
+//                        m0 += c2o3 * oMdrho;
+//                        mfbba = m1 - m0 * uy;
+//                        mfbca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbab + mfbcb;
+//                        m1    = mfbcb - mfbab;
+//                        m0    = m2 + mfbbb;
+//                        mfbab = m0;
+//                        mfbbb = m1 - m0 * uy;
+//                        mfbcb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbac + mfbcc;
+//                        m1    = mfbcc - mfbac;
+//                        m0    = m2 + mfbbc;
+//                        mfbac = m0;
+//                        m0 += c2o9 * oMdrho;
+//                        mfbbc = m1 - m0 * uy;
+//                        mfbcc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcaa + mfcca;
+//                        m1    = mfcca - mfcaa;
+//                        m0    = m2 + mfcba;
+//                        mfcaa = m0;
+//                        m0 += c1o6 * oMdrho;
+//                        mfcba = m1 - m0 * uy;
+//                        mfcca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcab + mfccb;
+//                        m1    = mfccb - mfcab;
+//                        m0    = m2 + mfcbb;
+//                        mfcab = m0;
+//                        mfcbb = m1 - m0 * uy;
+//                        mfccb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcac + mfccc;
+//                        m1    = mfccc - mfcac;
+//                        m0    = m2 + mfcbc;
+//                        mfcac = m0;
+//                        m0 += c1o18 * oMdrho;
+//                        mfcbc = m1 - m0 * uy;
+//                        mfccc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // X - Dir
+//                        m2    = mfaaa + mfcaa;
+//                        m1    = mfcaa - mfaaa;
+//                        m0    = m2 + mfbaa;
+//                        mfaaa = m0;
+//                        m0 += 1. * oMdrho;
+//                        mfbaa = m1 - m0 * ux;
+//                        mfcaa = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaba + mfcba;
+//                        m1    = mfcba - mfaba;
+//                        m0    = m2 + mfbba;
+//                        mfaba = m0;
+//                        mfbba = m1 - m0 * ux;
+//                        mfcba = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaca + mfcca;
+//                        m1    = mfcca - mfaca;
+//                        m0    = m2 + mfbca;
+//                        mfaca = m0;
+//                        m0 += c1o3 * oMdrho;
+//                        mfbca = m1 - m0 * ux;
+//                        mfcca = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaab + mfcab;
+//                        m1    = mfcab - mfaab;
+//                        m0    = m2 + mfbab;
+//                        mfaab = m0;
+//                        mfbab = m1 - m0 * ux;
+//                        mfcab = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfabb + mfcbb;
+//                        m1    = mfcbb - mfabb;
+//                        m0    = m2 + mfbbb;
+//                        mfabb = m0;
+//                        mfbbb = m1 - m0 * ux;
+//                        mfcbb = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfacb + mfccb;
+//                        m1    = mfccb - mfacb;
+//                        m0    = m2 + mfbcb;
+//                        mfacb = m0;
+//                        mfbcb = m1 - m0 * ux;
+//                        mfccb = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaac + mfcac;
+//                        m1    = mfcac - mfaac;
+//                        m0    = m2 + mfbac;
+//                        mfaac = m0;
+//                        m0 += c1o3 * oMdrho;
+//                        mfbac = m1 - m0 * ux;
+//                        mfcac = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfabc + mfcbc;
+//                        m1    = mfcbc - mfabc;
+//                        m0    = m2 + mfbbc;
+//                        mfabc = m0;
+//                        mfbbc = m1 - m0 * ux;
+//                        mfcbc = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfacc + mfccc;
+//                        m1    = mfccc - mfacc;
+//                        m0    = m2 + mfbcc;
+//                        mfacc = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbcc = m1 - m0 * ux;
+//                        mfccc = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Cumulants
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        LBMReal OxxPyyPzz = 1.; // omega2 or bulk viscosity
+//                        LBMReal OxyyPxzz  = 1.; //-s9;//2+s9;//
+//                        LBMReal OxyyMxzz  = 1.; // 2+s9;//
+//                        LBMReal O4        = 1.;
+//                        LBMReal O5        = 1.;
+//                        LBMReal O6        = 1.;
+//
+//                        // Cum 4.
+//                        LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//                        LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//                        LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//                        LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) +
+//                                                  c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//                        LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) +
+//                                                  c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//                        LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) +
+//                                                  c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//
+//                        // Cum 5.
+//                        LBMReal CUMbcc = mfbcc -
+//                                         (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb +
+//                                          2. * (mfbab * mfacb + mfbba * mfabc)) -
+//                                         c1o3 * (mfbca + mfbac) * oMdrho;
+//                        LBMReal CUMcbc = mfcbc -
+//                                         (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb +
+//                                          2. * (mfabb * mfcab + mfbba * mfbac)) -
+//                                         c1o3 * (mfcba + mfabc) * oMdrho;
+//                        LBMReal CUMccb = mfccb -
+//                                         (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb +
+//                                          2. * (mfbab * mfbca + mfabb * mfcba)) -
+//                                         c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//                        // Cum 6.
+//                        LBMReal CUMccc =
+//                            mfccc +
+//                            ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+//                              4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) -
+//                              2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) +
+//                             (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+//                              2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) -
+//                             c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho -
+//                             c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) -
+//                             c1o27 * oMdrho * oMdrho * (-2. * oMdrho) +
+//                             (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+//                              (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) *
+//                                 c2o3 * oMdrho) +
+//                            c1o27 * oMdrho;
+//
+//                        // 2.
+//                        // linear combinations
+//                        LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+//                        LBMReal mxxMyy    = mfcaa - mfaca;
+//                        LBMReal mxxMzz    = mfcaa - mfaac;
+//
+//                        LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz);
+//                        LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy;
+//                        LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz;
+//
+//                        (*divU)(x1, x2, x3) = dxux + dyuy + dzuz;
+//
+//                        // relax
+//                        mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) -
+//                                     3. * (1. - c1o2 * OxxPyyPzz) * (ux2 * dxux + uy2 * dyuy + uz2 * dzuz);
+//                        mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (ux2 * dxux - uy2 * dyuy);
+//                        mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (ux2 * dxux - uz2 * dzuz);
+//
+//                        mfabb += collFactorM * (-mfabb);
+//                        mfbab += collFactorM * (-mfbab);
+//                        mfbba += collFactorM * (-mfbba);
+//
+//                        // linear combinations back
+//                        mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+//                        mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+//                        mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+//
+//                        // 3.
+//                        // linear combinations
+//                        LBMReal mxxyPyzz = mfcba + mfabc;
+//                        LBMReal mxxyMyzz = mfcba - mfabc;
+//
+//                        LBMReal mxxzPyyz = mfcab + mfacb;
+//                        LBMReal mxxzMyyz = mfcab - mfacb;
+//
+//                        LBMReal mxyyPxzz = mfbca + mfbac;
+//                        LBMReal mxyyMxzz = mfbca - mfbac;
+//
+//                        // relax
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+//                        mfbbb += wadjust * (-mfbbb);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+//                        mxxyPyzz += wadjust * (-mxxyPyzz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+//                        mxxyMyzz += wadjust * (-mxxyMyzz);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+//                        mxxzPyyz += wadjust * (-mxxzPyyz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+//                        mxxzMyyz += wadjust * (-mxxzMyyz);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+//                        mxyyPxzz += wadjust * (-mxyyPxzz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+//                        mxyyMxzz += wadjust * (-mxyyMxzz);
+//
+//                        // linear combinations back
+//                        mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+//                        mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+//                        mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+//                        mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+//                        mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+//                        mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+//
+//                        // 4.
+//                        CUMacc += O4 * (-CUMacc);
+//                        CUMcac += O4 * (-CUMcac);
+//                        CUMcca += O4 * (-CUMcca);
+//
+//                        CUMbbc += O4 * (-CUMbbc);
+//                        CUMbcb += O4 * (-CUMbcb);
+//                        CUMcbb += O4 * (-CUMcbb);
+//
+//                        // 5.
+//                        CUMbcc += O5 * (-CUMbcc);
+//                        CUMcbc += O5 * (-CUMcbc);
+//                        CUMccb += O5 * (-CUMccb);
+//
+//                        // 6.
+//                        CUMccc += O6 * (-CUMccc);
+//
+//                        // back cumulants to central moments
+//                        // 4.
+//                        mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//                        mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//                        mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//                        mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//                        mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//                        mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//
+//                        // 5.
+//                        mfbcc = CUMbcc +
+//                                (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb +
+//                                 2. * (mfbab * mfacb + mfbba * mfabc)) +
+//                                c1o3 * (mfbca + mfbac) * oMdrho;
+//                        mfcbc = CUMcbc +
+//                                (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb +
+//                                 2. * (mfabb * mfcab + mfbba * mfbac)) +
+//                                c1o3 * (mfcba + mfabc) * oMdrho;
+//                        mfccb = CUMccb +
+//                                (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb +
+//                                 2. * (mfbab * mfbca + mfabb * mfcba)) +
+//                                c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//                        // 6.
+//                        mfccc = CUMccc -
+//                                ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+//                                  4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) -
+//                                  2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) +
+//                                 (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+//                                  2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) -
+//                                 c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho -
+//                                 c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) -
+//                                 c1o27 * oMdrho * oMdrho * (-2. * oMdrho) +
+//                                 (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+//                                  (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) *
+//                                     c2o3 * oMdrho) -
+//                                c1o27 * oMdrho;
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // forcing
+//                        mfbaa = -mfbaa;
+//                        mfaba = -mfaba;
+//                        mfaab = -mfaab;
+//                        //////////////////////////////////////////////////////////////////////////////////////
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // back
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Z - Dir
+//                        m0    = mfaac * c1o2 + mfaab * (uz - c1o2) + (mfaaa + 1. * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfaac - 2. * mfaab * uz + mfaaa * (1. - uz2) - 1. * oMdrho * uz2;
+//                        m2    = mfaac * c1o2 + mfaab * (uz + c1o2) + (mfaaa + 1. * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfaaa = m0;
+//                        mfaab = m1;
+//                        mfaac = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfabc * c1o2 + mfabb * (uz - c1o2) + mfaba * (uz2 - uz) * c1o2;
+//                        m1    = -mfabc - 2. * mfabb * uz + mfaba * (1. - uz2);
+//                        m2    = mfabc * c1o2 + mfabb * (uz + c1o2) + mfaba * (uz2 + uz) * c1o2;
+//                        mfaba = m0;
+//                        mfabb = m1;
+//                        mfabc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacc * c1o2 + mfacb * (uz - c1o2) + (mfaca + c1o3 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfacc - 2. * mfacb * uz + mfaca * (1. - uz2) - c1o3 * oMdrho * uz2;
+//                        m2    = mfacc * c1o2 + mfacb * (uz + c1o2) + (mfaca + c1o3 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfaca = m0;
+//                        mfacb = m1;
+//                        mfacc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbac * c1o2 + mfbab * (uz - c1o2) + mfbaa * (uz2 - uz) * c1o2;
+//                        m1    = -mfbac - 2. * mfbab * uz + mfbaa * (1. - uz2);
+//                        m2    = mfbac * c1o2 + mfbab * (uz + c1o2) + mfbaa * (uz2 + uz) * c1o2;
+//                        mfbaa = m0;
+//                        mfbab = m1;
+//                        mfbac = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbbc * c1o2 + mfbbb * (uz - c1o2) + mfbba * (uz2 - uz) * c1o2;
+//                        m1    = -mfbbc - 2. * mfbbb * uz + mfbba * (1. - uz2);
+//                        m2    = mfbbc * c1o2 + mfbbb * (uz + c1o2) + mfbba * (uz2 + uz) * c1o2;
+//                        mfbba = m0;
+//                        mfbbb = m1;
+//                        mfbbc = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcc * c1o2 + mfbcb * (uz - c1o2) + mfbca * (uz2 - uz) * c1o2;
+//                        m1    = -mfbcc - 2. * mfbcb * uz + mfbca * (1. - uz2);
+//                        m2    = mfbcc * c1o2 + mfbcb * (uz + c1o2) + mfbca * (uz2 + uz) * c1o2;
+//                        mfbca = m0;
+//                        mfbcb = m1;
+//                        mfbcc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcac * c1o2 + mfcab * (uz - c1o2) + (mfcaa + c1o3 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfcac - 2. * mfcab * uz + mfcaa * (1. - uz2) - c1o3 * oMdrho * uz2;
+//                        m2    = mfcac * c1o2 + mfcab * (uz + c1o2) + (mfcaa + c1o3 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfcaa = m0;
+//                        mfcab = m1;
+//                        mfcac = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbc * c1o2 + mfcbb * (uz - c1o2) + mfcba * (uz2 - uz) * c1o2;
+//                        m1    = -mfcbc - 2. * mfcbb * uz + mfcba * (1. - uz2);
+//                        m2    = mfcbc * c1o2 + mfcbb * (uz + c1o2) + mfcba * (uz2 + uz) * c1o2;
+//                        mfcba = m0;
+//                        mfcbb = m1;
+//                        mfcbc = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfccb * (uz - c1o2) + (mfcca + c1o9 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfccc - 2. * mfccb * uz + mfcca * (1. - uz2) - c1o9 * oMdrho * uz2;
+//                        m2    = mfccc * c1o2 + mfccb * (uz + c1o2) + (mfcca + c1o9 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfcca = m0;
+//                        mfccb = m1;
+//                        mfccc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Y - Dir
+//                        m0    = mfaca * c1o2 + mfaba * (uy - c1o2) + (mfaaa + c1o6 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfaca - 2. * mfaba * uy + mfaaa * (1. - uy2) - c1o6 * oMdrho * uy2;
+//                        m2    = mfaca * c1o2 + mfaba * (uy + c1o2) + (mfaaa + c1o6 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaaa = m0;
+//                        mfaba = m1;
+//                        mfaca = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacb * c1o2 + mfabb * (uy - c1o2) + (mfaab + c2o3 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfacb - 2. * mfabb * uy + mfaab * (1. - uy2) - c2o3 * oMdrho * uy2;
+//                        m2    = mfacb * c1o2 + mfabb * (uy + c1o2) + (mfaab + c2o3 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaab = m0;
+//                        mfabb = m1;
+//                        mfacb = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacc * c1o2 + mfabc * (uy - c1o2) + (mfaac + c1o6 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfacc - 2. * mfabc * uy + mfaac * (1. - uy2) - c1o6 * oMdrho * uy2;
+//                        m2    = mfacc * c1o2 + mfabc * (uy + c1o2) + (mfaac + c1o6 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaac = m0;
+//                        mfabc = m1;
+//                        mfacc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbca * c1o2 + mfbba * (uy - c1o2) + mfbaa * (uy2 - uy) * c1o2;
+//                        m1    = -mfbca - 2. * mfbba * uy + mfbaa * (1. - uy2);
+//                        m2    = mfbca * c1o2 + mfbba * (uy + c1o2) + mfbaa * (uy2 + uy) * c1o2;
+//                        mfbaa = m0;
+//                        mfbba = m1;
+//                        mfbca = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcb * c1o2 + mfbbb * (uy - c1o2) + mfbab * (uy2 - uy) * c1o2;
+//                        m1    = -mfbcb - 2. * mfbbb * uy + mfbab * (1. - uy2);
+//                        m2    = mfbcb * c1o2 + mfbbb * (uy + c1o2) + mfbab * (uy2 + uy) * c1o2;
+//                        mfbab = m0;
+//                        mfbbb = m1;
+//                        mfbcb = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcc * c1o2 + mfbbc * (uy - c1o2) + mfbac * (uy2 - uy) * c1o2;
+//                        m1    = -mfbcc - 2. * mfbbc * uy + mfbac * (1. - uy2);
+//                        m2    = mfbcc * c1o2 + mfbbc * (uy + c1o2) + mfbac * (uy2 + uy) * c1o2;
+//                        mfbac = m0;
+//                        mfbbc = m1;
+//                        mfbcc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcca * c1o2 + mfcba * (uy - c1o2) + (mfcaa + c1o18 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfcca - 2. * mfcba * uy + mfcaa * (1. - uy2) - c1o18 * oMdrho * uy2;
+//                        m2    = mfcca * c1o2 + mfcba * (uy + c1o2) + (mfcaa + c1o18 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcaa = m0;
+//                        mfcba = m1;
+//                        mfcca = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccb * c1o2 + mfcbb * (uy - c1o2) + (mfcab + c2o9 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfccb - 2. * mfcbb * uy + mfcab * (1. - uy2) - c2o9 * oMdrho * uy2;
+//                        m2    = mfccb * c1o2 + mfcbb * (uy + c1o2) + (mfcab + c2o9 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcab = m0;
+//                        mfcbb = m1;
+//                        mfccb = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfcbc * (uy - c1o2) + (mfcac + c1o18 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfccc - 2. * mfcbc * uy + mfcac * (1. - uy2) - c1o18 * oMdrho * uy2;
+//                        m2    = mfccc * c1o2 + mfcbc * (uy + c1o2) + (mfcac + c1o18 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcac = m0;
+//                        mfcbc = m1;
+//                        mfccc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // X - Dir
+//                        m0    = mfcaa * c1o2 + mfbaa * (ux - c1o2) + (mfaaa + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcaa - 2. * mfbaa * ux + mfaaa * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcaa * c1o2 + mfbaa * (ux + c1o2) + (mfaaa + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaaa = m0;
+//                        mfbaa = m1;
+//                        mfcaa = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcba * c1o2 + mfbba * (ux - c1o2) + (mfaba + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcba - 2. * mfbba * ux + mfaba * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcba * c1o2 + mfbba * (ux + c1o2) + (mfaba + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaba = m0;
+//                        mfbba = m1;
+//                        mfcba = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcca * c1o2 + mfbca * (ux - c1o2) + (mfaca + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcca - 2. * mfbca * ux + mfaca * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcca * c1o2 + mfbca * (ux + c1o2) + (mfaca + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaca = m0;
+//                        mfbca = m1;
+//                        mfcca = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcab * c1o2 + mfbab * (ux - c1o2) + (mfaab + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcab - 2. * mfbab * ux + mfaab * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcab * c1o2 + mfbab * (ux + c1o2) + (mfaab + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaab = m0;
+//                        mfbab = m1;
+//                        mfcab = m2;
+//                        ///////////b////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbb * c1o2 + mfbbb * (ux - c1o2) + (mfabb + c4o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcbb - 2. * mfbbb * ux + mfabb * (1. - ux2) - c4o9 * oMdrho * ux2;
+//                        m2    = mfcbb * c1o2 + mfbbb * (ux + c1o2) + (mfabb + c4o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfabb = m0;
+//                        mfbbb = m1;
+//                        mfcbb = m2;
+//                        ///////////b////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccb * c1o2 + mfbcb * (ux - c1o2) + (mfacb + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfccb - 2. * mfbcb * ux + mfacb * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfccb * c1o2 + mfbcb * (ux + c1o2) + (mfacb + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfacb = m0;
+//                        mfbcb = m1;
+//                        mfccb = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcac * c1o2 + mfbac * (ux - c1o2) + (mfaac + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcac - 2. * mfbac * ux + mfaac * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcac * c1o2 + mfbac * (ux + c1o2) + (mfaac + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaac = m0;
+//                        mfbac = m1;
+//                        mfcac = m2;
+//                        ///////////c////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbc * c1o2 + mfbbc * (ux - c1o2) + (mfabc + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcbc - 2. * mfbbc * ux + mfabc * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcbc * c1o2 + mfbbc * (ux + c1o2) + (mfabc + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfabc = m0;
+//                        mfbbc = m1;
+//                        mfcbc = m2;
+//                        ///////////c////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfbcc * (ux - c1o2) + (mfacc + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfccc - 2. * mfbcc * ux + mfacc * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfccc * c1o2 + mfbcc * (ux + c1o2) + (mfacc + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfacc = m0;
+//                        mfbcc = m1;
+//                        mfccc = m2;
+//
+//                        ///////////////////////////////////////////////////////////////////////////
+//
+//                        //////////////////////////////////////////////////////////////////////////
+//                        // proof correctness
+//                        //////////////////////////////////////////////////////////////////////////
+//#ifdef PROOF_CORRECTNESS
+//                        LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+//                                           (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+//                                           (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) +
+//                                           (mfbba + mfbbc) + mfbbb;
+//
+//                        LBMReal dif = rho1 - rho_post;
+//#ifdef SINGLEPRECISION
+//                        if (dif > 10.0E-7 || dif < -10.0E-7)
+//#else
+//                        if (dif > 10.0E-15 || dif < -10.0E-15)
+//#endif
+//                        {
+//                            UB_THROW(UbException(UB_EXARGS,
+//                                                 "rho=" + UbSystem::toString(rho) + ", rho_post=" +
+//                                                     UbSystem::toString(rho_post) + " dif=" + UbSystem::toString(dif) +
+//                                                     " rho is not correct for node " + UbSystem::toString(x1) + "," +
+//                                                     UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//                        }
+//#endif
+//
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
+//                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
+//                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
+//                        mfacb = rho * c1o3 * (mfacb) + 0.5 * forcingTerm[NW];
+//                        mfcbc = rho * c1o3 * (mfcbc) + 0.5 * forcingTerm[TE];
+//                        mfabc = rho * c1o3 * (mfabc) + 0.5 * forcingTerm[TW];
+//                        mfbcc = rho * c1o3 * (mfbcc) + 0.5 * forcingTerm[TN];
+//                        mfbac = rho * c1o3 * (mfbac) + 0.5 * forcingTerm[TS];
+//                        mfccc = rho * c1o3 * (mfccc) + 0.5 * forcingTerm[TNE];
+//                        mfacc = rho * c1o3 * (mfacc) + 0.5 * forcingTerm[TNW];
+//                        mfcac = rho * c1o3 * (mfcac) + 0.5 * forcingTerm[TSE];
+//                        mfaac = rho * c1o3 * (mfaac) + 0.5 * forcingTerm[TSW];
+//                        mfabb = rho * c1o3 * (mfabb) + 0.5 * forcingTerm[W];
+//                        mfbab = rho * c1o3 * (mfbab) + 0.5 * forcingTerm[S];
+//                        mfbba = rho * c1o3 * (mfbba) + 0.5 * forcingTerm[B];
+//                        mfaab = rho * c1o3 * (mfaab) + 0.5 * forcingTerm[SW];
+//                        mfcab = rho * c1o3 * (mfcab) + 0.5 * forcingTerm[SE];
+//                        mfaba = rho * c1o3 * (mfaba) + 0.5 * forcingTerm[BW];
+//                        mfcba = rho * c1o3 * (mfcba) + 0.5 * forcingTerm[BE];
+//                        mfbaa = rho * c1o3 * (mfbaa) + 0.5 * forcingTerm[BS];
+//                        mfbca = rho * c1o3 * (mfbca) + 0.5 * forcingTerm[BN];
+//                        mfaaa = rho * c1o3 * (mfaaa) + 0.5 * forcingTerm[BSW];
+//                        mfcaa = rho * c1o3 * (mfcaa) + 0.5 * forcingTerm[BSE];
+//                        mfaca = rho * c1o3 * (mfaca) + 0.5 * forcingTerm[BNW];
+//                        mfcca = rho * c1o3 * (mfcca) + 0.5 * forcingTerm[BNE];
+//                        mfbbb = rho * c1o3 * (mfbbb) + 0.5 * forcingTerm[REST];
+//
+//                        //////////////////////////////////////////////////////////////////////////
+//                        // write distribution for F
+//                        //////////////////////////////////////////////////////////////////////////
+//
+//                        (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)     = mfabb;
+//                        (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)     = mfbab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)     = mfbba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)    = mfaab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)   = mfcab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)    = mfaba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)   = mfcba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)    = mfbaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)   = mfbca;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)   = mfaaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)  = mfcaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)  = mfaca;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+//
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     = mfcbb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     = mfbcb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     = mfbbc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfccb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    = mfacb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfcbc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    = mfabc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfbcc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    = mfbac;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfacc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfcac;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfaac;
+//
+//                        (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;
+// !Old Kernel
+                        /////////////////////  P H A S E - F I E L D   S O L V E R
+                        ////////////////////////////////////////////
+		/////CUMULANT PHASE-FIELD
+				LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+				{
+			   mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+			   mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+			   mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+			   mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+			   mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+			   mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+			   mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+			   mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+			   mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+			   mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+			   mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+			   mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+			   mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+			   mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+			   mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+			   mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+			   mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+			   mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+			   mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+			   mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+			   mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+			   mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+			   mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+			   mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+			   mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+			   mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+			   mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+
+
+					////////////////////////////////////////////////////////////////////////////////////
+		//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//!
+		////////////////////////////////////////////////////////////////////////////////////
+		// fluid component
+			   //LBMReal drhoFluid =
+				  // ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) +
+				  // (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) +
+					 //  ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb;
+
+			   //LBMReal rhoFluid = c1 + drhoFluid;
+			   //LBMReal OOrhoFluid = c1 / rhoFluid;
+
+
+			   //LBMReal vvx =
+				  // ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) +
+				  // (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) +
+					 //  (fcbb - fabb)) * OOrhoFluid;
+			   //LBMReal vvy =
+				  // ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) +
+				  // (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) +
+					 //  (fbcb - fbab)) * OOrhoFluid;
+			   //LBMReal vvz =
+				  // ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) +
+				  // (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) +
+					 //  (fbbc - fbba)) * OOrhoFluid;
+
+			 //  LBMReal vvx = ux;
+			 //  LBMReal vvy = uy;
+			 //  LBMReal vvz = uz;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // second component
+			   LBMReal concentration =
+				   ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+				   (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+					   ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //!
+			  // LBMReal fx = forces[0];
+			  // LBMReal fy = forces[1];
+			  // LBMReal fz = -concentration * forces[2];
+			  // vvx += fx * c1o2;
+			  // vvy += fy * c1o2;
+			  // vvz += fz * c1o2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   LBMReal oneMinusRho = c1- concentration;
+
+			   LBMReal cx =
+				   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+					   (mfcbb - mfabb));
+			   LBMReal cy =
+				   ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+				   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+					   (mfbcb - mfbab));
+			   LBMReal cz =
+				   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+				   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+					   (mfbbc - mfbba));
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // calculate the square of velocities for this lattice node
+			   LBMReal cx2 = cx * cx;
+			   LBMReal cy2 = cy * cy;
+			   LBMReal cz2 = cz * cz;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //! see also Eq. (6)-(14) in \ref
+			   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+			   //!
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+			   forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+			   forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+			   forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+			   forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+			   forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+			   forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+			   forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+			   forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - experimental Cumulant ... to be published ... hopefully
+			   //!
+
+			   // linearized orthogonalization of 3rd order central moments
+			   LBMReal Mabc = mfabc - mfaba * c1o3;
+			   LBMReal Mbca = mfbca - mfbaa * c1o3;
+			   LBMReal Macb = mfacb - mfaab * c1o3;
+			   LBMReal Mcba = mfcba - mfaba * c1o3;
+			   LBMReal Mcab = mfcab - mfaab * c1o3;
+			   LBMReal Mbac = mfbac - mfbaa * c1o3;
+			   // linearized orthogonalization of 5th order central moments
+			   LBMReal Mcbc = mfcbc - mfaba * c1o9;
+			   LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+			   LBMReal Mccb = mfccb - mfaab * c1o9;
+
+			   // collision of 1st order moments
+			  // LBMReal ccx, ccy, ccz;
+			   
+
+               cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+               cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+               cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+
+			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
+			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
+			//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
+
+
+			   cx2 = cx * cx;
+			   cy2 = cy * cy;
+			   cz2 = cz * cz;
+
+			   // equilibration of 2nd order moments
+			   mfbba = zeroReal;
+			   mfbab = zeroReal;
+			   mfabb = zeroReal;
+
+			   mfcaa = c1o3 * concentration;
+			   mfaca = c1o3 * concentration;
+			   mfaac = c1o3 * concentration;
+
+
+			   //LBMReal omega2 = 1.0f;// omegaD;
+			   //mfbba *= (c1 - omega2);
+			   //mfbab *= (c1 - omega2);
+			   //mfabb *= (c1 - omega2);
+
+			   //mfcaa = mfcaa*(c1 - omega2) + omega2*c1o3 * concentration;
+			   //mfaca = mfaca*(c1 - omega2) + omega2*c1o3 * concentration;
+			   //mfaac = mfaac*(c1 - omega2) + omega2*c1o3 * concentration;
+
+			   // equilibration of 3rd order moments
+			   Mabc = zeroReal;
+			   Mbca = zeroReal;
+			   Macb = zeroReal;
+			   Mcba = zeroReal;
+			   Mcab = zeroReal;
+			   Mbac = zeroReal;
+			   mfbbb = zeroReal;
+
+			   // from linearized orthogonalization 3rd order central moments to central moments
+			   mfabc = Mabc + mfaba * c1o3;
+			   mfbca = Mbca + mfbaa * c1o3;
+			   mfacb = Macb + mfaab * c1o3;
+			   mfcba = Mcba + mfaba * c1o3;
+			   mfcab = Mcab + mfaab * c1o3;
+			   mfbac = Mbac + mfbaa * c1o3;
+
+			   // equilibration of 4th order moments
+			   mfacc = c1o9 * concentration;
+			   mfcac = c1o9 * concentration;
+			   mfcca = c1o9 * concentration;
+
+			   mfcbb = zeroReal;
+			   mfbcb = zeroReal;
+			   mfbbc = zeroReal;
+
+			   // equilibration of 5th order moments
+			   Mcbc = zeroReal;
+			   Mbcc = zeroReal;
+			   Mccb = zeroReal;
+
+			   // from linearized orthogonalization 5th order central moments to central moments
+			   mfcbc = Mcbc + mfaba * c1o9;
+			   mfbcc = Mbcc + mfbaa * c1o9;
+			   mfccb = Mccb + mfaab * c1o9;
+
+			   // equilibration of 6th order moment
+			   mfccc = c1o27 * concentration;
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //! see also Eq. (88)-(96) in
+			   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+			   //!
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+			   backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+			   backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+			   backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+			   backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+			   backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+			   backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+			   backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+			   backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+			   (*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+   (*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+   (*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+   (*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+   (*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+   (*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+   (*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+   (*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+   (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+   (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+
+   (*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+   }
+
+   ////Phasefield 2:
+
+   {
+
+   normX1 *= -1;
+   normX2 *= -1;
+   normX3 *= -1;
+
+   mfcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+   mfbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+   mfbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+   mfccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+   mfacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+   mfcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+   mfabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+   mfbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+   mfbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+   mfccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+   mfacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+   mfcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+   mfaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+   mfabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+   mfbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+   mfbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+   mfaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+   mfcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+   mfaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+   mfcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+   mfbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+   mfbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+   mfaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+   mfcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+   mfaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+   mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+   mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+
+
+   ////////////////////////////////////////////////////////////////////////////////////
+//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//!
+////////////////////////////////////////////////////////////////////////////////////
+// fluid component
+	   //LBMReal drhoFluid =
+		  // ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) +
+		  // (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) +
+			 //  ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb;
+
+	   //LBMReal rhoFluid = c1 + drhoFluid;
+	   //LBMReal OOrhoFluid = c1 / rhoFluid;
+
+
+	   //LBMReal vvx =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) +
+		  // (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) +
+			 //  (fcbb - fabb)) * OOrhoFluid;
+	   //LBMReal vvy =
+		  // ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) +
+		  // (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) +
+			 //  (fbcb - fbab)) * OOrhoFluid;
+	   //LBMReal vvz =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) +
+		  // (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) +
+			 //  (fbbc - fbba)) * OOrhoFluid;
+
+	 //  LBMReal vvx = ux;
+	 //  LBMReal vvy = uy;
+	 //  LBMReal vvz = uz;
+	   ////////////////////////////////////////////////////////////////////////////////////
+	   // second component
+   LBMReal concentration =
+	   ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+	   (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+		   ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //!
+  // LBMReal fx = forces[0];
+  // LBMReal fy = forces[1];
+  // LBMReal fz = -concentration * forces[2];
+  // vvx += fx * c1o2;
+  // vvy += fy * c1o2;
+  // vvz += fz * c1o2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   LBMReal oneMinusRho = c1 - concentration;
+
+   LBMReal cx =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+	   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+		   (mfcbb - mfabb));
+   LBMReal cy =
+	   ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+	   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+		   (mfbcb - mfbab));
+   LBMReal cz =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+	   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+		   (mfbbc - mfbba));
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // calculate the square of velocities for this lattice node
+   LBMReal cx2 = cx * cx;
+   LBMReal cy2 = cy * cy;
+   LBMReal cz2 = cz * cz;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (6)-(14) in \ref
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - experimental Cumulant ... to be published ... hopefully
+   //!
+
+   // linearized orthogonalization of 3rd order central moments
+   LBMReal Mabc = mfabc - mfaba * c1o3;
+   LBMReal Mbca = mfbca - mfbaa * c1o3;
+   LBMReal Macb = mfacb - mfaab * c1o3;
+   LBMReal Mcba = mfcba - mfaba * c1o3;
+   LBMReal Mcab = mfcab - mfaab * c1o3;
+   LBMReal Mbac = mfbac - mfbaa * c1o3;
+   // linearized orthogonalization of 5th order central moments
+   LBMReal Mcbc = mfcbc - mfaba * c1o9;
+   LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+   LBMReal Mccb = mfccb - mfaab * c1o9;
+
+   // collision of 1st order moments
+   cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+
+   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
+   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
+//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
+
+
+   cx2 = cx * cx;
+   cy2 = cy * cy;
+   cz2 = cz * cz;
+
+   // equilibration of 2nd order moments
+   mfbba = zeroReal;
+   mfbab = zeroReal;
+   mfabb = zeroReal;
+
+   mfcaa = c1o3 * concentration;
+   mfaca = c1o3 * concentration;
+   mfaac = c1o3 * concentration;
+
+
+   //LBMReal omega2 = 1.0f;// omegaD;
+   //mfbba *= (c1 - omega2);
+   //mfbab *= (c1 - omega2);
+   //mfabb *= (c1 - omega2);
+
+   //mfcaa = mfcaa*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaca = mfaca*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaac = mfaac*(c1 - omega2) + omega2*c1o3 * concentration;
+
+   // equilibration of 3rd order moments
+   Mabc = zeroReal;
+   Mbca = zeroReal;
+   Macb = zeroReal;
+   Mcba = zeroReal;
+   Mcab = zeroReal;
+   Mbac = zeroReal;
+   mfbbb = zeroReal;
+
+   // from linearized orthogonalization 3rd order central moments to central moments
+   mfabc = Mabc + mfaba * c1o3;
+   mfbca = Mbca + mfbaa * c1o3;
+   mfacb = Macb + mfaab * c1o3;
+   mfcba = Mcba + mfaba * c1o3;
+   mfcab = Mcab + mfaab * c1o3;
+   mfbac = Mbac + mfbaa * c1o3;
+
+   // equilibration of 4th order moments
+   mfacc = c1o9 * concentration;
+   mfcac = c1o9 * concentration;
+   mfcca = c1o9 * concentration;
+
+   mfcbb = zeroReal;
+   mfbcb = zeroReal;
+   mfbbc = zeroReal;
+
+   // equilibration of 5th order moments
+   Mcbc = zeroReal;
+   Mbcc = zeroReal;
+   Mccb = zeroReal;
+
+   // from linearized orthogonalization 5th order central moments to central moments
+   mfcbc = Mcbc + mfaba * c1o9;
+   mfbcc = Mbcc + mfbaa * c1o9;
+   mfccb = Mccb + mfaab * c1o9;
+
+   // equilibration of 6th order moment
+   mfccc = c1o27 * concentration;
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (88)-(96) in
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+   (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3) = mfabb;
+   (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3) = mfbab;
+   (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3) = mfbba;
+   (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;
+   (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;
+   (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;
+
+   (*this->zeroDistributionsH2)(x1, x2, x3) = mfbbb;
+
+   }
+
+
+
+		/////!CUMULANT PHASE-FIELD
+
+
+
+                        /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
+
+                        //h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        //h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
+                        //h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
+                        //h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
+                        //h[NW]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
+                        //h[TE]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
+                        //h[TW]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
+                        //h[TN]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
+                        //h[TS]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
+                        //h[TNE] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
+                        //h[TNW] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        //h[TSE] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        //h[TSW] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+                        //h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
+                        //h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
+                        //h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
+                        //h[SW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        //h[SE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
+                        //h[BW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        //h[BE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
+                        //h[BS]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        //h[BN]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
+                        //h[BSW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        //h[BSE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        //h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        //h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        //h[REST] = (*this->zeroDistributionsH)(x1, x2, x3);
+
+                        //for (int dir = STARTF; dir < (ENDF + 1); dir++) {
+                        //    LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
+                        //    LBMReal velSq1  = velProd * velProd;
+                        //    LBMReal hEq; //, gEq;
+
+                        //    if (dir != REST) {
+                        //        LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]]) / 2.0;
+                        //        LBMReal hSource     = (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST]) * (dirGrad_phi) / denom; 
+                        //        hEq = phi[REST] * WEIGTH[dir] * (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) +                                 hSource * WEIGTH[dir];
+
+                        //        // This corresponds with the collision factor of 1.0 which equals (tauH + 0.5).
+                        //        h[dir] = h[dir] - (h[dir] - hEq) / (tauH); 
+
+                        //    } else {
+                        //        hEq = phi[REST] * WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+                        //        h[REST] = h[REST] - (h[REST] - hEq) / (tauH); 
+                        //    }
+                        //}
+
+                        //(*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3)     = h[D3Q27System::INV_E];
+                        //(*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3)     = h[D3Q27System::INV_N];
+                        //(*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3)     = h[D3Q27System::INV_T];
+                        //(*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3)    = h[D3Q27System::INV_NE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3)   = h[D3Q27System::INV_NW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3)    = h[D3Q27System::INV_TE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3)   = h[D3Q27System::INV_TW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3)    = h[D3Q27System::INV_TN];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3)   = h[D3Q27System::INV_TS];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3)   = h[D3Q27System::INV_TNE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3)  = h[D3Q27System::INV_TNW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3)  = h[D3Q27System::INV_TSE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3) = h[D3Q27System::INV_TSW];
+
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3)     = h[D3Q27System::INV_W];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3)     = h[D3Q27System::INV_S];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p)     = h[D3Q27System::INV_B];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3)   = h[D3Q27System::INV_SW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3)    = h[D3Q27System::INV_SE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p)   = h[D3Q27System::INV_BW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p)    = h[D3Q27System::INV_BE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p)   = h[D3Q27System::INV_BS];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p)    = h[D3Q27System::INV_BN];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p) = h[D3Q27System::INV_BSW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p)  = h[D3Q27System::INV_BSE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p)  = h[D3Q27System::INV_BNW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p)   = h[D3Q27System::INV_BNE];
+
+                        //(*this->zeroDistributionsH)(x1, x2, x3) = h[D3Q27System::REST];
+
+                        /////////////////////   END OF OLD BGK SOLVER ///////////////////////////////
+                    }
+                }
+            }
+        
+       // dataSet->setPhaseField(divU);
+		}
+}
+//////////////////////////////////////////////////////////////////////////
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi()
+{
+    using namespace D3Q27System;
+	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
+		+WEIGTH[N] * (phi[E] - phi[W]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX1[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi()
+{
+    using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
+		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+		+WEIGTH[N] * (phi[N] - phi[S]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX2[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi()
+{
+    using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+		+WEIGTH[N] * (phi[T] - phi[B]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX3[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+		+WEIGTH[N] * (phi2[N] - phi2[S]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+		+WEIGTH[N] * (phi2[T] - phi2[B]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+
+
+
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::nabla2_phi()
+{
+    using namespace D3Q27System;
+    LBMReal sum = 0.0;
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
+		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TN] * (
+			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
+		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
+		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		);
+	sum += WEIGTH[T] * (
+			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
+		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
+		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		);
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
+    //}
+    return 6.0 * sum;
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::computePhasefield()
+{
+    using namespace D3Q27System;
+    SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+
+    int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+    int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+    int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+
+    //------------- Computing the phase-field ------------------
+    for (int x3 = minX3; x3 < maxX3; x3++) {
+        for (int x2 = minX2; x2 < maxX2; x2++) {
+            for (int x1 = minX1; x1 < maxX1; x1++) {
+                // if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+                {
+                    int x1p = x1 + 1;
+                    int x2p = x2 + 1;
+                    int x3p = x3 + 1;
+
+                    h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                    h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                    h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                    h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+                    h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                    h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+                }
+            }
+        }
+    }
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+                                                int x3)
+{
+    using namespace D3Q27System;
+
+    SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+    phi[REST] = (*ph)(x1, x2, x3);
+
+
+    for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+        if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+            phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+        } else {
+			phi[k] = 0.0;
+         }
+    }
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.0;
+		}
+	}
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::swapDistributions()
+{
+    LBMKernel::swapDistributions();
+    dataSet->getHdistributions()->swap();
+	dataSet->getH2distributions()->swap();
+}
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
new file mode 100644
index 000000000..67232529c
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
@@ -0,0 +1,116 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
+//! \ingroup LBMKernel
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel_H
+#define MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief  Multiphase Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  H. Safari, K. Kutscher, M. Geier
+class MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel : public LBMKernel
+{
+public:
+   MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel();
+   virtual ~MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel(void) = default;
+   void calculate(int step) override;
+   SPtr<LBMKernel> clone() override;
+   void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+   void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+   double getCalculationTime() override { return .0; }
+protected:
+   virtual void initDataSet();
+   void swapDistributions() override;
+   LBMReal f1[D3Q27System::ENDF+1];
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH1;
+
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2;
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2;
+
+   //CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   phaseField;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
+   LBMReal h  [D3Q27System::ENDF+1];
+   LBMReal h2[D3Q27System::ENDF + 1];
+   LBMReal g  [D3Q27System::ENDF+1];
+   LBMReal phi[D3Q27System::ENDF+1];
+   LBMReal phi2[D3Q27System::ENDF + 1];
+   LBMReal pr1[D3Q27System::ENDF+1];
+   LBMReal phi_cutoff[D3Q27System::ENDF+1];
+
+   LBMReal gradX1_phi();
+   LBMReal gradX2_phi();
+   LBMReal gradX3_phi();
+   LBMReal gradX1_phi2();
+   LBMReal gradX2_phi2();
+   LBMReal gradX3_phi2();
+   //LBMReal gradX1_pr1();
+   //LBMReal gradX2_pr1();
+   //LBMReal gradX3_pr1();
+   //LBMReal dirgradC_phi(int n, int k);
+   void computePhasefield();
+   void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+   void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
+   //void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, int x1, int x2, int x3);
+   //void pressureFiltering(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf_filtered /*Pressure-Field*/);
+
+   LBMReal nabla2_phi();
+
+
+   mu::value_type muX1,muX2,muX3;
+   mu::value_type muDeltaT;
+   mu::value_type muNu;
+   LBMReal forcingX1;
+   LBMReal forcingX2;
+   LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
new file mode 100644
index 000000000..f96aaa996
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
@@ -0,0 +1,362 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+//! \ingroup Visitors
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphaseInitDistributionsBlockVisitorVelocity.h"
+#include "BCArray3D.h"
+#include "BCProcessor.h"
+#include "Block3D.h"
+#include "DataSet3D.h"
+#include "EsoTwist3D.h"
+#include "Grid3D.h"
+#include "Grid3DSystem.h"
+#include "LBMKernel.h"
+
+MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity() 
+	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+{
+	this->setVx1(0.0);
+	this->setVx2(0.0);
+	this->setVx3(0.0);
+	this->setRho(0.0);
+}
+//////////////////////////////////////////////////////////////////////////
+MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3)
+	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) /*, intThickness(intThickness), radius(radius) */
+{
+    (void) intThickness;
+    (void) radius;
+
+	this->setVx1(vx1);
+	this->setVx2(vx2);
+	this->setVx3(vx3);
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( const mu::Parser& parser)  
+{ 
+	this->checkFunction(parser); 
+	this->muVx1 = parser;  
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( const mu::Parser& parser)
+{ 
+	this->checkFunction(parser); 
+	this->muVx2 = parser;  
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( const mu::Parser& parser)  
+{ 
+	this->checkFunction(parser); 
+	this->muVx3 = parser;  
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( const mu::Parser& parser)  
+{ 
+	this->checkFunction(parser); 
+	this->muRho = parser;  
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( const mu::Parser& parser)  
+{ 
+	this->checkFunction(parser); 
+	this->muPhi = parser;  
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( const std::string& muParserString)  
+{ 
+	this->muVx1.SetExpr(muParserString); 
+	this->checkFunction(muVx1); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( const std::string& muParserString) 
+{ 
+	this->muVx2.SetExpr(muParserString); 
+	this->checkFunction(muVx2); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( const std::string& muParserString)  
+{ 
+	this->muVx3.SetExpr(muParserString); 
+	this->checkFunction(muVx3); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( const std::string& muParserString)  
+{ 
+	this->muRho.SetExpr(muParserString); 
+	this->checkFunction(muRho); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( const std::string& muParserString)  
+{ 
+	this->muPhi.SetExpr(muParserString); 
+	this->checkFunction(muPhi); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( LBMReal vx1 ) 
+{ 
+	this->muVx1.SetExpr( UbSystem::toString(vx1,D3Q27RealLim::digits10) );  
+	this->checkFunction(muVx1); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( LBMReal vx2 ) 
+{ 
+	this->muVx2.SetExpr( UbSystem::toString(vx2,D3Q27RealLim::digits10) );  
+	this->checkFunction(muVx2); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( LBMReal vx3 ) 
+{ 
+	this->muVx3.SetExpr( UbSystem::toString(vx3,D3Q27RealLim::digits10) );  
+	this->checkFunction(muVx3); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( LBMReal rho ) 
+{ 
+	this->muRho.SetExpr( UbSystem::toString(rho,D3Q27RealLim::digits10) );  
+	this->checkFunction(muRho); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( LBMReal phi ) 
+{ 
+	this->muPhi.SetExpr( UbSystem::toString(phi,D3Q27RealLim::digits10) );  
+	this->checkFunction(muPhi); 
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block) 
+{
+	using namespace D3Q27System;
+
+	if(!block) UB_THROW( UbException(UB_EXARGS,"block is not exist") );
+
+	//define vars for functions
+	mu::value_type x1,x2,x3;
+	this->muVx1.DefineVar("x1",&x1); this->muVx1.DefineVar("x2",&x2); this->muVx1.DefineVar("x3",&x3);
+	this->muVx2.DefineVar("x1",&x1); this->muVx2.DefineVar("x2",&x2); this->muVx2.DefineVar("x3",&x3);
+	this->muVx3.DefineVar("x1",&x1); this->muVx3.DefineVar("x2",&x2); this->muVx3.DefineVar("x3",&x3);
+	this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3);
+	this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3);
+
+	LBMReal vx1, vx2, vx3, rho, p1, phi;
+
+	int gridRank = grid->getRank();
+	int blockRank = block->getRank();
+
+	if (blockRank == gridRank && block->isActive())
+	{
+        SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+		if (!kernel)
+			throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString());
+
+		SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+        SPtr<EsoTwist3D> distributionsF = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); 
+		SPtr<EsoTwist3D> distributionsH = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getHdistributions());
+        SPtr<EsoTwist3D> distributionsH2 = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getH2distributions());
+
+		LBMReal phiL = kernel->getPhiL();
+		LBMReal phiH = kernel->getPhiH();
+
+		LBMReal f[D3Q27System::ENDF+1];
+
+		for(int ix3=0; ix3<(int)bcArray->getNX3(); ix3++)
+            for (int ix2 = 0; ix2 < (int)bcArray->getNX2(); ix2++)
+                for (int ix1 = 0; ix1 < (int)bcArray->getNX1(); ix1++)
+				{
+					Vector3D coords = grid->getNodeCoordinates(block, ix1, ix2, ix3);
+                    x1              = coords[0];
+                    x2              = coords[1];
+                    x3              = coords[2];
+
+					
+					p1  = 0.0;
+					//p1 = muRho.Eval();
+					vx1 = muVx1.Eval();
+					vx2 = muVx2.Eval();
+					vx3 = muVx3.Eval();
+					phi = muPhi.Eval();
+					
+					//rho = phi*1.0 + (1.0-phi)/densityRatio;
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0/densityRatio;
+					rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL);
+
+			
+					LBMReal feq[27];
+					LBMReal geq[27];
+
+					//calcFeqsFct(feq,rho,vx1,vx2,vx3);
+					LBMReal vx1Sq = vx1*vx1;
+					LBMReal vx2Sq = vx2*vx2;
+					LBMReal vx3Sq = vx3*vx3;
+					for (int dir = STARTF; dir < (ENDF+1); dir++)
+					{
+						LBMReal velProd = DX1[dir]*vx1 + DX2[dir]*vx2 + DX3[dir]*vx3;
+						LBMReal velSq1 = velProd*velProd;
+						LBMReal gamma = WEIGTH[dir]*(3*velProd + 4.5*velSq1 - 1.5*(vx1Sq+vx2Sq+vx3Sq));
+
+						//feq[dir] = rho*WEIGTH[dir]*(1 + 3*velProd + 4.5*velSq1 - 1.5*(vx1Sq+vx2Sq+vx3Sq));
+						feq[dir] =  WEIGTH[dir] * (1 + 3 * velProd + 4.5 * velSq1 - 1.5 * (vx1Sq + vx2Sq + vx3Sq));
+						//geq[dir] = p1*WEIGTH1[dir] + gamma;
+						//geq[dir] = p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma*rho;
+						geq[dir] = p1 * WEIGTH[dir] / ( UbMath::c1o3) + gamma ;
+					}
+
+
+					f[E]    =  geq[E]    ;
+					f[W]    =  geq[W]    ;
+					f[N]    =  geq[N]    ;
+					f[S]    =  geq[S]    ;
+					f[T]    =  geq[T]    ;
+					f[B]    =  geq[B]    ;
+					f[NE]   =  geq[NE]   ;
+					f[SW]   =  geq[SW]   ;
+					f[SE]   =  geq[SE]   ;
+					f[NW]   =  geq[NW]   ;
+					f[TE]   =  geq[TE]   ;
+					f[BW]   =  geq[BW]   ;
+					f[BE]   =  geq[BE]   ;
+					f[TW]   =  geq[TW]   ;
+					f[TN]   =  geq[TN]   ;
+					f[BS]   =  geq[BS]   ;
+					f[BN]   =  geq[BN]   ;
+					f[TS]   =  geq[TS]   ;
+					f[TNE]  =  geq[TNE]  ;
+					f[TNW]  =  geq[TNW]  ;
+					f[TSE]  =  geq[TSE]  ;
+					f[TSW]  =  geq[TSW]  ;
+					f[BNE]  =  geq[BNE]  ;
+					f[BNW]  =  geq[BNW]  ;
+					f[BSE]  =  geq[BSE]  ;
+					f[BSW]  =  geq[BSW]  ;
+					f[REST] =  geq[REST] ;
+
+					distributionsF->setDistribution(f, ix1, ix2, ix3);
+					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
+
+					f[E]    =  phi * feq[E]    ;// / rho;
+					f[W]    =  phi * feq[W]    ;// / rho;
+					f[N]    =  phi * feq[N]    ;// / rho;
+					f[S]    =  phi * feq[S]    ;// / rho;
+					f[T]    =  phi * feq[T]    ;// / rho;
+					f[B]    =  phi * feq[B]    ;// / rho;
+					f[NE]   =  phi * feq[NE]   ;// / rho;
+					f[SW]   =  phi * feq[SW]   ;// / rho;
+					f[SE]   =  phi * feq[SE]   ;// / rho;
+					f[NW]   =  phi * feq[NW]   ;// / rho;
+					f[TE]   =  phi * feq[TE]   ;// / rho;
+					f[BW]   =  phi * feq[BW]   ;// / rho;
+					f[BE]   =  phi * feq[BE]   ;// / rho;
+					f[TW]   =  phi * feq[TW]   ;// / rho;
+					f[TN]   =  phi * feq[TN]   ;// / rho;
+					f[BS]   =  phi * feq[BS]   ;// / rho;
+					f[BN]   =  phi * feq[BN]   ;// / rho;
+					f[TS]   =  phi * feq[TS]   ;// / rho;
+					f[TNE]  =  phi * feq[TNE]  ;// / rho;
+					f[TNW]  =  phi * feq[TNW]  ;// / rho;
+					f[TSE]  =  phi * feq[TSE]  ;// / rho;
+					f[TSW]  =  phi * feq[TSW]  ;// / rho;
+					f[BNE]  =  phi * feq[BNE]  ;// / rho;
+					f[BNW]  =  phi * feq[BNW]  ;// / rho;
+					f[BSE]  =  phi * feq[BSE]  ;// / rho;
+					f[BSW]  =  phi * feq[BSW]  ;// / rho;
+					f[REST] =  phi * feq[REST] ;// / rho;
+
+					distributionsH->setDistribution(f, ix1, ix2, ix3);
+					distributionsH->setDistributionInv(f, ix1, ix2, ix3);
+
+					if (distributionsH2) {
+
+						f[E]    = (1.-phi) * feq[E]   ;// / rho;
+						f[W]    = (1.-phi) * feq[W]   ;// / rho;
+						f[N]    = (1.-phi) * feq[N]   ;// / rho;
+						f[S]    = (1.-phi) * feq[S]   ;// / rho;
+						f[T]    = (1.-phi) * feq[T]   ;// / rho;
+						f[B]    = (1.-phi) * feq[B]   ;// / rho;
+						f[NE]   = (1.-phi) * feq[NE]  ;// / rho;
+						f[SW]   = (1.-phi) * feq[SW]  ;// / rho;
+						f[SE]   = (1.-phi) * feq[SE]  ;// / rho;
+						f[NW]   = (1.-phi) * feq[NW]  ;// / rho;
+						f[TE]   = (1.-phi) * feq[TE]  ;// / rho;
+						f[BW]   = (1.-phi) * feq[BW]  ;// / rho;
+						f[BE]   = (1.-phi) * feq[BE]  ;// / rho;
+						f[TW]   = (1.-phi) * feq[TW]  ;// / rho;
+						f[TN]   = (1.-phi) * feq[TN]  ;// / rho;
+						f[BS]   = (1.-phi) * feq[BS]  ;// / rho;
+						f[BN]   = (1.-phi) * feq[BN]  ;// / rho;
+						f[TS]   = (1.-phi) * feq[TS]  ;// / rho;
+						f[TNE]  = (1.-phi) * feq[TNE] ;// / rho;
+						f[TNW]  = (1.-phi) * feq[TNW] ;// / rho;
+						f[TSE]  = (1.-phi) * feq[TSE] ;// / rho;
+						f[TSW]  = (1.-phi) * feq[TSW] ;// / rho;
+						f[BNE]  = (1.-phi) * feq[BNE] ;// / rho;
+						f[BNW]  = (1.-phi) * feq[BNW] ;// / rho;
+						f[BSE]  = (1.-phi) * feq[BSE] ;// / rho;
+						f[BSW]  = (1.-phi) * feq[BSW] ;// / rho;
+						f[REST] = (1.-phi) * feq[REST];//  / rho;
+
+                        distributionsH2->setDistribution(f, ix1, ix2, ix3);
+                        distributionsH2->setDistributionInv(f, ix1, ix2, ix3);                    
+					}
+				}
+	}
+
+	//variablen der functions loeschen, da die verwiesenen Objecte nach dem verlassen des scopes ungueltig sind!
+	this->muVx1.ClearVar();
+	this->muVx2.ClearVar();
+	this->muVx3.ClearVar();
+	this->muRho.ClearVar();
+
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::checkFunction(mu::Parser fct)
+{
+	double x1=1.0,x2=1.0,x3=1.0;
+	fct.DefineVar("x1",&x1); 
+	fct.DefineVar("x2",&x2); 
+	fct.DefineVar("x3",&x3);
+
+	try
+	{
+		fct.Eval();
+		fct.ClearVar();
+	}
+	catch(mu::ParserError& e)
+	{
+		throw UbException(UB_EXARGS,"function: "+e.GetExpr() + (std::string)"error: "+e.GetMsg()
+			+(std::string)", only x1,x2,x3 are allowed as variables" );
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseInitDistributionsBlockVisitorVelocity::setNu( LBMReal nu )
+{
+	this->nu = nu;
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
new file mode 100644
index 000000000..fa66633ac
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
@@ -0,0 +1,102 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseInitDistributionsBlockVisitorVelocity.h
+//! \ingroup Visitors
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphaseInitDistributionsBlockVisitorVelocity_H
+#define MultiphaseInitDistributionsBlockVisitorVelocity_H
+
+#include "Block3DVisitor.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+
+#include <muParser.h>
+
+
+
+class MultiphaseInitDistributionsBlockVisitorVelocity : public Block3DVisitor
+{
+public:
+	typedef std::numeric_limits<LBMReal> D3Q27RealLim;
+
+public:
+	MultiphaseInitDistributionsBlockVisitorVelocity();
+	//D3Q27ETInitDistributionsBlockVisitor(LBMReal rho, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
+	//! Constructor
+	//! \param nu - viscosity
+	//! \param rho - density
+	//! \param vx1 - velocity in x
+	//! \param vx2 - velocity in y
+	//! \param vx3 - velocity in z
+	MultiphaseInitDistributionsBlockVisitorVelocity( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
+	//////////////////////////////////////////////////////////////////////////
+	//automatic vars are: x1,x2, x3
+	//ussage example: setVx1("x1*0.01+x2*0.003")
+	//////////////////////////////////////////////////////////////////////////
+	void setVx1( const mu::Parser& parser);
+	void setVx2( const mu::Parser& parser);
+	void setVx3( const mu::Parser& parser);
+	void setRho( const mu::Parser& parser);
+	void setPhi( const mu::Parser& parser);
+
+	void setVx1( const std::string& muParserString);
+	void setVx2( const std::string& muParserString);
+	void setVx3( const std::string& muParserString);
+	void setRho( const std::string& muParserString);
+	void setPhi( const std::string& muParserString);
+
+	//////////////////////////////////////////////////////////////////////////
+	void setVx1( LBMReal vx1 );
+	void setVx2( LBMReal vx2 );
+	void setVx3( LBMReal vx3 );
+	void setRho( LBMReal rho );
+	void setPhi( LBMReal rho );
+	void setNu( LBMReal nu );
+
+	void visit(SPtr<Grid3D> grid, SPtr<Block3D> block);
+
+protected:
+	void checkFunction(mu::Parser fct);
+
+private:
+	mu::Parser muVx1;
+	mu::Parser muVx2;
+	mu::Parser muVx3;
+	mu::Parser muRho;
+	mu::Parser muPhi;
+
+	LBMReal nu;
+	LBMReal densityRatio;
+	//LBMReal intThickness;
+	//LBMReal radius;
+};
+
+#endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_H
-- 
GitLab


From b0cc9ac8f20b09b86ddef06b4188982e82ab8a57 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Fri, 18 Jun 2021 15:52:21 +0200
Subject: [PATCH 005/179] output fixed for prototype velocity formulation
 without viscosity correction

---
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  | 58 +++++++++++++------
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp |  2 +-
 ...eTwoPhaseFieldsVelocityCumulantLBMKernel.h |  7 ++-
 3 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 70d2f2b6c..05ec0c36c 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -36,6 +36,7 @@
 #include "LBMKernel.h"
 #include <string>
 #include <vector>
+#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h"
 
 #include "BCArray3D.h"
 #include "Block3D.h"
@@ -145,7 +146,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
 {
     using namespace D3Q27System;
     using namespace UbMath;
-
+    SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
     //double level   = (double)block->getLevel();
 
     // Diese Daten werden geschrieben:
@@ -156,10 +157,11 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     datanames.push_back("Vz");
     datanames.push_back("P1");
     datanames.push_back("Phi2");
+    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) datanames.push_back("Pressure");
 
     data.resize(datanames.size());
 
-    SPtr<LBMKernel> kernel                   = dynamicPointerCast<LBMKernel>(block->getKernel());
+
     SPtr<BCArray3D> bcArray                  = kernel->getBCProcessor()->getBCArray();
     SPtr<DistributionArray3D> distributionsF = kernel->getDataSet()->getFdistributions();
     SPtr<DistributionArray3D> distributionsH = kernel->getDataSet()->getHdistributions();
@@ -227,6 +229,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                             ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
                 }
                     else { (*phaseField2)(ix1, ix2, ix3) = 999.0; }
+                    
                 }
             }
         }
@@ -344,23 +347,40 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     // rho = phi[ZERO] + (1.0 - phi[ZERO])*1.0/densityRatio;
                     rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
-                   vx1 =
-                        ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-                         (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) /
-                            (rho * c1o3) +
-                        mu * dX1_phi / (2 * rho);
+                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) {
+                        vx1 =
+                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
+                            (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) ;
 
-                    vx2 =
-                        ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-                         (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) /
-                            (rho * c1o3) +
-                        mu * dX2_phi / (2 * rho);
+                        vx2 =
+                            ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
+                            (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) ;
 
-                    vx3 =
-                        ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-                         (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B])) /
-                            (rho * c1o3) +
-                        mu * dX3_phi / (2 * rho);
+                        vx3 =
+                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
+                            (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B]));
+
+                    }
+                    else {
+                        vx1 =
+                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
+                            (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) /
+                                (rho * c1o3) +
+                            mu * dX1_phi / (2 * rho);
+
+                        vx2 =
+                            ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
+                            (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) /
+                                (rho * c1o3) +
+                            mu * dX2_phi / (2 * rho);
+
+                        vx3 =
+                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
+                            (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B])) /
+                                (rho * c1o3) +
+                            mu * dX3_phi / (2 * rho);
+
+                    }
 
                     p1 = (((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
                           (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
@@ -409,6 +429,10 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     data[index++].push_back(vx3);
                     data[index++].push_back(p1);
                     data[index++].push_back(phi2[REST]);
+                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) {
+                        data[index++].push_back((*dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure)(ix1, ix2, ix3));
+                    }
+                   // else { data[index++].push_back(999); }
                 }
             }
         }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index fd0b7f2a1..db01b3edc 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -52,7 +52,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::initDataSet()
     SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9)); // For phase-field
     SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
 	 pressure= CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
-	 pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
+	// pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
     dataSet->setFdistributions(f);
     dataSet->setHdistributions(h); // For phase-field
     dataSet->setH2distributions(h2); // For phase-field
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
index 67232529c..7e14cc3c3 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
@@ -56,6 +56,10 @@ public:
    void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
    void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
 
+   ///refactor
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+   //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
    double getCalculationTime() override { return .0; }
 protected:
    virtual void initDataSet();
@@ -75,8 +79,7 @@ protected:
    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2;
 
    //CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   phaseField;
-   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
-   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
 
    LBMReal h  [D3Q27System::ENDF+1];
    LBMReal h2[D3Q27System::ENDF + 1];
-- 
GitLab


From a76c50055f72d92041d3b4d4b414c2393d2fdbaa Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Sun, 27 Jun 2021 23:24:47 +0200
Subject: [PATCH 006/179] fix torque scaling

---
 apps/cpu/Applications.cmake                   |   1 +
 apps/cpu/LaminarTubeFlow/ltf.cfg              |   4 +-
 apps/cpu/LaminarTubeFlow/ltf.cpp              |  33 +-
 apps/cpu/ViskomatXL/viskomat.cfg              |  21 +-
 apps/cpu/ViskomatXL/viskomat.cpp              |  43 +-
 apps/cpu/ViskomatXL_2/CMakeLists.txt          |   6 +
 apps/cpu/ViskomatXL_2/viscosity.cfg           |   1 +
 apps/cpu/ViskomatXL_2/viskomat2.cfg           |  55 +++
 apps/cpu/ViskomatXL_2/viskomat2.cpp           | 446 ++++++++++++++++++
 .../VelocityWithDensityBCAlgorithm.cpp        |   9 +-
 .../CalculateTorqueCoProcessor.cpp            |  68 +--
 .../CoProcessors/CalculateTorqueCoProcessor.h |   6 +-
 .../CoProcessors/ForceCalculator.cpp          |   2 +-
 ...croscopicQuantitiesPlusMassCoProcessor.cpp | 278 +++++++++++
 ...MacroscopicQuantitiesPlusMassCoProcessor.h |  99 ++++
 15 files changed, 988 insertions(+), 84 deletions(-)
 create mode 100644 apps/cpu/ViskomatXL_2/CMakeLists.txt
 create mode 100644 apps/cpu/ViskomatXL_2/viscosity.cfg
 create mode 100644 apps/cpu/ViskomatXL_2/viskomat2.cfg
 create mode 100644 apps/cpu/ViskomatXL_2/viskomat2.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index e8902e5ff..88ada0577 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -5,6 +5,7 @@ add_subdirectory(${APPS_ROOT_CPU}/rheometer)
 add_subdirectory(${APPS_ROOT_CPU}/CouetteFlow)
 add_subdirectory(${APPS_ROOT_CPU}/Multiphase)
 add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL)
+add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL_2)
 add_subdirectory(${APPS_ROOT_CPU}/sphere)
 add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cfg b/apps/cpu/LaminarTubeFlow/ltf.cfg
index 8b8e33e49..1682ec7dc 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cfg
+++ b/apps/cpu/LaminarTubeFlow/ltf.cfg
@@ -22,5 +22,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1000
-endTime = 1000
\ No newline at end of file
+outTime = 10
+endTime = 10
\ No newline at end of file
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index e523dd2de..9f4bf28d9 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -70,27 +70,28 @@ void run(string configname)
       noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
 
       SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
 
       double startTime = 5;
       mu::Parser fct1;
       fct1.SetExpr("U");
-      fct1.DefineConst("U", 0.00001);
-      SPtr<BCAdapter> velBCAdapter1(new VelocityBCAdapter(true, false, false, fct1, 0, startTime));
-      velBCAdapter1->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+      fct1.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter1(new VelocityBCAdapter(true, false, false, fct1, 0, BCFunction::INFCONST));
+      //velBCAdapter1->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+      velBCAdapter1->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
 
-      mu::Parser fct2;
-      fct2.SetExpr("U");
-      fct2.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter2(new VelocityBCAdapter(true, false, false, fct2, startTime, BCFunction::INFCONST));
+      //mu::Parser fct2;
+      //fct2.SetExpr("U");
+      //fct2.DefineConst("U", uLB);
+      //SPtr<BCAdapter> velBCAdapter2(new VelocityBCAdapter(true, false, false, fct2, startTime, BCFunction::INFCONST));
 
       //////////////////////////////////////////////////////////////////////////////////
       //BS visitor
       BoundaryConditionsBlockVisitor bcVisitor;
       bcVisitor.addBC(noSlipBCAdapter);
       bcVisitor.addBC(denBCAdapter);
-      //bcVisitor.addBC(velBCAdapter);
+      //bcVisitor.addBC(velBCAdapter1);
 
       SPtr<Grid3D> grid(new Grid3D(comm));
 
@@ -155,7 +156,7 @@ void run(string configname)
          grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
 
          grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
+         grid->setPeriodicX2(false);
          grid->setPeriodicX3(false);
 
          if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
@@ -206,7 +207,7 @@ void run(string configname)
          //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
          
          inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter1, Interactor3D::SOLID));
-         inflowInt->addBCAdapter(velBCAdapter2);
+         //inflowInt->addBCAdapter(velBCAdapter2);
 
 
          //outflow
@@ -311,9 +312,9 @@ void run(string configname)
       SPtr<UbScheduler> nupsSch(new UbScheduler(100, 100, 100000000));
       SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
 
-      SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime));
-      auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch));
-      timeDepBC->addInteractor(inflowInt);
+      //SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime));
+      //auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch));
+      //timeDepBC->addInteractor(inflowInt);
 
       omp_set_num_threads(numOfThreads);
       numOfThreads = 1;
@@ -322,7 +323,7 @@ void run(string configname)
       calculator->addCoProcessor(npr);
       calculator->addCoProcessor(pp);
       calculator->addCoProcessor(migCoProcessor);
-      calculator->addCoProcessor(timeDepBC);
+      //calculator->addCoProcessor(timeDepBC);
 
       if (myid == 0) UBLOG(logINFO, "Simulation-start");
       calculator->calculate();
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index 4227ba9f8..f46bda31a 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -1,12 +1,15 @@
-outputPath = d:/temp/viskomatCylinderRestartTest3_Migration
-geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
-geoFile = fishbone.stl
+outputPath = d:/temp/viskomatCylinderSBB_16_dx_1_stl_2
+#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
+geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
+#geoFile = fishbone.stl
+geoFile = cylinder.stl
 
 numOfThreads = 4
 availMem = 8e9
 logToFile = false
 
-blocknx = 16 16 16
+#blocknx = 8 8 8
+blocknx = 2 32 32
 #blocknx = 1 8 8
 #boundingBox = -4 171 -9.5 155.5 -76.5 82.5
 #boundingBox = -4 166 -9.5 155.5 -76.5 82.5
@@ -15,7 +18,9 @@ blocknx = 16 16 16
 
 #boundingBox = -4 166 -82.5 82.5 -82.5 82.5
 
-boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+
+boundingBox = 0 2 -16 16 -16 16
 
 # around X
 #blocknx = 1 16 16
@@ -30,11 +35,11 @@ boundingBox = 0 140 -82.5 82.5 -82.5 82.5
 #boundingBox =  0 8 0 8 0 8
 
 deltax = 1
-
 refineLevel = 0
 
 #nuLB = 1.5e-4
 OmegaLB = 1e-4
+N = 80 #rpm
 tau0 = 20e-7
 
 resolution = 32
@@ -46,5 +51,5 @@ restartStep = 10000
 cpStart = 10000
 cpStep = 10000
 
-outTime = 1000
-endTime = 1000000
\ No newline at end of file
+outTime = 10000
+endTime = 20 #0000
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 3beef8dd3..a5d5f60e1 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -68,9 +68,11 @@ void bflow(string configname)
 
       //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
 
-      double nuLB = OmegaLB * (R / deltax)*(R / deltax) / Re;
+      double nuLB = 0.01230579456896098; // OmegaLB* (R / deltax * 1e-3)* (R / deltax * 1e-3) / Re;
 
       SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+      //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(1, 1461, 970, 1e3));
+      //UBLOG(logINFO, conv->toString());
 
       //bounding box
 
@@ -184,31 +186,32 @@ void bflow(string configname)
 
       ////stator
       // rotation around X-axis 
-      // SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
-      //                                          g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-      //     g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
+       //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+       //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+       //    g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
 
-      // SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 4.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+      // SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 4.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
       //                                          g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-      //     g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 11.8*0.5));
+      //     g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 12.0*0.5));
 
-      //  // rotation around Y-axis 
-      // //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
-      // //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
-      // //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
-      // //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
+      ////  // rotation around Y-axis 
+      //// //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
+      //// //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
+      //// //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
+      //// //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
 
       // SPtr<D3Q27Interactor> statorInt =
       //    SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID));
       
       SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
       stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
-      stator->translate(4.0, -73.0, -6.0);
-      GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance());
-      
+      //stator->translate(4.0, -73.0, -6.0);
+
       SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
          new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
 
+      GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance());
+
       ////rotor (cylinder)
       // rotation around X-axis 
       SPtr<GbObject3D> rotor(new GbCylinder3D(
@@ -236,7 +239,7 @@ void bflow(string configname)
       if (myid == 0) GbSystem3D::writeGeoObject(wallXmax.get(), outputPath + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
 
       //wall interactors
-      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
       SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
 
       if (myid == 0)
@@ -387,7 +390,7 @@ void bflow(string configname)
       SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
       //writeMQCoProcessor->process(100);
 
-      SPtr<UbScheduler> forceSch(new UbScheduler(1000));
+      SPtr<UbScheduler> forceSch(new UbScheduler(10));
       SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
       fp->addInteractor(rotorInt);
       SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
@@ -397,12 +400,12 @@ void bflow(string configname)
 
       SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
       SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(fp);
+      //calculator->addCoProcessor(npr);
+      //calculator->addCoProcessor(fp);
       calculator->addCoProcessor(fp2);
-      calculator->addCoProcessor(writeMQCoProcessor);
+      //calculator->addCoProcessor(writeMQCoProcessor);
       //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
-      calculator->addCoProcessor(restartCoProcessor);
+      //calculator->addCoProcessor(restartCoProcessor);
 
       if (myid == 0) UBLOG(logINFO, "Simulation-start");
       calculator->calculate();
diff --git a/apps/cpu/ViskomatXL_2/CMakeLists.txt b/apps/cpu/ViskomatXL_2/CMakeLists.txt
new file mode 100644
index 000000000..41cab00e2
--- /dev/null
+++ b/apps/cpu/ViskomatXL_2/CMakeLists.txt
@@ -0,0 +1,6 @@
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(viskomat2)
+
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES viskomat2.cpp )
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viscosity.cfg b/apps/cpu/ViskomatXL_2/viscosity.cfg
new file mode 100644
index 000000000..bf2822c7b
--- /dev/null
+++ b/apps/cpu/ViskomatXL_2/viscosity.cfg
@@ -0,0 +1 @@
+nuLB = 1.5e-3
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viskomat2.cfg b/apps/cpu/ViskomatXL_2/viskomat2.cfg
new file mode 100644
index 000000000..b76a38d12
--- /dev/null
+++ b/apps/cpu/ViskomatXL_2/viskomat2.cfg
@@ -0,0 +1,55 @@
+outputPath = d:/temp/viskomatCylinderSBB_16_dx_1_gen_2
+#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
+geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
+#geoFile = fishbone.stl
+geoFile = cylinder.stl
+
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+
+#blocknx = 8 8 8
+blocknx = 2 32 32
+#blocknx = 1 8 8
+#boundingBox = -4 171 -9.5 155.5 -76.5 82.5
+#boundingBox = -4 166 -9.5 155.5 -76.5 82.5
+
+#boundingBox = -4 166 0 165 0 165
+
+#boundingBox = -4 166 -82.5 82.5 -82.5 82.5
+
+#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+
+boundingBox = 0 2 -16 16 -16 16
+
+# around X
+#blocknx = 1 16 16
+#boundingBox = 0 1 0 165 0 165
+
+# around Y
+#blocknx = 16 1 16
+#boundingBox =  0 165 0 1 0 165
+
+#zero test
+#blocknx = 8 8 8
+#boundingBox =  0 8 0 8 0 8
+
+deltax = 1
+refineLevel = 0
+
+#nuLB = 1.5e-4
+OmegaLB = 1e-4
+N = 80 #rpm
+tau0 = 20e-7
+
+resolution = 32
+scaleFactor = 1
+
+newStart = true
+restartStep = 10000
+
+cpStart = 10000
+cpStep = 10000
+
+outTime = 10000
+endTime = 20 #0000
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viskomat2.cpp b/apps/cpu/ViskomatXL_2/viskomat2.cpp
new file mode 100644
index 000000000..b8784b40b
--- /dev/null
+++ b/apps/cpu/ViskomatXL_2/viskomat2.cpp
@@ -0,0 +1,446 @@
+#include <iostream>
+#include <string>
+
+#include <VirtualFluids.h>
+
+using namespace std;
+
+
+void bflow(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          outputPath = config.getValue<string>("outputPath");
+      string          geoPath = config.getValue<string>("geoPath");
+      string          geoFile = config.getValue<string>("geoFile");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          deltax = config.getValue<double>("deltax");
+      double          cpStep = config.getValue<double>("cpStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      bool            newStart = config.getValue<bool>("newStart");
+      double          OmegaLB = config.getValue<double>("OmegaLB");
+      double          tau0 = config.getValue<double>("tau0");
+      double          N = config.getValue<double>("N");
+
+
+      ConfigurationFile   viscosity;
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = outputPath.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      LBMReal rhoLB = 0.0;
+
+      //double N  = 70; //rpm
+      double Omega = 2 * UbMath::PI / 60.0 * N; //rad/s
+      double mu    = 1; //Pa s
+      double R     = 0.165 / 2.0; //m
+      double rho   = 970; //kg/m^3
+      double Re    = Omega * R * R * rho / mu;
+
+      //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
+
+      double nuLB = 0.01230579456896098; // OmegaLB* (R / deltax * 1e-3)* (R / deltax * 1e-3) / Re;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+      //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(1, 1461, 970, 1e3));
+      //UBLOG(logINFO, conv->toString());
+
+      //bounding box
+
+      double g_minX1 = boundingBox[0];
+      double g_maxX1 = boundingBox[1];
+
+      double g_minX2 = boundingBox[2];
+      double g_maxX2 = boundingBox[3];
+      
+      double g_minX3 = boundingBox[4];
+      double g_maxX3 = boundingBox[5];
+
+      SPtr<Rheology> thix = Rheology::getInstance();
+      //thix->setPowerIndex(n);
+      //thix->setViscosityParameter(k);
+      thix->setYieldStress(tau0);
+      //thix->setOmegaMin(omegaMin);
+
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm()));
+      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm()));
+      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      //// rotation around X-axis
+      mu::Parser fctVy;
+      fctVy.SetExpr("-Omega*(x3-z0-r)");
+      fctVy.DefineConst("Omega", OmegaLB);
+      fctVy.DefineConst("r", 0.5 * (g_maxX3 - g_minX3));
+      fctVy.DefineConst("z0", g_minX3);
+
+      mu::Parser fctVz;
+      fctVz.SetExpr("Omega*(x2-y0-r)");
+      fctVz.DefineConst("Omega", OmegaLB);
+      fctVz.DefineConst("r", 0.5 * (g_maxX2 - g_minX2));
+      fctVz.DefineConst("y0", g_minX2);
+
+      mu::Parser fctVx;
+      fctVx.SetExpr("0.0");
+
+      // rotation around Y-axis
+      //mu::Parser fctVz;
+      //// fctVx.SetExpr("omega*(r-x2)");
+      //fctVz.SetExpr("Omega*(x1-r)");
+      //fctVz.DefineConst("Omega", OmegaLB);
+      //fctVz.DefineConst("r", 0.5 * (g_maxX1 - g_minX1));
+
+      //mu::Parser fctVx;
+      //fctVx.SetExpr("-Omega*(x3-r)");
+      //fctVx.DefineConst("Omega", OmegaLB);
+      //fctVx.DefineConst("r", 0.5 * (g_maxX1 - g_minX1));
+
+      //mu::Parser fctVy;
+      //fctVy.SetExpr("0.0");
+
+      SPtr<BCAdapter> velocityBCAdapter(new VelocityBCAdapter(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST));
+      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+      velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm()));
+      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelVelocityBCAlgorithm()));
+
+      //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter());
+      //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+      ////densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      //bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(slipBCAdapter);
+      bcVisitor.addBC(velocityBCAdapter);
+      //bcVisitor.addBC(densityBCAdapter);
+      
+      SPtr<BCProcessor> bcProc;
+      bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BGKLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); 
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); 
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BinghamModelLBMKernel());
+      kernel->setBCProcessor(bcProc);
+      //kernel->setForcingX1(forcing);
+      //kernel->setWithForcing(true);
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(false);
+      grid->setDeltaX(deltax);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm));
+      //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, mSch, outputPath, comm));
+      restartCoProcessor->setLBMKernel(kernel);
+      restartCoProcessor->setBCProcessor(bcProc);
+      //restartCoProcessor->setNu(k);
+      //////////////////////////////////////////////////////////////////////////
+
+      ////stator
+      // rotation around X-axis 
+       //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+       //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+       //    g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
+
+       SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 4.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+                                                g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+           g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 12.0*0.5));
+
+      //  // rotation around Y-axis 
+      // //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
+      // //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
+      // //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
+      // //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
+
+       SPtr<D3Q27Interactor> statorInt =
+          SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID));
+      
+      //SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
+      //stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
+      ////stator->translate(4.0, -73.0, -6.0);
+
+      //SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
+      //   new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+
+      GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance());
+
+      ////rotor (cylinder)
+      // rotation around X-axis 
+      SPtr<GbObject3D> rotor(new GbCylinder3D(
+          g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
+                                              g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
+          g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3)));
+      // rotation around Y-axis
+      //SPtr<GbObject3D> rotor(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax,
+      //                                        g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
+      //                                        g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
+      //                                        0.5 * (g_maxX3 - g_minX3)));
+
+      GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<D3Q27Interactor> rotorInt =
+          SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBCAdapter, Interactor3D::INVERSESOLID));
+
+      //walls
+      GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - deltax, g_minX2 - deltax, g_minX3 - deltax, g_minX1,
+          g_maxX2 + deltax, g_maxX3 + deltax));
+      if (myid == 0) GbSystem3D::writeGeoObject(wallXmin.get(), outputPath + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - deltax, g_minX3 - deltax, g_maxX1 +  (double)blocknx[0]*deltax,
+          g_maxX2 + deltax, g_maxX3 + deltax));
+      if (myid == 0) GbSystem3D::writeGeoObject(wallXmax.get(), outputPath + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+
+      //wall interactors
+      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
+      SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "Parameters:");
+         UBLOG(logINFO, "N = " << N << " rpm");
+         UBLOG(logINFO, "Omega = " << Omega << " rad/s");
+         UBLOG(logINFO, "Re = " << Re);
+         UBLOG(logINFO, "rho = " << rhoLB);
+         UBLOG(logINFO, "uLB = " << OmegaLB);
+         UBLOG(logINFO, "nuLB = " << nuLB);
+         UBLOG(logINFO, "tau0 = " << tau0);
+         UBLOG(logINFO, "deltax = " << deltax);
+         UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+         UBLOG(logINFO, "number of threads = " << numOfThreads);
+         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
+         UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
+         UBLOG(logINFO, "output path = " << outputPath);
+         UBLOG(logINFO, "Preprozess - start");
+      }
+
+      if (newStart)
+      {
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (refineLevel > 0)
+         {
+            GbCuboid3DPtr refCube(new GbCuboid3D(-10, -10, -10, 0, 0, 0));
+            if (myid == 0) GbSystem3D::writeGeoObject(refCube.get(), outputPath + "/geo/refCube", WbWriterVtkXmlASCII::getInstance());
+            
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            //refineHelper.addGbObject(sphere, refineLevel);
+            refineHelper.addGbObject(refCube, refineLevel);
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(wallXmaxInt);
+         intHelper.addInteractor(statorInt);
+         intHelper.addInteractor(rotorInt);
+         intHelper.addInteractor(wallXminInt);
+         
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->process(0);
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
+         double needMemAll = double(nodg * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //BC
+         intHelper.setBC();
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         grid->accept(initVisitor);
+
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm);
+         ppgeo.process(0);
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         restartCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         
+         SetBcBlocksBlockVisitor v2(wallXmaxInt);
+         grid->accept(v2);
+         wallXmaxInt->initInteractor();
+
+         SetBcBlocksBlockVisitor v3(statorInt);
+         grid->accept(v3);
+         statorInt->initInteractor();
+
+         SetBcBlocksBlockVisitor v4(rotorInt);
+         grid->accept(v4);
+         rotorInt->initInteractor();
+
+         SetBcBlocksBlockVisitor v1(wallXminInt);
+         grid->accept(v1);
+         wallXminInt->initInteractor();
+      }
+      
+      omp_set_num_threads(numOfThreads);
+
+      //set connectors
+      //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor());
+      //static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin());
+      //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      //grid->accept(setConnsVisitor);
+
+      OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+      grid->accept(setConnsVisitor);
+
+      grid->accept(bcVisitor);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      //write data for visualization of macroscopic quantities
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+      //SPtr<UbScheduler> visSch(new UbScheduler(10,1));
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+      //writeMQCoProcessor->process(100);
+
+      SPtr<UbScheduler> forceSch(new UbScheduler(10));
+      SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
+      fp->addInteractor(rotorInt);
+      SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
+      fp2->addInteractor(statorInt);
+
+      //SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      //calculator->addCoProcessor(npr);
+      //calculator->addCoProcessor(fp);
+      calculator->addCoProcessor(fp2);
+      //calculator->addCoProcessor(writeMQCoProcessor);
+      //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
+      //calculator->addCoProcessor(restartCoProcessor);
+
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         //pflowForcing(string(argv[1]));
+         bflow(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp
index c63b15594..1fe6632b9 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp
@@ -82,11 +82,12 @@ void VelocityWithDensityBCAlgorithm::applyBC()
         if (minX1 <= nX1 && maxX1 > nX1 && minX2 <= nX2 && maxX2 > nX2 && minX3 <= nX3 && maxX3 > nX3) {
             if (bcArray->isSolid(nX1, nX2, nX3)) {
                 const int invDir = D3Q27System::INVDIR[fdir];
-                //            LBMReal q =1.0;// bcPtr->getQ(invDir);// m+m q=0 stabiler
+                //LBMReal q =1.0;// bcPtr->getQ(invDir);// m+m q=0 stabiler
                 LBMReal velocity = bcPtr->getBoundaryVelocity(fdir);
-                //            LBMReal fReturn = ((1.0 - q) / (1.0 + q))*((f[fdir] - feq[fdir]*collFactor) / (1.0 -
-                //            collFactor)) + ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 +
-                //            q))-drho*D3Q27System::WEIGTH[invDir];
+                
+                //LBMReal fReturn = ((1.0 - q) / (1.0 + q))*((f[fdir] - feq[fdir]*collFactor) / (1.0 -
+                //collFactor)) + ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 +
+                //q))-drho*D3Q27System::WEIGTH[invDir];
 
                 // if q=1
                 // LBMReal fReturn = ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 +
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index 9fd6e8c28..affdcdc65 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -13,7 +13,7 @@
 #include "EsoTwist3D.h"
 #include "DistributionArray3D.h"
 
-CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path_), comm(comm), forceX1global(0), forceX2global(0), forceX3global(0)
+CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0)
 {
    if (comm->getProcessID() == comm->getRoot())
    {
@@ -68,9 +68,9 @@ void CalculateTorqueCoProcessor::collectData( double step )
       }
 
       ostr << istep << ";";
-      ostr << forceX1global << ";";
-      ostr << forceX2global << ";";
-      ostr << forceX3global;
+      ostr << torqueX1global << ";";
+      ostr << torqueX2global << ";";
+      ostr << torqueX3global;
       ostr << std::endl;
       ostr.close();
    }
@@ -78,9 +78,11 @@ void CalculateTorqueCoProcessor::collectData( double step )
 //////////////////////////////////////////////////////////////////////////
 void CalculateTorqueCoProcessor::calculateForces()
 {
-   forceX1global = 0.0;
-   forceX2global = 0.0;
-   forceX3global = 0.0;
+   torqueX1global = 0.0;
+   torqueX2global = 0.0;
+   torqueX3global = 0.0;
+
+   int counter = 0;
 
    for(SPtr<D3Q27Interactor> interactor : interactors)
    {
@@ -97,6 +99,8 @@ void CalculateTorqueCoProcessor::calculateForces()
          SPtr<Block3D> block = t.first;
          std::set< std::vector<int> >& transNodeIndicesSet = t.second;
 
+         double deltaX = grid->getDeltaX(block);
+
          SPtr<ILBMKernel> kernel = block->getKernel();
 
          if (kernel->getCompressible())
@@ -128,11 +132,6 @@ void CalculateTorqueCoProcessor::calculateForces()
             int x2 = node[1];
             int x3 = node[2];
 
-            Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3);
-            double rx                 = worldCoordinates[0] - x1Centre;
-            double ry                 = worldCoordinates[1] - x2Centre;
-            double rz                 = worldCoordinates[2] - x3Centre;
-
             //without ghost nodes
             if (x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 ||x3 < minX3 || x3 > maxX3 ) continue;
 
@@ -144,16 +143,23 @@ void CalculateTorqueCoProcessor::calculateForces()
                double Fy                   = val<2>(forceVec);
                double Fz                   = val<3>(forceVec);
 
+               Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3);
+               double rx                 = (worldCoordinates[0] - x1Centre) / deltaX;
+               double ry                 = (worldCoordinates[1] - x2Centre) / deltaX;
+               double rz                 = (worldCoordinates[2] - x3Centre) / deltaX;
+
                torqueX1 += ry * Fz - rz * Fy;
                torqueX2 += rz * Fx - rx * Fz;
                torqueX3 += rx * Fy - ry * Fx;
-               //counter++;
+               
+               
+               counter++;
                //UBLOG(logINFO, "x1="<<(worldCoordinates[1] - x2Centre)<<",x2=" << (worldCoordinates[2] - x3Centre)<< ",x3=" << (worldCoordinates[0] - x1Centre) <<" forceX3 = " << forceX3);
             }
          }
          //if we have got discretization with more level
          // deltaX is LBM deltaX and equal LBM deltaT 
-         double deltaX = LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
+         //double deltaX = 0.5; // LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
          double deltaXquadrat = deltaX*deltaX;
          torqueX1 *= deltaXquadrat;
          torqueX2 *= deltaXquadrat;
@@ -161,31 +167,33 @@ void CalculateTorqueCoProcessor::calculateForces()
 
          distributions->swap();
 
-         forceX1global += torqueX1;
-         forceX2global += torqueX2;
-         forceX3global += torqueX3;
+         torqueX1global += torqueX1;
+         torqueX2global += torqueX2;
+         torqueX3global += torqueX3;
+
+         UBLOG(logINFO, "torqueX1global = " << torqueX1global);
 
-         //UBLOG(logINFO, "forceX3global = " << forceX3global);
+         UBLOG(logINFO, "counter = " << counter);
       }
    }
    std::vector<double> values;
    std::vector<double> rvalues;
-   values.push_back(forceX1global);
-   values.push_back(forceX2global);
-   values.push_back(forceX3global);
+   values.push_back(torqueX1global);
+   values.push_back(torqueX2global);
+   values.push_back(torqueX3global);
 
    rvalues = comm->gather(values);
    if (comm->getProcessID() == comm->getRoot())
    {
-      forceX1global = 0.0;
-      forceX2global = 0.0;
-      forceX3global = 0.0;
+      torqueX1global = 0.0;
+      torqueX2global = 0.0;
+      torqueX3global = 0.0;
       
       for (int i = 0; i < (int)rvalues.size(); i+=3)
       {
-         forceX1global += rvalues[i];
-         forceX2global += rvalues[i+1];
-         forceX3global += rvalues[i+2];
+         torqueX1global += rvalues[i];
+         torqueX2global += rvalues[i+1];
+         torqueX3global += rvalues[i+2];
       }
    }
 }
@@ -229,9 +237,9 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
                correction[2] = forceTerm * boundaryVelocity[2];
             }
 
-            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
-            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
-            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
+            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
+            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
+            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
          }
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
index 43e1e75ac..2b6651e66 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
@@ -40,9 +40,9 @@ private:
    std::string path;
    SPtr<Communicator> comm;
    std::vector<SPtr<D3Q27Interactor> > interactors;
-   double forceX1global;
-   double forceX2global;
-   double forceX3global;
+   double torqueX1global;
+   double torqueX2global;
+   double torqueX3global;
 
    typedef void(*CalcMacrosFct)(const LBMReal* const& /*f[27]*/, LBMReal& /*rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
    CalcMacrosFct    calcMacrosFct;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp
index 7e04fd4b6..c9252eb24 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp
@@ -42,7 +42,7 @@ Vector3D ForceCalculator::getForces(int x1, int x2, int x3, SPtr<DistributionArr
                 // UBLOG(logINFO, "c, c * bv(x,y,z): " << correction << ", " << correction * val<1>(boundaryVelocity) <<
                 // ", " << correction * val<2>(boundaryVelocity) << ", " << correction * val<3>(boundaryVelocity));
 
-                // force consists of the MEM part and the galilean invariance correction including the boundary velocity
+                // force consists of the MEM part and the Galilean invariance correction including the boundary velocity
                 forceX1 += (f + fnbr) * D3Q27System::DX1[invDir] - correction[0];
                 forceX2 += (f + fnbr) * D3Q27System::DX2[invDir] - correction[1];
                 forceX3 += (f + fnbr) * D3Q27System::DX3[invDir] - correction[2];
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
new file mode 100644
index 000000000..f67750dd7
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
@@ -0,0 +1,278 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "WriteMacroscopicQuantitiesPlusMassCoProcessor.h"
+#include "BCProcessor.h"
+#include "LBMKernel.h"
+#include <string>
+#include <vector>
+
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "Communicator.h"
+#include "DataSet3D.h"
+#include "Grid3D.h"
+#include "LBMUnitConverter.h"
+#include "UbScheduler.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+
+WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMassCoProcessor() = default;
+//////////////////////////////////////////////////////////////////////////
+WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMassCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                                                             const std::string &path,
+                                                                             WbWriter *const writer,
+                                                                             SPtr<LBMUnitConverter> conv,
+                                                                             SPtr<Communicator> comm)
+        : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm)
+{
+    gridRank = comm->getProcessID();
+    minInitLevel = this->grid->getCoarsestInitializedLevel();
+    maxInitLevel = this->grid->getFinestInitializedLevel();
+
+    blockVector.resize(maxInitLevel + 1);
+
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        grid->getBlocks(level, gridRank, true, blockVector[level]);
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////
+void WriteMacroscopicQuantitiesPlusMassCoProcessor::init()
+{}
+
+//////////////////////////////////////////////////////////////////////////
+void WriteMacroscopicQuantitiesPlusMassCoProcessor::process(double step)
+{
+    if (scheduler->isDue(step))
+        collectData(step);
+
+    UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesPlusMassCoProcessor::update:" << step);
+}
+
+//////////////////////////////////////////////////////////////////////////
+void WriteMacroscopicQuantitiesPlusMassCoProcessor::collectData(double step)
+{
+    int istep = static_cast<int>(step);
+
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        for (SPtr<Block3D> block : blockVector[level])
+        {
+            if (block)
+            {
+                addDataMQ(block);
+            }
+        }
+    }
+
+    std::string pfilePath, partPath, subfolder, cfilePath;
+
+    subfolder = "mq" + UbSystem::toString(istep);
+    pfilePath = path + "/mq/" + subfolder;
+    cfilePath = path + "/mq/mq_collection";
+    partPath = pfilePath + "/mq" + UbSystem::toString(gridRank) + "_" + UbSystem::toString(istep);
+
+    std::string partName = writer->writeOctsWithNodeData(partPath, nodes, cells, datanames, data);
+    size_t found = partName.find_last_of("/");
+    std::string piece = partName.substr(found + 1);
+    piece = subfolder + "/" + piece;
+
+    std::vector<std::string> cellDataNames;
+    std::vector<std::string> pieces = comm->gather(piece);
+    if (comm->getProcessID() == comm->getRoot()) {
+        std::string pname =
+                WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath, pieces, datanames, cellDataNames);
+        found = pname.find_last_of("/");
+        piece = pname.substr(found + 1);
+
+        std::vector<std::string> filenames;
+        filenames.push_back(piece);
+        if (step == CoProcessor::scheduler->getMinBegin())
+        {
+            WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false);
+        } else
+        {
+            WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false);
+        }
+        UBLOG(logINFO, "WriteMacroscopicQuantitiesPlusMassCoProcessor step: " << istep);
+    }
+
+    clearData();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void WriteMacroscopicQuantitiesPlusMassCoProcessor::clearData()
+{
+    nodes.clear();
+    cells.clear();
+    datanames.clear();
+    data.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////
+void WriteMacroscopicQuantitiesPlusMassCoProcessor::addDataMQ(SPtr<Block3D> block)
+{
+    double level   = (double)block->getLevel();
+
+    // Diese Daten werden geschrieben:
+    datanames.resize(0);
+    datanames.push_back("Rho");
+    datanames.push_back("Vx");
+    datanames.push_back("Vy");
+    datanames.push_back("Vz");
+    // datanames.push_back("Press");
+    datanames.push_back("Level");
+    // datanames.push_back("BlockID");
+    // datanames.push_back("gamma");
+    // datanames.push_back("collFactor");
+
+    data.resize(datanames.size());
+
+    SPtr<ILBMKernel> kernel                 = block->getKernel();
+    SPtr<BCArray3D> bcArray                 = kernel->getBCProcessor()->getBCArray();
+    SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+    LBMReal f[D3Q27System::ENDF + 1];
+    LBMReal vx1, vx2, vx3, rho;
+
+    // knotennummerierung faengt immer bei 0 an!
+    int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT;
+
+    if (block->getKernel()->getCompressible()) {
+        calcMacros = &D3Q27System::calcCompMacroscopicValues;
+    } else {
+        calcMacros = &D3Q27System::calcIncompMacroscopicValues;
+    }
+
+    int minX1 = 0;
+    int minX2 = 0;
+    int minX3 = 0;
+
+    int maxX1 = (int)(distributions->getNX1());
+    int maxX2 = (int)(distributions->getNX2());
+    int maxX3 = (int)(distributions->getNX3());
+
+    // int minX1 = 1;
+    // int minX2 = 1;
+    // int minX3 = 1;
+
+    // int maxX1 = (int)(distributions->getNX1());
+    // int maxX2 = (int)(distributions->getNX2());
+    // int maxX3 = (int)(distributions->getNX3());
+
+    // nummern vergeben und node vector erstellen + daten sammeln
+    CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
+    maxX1 -= 2;
+    maxX2 -= 2;
+    maxX3 -= 2;
+
+    // D3Q27BoundaryConditionPtr bcPtr;
+    int nr = (int)nodes.size();
+
+    for (int ix3 = minX3; ix3 <= maxX3; ix3++) {
+        for (int ix2 = minX2; ix2 <= maxX2; ix2++) {
+            for (int ix1 = minX1; ix1 <= maxX1; ix1++) {
+                if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) {
+                    int index                  = 0;
+                    nodeNumbers(ix1, ix2, ix3) = nr++;
+                    Vector3D worldCoordinates  = grid->getNodeCoordinates(block, ix1, ix2, ix3);
+                    nodes.push_back(UbTupleFloat3(float(worldCoordinates[0]), float(worldCoordinates[1]),
+                                                  float(worldCoordinates[2])));
+
+                    distributions->getDistribution(f, ix1, ix2, ix3);
+                    calcMacros(f, rho, vx1, vx2, vx3);
+                    //double press = D3Q27System::getPressure(f); // D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
+
+                    if (UbMath::isNaN(rho) || UbMath::isInfinity(rho))
+                         UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+",node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+                        //rho = 999.0;
+                    //if (UbMath::isNaN(press) || UbMath::isInfinity(press))
+                        // UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number
+                        // -1.#INF in block="+block->toString()+",
+                        // node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+                        //press = 999.0;
+                    if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1))
+                         UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+                        //vx1 = 999.0;
+                    if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2))
+                         UB_THROW( UbException(UB_EXARGS,"vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+                        //vx2 = 999.0;
+                    if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3))
+                         UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+                        //vx3 = 999.0;
+
+                    data[index++].push_back(rho);
+                    data[index++].push_back(vx1);
+                    data[index++].push_back(vx2);
+                    data[index++].push_back(vx3);
+
+                    // shearRate = D3Q27System::getShearRate(f, collFactor);
+
+                    // LBMReal collFactorF = RheologyBinghamModelLBMKernel::getBinghamCollFactor(collFactor, yieldStress,
+                    // shearRate, rho);
+
+                    // data[index++].push_back(shearRate);
+                    // data[index++].push_back(collFactorF);
+
+                    // data[index++].push_back((rho+1.0) * conv->getFactorDensityLbToW() );
+                    // data[index++].push_back(vx1 * conv->getFactorVelocityLbToW());
+                    // data[index++].push_back(vx2 * conv->getFactorVelocityLbToW());
+                    // data[index++].push_back(vx3 * conv->getFactorVelocityLbToW());
+                    // data[index++].push_back((press * conv->getFactorPressureLbToW()) / ((rho+1.0) *
+                    // conv->getFactorDensityLbToW()));
+                    data[index++].push_back(level);
+                    // data[index++].push_back(blockID);
+                }
+            }
+        }
+    }
+    maxX1 -= 1;
+    maxX2 -= 1;
+    maxX3 -= 1;
+    // cell vector erstellen
+    for (int ix3 = minX3; ix3 <= maxX3; ix3++) {
+        for (int ix2 = minX2; ix2 <= maxX2; ix2++) {
+            for (int ix1 = minX1; ix1 <= maxX1; ix1++) {
+                if ((SWB = nodeNumbers(ix1, ix2, ix3)) >= 0 && (SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0 &&
+                    (NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0 && (NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0 &&
+                    (SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0 && (SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0 &&
+                    (NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0 &&
+                    (NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0) {
+                    cells.push_back(makeUbTuple((unsigned int)SWB, (unsigned int)SEB, (unsigned int)NEB,
+                                                (unsigned int)NWB, (unsigned int)SWT, (unsigned int)SET,
+                                                (unsigned int)NET, (unsigned int)NWT));
+                }
+            }
+        }
+    }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h
new file mode 100644
index 000000000..b617c912a
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h
@@ -0,0 +1,99 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file WriteMacroscopicQuantitiesPlusMassCoProcessor.h
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef WriteMacroscopicQuantitiesPlusMassCoProcessor_H
+#define WriteMacroscopicQuantitiesPlusMassCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+#include "UbTuple.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class LBMUnitConverter;
+class WbWriter;
+class Block3D;
+
+//! \brief A class writes macroscopic quantities information to a VTK-file
+class WriteMacroscopicQuantitiesPlusMassCoProcessor : public CoProcessor
+{
+public:
+    WriteMacroscopicQuantitiesPlusMassCoProcessor();
+    //! \brief Construct WriteMacroscopicQuantitiesPlusMassCoProcessor object
+    //! \pre The Grid3D and UbScheduler objects must exist
+    //! \param grid is observable Grid3D object
+    //! \param s is UbScheduler object for scheduling of observer
+    //! \param path is path of folder for output
+    //! \param writer is WbWriter object
+    //! \param conv is LBMUnitConverter object
+    //! \param comm is Communicator object
+    WriteMacroscopicQuantitiesPlusMassCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
+                                          WbWriter *const writer, SPtr<LBMUnitConverter> conv, SPtr<Communicator> comm);
+    ~WriteMacroscopicQuantitiesPlusMassCoProcessor() override = default;
+
+    void process(double step) override;
+
+protected:
+    //! Collect data for VTK-file
+    //! \param step is a time step
+    void collectData(double step);
+    //! Collect data for VTK-file
+    //! \param block is a time step
+    void addDataMQ(SPtr<Block3D> block);
+    void clearData();
+
+private:
+    void init();
+    std::vector<UbTupleFloat3> nodes;
+    std::vector<UbTupleUInt8> cells;
+    std::vector<std::string> datanames;
+    std::vector<std::vector<double>> data;
+    std::string path;
+    WbWriter *writer;
+    SPtr<LBMUnitConverter> conv;
+    std::vector<std::vector<SPtr<Block3D>>> blockVector;
+    int minInitLevel;
+    int maxInitLevel;
+    int gridRank;
+    SPtr<Communicator> comm;
+
+    using CalcMacrosFct = void (*)(const LBMReal *const &, LBMReal &, LBMReal &, LBMReal &, LBMReal &);
+    CalcMacrosFct calcMacros;
+};
+
+#endif
-- 
GitLab


From 2ac38a37359858439b42a54d189b8ef11b30e793 Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Thu, 8 Jul 2021 10:59:14 +0200
Subject: [PATCH 007/179] Add two PhaseFields support in
 Restart/Migration/MigrationBECoProcessors

---
 apps/cpu/LaminarTubeFlow/ltf.cfg              |   8 +-
 apps/cpu/LaminarTubeFlow/ltf.cpp              |   6 +-
 apps/cpu/Multiphase/Multiphase.cfg            |   4 +-
 apps/cpu/Multiphase/Multiphase.cpp            |   2 +-
 apps/cpu/ViskomatXL/viskomat.cfg              |   9 +-
 .../CoProcessors/MPIIOCoProcessor.cpp         |   3 +-
 .../MPIIOMigrationBECoProcessor.cpp           | 103 ++++++---
 .../MPIIOMigrationCoProcessor.cpp             | 106 +++++----
 .../CoProcessors/MPIIORestartCoProcessor.cpp  | 143 +++++++-----
 .../Utilities/CheckpointConverter.cpp         | 215 +++++++++---------
 .../Utilities/CheckpointConverter.h           |   2 +-
 11 files changed, 340 insertions(+), 261 deletions(-)

diff --git a/apps/cpu/LaminarTubeFlow/ltf.cfg b/apps/cpu/LaminarTubeFlow/ltf.cfg
index 94919cc34..7e409e1b6 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cfg
+++ b/apps/cpu/LaminarTubeFlow/ltf.cfg
@@ -16,11 +16,11 @@ Re = 10
 
 logToFile = false
 
-newStart = true
-restartStep = 100000
+newStart = false
+restartStep = 10
 
-cpStart = 100000
-cpStep = 100000
+cpStart = 10
+cpStep = 10
 
 outTime = 1
 endTime = 100
\ No newline at end of file
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index 71340ab65..e65631afd 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -107,9 +107,13 @@ void run(string configname)
       //////////////////////////////////////////////////////////////////////////
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname + "/mig", comm));
+      //SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname + "/mig", comm));
+      SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, pathname + "/mig", comm));
       migCoProcessor->setLBMKernel(kernel);
       migCoProcessor->setBCProcessor(bcProc);
+      migCoProcessor->setNu(nuLB);
+      migCoProcessor->setNuLG(0.01, 0.01);
+      migCoProcessor->setDensityRatio(1);
       //////////////////////////////////////////////////////////////////////////
 
       SPtr<D3Q27Interactor> inflowInt;
diff --git a/apps/cpu/Multiphase/Multiphase.cfg b/apps/cpu/Multiphase/Multiphase.cfg
index cb5a072c3..bdc9cc894 100644
--- a/apps/cpu/Multiphase/Multiphase.cfg
+++ b/apps/cpu/Multiphase/Multiphase.cfg
@@ -44,5 +44,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1
-endTime = 10
\ No newline at end of file
+outTime = 100
+endTime = 10000
\ No newline at end of file
diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index bb99f5efd..939c1f7b1 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -70,7 +70,7 @@ void run(string configname)
             }
         }
 
-         //Sleep(30000);
+        // Sleep(20000);
 
         // LBMReal dLB = 0; // = length[1] / dx;
         LBMReal rhoLB = 0.0;
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index e178a8b27..71228231e 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -7,13 +7,14 @@ availMem = 8e9
 logToFile = false
 
 blocknx = 16 16 16
-boundingBox = -4 171 -9.5 155.5 -76.5 82.5
+#boundingBox = -4 171 -9.5 155.5 -76.5 82.5
+boundingBox = -4 166 -9.5 155.5 -76.5 82.5
 deltax = 1
 
 refineLevel = 0
 
-nuLB = 1.5e-3
-OmegaLB = 4e-5
+#nuLB = 1.5e-4
+OmegaLB = 1e-5
 tau0 = 20e-7
 
 resolution = 32
@@ -25,5 +26,5 @@ restartStep = 100000
 cpStart = 10000
 cpStep = 10000
 
-outTime = 100
+outTime = 10000
 endTime = 100000
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
index a3572c8c4..fa5ab41b7 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
@@ -422,8 +422,7 @@ void MPIIOCoProcessor::clearAllFiles(int step)
     MPI_File_set_size(file_handler, new_size);
     MPI_File_close(&file_handler);
 
-    std::string filename6 =
-        path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageFluktuationsArray.bin";
+    std::string filename6 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageFluktuationsArray.bin";
     // MPI_File_delete(filename6.c_str(), info);
     int rc6 = MPI_File_open(MPI_COMM_WORLD, filename6.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
     if (rc6 != MPI_SUCCESS)
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 806dee56c..ef0abd06f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -116,7 +116,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
     int firstGlobalID;
     std::vector<double> doubleValuesArrayF; // double-values (arrays of f's) in all blocks  Fdistribution
     std::vector<double> doubleValuesArrayH1; // double-values (arrays of f's) in all blocks  H1distribution
-    // std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
+    std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
 
     if (comm->isRoot()) 
     {
@@ -124,7 +124,8 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
     DSArraysPresence arrPresence;
     bool firstBlock        = true;
     int doubleCountInBlock = 0;
@@ -146,19 +147,20 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
             D3Q27EsoTwist3DSplittedVectorPtrH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getHdistributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH1 != 0)
             {
-                multiPhase = true;
+                multiPhase1 = true;
                 localDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getLocalDistributions();
                 nonLocalDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getNonLocalDistributions();
                 zeroDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getZeroDistributions();
             }
 
-            /*D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
+            D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
             {
+                multiPhase2 = true;
                 localDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getLocalDistributions();
                 nonLocalDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getNonLocalDistributions();
                 zeroDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getZeroDistributions();
-            }*/
+            }
 
 
             if (firstBlock) // && block->getKernel()) // when first (any) valid block...
@@ -253,7 +255,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
             if (zeroDistributionsF && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                 doubleValuesArrayF.insert(doubleValuesArrayF.end(), zeroDistributionsF->getDataVector().begin(), zeroDistributionsF->getDataVector().end());
 
-            if (multiPhase)
+            if (multiPhase1)
             {
                 if (localDistributionsH1 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), localDistributionsH1->getDataVector().begin(), localDistributionsH1->getDataVector().end());
@@ -263,7 +265,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), zeroDistributionsH1->getDataVector().begin(), zeroDistributionsH1->getDataVector().end());
             }
 
-            /*if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
+            if (multiPhase2)
             {
                 if (localDistributionsH2 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
                 doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), localDistributionsH2->getDataVector().begin(), localDistributionsH2->getDataVector().end());
@@ -271,7 +273,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
                 doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), nonLocalDistributionsH2->getDataVector().begin(), nonLocalDistributionsH2->getDataVector().end());
                 if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                 doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end());
-            }*/
+            }
 
             ic++;
         }
@@ -316,7 +318,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
     MPI_File_close(&file_handler);
 
     //-------------------------------- H1 ------------------------------------------------
-    if (multiPhase)
+    if (multiPhase1)
     {
         filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
         rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
@@ -331,7 +333,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
     }
 
     //-------------------------------- H2 --------------------------------------------------
-    /*if (D3Q27EsoTwist3DSplittedVectorPtr2 != 0)
+    if (multiPhase2)
     {
         filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
         rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
@@ -343,7 +345,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
 
         MPI_File_sync(file_handler);
         MPI_File_close(&file_handler);
-    }    */
+    }
 
     //--------------------------------
 
@@ -1005,7 +1007,8 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
     dataSetParam dataSetParamStr1, dataSetParamStr2, dataSetParamStr3;
 
     int blocksCountAll   = grid->getNumberOfBlocks(); // quantity of all blocks in the grid
@@ -1039,7 +1042,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
         dataSetParamStr3.nx[0] * dataSetParamStr3.nx[1] * dataSetParamStr3.nx[2] * dataSetParamStr3.nx[3];
     std::vector<double> doubleValuesArrayF(size_t(myBlocksCount * doubleCountInBlock)); // double-values in all blocks  Fdistributions
     std::vector<double> doubleValuesArrayH1; // double-values in all blocks  H1distributions
-    //std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
+    std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
 
     MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
     MPI_Type_commit(&dataSetDoubleType);
@@ -1059,7 +1062,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     int fs = MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
-        multiPhase = true;
+        multiPhase1 = true;
         doubleValuesArrayH1.resize(myBlocksCount * doubleCountInBlock);
 
         read_offset = (MPI_Offset)(indexB * doubleCountInBlock * sizeof(double)) ;
@@ -1067,6 +1070,22 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     }
     MPI_File_close(&file_handler);
 
+    //--------------------------------- H2 ---------------------------------------------------------
+    filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
+    rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+    fs = MPI_File_get_size(file_handler, &fsize);
+    if (fsize > 0)
+    {
+        multiPhase2 = true;
+        doubleValuesArrayH2.resize(myBlocksCount * doubleCountInBlock);
+
+        read_offset = (MPI_Offset)(indexB * doubleCountInBlock * sizeof(double));
+        MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH2[0], int(myBlocksCount), dataSetDoubleType, MPI_STATUS_IGNORE);
+    }
+    MPI_File_close(&file_handler);
+
     MPI_Type_free(&dataSetDoubleType);
 
     if (comm->isRoot()) 
@@ -1084,17 +1103,20 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     
 
     std::vector<double>* rawDataReceiveH1 = new std::vector<double>[size];
-    if (multiPhase)
+    if (multiPhase1)
     {
         for (int r = 0; r < size; r++)
             rawDataReceiveH1[r].resize(0);
         blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayH1, rawDataReceiveH1);
     }
 
-    /*    std::vector<double>* rawDataReceiveH2 = new std::vector<double>[size];
+    std::vector<double>* rawDataReceiveH2 = new std::vector<double>[size];
+    if (multiPhase2)
+    {
         for (int r = 0; r < size; r++)
             rawDataReceiveH2[r].resize(0);
-        blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayH2, rawDataReceiveH2);*/
+        blocksExchange(MESSAGE_TAG, indexB, indexE, int(doubleCountInBlock), doubleValuesArrayH2, rawDataReceiveH2);
+    }
 
     if (comm->isRoot())
     {
@@ -1108,7 +1130,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     int blockID;
     std::vector<double> vectorsOfValuesF1, vectorsOfValuesF2, vectorsOfValuesF3;
     std::vector<double> vectorsOfValuesH11, vectorsOfValuesH12, vectorsOfValuesH13;
-    //std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
+    std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
 
     size_t vectorSize1 = dataSetParamStr1.nx[0] * dataSetParamStr1.nx[1] * dataSetParamStr1.nx[2] * dataSetParamStr1.nx[3];
     size_t vectorSize2 = dataSetParamStr2.nx[0] * dataSetParamStr2.nx[1] * dataSetParamStr2.nx[2] * dataSetParamStr2.nx[3];
@@ -1124,21 +1146,24 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             index += 1;
 
             vectorsOfValuesF1.assign(rawDataReceiveF[r].data() + index, rawDataReceiveF[r].data() + index + vectorSize1);
-            if(multiPhase)
+            if(multiPhase1)
                 vectorsOfValuesH11.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize1);
-            //vectorsOfValuesH21.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize1);
+            if (multiPhase2)
+                vectorsOfValuesH21.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize1);
             index += vectorSize1;
 
             vectorsOfValuesF2.assign(rawDataReceiveF[r].data() + index, rawDataReceiveF[r].data() + index + vectorSize2);
-            if (multiPhase)
+            if (multiPhase1)
                 vectorsOfValuesH12.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize2);
-            //vectorsOfValuesH22.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize2);
+            if (multiPhase2)
+                vectorsOfValuesH22.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize2);
             index += vectorSize2;
 
             vectorsOfValuesF3.assign(rawDataReceiveF[r].data() + index, rawDataReceiveF[r].data() + index + vectorSize3);
-            if (multiPhase)
+            if (multiPhase1)
                 vectorsOfValuesH13.assign(rawDataReceiveH1[r].data() + index, rawDataReceiveH1[r].data() + index + vectorSize3);
-                //vectorsOfValuesH23.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize3);
+            if (multiPhase2)
+                vectorsOfValuesH23.assign(rawDataReceiveH2[r].data() + index, rawDataReceiveH2[r].data() + index + vectorSize3);
             index += vectorSize3;
 
             SPtr<DistributionArray3D> mFdistributions(new D3Q27EsoTwist3DSplittedVector());
@@ -1154,7 +1179,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr1.nx3);
 
             SPtr<DistributionArray3D> mH1distributions(new D3Q27EsoTwist3DSplittedVector());
-            if (multiPhase)
+            if (multiPhase1)
             {
                 dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
                     new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH11, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
@@ -1168,17 +1193,20 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
                 dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setNX3(dataSetParamStr1.nx3);
             }
 
-            /*SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+            SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
+            if (multiPhase2)
+            {
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
                     new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH21, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                    new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
-                    vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
-
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
-            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);*/
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+                        new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                        vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
+
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
+                dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);
+            }
 
             // find the nesessary block and fill it
             SPtr<Block3D> block = grid->getBlock(blockID);
@@ -1194,9 +1222,10 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             kernel->setDensityRatio(this->densityRatio);
             SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D());
             dataSetPtr->setFdistributions(mFdistributions);
-            if (multiPhase)
+            if (multiPhase1)
                 dataSetPtr->setHdistributions(mH1distributions);
-//            dataSetPtr->setHdistributions(mH2distributions);
+            if (multiPhase2)
+                dataSetPtr->setH2distributions(mH2distributions);
             kernel->setDataSet(dataSetPtr);
             block->setKernel(kernel);
         }
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index d0ce025fd..a34e1b4ca 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -134,7 +134,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
     DataSetMigration *dataSetArray = new DataSetMigration[blocksCount];
     std::vector<double> doubleValuesArrayF; // double-values (arrays of f's) in all blocks  Fdistribution
     std::vector<double> doubleValuesArrayH1; // double-values (arrays of f's) in all blocks  H1distribution
-    // std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
+    std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
 
     if (comm->isRoot()) 
     {
@@ -142,7 +142,8 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
     DSArraysPresence arrPresence;
     bool firstBlock           = true;
     size_t doubleCountInBlock = 0;
@@ -178,19 +179,20 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
             D3Q27EsoTwist3DSplittedVectorPtrH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getHdistributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH1 != 0)
             {
-                multiPhase = true;
+                multiPhase1 = true;
                 localDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getLocalDistributions();
                 nonLocalDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getNonLocalDistributions();
                 zeroDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getZeroDistributions();
             }
 
-            /*D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
+            D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
             {
+                multiPhase2 = true;
                 localDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getLocalDistributions();
                 nonLocalDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getNonLocalDistributions();
                 zeroDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getZeroDistributions();
-            }*/
+            }
 
             if (firstBlock) // && block->getKernel()) // when first (any) valid block...
             {
@@ -284,7 +286,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
             if (zeroDistributionsF && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                 doubleValuesArrayF.insert(doubleValuesArrayF.end(), zeroDistributionsF->getDataVector().begin(), zeroDistributionsF->getDataVector().end());
 
-            if (multiPhase)
+            if (multiPhase1)
             {
                 if (localDistributionsH1 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), localDistributionsH1->getDataVector().begin(), localDistributionsH1->getDataVector().end());
@@ -294,7 +296,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), zeroDistributionsH1->getDataVector().begin(), zeroDistributionsH1->getDataVector().end());
             }
 
-            /*if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
+            if (multiPhase2)
             {
                 if (localDistributionsH2 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
                     doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), localDistributionsH2->getDataVector().begin(), localDistributionsH2->getDataVector().end());
@@ -302,7 +304,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
                     doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), nonLocalDistributionsH2->getDataVector().begin(), nonLocalDistributionsH2->getDataVector().end());
                 if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                     doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end());
-            }*/
+            }
 
             ic++;
         }
@@ -354,7 +356,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
     MPI_File_close(&file_handler);
 
     //-------------------------------- H1 ----------------------------------------------------
-    if (multiPhase)
+    if (multiPhase1)
     {
         filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
         rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
@@ -374,7 +376,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
     }
 
     //-------------------------------- H2 ----------------------------------------------------
-    /*if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
+    if (multiPhase2)
     {
         filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
         rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
@@ -391,7 +393,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
 
         MPI_File_sync(file_handler);
         MPI_File_close(&file_handler);
-    }*/
+    }
     //--------------------------------
 
     MPI_Type_free(&dataSetDoubleType);
@@ -1646,7 +1648,8 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     if (comm->isRoot())
         start = MPI_Wtime();
 
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
     size_t blocksCount = 0; // quantity of the blocks, that belong to this process
     dataSetParam dataSetParamStr1, dataSetParamStr2, dataSetParamStr3;
 
@@ -1677,7 +1680,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
         dataSetParamStr3.nx[0] * dataSetParamStr3.nx[1] * dataSetParamStr3.nx[2] * dataSetParamStr3.nx[3];
     std::vector<double> doubleValuesArrayF(size_t(blocksCount * doubleCountInBlock)); // double-values in all blocks  Fdistributions
     std::vector<double> doubleValuesArrayH1; // double-values in all blocks  H1distributions
-    //std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
+    std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
 
     // define MPI_types depending on the block-specific information
     MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
@@ -1710,7 +1713,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     int fs = MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
-        multiPhase = true;
+        multiPhase1 = true;
         doubleValuesArrayH1.resize(blocksCount * doubleCountInBlock);
 
         sizeofOneDataSet = size_t(doubleCountInBlock * sizeof(double));
@@ -1729,25 +1732,31 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     MPI_File_close(&file_handler);
 
     //----------------------------------------- H2 ----------------------------------------------------
-  /*filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
+    filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
     rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
 
-    sizeofOneDataSet = size_t(doubleCountInBlock * sizeof(double));
-    doubleValuesArrayH2.resize(blocksCount * doubleCountInBlock);
-
-    for (int level = minInitLevel; level <= maxInitLevel; level++) 
+    fs = MPI_File_get_size(file_handler, &fsize);
+    if (fsize > 0)
     {
-        for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
+        multiPhase2 = true;
+        doubleValuesArrayH2.resize(blocksCount * doubleCountInBlock);
+
+        sizeofOneDataSet = size_t(doubleCountInBlock * sizeof(double));
+
+        for (int level = minInitLevel; level <= maxInitLevel; level++)
         {
-            read_offset = (MPI_Offset)(block->getGlobalID() * sizeofOneDataSet);
-            MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH2[ic * doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-            ic++;
+            for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
+            {
+                read_offset = (MPI_Offset)(block->getGlobalID() * sizeofOneDataSet);
+                MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH2[ic * doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
+                ic++;
+            }
         }
-    }
 
-    MPI_File_close(&file_handler);*/
+    }
+    MPI_File_close(&file_handler);
 
     MPI_Type_free(&dataSetDoubleType);
 
@@ -1762,7 +1771,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     size_t index = 0;
     std::vector<double> vectorsOfValuesF1, vectorsOfValuesF2, vectorsOfValuesF3;
     std::vector<double> vectorsOfValuesH11, vectorsOfValuesH12, vectorsOfValuesH13;
-    //std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
+    std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
 
     size_t vectorSize1 = dataSetParamStr1.nx[0] * dataSetParamStr1.nx[1] * dataSetParamStr1.nx[2] * dataSetParamStr1.nx[3];
     size_t vectorSize2 = dataSetParamStr2.nx[0] * dataSetParamStr2.nx[1] * dataSetParamStr2.nx[2] * dataSetParamStr2.nx[3];
@@ -1771,21 +1780,24 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     for (std::size_t n = 0; n < blocksCount; n++) 
     {
         vectorsOfValuesF1.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize1);
-        if(multiPhase)
+        if(multiPhase1)
             vectorsOfValuesH11.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize1);
-        //vectorsOfValuesH21.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize1);
+        if (multiPhase2)
+            vectorsOfValuesH21.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize1);
         index += vectorSize1;
 
         vectorsOfValuesF2.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize2);
-        if (multiPhase)
+        if (multiPhase1)
             vectorsOfValuesH12.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize2);
-        //vectorsOfValuesH22.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize2);
+        if (multiPhase2)
+            vectorsOfValuesH22.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize2);
         index += vectorSize2;
 
         vectorsOfValuesF3.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize3);
-        if (multiPhase)
+        if (multiPhase1)
             vectorsOfValuesH13.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize3);
-        //vectorsOfValuesH23.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize3);
+        if (multiPhase2)
+            vectorsOfValuesH23.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize3);
         index += vectorSize3;
 
         SPtr<DistributionArray3D> mFdistributions(new D3Q27EsoTwist3DSplittedVector());
@@ -1801,7 +1813,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
         dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr1.nx3);
 
        SPtr<DistributionArray3D> mH1distributions(new D3Q27EsoTwist3DSplittedVector());
-       if (multiPhase)
+       if (multiPhase1)
         {
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
                 new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH11, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
@@ -1815,17 +1827,20 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setNX3(dataSetParamStr1.nx3);
          }
 
-        /*SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+        SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
+        if (multiPhase2)
+        {
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
                 new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH21, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
-                vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
-
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);*/
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+                    new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                    vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
+
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);
+        }
 
         // find the nesessary block and fill it
         SPtr<Block3D> block = grid->getBlock(dataSetArray[n].globalID);
@@ -1841,9 +1856,10 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
 
         SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D());
         dataSetPtr->setFdistributions(mFdistributions);
-        if (multiPhase)
+        if (multiPhase1)
             dataSetPtr->setHdistributions(mH1distributions);
-        //dataSetPtr->setH2distributions(mH2distributions);
+        if (multiPhase2)
+            dataSetPtr->setH2distributions(mH2distributions);
         kernel->setDataSet(dataSetPtr);
         block->setKernel(kernel);
     }
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 49277be64..f75aaa58f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -140,7 +140,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
     DataSetRestart *dataSetArray = new DataSetRestart[blocksCount];
     std::vector<double> doubleValuesArrayF; // double-values (arrays of f's) in all blocks  Fdistribution
     std::vector<double> doubleValuesArrayH1; // double-values (arrays of f's) in all blocks  H1distribution
-    // std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
+    std::vector<double> doubleValuesArrayH2; // double-values (arrays of f's) in all blocks  H2distribution
 
     if (comm->isRoot()) 
     {
@@ -148,7 +148,8 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
     DSArraysPresence arrPresence;
     bool firstBlock        = true;
     int doubleCountInBlock = 0;
@@ -188,36 +189,40 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
             D3Q27EsoTwist3DSplittedVectorPtrH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getHdistributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH1 != 0)
             {
-                multiPhase = true;
+                multiPhase1 = true;
                 localDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getLocalDistributions();
                 nonLocalDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getNonLocalDistributions();
                 zeroDistributionsH1 = D3Q27EsoTwist3DSplittedVectorPtrH1->getZeroDistributions();
             }
 
-            /*D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
+            D3Q27EsoTwist3DSplittedVectorPtrH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getH2distributions());
             if (D3Q27EsoTwist3DSplittedVectorPtrH2 != 0)
             {
+                multiPhase2 = true;
                 localDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getLocalDistributions();
                 nonLocalDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getNonLocalDistributions();
                 zeroDistributionsH2 = D3Q27EsoTwist3DSplittedVectorPtrH2->getZeroDistributions();
-            }*/
+            }
 
             if (firstBlock) // when first (any) valid block...
             {
-                if (localDistributionsF) {
+                if (localDistributionsF) 
+                {
                     dataSetParamStr1.nx[0] = static_cast<int>(localDistributionsF->getNX1());
                     dataSetParamStr1.nx[1] = static_cast<int>(localDistributionsF->getNX2());
                     dataSetParamStr1.nx[2] = static_cast<int>(localDistributionsF->getNX3());
                     dataSetParamStr1.nx[3] = static_cast<int>(localDistributionsF->getNX4());
                 }
 
-                if (nonLocalDistributionsF) {
+                if (nonLocalDistributionsF) 
+                {
                     dataSetParamStr2.nx[0] = static_cast<int>(nonLocalDistributionsF->getNX1());
                     dataSetParamStr2.nx[1] = static_cast<int>(nonLocalDistributionsF->getNX2());
                     dataSetParamStr2.nx[2] = static_cast<int>(nonLocalDistributionsF->getNX3());
                     dataSetParamStr2.nx[3] = static_cast<int>(nonLocalDistributionsF->getNX4());
                 }
-                if (zeroDistributionsF) {
+                if (zeroDistributionsF) 
+                {
                     dataSetParamStr3.nx[0] = static_cast<int>(zeroDistributionsF->getNX1());
                     dataSetParamStr3.nx[1] = static_cast<int>(zeroDistributionsF->getNX2());
                     dataSetParamStr3.nx[2] = static_cast<int>(zeroDistributionsF->getNX3());
@@ -291,7 +296,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
             if (zeroDistributionsF && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                 doubleValuesArrayF.insert(doubleValuesArrayF.end(), zeroDistributionsF->getDataVector().begin(), zeroDistributionsF->getDataVector().end());
 
-            if (multiPhase)
+            if (multiPhase1)
             {
                 if (localDistributionsH1 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), localDistributionsH1->getDataVector().begin(), localDistributionsH1->getDataVector().end());
@@ -300,15 +305,17 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
                 if (zeroDistributionsH1 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                     doubleValuesArrayH1.insert(doubleValuesArrayH1.end(), zeroDistributionsH1->getDataVector().begin(), zeroDistributionsH1->getDataVector().end());
             }
-
-            /*if (localDistributionsH2 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
-                doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), localDistributionsH2->getDataVector().begin(), localDistributionsH2->getDataVector().end());
-            if (nonLocalDistributionsH2 && (dataSetParamStr2.nx[0] > 0) && (dataSetParamStr2.nx[1] > 0) && (dataSetParamStr2.nx[2] > 0) && (dataSetParamStr2.nx[3] > 0))
-                doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), nonLocalDistributionsH2->getDataVector().begin(), nonLocalDistributionsH2->getDataVector().end());
-            if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
-                doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end());*/
-
-            ic++;
+            if (multiPhase2)
+            {
+                if (localDistributionsH2 && (dataSetParamStr1.nx[0] > 0) && (dataSetParamStr1.nx[1] > 0) && (dataSetParamStr1.nx[2] > 0) && (dataSetParamStr1.nx[3] > 0))
+                    doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), localDistributionsH2->getDataVector().begin(), localDistributionsH2->getDataVector().end());
+                if (nonLocalDistributionsH2 && (dataSetParamStr2.nx[0] > 0) && (dataSetParamStr2.nx[1] > 0) && (dataSetParamStr2.nx[2] > 0) && (dataSetParamStr2.nx[3] > 0))
+                    doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), nonLocalDistributionsH2->getDataVector().begin(), nonLocalDistributionsH2->getDataVector().end());
+                if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
+                    doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end());
+             }
+
+           ic++;
         }
     }
 
@@ -379,7 +386,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
     MPI_File_close(&file_handler);
 
     //------------------------------------------------------------------------------------------------------------------
-    if (multiPhase)
+    if (multiPhase1)
     {
         filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
         rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
@@ -394,20 +401,23 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
         MPI_File_close(&file_handler);
     }
 
-    //--------------------------------------------------------------------------------------------------------------------
-    /*filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
-    rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-    if (rc != MPI_SUCCESS)
-        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+        //--------------------------------------------------------------------------------------------------------------------
+    if (multiPhase2)
+    {
+        filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
+        rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
+        if (rc != MPI_SUCCESS)
+            throw UbException(UB_EXARGS, "couldn't open file " + filename);
 
-    // each process writes the dataSet arrays
-    if (doubleValuesArrayH1.size() > 0)
-        MPI_File_write_at(file_handler, write_offset, &doubleValuesArrayH2[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+        // each process writes the dataSet arrays
+        if (doubleValuesArrayH2.size() > 0)
+            MPI_File_write_at(file_handler, write_offset, &doubleValuesArrayH2[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
 
-    MPI_File_sync(file_handler);
-    MPI_File_close(&file_handler);*/
+        MPI_File_sync(file_handler);
+        MPI_File_close(&file_handler);
+    }
+    //------------------------------------------------------------------------------------------------------------------------
 
-    //--------------------------------
     MPI_Type_free(&dataSetDoubleType);
 
     delete[] dataSetArray;
@@ -1665,7 +1675,8 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     // calculate the read offset
     MPI_Offset read_offset  = (MPI_Offset)(size * sizeof(int));
     size_t next_read_offset = 0;
-    bool multiPhase = false;
+    bool multiPhase1 = false;
+    bool multiPhase2 = false;
 
     // read count of blocks
     int blocksCount = 0;
@@ -1682,7 +1693,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
         dataSetParamStr3.nx[0] * dataSetParamStr3.nx[1] * dataSetParamStr3.nx[2] * dataSetParamStr3.nx[3];
     std::vector<double> doubleValuesArrayF(size_t(blocksCount * doubleCountInBlock)); // double-values in all blocks  Fdistributions
     std::vector<double> doubleValuesArrayH1; // double-values in all blocks  H1distributions
-    //std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
+    std::vector<double> doubleValuesArrayH2; // double-values in all blocks  H2distributions
 
     //   define MPI_types depending on the block-specific information
     MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
@@ -1718,21 +1729,27 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     int fs = MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
-        multiPhase = true;
+        multiPhase1 = true;
         doubleValuesArrayH1.resize(blocksCount * doubleCountInBlock);
         MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH1[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
     }
     MPI_File_close(&file_handler);
 
     //-------------------------------------- H2 -----------------------------
-       /*filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
+    filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
     rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
 
-    doubleValuesArrayH2.resize(blocksCount * doubleCountInBlock);
-    MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH2[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
-    MPI_File_close(&file_handler);*/
+    fs = MPI_File_get_size(file_handler, &fsize);
+    if (fsize > 0)
+    {
+        multiPhase2 = true;
+        doubleValuesArrayH2.resize(blocksCount * doubleCountInBlock);
+        MPI_File_read_at(file_handler, read_offset, &doubleValuesArrayH2[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+    }
+    MPI_File_close(&file_handler);
+    //-------------------------------------------------------------------
 
     MPI_Type_free(&dataSetDoubleType);
 
@@ -1747,7 +1764,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     size_t index = 0;
     std::vector<double> vectorsOfValuesF1, vectorsOfValuesF2, vectorsOfValuesF3;
     std::vector<double> vectorsOfValuesH11, vectorsOfValuesH12, vectorsOfValuesH13;
-    //std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
+    std::vector<double> vectorsOfValuesH21, vectorsOfValuesH22, vectorsOfValuesH23;
     size_t vectorSize1 = dataSetParamStr1.nx[0] * dataSetParamStr1.nx[1] * dataSetParamStr1.nx[2] * dataSetParamStr1.nx[3];
     size_t vectorSize2 = dataSetParamStr2.nx[0] * dataSetParamStr2.nx[1] * dataSetParamStr2.nx[2] * dataSetParamStr2.nx[3];
     size_t vectorSize3 = dataSetParamStr3.nx[0] * dataSetParamStr3.nx[1] * dataSetParamStr3.nx[2] * dataSetParamStr3.nx[3];
@@ -1755,21 +1772,24 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     for (int n = 0; n < blocksCount; n++) 
     {
         vectorsOfValuesF1.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize1);
-        if (multiPhase)
+        if (multiPhase1)
             vectorsOfValuesH11.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize1);
-        //vectorsOfValuesH21.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize1);
+        if (multiPhase2)
+            vectorsOfValuesH21.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize1);
         index += vectorSize1;
 
         vectorsOfValuesF2.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize2);
-        if (multiPhase)
+        if (multiPhase1)
             vectorsOfValuesH12.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize2);
-        //vectorsOfValuesH22.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize2);
+        if (multiPhase2)
+            vectorsOfValuesH22.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize2);
         index += vectorSize2;
 
         vectorsOfValuesF3.assign(doubleValuesArrayF.data() + index, doubleValuesArrayF.data() + index + vectorSize3);
-        if (multiPhase)
+        if (multiPhase1)
             vectorsOfValuesH13.assign(doubleValuesArrayH1.data() + index, doubleValuesArrayH1.data() + index + vectorSize3);
-        //vectorsOfValuesH23.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize3);
+        if (multiPhase2)
+            vectorsOfValuesH23.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize3);
         index += vectorSize3;
 
         SPtr<DistributionArray3D> mFdistributions(new D3Q27EsoTwist3DSplittedVector());
@@ -1785,7 +1805,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
         dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr1.nx3);
 
         SPtr<DistributionArray3D> mH1distributions(new D3Q27EsoTwist3DSplittedVector());
-        if (multiPhase)
+        if (multiPhase1)
         {
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
                 new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH11, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
@@ -1798,18 +1818,22 @@ void MPIIORestartCoProcessor::readDataSet(int step)
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setNX2(dataSetParamStr1.nx2);
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH1distributions)->setNX3(dataSetParamStr1.nx3);
         }
-        /*SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH21, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
-                vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
-
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);*/
-         
+
+        SPtr<DistributionArray3D> mH2distributions(new D3Q27EsoTwist3DSplittedVector());
+        if (multiPhase2)
+        {
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+                    new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH21, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
+                    new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesH22, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                    vectorsOfValuesH23, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
+
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX1(dataSetParamStr1.nx1);
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX2(dataSetParamStr1.nx2);
+            dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);
+        }
+
         // find the nesessary block and fill it
         SPtr<Block3D> block = grid->getBlock(dataSetArray[n].x1, dataSetArray[n].x2, dataSetArray[n].x3, dataSetArray[n].level);
    
@@ -1825,9 +1849,10 @@ void MPIIORestartCoProcessor::readDataSet(int step)
 
         SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D());
         dataSetPtr->setFdistributions(mFdistributions);
-        if (multiPhase)
+        if (multiPhase1)
             dataSetPtr->setHdistributions(mH1distributions);
-        //dataSetPtr->setH2distributions(mH2distributions);
+        if (multiPhase2)
+            dataSetPtr->setH2distributions(mH2distributions);
         kernel->setDataSet(dataSetPtr);
         block->setKernel(kernel);
     }
diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
index b66eff480..78001c1d5 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
@@ -77,7 +77,7 @@ CheckpointConverter::CheckpointConverter(SPtr<Grid3D> grid, const std::string &p
     //---------------------------------------
 
     MPI_Datatype typesDataSetRead[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR };
-    int blocksDataSetRead[3]         = { 3, 5, 2 };
+    int blocksDataSetRead[3]         = { 5, 5, 2 };
     MPI_Aint offsetsDataSetRead[3], lbDataSetRead, extentDataSetRead;
 
     offsetsDataSetRead[0] = 0;
@@ -93,7 +93,7 @@ CheckpointConverter::CheckpointConverter(SPtr<Grid3D> grid, const std::string &p
     //-----------------------------------------------------------------------
 
     MPI_Datatype typesDataSetWrite[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR };
-    int blocksDataSetWrite[3]         = { 2, 2, 2 };
+    int blocksDataSetWrite[3]         = { 5, 2, 2 };
     MPI_Aint offsetsDataSetWrite[3], lbDataSetWrite, extentDataSetWrite;
 
     offsetsDataSetWrite[0] = 0;
@@ -147,8 +147,7 @@ void CheckpointConverter::convertBlocks(int step, int procCount)
     MPI_File file_handlerW;
     UbSystem::makeDirectory(path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step));
     std::string filenameW = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBlocks.bin";
-    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL,
-                            &file_handlerW);
+    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handlerW);
     if (rcW != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filenameW);
 
@@ -159,21 +158,21 @@ void CheckpointConverter::convertBlocks(int step, int procCount)
     GridParam *gridParameters = new GridParam;
 
     // calculate the read offset
-    procCount =
-        1; // readBlocks and writeBlocks in both MPIIORestartCoProcessor and MPIIOMigrationCoProcessor have size == 1!
+    procCount = 1; // readBlocks and writeBlocks in both MPIIORestartCoProcessor and MPIIOMigrationCoProcessor have size == 1!
     MPI_Offset read_offset = (MPI_Offset)(procCount * sizeof(int));
 
     // read parameters of the grid and blocks
     MPI_File_read_at(file_handlerR, read_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE);
-    MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(GridParam)), &block3dArray[0], blocksCount,
-                     block3dType, MPI_STATUS_IGNORE);
+    MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE);
 
     // clear the grid
     std::vector<SPtr<Block3D>> blocksVector[25];
     int minInitLevel = this->grid->getCoarsestInitializedLevel();
-    if (minInitLevel > -1) {
+    if (minInitLevel > -1) 
+    {
         int maxInitLevel = this->grid->getFinestInitializedLevel();
-        for (int level = minInitLevel; level <= maxInitLevel; level++) {
+        for (int level = minInitLevel; level <= maxInitLevel; level++) 
+        {
             grid->getBlocks(level, blocksVector[level]);
             for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
                 grid->deleteBlock(block);
@@ -233,9 +232,9 @@ void CheckpointConverter::convertBlocks(int step, int procCount)
     grid->setPeriodicX3(gridParameters->periodicX3);
 
     // regenerate blocks
-    for (int n = 0; n < blocksCount; n++) {
-        SPtr<Block3D> block(
-            new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level));
+    for (int n = 0; n < blocksCount; n++) 
+    {
+        SPtr<Block3D> block(new Block3D(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level));
         block->setActive(block3dArray[n].active);
         block->setBundle(block3dArray[n].bundle);
         block->setRank(block3dArray[n].rank);
@@ -255,7 +254,8 @@ void CheckpointConverter::convertBlocks(int step, int procCount)
 
     // refresh globalID in all the blocks
     SPtr<Block3D> block;
-    for (int n = 0; n < blocksCount; n++) {
+    for (int n = 0; n < blocksCount; n++) 
+    {
         block = grid->getBlock(block3dArray[n].x1, block3dArray[n].x2, block3dArray[n].x3, block3dArray[n].level);
         block3dArray[n].globalID = block->getGlobalID();
     }
@@ -265,8 +265,7 @@ void CheckpointConverter::convertBlocks(int step, int procCount)
 
     MPI_File_write_at(file_handlerW, 0, &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
     MPI_File_write_at(file_handlerW, write_offset, gridParameters, 1, gridParamType, MPI_STATUS_IGNORE);
-    MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(GridParam)), &block3dArray[0], blocksCount,
-                      block3dType, MPI_STATUS_IGNORE);
+    MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(GridParam)), &block3dArray[0], blocksCount, block3dType, MPI_STATUS_IGNORE);
 
     MPI_File_close(&file_handlerR);
     MPI_File_close(&file_handlerW);
@@ -282,19 +281,31 @@ void CheckpointConverter::convertDataSet(int step, int procCount)
 {
     // file to read from
     MPI_File file_handlerR;
-    std::string filenameR = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin";
+    std::string filenameR = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetF.bin";
     int rcR = MPI_File_open(MPI_COMM_WORLD, filenameR.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handlerR);
     if (rcR != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filenameR);
 
     // file to write to
     MPI_File file_handlerW;
-    std::string filenameW = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSet.bin";
-    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL,
-                            &file_handlerW);
+    std::string filenameW = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetF.bin";
+    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handlerW);
     if (rcW != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filenameW);
 
+    MPI_File file_handlerR1;
+    std::string filenameR1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
+    rcR = MPI_File_open(MPI_COMM_WORLD, filenameR1.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handlerR1);
+    if (rcR != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filenameR1);
+
+    MPI_File file_handlerW1;
+    std::string filenameW1 = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
+    rcW = MPI_File_open(MPI_COMM_WORLD, filenameW1.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handlerW1);
+    if (rcW != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filenameW1);
+
+    MPI_Offset fsize;
     double start, finish;
     start = MPI_Wtime();
 
@@ -304,22 +315,21 @@ void CheckpointConverter::convertDataSet(int step, int procCount)
     DataSetMigration *dataSetWriteArray;
     size_t doubleCountInBlock;
     std::vector<double> doubleValuesArray;
+    std::vector<double> doubleValuesArrayH1; // double-values in all blocks  H1distributions
     size_t sizeofOneDataSet;
 
     // calculate the read offset
     MPI_Offset read_offset = (MPI_Offset)(procCount * sizeof(int));
     MPI_Offset write_offset;
 
-    for (int pc = 0; pc < procCount; pc++) {
+    for (int pc = 0; pc < procCount; pc++) 
+    {
         // read count of blocks and parameters of data arrays
         MPI_File_read_at(file_handlerR, (MPI_Offset)(pc * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
         MPI_File_read_at(file_handlerR, read_offset, &dataSetParamStr1, 1, dataSetParamType, MPI_STATUS_IGNORE);
-        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(dataSetParam)), &dataSetParamStr2, 1,
-                         dataSetParamType, MPI_STATUS_IGNORE);
-        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + 2 * sizeof(dataSetParam)), &dataSetParamStr3, 1,
-                         dataSetParamType, MPI_STATUS_IGNORE);
-        doubleCountInBlock =
-            dataSetParamStr1.nx[0] * dataSetParamStr1.nx[1] * dataSetParamStr1.nx[2] * dataSetParamStr1.nx[3] +
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(dataSetParam)), &dataSetParamStr2, 1, dataSetParamType, MPI_STATUS_IGNORE);
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + 2 * sizeof(dataSetParam)), &dataSetParamStr3, 1, dataSetParamType, MPI_STATUS_IGNORE);
+        doubleCountInBlock = dataSetParamStr1.nx[0] * dataSetParamStr1.nx[1] * dataSetParamStr1.nx[2] * dataSetParamStr1.nx[3] +
             dataSetParamStr2.nx[0] * dataSetParamStr2.nx[1] * dataSetParamStr2.nx[2] * dataSetParamStr2.nx[3] +
             dataSetParamStr3.nx[0] * dataSetParamStr3.nx[1] * dataSetParamStr3.nx[2] * dataSetParamStr3.nx[3];
 
@@ -327,56 +337,77 @@ void CheckpointConverter::convertDataSet(int step, int procCount)
         dataSetWriteArray = new DataSetMigration[blocksCount];
         doubleValuesArray.resize(blocksCount * doubleCountInBlock);
 
+        MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
+        MPI_Type_commit(&dataSetDoubleType);
+
         // read data
         MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + 3 * sizeof(dataSetParam)), dataSetReadArray,
                          blocksCount, dataSetTypeRead, MPI_STATUS_IGNORE);
-        MPI_File_read_at(file_handlerR,
-                         (MPI_Offset)(read_offset + 3 * sizeof(dataSetParam) + blocksCount * sizeof(DataSetRestart)),
-                         &doubleValuesArray[0], int(blocksCount * doubleCountInBlock), MPI_DOUBLE, MPI_STATUS_IGNORE);
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + 3 * sizeof(dataSetParam) + blocksCount * sizeof(DataSetRestart)),
+                         &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
 
         // offset to read the data of the next process
-        read_offset =
-            read_offset + (MPI_Offset)(3 * sizeof(dataSetParam) +
-                                       blocksCount * (sizeof(DataSetRestart) + doubleCountInBlock * sizeof(double)));
+        read_offset = read_offset + (MPI_Offset)(3 * sizeof(dataSetParam) + blocksCount * (sizeof(DataSetRestart) + doubleCountInBlock * sizeof(double)));
 
         // write parameters of data arrays
         MPI_File_write_at(file_handlerW, (MPI_Offset)0, &dataSetParamStr1, 1, dataSetParamType, MPI_STATUS_IGNORE);
-        MPI_File_write_at(file_handlerW, (MPI_Offset)(sizeof(dataSetParam)), &dataSetParamStr2, 1, dataSetParamType,
-                          MPI_STATUS_IGNORE);
-        MPI_File_write_at(file_handlerW, (MPI_Offset)(2 * sizeof(dataSetParam)), &dataSetParamStr3, 1, dataSetParamType,
-                          MPI_STATUS_IGNORE);
+        MPI_File_write_at(file_handlerW, (MPI_Offset)(sizeof(dataSetParam)), &dataSetParamStr2, 1, dataSetParamType, MPI_STATUS_IGNORE);
+        MPI_File_write_at(file_handlerW, (MPI_Offset)(2 * sizeof(dataSetParam)), &dataSetParamStr3, 1, dataSetParamType, MPI_STATUS_IGNORE);
 
         sizeofOneDataSet = sizeof(DataSetMigration) + doubleCountInBlock * sizeof(double);
 
         // write blocks and their data arrays
-        for (int nb = 0; nb < blocksCount; nb++) {
-            SPtr<Block3D> block                   = grid->getBlock(dataSetReadArray[nb].x1, dataSetReadArray[nb].x2,
-                                                 dataSetReadArray[nb].x3, dataSetReadArray[nb].level);
+        for (int nb = 0; nb < blocksCount; nb++) 
+        {
+            SPtr<Block3D> block = grid->getBlock(dataSetReadArray[nb].x1, dataSetReadArray[nb].x2, dataSetReadArray[nb].x3, dataSetReadArray[nb].level);
             dataSetWriteArray[nb].globalID        = block->getGlobalID();
             dataSetWriteArray[nb].ghostLayerWidth = dataSetReadArray[nb].ghostLayerWidth;
             dataSetWriteArray[nb].collFactor      = dataSetReadArray[nb].collFactor;
             dataSetWriteArray[nb].deltaT          = dataSetReadArray[nb].deltaT;
             dataSetWriteArray[nb].compressible    = dataSetReadArray[nb].compressible;
             dataSetWriteArray[nb].withForcing     = dataSetReadArray[nb].withForcing;
-//            dataSetWriteArray[nb].densityRatio    = dataSetReadArray[nb].densityRatio;
+            dataSetWriteArray[nb].collFactorL = dataSetReadArray[nb].collFactorL; // for Multiphase model
+            dataSetWriteArray[nb].collFactorG = dataSetReadArray[nb].collFactorG; // for Multiphase model
+            dataSetWriteArray[nb].densityRatio = dataSetReadArray[nb].densityRatio;// for Multiphase model
 
             write_offset = (MPI_Offset)(3 * sizeof(dataSetParam) + dataSetWriteArray[nb].globalID * sizeofOneDataSet);
-            MPI_File_write_at(file_handlerW, write_offset, &dataSetWriteArray[nb], 1, dataSetTypeWrite,
-                              MPI_STATUS_IGNORE);
+            MPI_File_write_at(file_handlerW, write_offset, &dataSetWriteArray[nb], 1, dataSetTypeWrite, MPI_STATUS_IGNORE);
             MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(DataSetMigration)),
-                              &doubleValuesArray[nb * doubleCountInBlock], int(doubleCountInBlock), MPI_DOUBLE,
-                              MPI_STATUS_IGNORE);
+                              &doubleValuesArray[nb * doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
         }
 
+        //-------------------------------------- H1 -----------------------------
+        int fs = MPI_File_get_size(file_handlerR1, &fsize);
+        if (fsize > 0)
+        {
+            doubleValuesArrayH1.resize(blocksCount * doubleCountInBlock);
+            MPI_File_read_at(file_handlerR1, read_offset, &doubleValuesArrayH1[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+
+            sizeofOneDataSet = doubleCountInBlock * sizeof(double);
+
+            for (int nb = 0; nb < blocksCount; nb++)
+            {
+                write_offset = (MPI_Offset)(dataSetWriteArray[nb].globalID * sizeofOneDataSet);
+                MPI_File_write_at(file_handlerW1, write_offset, &doubleValuesArrayH1[nb * doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
+            }
+
+        }
+
+        MPI_Type_free(&dataSetDoubleType);
+
         delete[] dataSetReadArray;
         delete[] dataSetWriteArray;
     }
 
-    MPI_File_close(&file_handlerR);
+    MPI_File_close(&file_handlerR1);
+    MPI_File_sync(file_handlerW1);
+    MPI_File_close(&file_handlerW1);
 
+    MPI_File_close(&file_handlerR);
     MPI_File_sync(file_handlerW);
     MPI_File_close(&file_handlerW);
 
+//--------------------------------------------------------------------------------
     DSArraysPresence arrPresence;
     MPI_File file_handler1;
     std::string filename1 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpArrays.bin";
@@ -400,28 +431,22 @@ void CheckpointConverter::convertDataSet(int step, int procCount)
     std::string filenameWW = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step);
 
     if (arrPresence.isAverageDensityArrayPresent)
-        convert___Array(step, procCount, filenameRR + "/cpAverageDensityArray.bin",
-                        filenameWW + "/cpAverageDensityArray.bin");
+        convert___Array(step, procCount, filenameRR + "/cpAverageDensityArray.bin", filenameWW + "/cpAverageDensityArray.bin");
 
     if (arrPresence.isAverageVelocityArrayPresent)
-        convert___Array(step, procCount, filenameRR + "/cpAverageVelocityArray.bin",
-                        filenameWW + "/cpAverageVelocityArray.bin");
+        convert___Array(step, procCount, filenameRR + "/cpAverageVelocityArray.bin", filenameWW + "/cpAverageVelocityArray.bin");
 
     if (arrPresence.isAverageFluktuationsArrayPresent)
-        convert___Array(step, procCount, filenameRR + "/cpAverageFluktuationsArray.bin",
-                        filenameWW + "/cpAverageFluktuationsArray.bin");
+        convert___Array(step, procCount, filenameRR + "/cpAverageFluktuationsArray.bin", filenameWW + "/cpAverageFluktuationsArray.bin");
 
     if (arrPresence.isAverageTripleArrayPresent)
-        convert___Array(step, procCount, filenameRR + "/cpAverageTripleArray.bin",
-                        filenameWW + "/cpAverageTripleArray.bin");
+        convert___Array(step, procCount, filenameRR + "/cpAverageTripleArray.bin", filenameWW + "/cpAverageTripleArray.bin");
 
     if (arrPresence.isShearStressValArrayPresent)
-        convert___Array(step, procCount, filenameRR + "/cpShearStressValArray.bin",
-                        filenameWW + "/cpShearStressValArray.bin");
+        convert___Array(step, procCount, filenameRR + "/cpShearStressValArray.bin", filenameWW + "/cpShearStressValArray.bin");
 
     if (arrPresence.isRelaxationFactorPresent)
-        convert___Array(step, procCount, filenameRR + "/cpRelaxationFactor.bin",
-                        filenameWW + "/cpRelaxationFactor.bin");
+        convert___Array(step, procCount, filenameRR + "/cpRelaxationFactor.bin", filenameWW + "/cpRelaxationFactor.bin");
 
     finish = MPI_Wtime();
     UBLOG(logINFO, "UtilConvertor::convertDataSet time: " << finish - start << " s");
@@ -439,8 +464,7 @@ void CheckpointConverter::convert___Array(int /*step*/, int procCount, std::stri
         throw UbException(UB_EXARGS, "couldn't open file " + filenameR);
 
     MPI_File file_handlerW;
-    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL,
-                            &file_handlerW);
+    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handlerW);
     if (rcW != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filenameW);
 
@@ -457,32 +481,29 @@ void CheckpointConverter::convert___Array(int /*step*/, int procCount, std::stri
     MPI_Offset write_offset;
     size_t sizeofOneDataSet;
 
-    for (int pc = 0; pc < procCount; pc++) {
+    for (int pc = 0; pc < procCount; pc++) 
+    {
         MPI_File_read_at(file_handlerR, (MPI_Offset)(pc * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
         MPI_File_read_at(file_handlerR, read_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
 
         dataSetSmallReadArray  = new DataSetSmallRestart[blocksCount];
         dataSetSmallWriteArray = new DataSetSmallMigration[blocksCount];
-        doubleCountInBlock =
-            dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+        doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
         doubleValuesArray.resize(blocksCount * doubleCountInBlock);
 
-        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallReadArray,
-                         blocksCount * 4, MPI_INT, MPI_STATUS_IGNORE);
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallReadArray, blocksCount * 4, MPI_INT, MPI_STATUS_IGNORE);
         if (doubleCountInBlock > 0)
-            MPI_File_read_at(
-                file_handlerR,
-                (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
                 &doubleValuesArray[0], blocksCount * doubleCountInBlock, MPI_DOUBLE, MPI_STATUS_IGNORE);
 
-        read_offset = read_offset + sizeof(dataSetParam) +
-                      blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+        read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
 
         sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
 
         MPI_File_write_at(file_handlerW, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
 
-        for (int nb = 0; nb < blocksCount; nb++) {
+        for (int nb = 0; nb < blocksCount; nb++) 
+        {
             SPtr<Block3D> block = grid->getBlock(dataSetSmallReadArray[nb].x1, dataSetSmallReadArray[nb].x2,
                                                  dataSetSmallReadArray[nb].x3, dataSetSmallReadArray[nb].level);
             dataSetSmallWriteArray[nb].globalID = block->getGlobalID();
@@ -490,8 +511,7 @@ void CheckpointConverter::convert___Array(int /*step*/, int procCount, std::stri
             write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallWriteArray[nb].globalID * sizeofOneDataSet);
             MPI_File_write_at(file_handlerW, write_offset, &dataSetSmallWriteArray[nb], 1, MPI_INT, MPI_STATUS_IGNORE);
             MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)),
-                              &doubleValuesArray[nb * doubleCountInBlock], doubleCountInBlock, MPI_DOUBLE,
-                              MPI_STATUS_IGNORE);
+                              &doubleValuesArray[nb * doubleCountInBlock], doubleCountInBlock, MPI_DOUBLE, MPI_STATUS_IGNORE);
         }
 
         delete[] dataSetSmallReadArray;
@@ -518,8 +538,7 @@ void CheckpointConverter::convertBC(int step, int procCount)
     // file to write to
     MPI_File file_handlerW;
     std::string filenameW = path + "/mig/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin";
-    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL,
-                            &file_handlerW);
+    int rcW = MPI_File_open(MPI_COMM_WORLD, filenameW.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file_handlerW);
     if (rcW != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filenameW);
 
@@ -546,7 +565,8 @@ void CheckpointConverter::convertBC(int step, int procCount)
     MPI_Offset write_offset = (MPI_Offset)(sizeof(boundCondParam) + grid->getNumberOfBlocks() * sizeof(size_t));
     MPI_Offset write_offsetIndex;
 
-    for (int pc = 0; pc < procCount; pc++) {
+    for (int pc = 0; pc < procCount; pc++) 
+    {
         read_offset = (MPI_Offset)(pc * (3 * sizeof(int) + sizeof(boundCondParam)));
 
         // read count of blocks
@@ -574,15 +594,10 @@ void CheckpointConverter::convertBC(int step, int procCount)
         MPI_File_read_at(file_handlerR, read_offset1, bcAddReadArray, blocksCount * 6, MPI_INT, MPI_STATUS_IGNORE);
         MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset1 + blocksCount * sizeof(BCAddRestart)), &bcArray[0],
                          dataCount1000, boundCondType1000, MPI_STATUS_IGNORE);
-        MPI_File_read_at(
-            file_handlerR,
-            (MPI_Offset)(read_offset1 + blocksCount * sizeof(BCAddRestart) + dataCount * sizeof(BoundaryCondition)),
-            &intArray1[0], blocksCount * boundCondParamStr.bcindexmatrixCount, MPI_INT, MPI_STATUS_IGNORE);
-        MPI_File_read_at(file_handlerR,
-                         (MPI_Offset)(read_offset1 + blocksCount * sizeof(BCAddRestart) +
-                                      dataCount * sizeof(BoundaryCondition) +
-                                      blocksCount * boundCondParamStr.bcindexmatrixCount * sizeof(int)),
-                         &intArray2[0], dataCount2, MPI_INT, MPI_STATUS_IGNORE);
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset1 + blocksCount * sizeof(BCAddRestart) + dataCount * sizeof(BoundaryCondition)),
+                         &intArray1[0], blocksCount * boundCondParamStr.bcindexmatrixCount, MPI_INT, MPI_STATUS_IGNORE);
+        MPI_File_read_at(file_handlerR, (MPI_Offset)(read_offset1 + blocksCount * sizeof(BCAddRestart) + dataCount * sizeof(BoundaryCondition) +
+                         blocksCount * boundCondParamStr.bcindexmatrixCount * sizeof(int)), &intArray2[0], dataCount2, MPI_INT, MPI_STATUS_IGNORE);
 
         // offset to read the data of the next process
         read_offset1 = read_offset1 + blocksCount * sizeof(BCAddRestart) + dataCount * sizeof(BoundaryCondition) +
@@ -593,14 +608,12 @@ void CheckpointConverter::convertBC(int step, int procCount)
         indexBC = 0;
         indexC  = 0;
         // write blocks and their BC data arrays
-        for (int nb = 0; nb < blocksCount; nb++) {
-            SPtr<Block3D> block = grid->getBlock(bcAddReadArray[nb].x1, bcAddReadArray[nb].x2, bcAddReadArray[nb].x3,
-                                                 bcAddReadArray[nb].level);
+        for (int nb = 0; nb < blocksCount; nb++) 
+        {
+            SPtr<Block3D> block = grid->getBlock(bcAddReadArray[nb].x1, bcAddReadArray[nb].x2, bcAddReadArray[nb].x3, bcAddReadArray[nb].level);
             bcAddWriteArray[nb].globalID = block->getGlobalID();
-            bcAddWriteArray[nb].boundCond_count =
-                bcAddReadArray[nb].boundCond_count; // how many BoundaryConditions in this block
-            bcAddWriteArray[nb].indexContainer_count =
-                bcAddReadArray[nb].indexContainer_count; // how many indexContainer-values in this block
+            bcAddWriteArray[nb].boundCond_count = bcAddReadArray[nb].boundCond_count; // how many BoundaryConditions in this block
+            bcAddWriteArray[nb].indexContainer_count = bcAddReadArray[nb].indexContainer_count; // how many indexContainer-values in this block
 
             write_offsetIndex = (MPI_Offset)(sizeof(boundCondParam) + bcAddWriteArray[nb].globalID * sizeof(size_t));
             MPI_File_write_at(file_handlerW, write_offsetIndex, &write_offset, 1, MPI_LONG_LONG_INT, MPI_STATUS_IGNORE);
@@ -612,24 +625,16 @@ void CheckpointConverter::convertBC(int step, int procCount)
             indexBC += bcAddWriteArray[nb].boundCond_count;
 
             if (boundCondParamStr.bcindexmatrixCount > 0)
-                MPI_File_write_at(file_handlerW,
-                                  (MPI_Offset)(write_offset + sizeof(BCAddMigration) +
-                                               bcAddWriteArray[nb].boundCond_count * sizeof(BoundaryCondition)),
-                                  &intArray1[nb * boundCondParamStr.bcindexmatrixCount],
-                                  boundCondParamStr.bcindexmatrixCount, MPI_INT, MPI_STATUS_IGNORE);
+                MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(BCAddMigration) + bcAddWriteArray[nb].boundCond_count * sizeof(BoundaryCondition)),
+                                  &intArray1[nb * boundCondParamStr.bcindexmatrixCount], boundCondParamStr.bcindexmatrixCount, MPI_INT, MPI_STATUS_IGNORE);
 
             if (bcAddWriteArray[nb].indexContainer_count > 0)
-                MPI_File_write_at(file_handlerW,
-                                  (MPI_Offset)(write_offset + sizeof(BCAddMigration) +
-                                               bcAddWriteArray[nb].boundCond_count * sizeof(BoundaryCondition) +
-                                               boundCondParamStr.bcindexmatrixCount * sizeof(int)),
-                                  &intArray2[indexC], bcAddWriteArray[nb].indexContainer_count, MPI_INT,
-                                  MPI_STATUS_IGNORE);
+                MPI_File_write_at(file_handlerW, (MPI_Offset)(write_offset + sizeof(BCAddMigration) + bcAddWriteArray[nb].boundCond_count * sizeof(BoundaryCondition) +
+                boundCondParamStr.bcindexmatrixCount * sizeof(int)), &intArray2[indexC], bcAddWriteArray[nb].indexContainer_count, MPI_INT, MPI_STATUS_IGNORE);
             indexC += bcAddWriteArray[nb].indexContainer_count;
 
             write_offset += sizeof(BCAddMigration) + bcAddWriteArray[nb].boundCond_count * sizeof(BoundaryCondition) +
-                            boundCondParamStr.bcindexmatrixCount * sizeof(int) +
-                            bcAddWriteArray[nb].indexContainer_count * sizeof(int);
+                            boundCondParamStr.bcindexmatrixCount * sizeof(int) + bcAddWriteArray[nb].indexContainer_count * sizeof(int);
         }
 
         delete[] bcAddReadArray;
diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
index bad6116cc..294081a4f 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
+++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
@@ -32,7 +32,7 @@ protected:
 private:
     MPI_Datatype gridParamType, block3dType;
     MPI_Datatype dataSetParamType, dataSetTypeRead, dataSetTypeWrite;
-    MPI_Datatype boundCondType, boundCondType1000;
+    MPI_Datatype boundCondType, boundCondType1000, dataSetDoubleType;
 
     MPIIODataStructures::boundCondParam boundCondParamStr;
 };
-- 
GitLab


From 308ffe5287b13136848576f3b5d80643ab856de7 Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Wed, 14 Jul 2021 11:00:58 +0200
Subject: [PATCH 008/179] Delete lodi-variables from
 BoundaryCondition-structure in Restart/MigrationCoprocessor

---
 .../CoProcessors/MPIIOCoProcessor.cpp                  |  2 +-
 .../CoProcessors/MPIIOMigrationBECoProcessor.cpp       | 10 ----------
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp         | 10 ----------
 .../CoProcessors/MPIIORestartCoProcessor.cpp           | 10 ----------
 .../VirtualFluidsCore/Parallel/MPIIODataStructures.h   |  6 ------
 5 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
index fa5ab41b7..bc25bf37f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
@@ -55,7 +55,7 @@ MPIIOCoProcessor::MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const
     //-----------------------------------------------------------------------
 
     MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR };
-    int blocksBC[3]         = { 5, 38, 1 };
+    int blocksBC[3]         = { 5, 33, 1 };
     MPI_Aint offsetsBC[3], lbBC, extentBC;
 
     offsetsBC[0] = 0;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index ef0abd06f..ef2c9d07a 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -691,11 +691,6 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
-                    bouCond->bcLodiDensity          = (float)bcArr->bcvector[bc]->getDensityLodiDensity();
-                    bouCond->bcLodiVelocityX1       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX1();
-                    bouCond->bcLodiVelocityX2       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX2();
-                    bouCond->bcLodiVelocityX3       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX3();
-                    bouCond->bcLodiLentgh           = (float)bcArr->bcvector[bc]->getDensityLodiLength();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -1643,11 +1638,6 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step)
                     bc->bcVelocityX2           = bcArray[ibc].bcVelocityX2;
                     bc->bcVelocityX3           = bcArray[ibc].bcVelocityX3;
                     bc->bcDensity              = bcArray[ibc].bcDensity;
-                    bc->bcLodiDensity          = bcArray[ibc].bcLodiDensity;
-                    bc->bcLodiVelocityX1       = bcArray[ibc].bcLodiVelocityX1;
-                    bc->bcLodiVelocityX2       = bcArray[ibc].bcLodiVelocityX2;
-                    bc->bcLodiVelocityX3       = bcArray[ibc].bcLodiVelocityX3;
-                    bc->bcLodiLentgh           = bcArray[ibc].bcLodiLentgh;
 
                     bc->nx1 = bcArray[ibc].nx1;
                     bc->nx2 = bcArray[ibc].nx2;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index a34e1b4ca..c7f0b8cd1 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -1482,11 +1482,6 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
-                    bouCond->bcLodiDensity          = (float)bcArr->bcvector[bc]->getDensityLodiDensity();
-                    bouCond->bcLodiVelocityX1       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX1();
-                    bouCond->bcLodiVelocityX2       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX2();
-                    bouCond->bcLodiVelocityX3       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX3();
-                    bouCond->bcLodiLentgh           = (float)bcArr->bcvector[bc]->getDensityLodiLength();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -2794,11 +2789,6 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step)
                     bc->bcVelocityX2           = bcArray[ibc].bcVelocityX2;
                     bc->bcVelocityX3           = bcArray[ibc].bcVelocityX3;
                     bc->bcDensity              = bcArray[ibc].bcDensity;
-                    bc->bcLodiDensity          = bcArray[ibc].bcLodiDensity;
-                    bc->bcLodiVelocityX1       = bcArray[ibc].bcLodiVelocityX1;
-                    bc->bcLodiVelocityX2       = bcArray[ibc].bcLodiVelocityX2;
-                    bc->bcLodiVelocityX3       = bcArray[ibc].bcLodiVelocityX3;
-                    bc->bcLodiLentgh           = bcArray[ibc].bcLodiLentgh;
 
                     bc->nx1 = bcArray[ibc].nx1;
                     bc->nx2 = bcArray[ibc].nx2;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index f75aaa58f..567e46b6e 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -1489,11 +1489,6 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
-                    bouCond->bcLodiDensity          = (float)bcArr->bcvector[bc]->getDensityLodiDensity();
-                    bouCond->bcLodiVelocityX1       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX1();
-                    bouCond->bcLodiVelocityX2       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX2();
-                    bouCond->bcLodiVelocityX3       = (float)bcArr->bcvector[bc]->getDensityLodiVelocityX3();
-                    bouCond->bcLodiLentgh           = (float)bcArr->bcvector[bc]->getDensityLodiLength();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -2704,11 +2699,6 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step)
                 bc->bcVelocityX2           = bcArray[index].bcVelocityX2;
                 bc->bcVelocityX3           = bcArray[index].bcVelocityX3;
                 bc->bcDensity              = bcArray[index].bcDensity;
-                bc->bcLodiDensity          = bcArray[index].bcLodiDensity;
-                bc->bcLodiVelocityX1       = bcArray[index].bcLodiVelocityX1;
-                bc->bcLodiVelocityX2       = bcArray[index].bcLodiVelocityX2;
-                bc->bcLodiVelocityX3       = bcArray[index].bcLodiVelocityX3;
-                bc->bcLodiLentgh           = bcArray[index].bcLodiLentgh;
 
                 bc->nx1 = bcArray[index].nx1;
                 bc->nx2 = bcArray[index].nx2;
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
index c8bd2d079..a7272a307 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
@@ -118,12 +118,6 @@ struct BoundaryCondition {
     float bcVelocityX3;
     float bcDensity;
 
-    float bcLodiDensity;
-    float bcLodiVelocityX1;
-    float bcLodiVelocityX2;
-    float bcLodiVelocityX3;
-    float bcLodiLentgh;
-
     float nx1, nx2, nx3;
     float q[26];
 
-- 
GitLab


From 26dec35d8e5c37b6f15fc855e253ab757512b483 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Tue, 27 Jul 2021 14:30:41 +0200
Subject: [PATCH 009/179] Velocity formulation with filtered pressure and
 handmade periodic boundary conditions. WORKS ONLY WITH ONE BLOCK! No other
 boundary conditions.

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   6 +-
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp | 151 +++++++++++++++++-
 ...eTwoPhaseFieldsVelocityCumulantLBMKernel.h |   2 +-
 3 files changed, 148 insertions(+), 11 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 08bc3a435..ca7aae65a 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,5 +1,5 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTest
+pathname = E:/Multiphase/DropletTestFasterYet
 
 numOfThreads = 4
 availMem = 10e9
@@ -14,7 +14,7 @@ dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0.00001#0.005#0.005 
+uLB = 0.1#0.005#0.005 
 Re = 10
 nuL =1e-6# 1.0e-5 #!1e-2
 nuG =1e-6# 1.16e-4 #!1e-2
@@ -39,5 +39,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1
+outTime = 100
 endTime = 10000
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index db01b3edc..c77e7858b 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -52,7 +52,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::initDataSet()
     SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9)); // For phase-field
     SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
 	 pressure= CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
-	// pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
+	 pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 2, nx[1] + 2, nx[2] + 2, 0.0));
     dataSet->setFdistributions(f);
     dataSet->setHdistributions(h); // For phase-field
     dataSet->setH2distributions(h2); // For phase-field
@@ -299,7 +299,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
 						////!!!!!! relplace by pointer swap!
-						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+						(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
                     }
                 }
             }
@@ -308,6 +308,130 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
         LBMReal collFactorM;
         //LBMReal forcingTerm[D3Q27System::ENDF + 1];
 
+		////filter
+
+		//for (int x3 = minX3; x3 < maxX3; x3++) {
+		//	for (int x2 = minX2; x2 < maxX2; x2++) {
+		//		for (int x1 = minX1; x1 < maxX1; x1++) {
+		//			if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+		//				LBMReal sum = 0.;
+
+		//				//Lapalce pressure
+		//				//sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1+1, x2-1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3+1) - (*pressure)(x1, x2, x3)))));
+		//				//sum += WEIGTH[TN] * (
+		//				//	((((*pressure)(x1+1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1+1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	);
+		//				//sum += WEIGTH[T] * (
+		//				//	(((*pressure)(x1+1, x2, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3) - (*pressure)(x1, x2, x3)))
+		//				//	+ (((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3) - (*pressure)(x1, x2, x3)))
+		//				//	+ (((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2, x3-1) - (*pressure)(x1, x2, x3)))
+		//				//	);
+
+
+		//				//LBMReal pressureFilter = 100;
+		//				//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + pressureFilter * sum * (sqrt(fabs(sum)));
+
+		//				//Situpol Eq. 81
+		//				sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1)) + ((*pressure)(x1-1, x2-1, x3-1) )) + (((*pressure)(x1+1, x2+1, x3-1) ) + ((*pressure)(x1-1, x2-1, x3+1) )))
+		//					+ ((((*pressure)(x1+1, x2-1, x3+1) ) + ((*pressure)(x1-1, x2+1, x3-1) )) + (((*pressure)(x1+1, x2-1, x3-1) ) + ((*pressure)(x1-1, x2+1, x3+1) ))));
+		//				sum += WEIGTH[TN] * (
+		//					((((*pressure)(x1+1, x2+1, x3) ) + ((*pressure)(x1-1, x2-1, x3) )) + (((*pressure)(x1+1, x2-1, x3) ) + ((*pressure)(x1-1, x2+1, x3) )))
+		//					+ ((((*pressure)(x1+1, x2, x3+1) ) + ((*pressure)(x1-1, x2, x3-1) )) + (((*pressure)(x1+1, x2, x3-1) ) + ((*pressure)(x1-1, x2, x3+1) )))
+		//					+ ((((*pressure)(x1, x2+1, x3+1) ) + ((*pressure)(x1, x2-1, x3-1) )) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) )))
+		//					);
+		//				sum += WEIGTH[T] * (
+		//					(((*pressure)(x1+1, x2, x3) ) + ((*pressure)(x1-1, x2, x3) ))
+		//					+ (((*pressure)(x1, x2+1, x3) ) + ((*pressure)(x1, x2-1, x3) ))
+		//					+ (((*pressure)(x1, x2, x3+1)) + ((*pressure)(x1, x2, x3-1) ))
+		//					);
+		//				sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
+		//				(*pressureOld)(x1, x2, x3) = sum;
+
+
+
+
+		//			}
+		//		}
+		//	}
+		//}
+
+		////Periodic Filter
+		for (int x3 = 0; x3 <= maxX3; x3++) {
+			for (int x2 = 0; x2 <= maxX2; x2++) {
+				for (int x1 = 0; x1 <= maxX1; x1++) {
+					if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+						LBMReal sum = 0.;
+
+						int x1p = (x1<maxX1) ? x1 + 1: 0;
+						int x1m = (x1 > 0) ? x1 - 1 : maxX1;
+						int x2p = (x2 < maxX2) ? x2 + 1 : 0;
+						int x2m = (x2 > 0) ? x2 - 1 : maxX2;
+						int x3p = (x3 < maxX3) ? x3 + 1 : 0;
+						int x3m = (x3 > 0) ? x3 - 1 : maxX3;
+
+						//Lapalce pressure
+						//sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1+1, x2-1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3+1) - (*pressure)(x1, x2, x3)))));
+						//sum += WEIGTH[TN] * (
+						//	((((*pressure)(x1+1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1+1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3+1) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+						//	);
+						//sum += WEIGTH[T] * (
+						//	(((*pressure)(x1+1, x2, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3) - (*pressure)(x1, x2, x3)))
+						//	+ (((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3) - (*pressure)(x1, x2, x3)))
+						//	+ (((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2, x3-1) - (*pressure)(x1, x2, x3)))
+						//	);
+
+
+						//LBMReal pressureFilter = 100;
+						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + pressureFilter * sum * (sqrt(fabs(sum)));
+
+						//Situpol Eq. 81
+						sum += WEIGTH[TNE] * (((((*pressure)(x1p, x2p, x3p)) + ((*pressure)(x1m, x2m, x3m))) + (((*pressure)(x1p, x2p, x3m)) + ((*pressure)(x1m, x2m, x3p))))
+							+ ((((*pressure)(x1p, x2m, x3p)) + ((*pressure)(x1m, x2p, x3m))) + (((*pressure)(x1p, x2m, x3m)) + ((*pressure)(x1m, x2p, x3p)))));
+						sum += WEIGTH[TN] * (
+							((((*pressure)(x1p, x2p, x3)) + ((*pressure)(x1m, x2m, x3))) + (((*pressure)(x1p, x2m, x3)) + ((*pressure)(x1m, x2p, x3))))
+							+ ((((*pressure)(x1p, x2, x3p)) + ((*pressure)(x1m, x2, x3m))) + (((*pressure)(x1p, x2, x3m)) + ((*pressure)(x1m, x2, x3p))))
+							+ ((((*pressure)(x1, x2p, x3p)) + ((*pressure)(x1, x2m, x3m))) + (((*pressure)(x1, x2p, x3m) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2m, x3p))))
+							);
+						sum += WEIGTH[T] * (
+							(((*pressure)(x1p, x2, x3)) + ((*pressure)(x1m, x2, x3)))
+							+ (((*pressure)(x1, x2p, x3)) + ((*pressure)(x1, x2m, x3)))
+							+ (((*pressure)(x1, x2, x3p)) + ((*pressure)(x1, x2, x3m)))
+							);
+						sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
+						(*pressureOld)(x1, x2, x3) = sum;
+
+
+
+
+					}
+				}
+			}
+		}
+
+
+		for (int x3 = 0; x3 <= maxX3; x3++) {
+			for (int x2 = 0; x2 <= maxX2; x2++) {
+				for (int x1 = 0; x1 <= maxX1; x1++) {
+					if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+						///filter!
+
+						(*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3);
+					}
+				}
+			}
+		}
+		////!filter
+
+
+
         for (int x3 = minX3; x3 < maxX3; x3++) {
             for (int x2 = minX2; x2 < maxX2; x2++) {
                 for (int x1 = minX1; x1 < maxX1; x1++) {
@@ -316,6 +440,8 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
                         int x2p = x2 + 1;
                         int x3p = x3 + 1;
 
+
+
                         //////////////////////////////////////////////////////////////////////////
                         // Read distributions and phase field
                         ////////////////////////////////////////////////////////////////////////////
@@ -493,9 +619,13 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 				   // muX2 = static_cast<double>(x2-1+ix2*maxX2);
 				   // muX3 = static_cast<double>(x3-1+ix3*maxX3);
 
-				   forcingX1 = muForcingX1.Eval()-gradPx/rho;
-				   forcingX2 = muForcingX2.Eval()-gradPy/rho;
-				   forcingX3 = muForcingX3.Eval()-gradPz/rho;
+				  // forcingX1 = muForcingX1.Eval()+c1o3*drho*dX1_phi*rhoToPhi/rho;//-gradPx/rho;
+				  // forcingX2 = muForcingX2.Eval() + c1o3*drho*dX2_phi * rhoToPhi / rho;//-gradPy/rho;
+				   //forcingX3 = muForcingX3.Eval() + c1o3*drho*dX3_phi * rhoToPhi / rho;//-gradPz/rho;
+
+				   forcingX1 = muForcingX1.Eval() -gradPx/rho;
+				   forcingX2 = muForcingX2.Eval() -gradPy/rho;
+				   forcingX3 = muForcingX3.Eval() -gradPz/rho;
 
 				   //LBMReal rho_m = 1.0 / densityRatio;
 				   //forcingX1 = forcingX1 * (rho - rho_m);
@@ -1063,7 +1193,10 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   //2.
 			   // linear combinations
 			   LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
-				mxxPyyPzz-=mfaaa;//12.03.21 shifted by mfaaa
+
+			//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+			  mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+				//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
 			   LBMReal mxxMyy = mfcaa - mfaca;
 			   LBMReal mxxMzz = mfcaa - mfaac;
 
@@ -1110,9 +1243,13 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
                ////updated pressure
                //mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
-			   mfaaa = 0.0;
+			   mfaaa = 0.0; // Pressure elimination as in standard velocity model
+			 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
 
                mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+
+			  // mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+			   //mfaaa = mfaaaS;
 			   // linear combinations back
 			   mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
 			   mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
index 7e14cc3c3..070aff23f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h
@@ -58,7 +58,7 @@ public:
 
    ///refactor
    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
-   //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
 
    double getCalculationTime() override { return .0; }
 protected:
-- 
GitLab


From 3004fe6accbd2659be31417c612976b96a1e206a Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 27 Jul 2021 14:56:05 +0200
Subject: [PATCH 010/179] fix BC bug in D3Q27TriFaceMeshInteractor

---
 .../Interactors/D3Q27TriFaceMeshInteractor.cpp                 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
index 37c6c47f0..de46ada53 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
@@ -522,7 +522,8 @@ void D3Q27TriFaceMeshInteractor::setQs(const double &timeStep)
                                         bc = SPtr<BoundaryConditions>(new BoundaryConditions);
                                         ;
                                         bcMatrix->setBC(ix1, ix2, ix3, bc);
-                                    } else if (UbMath::less(bc->getQ(fdir), q)) // schon ein kuerzeres q voehanden?
+                                    } else if (UbMath::less(bc->getQ(fdir), q) &&
+                                        UbMath::equal(-999.0, q)) // schon ein kuerzeres q voehanden?
                                     {
                                         // neu:: 18.05.2010
                                         // um falsche qs die evtl durch die "wand" gehen zu vermeiden
-- 
GitLab


From 5824f183980e7291464974398fe41a6a9786e977 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Wed, 28 Jul 2021 17:21:54 +0200
Subject: [PATCH 011/179] Pressure filter and pressure gradient computed so
 that boundary conditions can be used. Everything is limited to a single
 block.

---
 apps/cpu/Multiphase/Multiphase.cpp            |   9 +-
 apps/cpu/Multiphase/MultiphaseGeier.cfg       |   8 +-
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   8 +-
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp | 171 +++++++++++++-----
 4 files changed, 136 insertions(+), 60 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index a22777658..a0972b8fd 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -88,6 +88,7 @@ void run(string configname)
         kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
+                kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(0.0);
@@ -388,11 +389,11 @@ void run(string configname)
                 UBLOG(logINFO, "Restart - end");
         }
 
-        TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        grid->accept(setConnsVisitor);
+      //  TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+      //  grid->accept(setConnsVisitor);
 
-        //ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        //grid->accept(setConnsVisitor);
+        ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
diff --git a/apps/cpu/Multiphase/MultiphaseGeier.cfg b/apps/cpu/Multiphase/MultiphaseGeier.cfg
index bcabb0684..6196da093 100644
--- a/apps/cpu/Multiphase/MultiphaseGeier.cfg
+++ b/apps/cpu/Multiphase/MultiphaseGeier.cfg
@@ -1,7 +1,7 @@
 #pathname = E:/Multiphase/HesamCodeWithCumulantsDensRatio
 #pathname = E:/Multiphase/HesamCodeWithCumulantsQuartic
 #pathname = E:/Multiphase/HesamCode
-pathname = E:/Multiphase/HesamCodeCumulantTubeFilter
+pathname = E:/Multiphase/VelocityForm
 pathGeo = C:/Users/geier/Documents/VirtualFluids_dev_Kostya/apps/cpu/Multiphase/backup
 geoFile=tubeTransformed.stl
 #geoFile = JetBreakup2.ASCII.stl
@@ -33,10 +33,10 @@ refineLevel = 0
 uLB =0.005# 0.0000005 #inlet velocity
 uF2 = 0.0001
 Re = 10
-nuL =1e-6#1e-2# 1.0e-5  #!1e-2
+nuL =1e-3#1e-2# 1.0e-5  #!1e-2
 nuG =1e-6#1e-2# 1.16e-4 #!1e-2
-densityRatio = 10000#1000#1000 #30
-sigma =0# 1e-4 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+densityRatio = 1000#1000#1000 #30
+sigma =1e-4# 1e-4 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 5
 radius = 615.0   (Jet Breakup)
 contactAngle = 110.0
diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index ca7aae65a..cbc225aff 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,5 +1,5 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTestFasterYet
+pathname = E:/Multiphase/DropletTestSigma
 
 numOfThreads = 4
 availMem = 10e9
@@ -14,12 +14,12 @@ dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0.1#0.005#0.005 
+uLB = 0.01#0.005#0.005 
 Re = 10
-nuL =1e-6# 1.0e-5 #!1e-2
+nuL =1e-3# 1.0e-5 #!1e-2
 nuG =1e-6# 1.16e-4 #!1e-2
 densityRatio = 1000
-sigma =0.# 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+sigma =0.0001# 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 5
 radius = 8#16
 contactAngle = 110.0
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index c77e7858b..e72c27c74 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -174,8 +174,8 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
         CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU(
             new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
 
-
-        for (int x3 = 0; x3 <= maxX3; x3++) {
+#pragma omp parallel for
+	  for (int x3 = 0; x3 <= maxX3; x3++) {
             for (int x2 = 0; x2 <= maxX2; x2++) {
                 for (int x1 = 0; x1 <= maxX1; x1++) {
                     if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
@@ -360,6 +360,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 		//}
 
 		////Periodic Filter
+#pragma omp parallel for
 		for (int x3 = 0; x3 <= maxX3; x3++) {
 			for (int x2 = 0; x2 <= maxX2; x2++) {
 				for (int x1 = 0; x1 <= maxX1; x1++) {
@@ -367,12 +368,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 						LBMReal sum = 0.;
 
-						int x1p = (x1<maxX1) ? x1 + 1: 0;
-						int x1m = (x1 > 0) ? x1 - 1 : maxX1;
-						int x2p = (x2 < maxX2) ? x2 + 1 : 0;
-						int x2m = (x2 > 0) ? x2 - 1 : maxX2;
-						int x3p = (x3 < maxX3) ? x3 + 1 : 0;
-						int x3m = (x3 > 0) ? x3 - 1 : maxX3;
+
 
 						//Lapalce pressure
 						//sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
@@ -393,21 +389,49 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + pressureFilter * sum * (sqrt(fabs(sum)));
 
 						//Situpol Eq. 81
-						sum += WEIGTH[TNE] * (((((*pressure)(x1p, x2p, x3p)) + ((*pressure)(x1m, x2m, x3m))) + (((*pressure)(x1p, x2p, x3m)) + ((*pressure)(x1m, x2m, x3p))))
-							+ ((((*pressure)(x1p, x2m, x3p)) + ((*pressure)(x1m, x2p, x3m))) + (((*pressure)(x1p, x2m, x3m)) + ((*pressure)(x1m, x2p, x3p)))));
-						sum += WEIGTH[TN] * (
-							((((*pressure)(x1p, x2p, x3)) + ((*pressure)(x1m, x2m, x3))) + (((*pressure)(x1p, x2m, x3)) + ((*pressure)(x1m, x2p, x3))))
-							+ ((((*pressure)(x1p, x2, x3p)) + ((*pressure)(x1m, x2, x3m))) + (((*pressure)(x1p, x2, x3m)) + ((*pressure)(x1m, x2, x3p))))
-							+ ((((*pressure)(x1, x2p, x3p)) + ((*pressure)(x1, x2m, x3m))) + (((*pressure)(x1, x2p, x3m) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2m, x3p))))
-							);
-						sum += WEIGTH[T] * (
-							(((*pressure)(x1p, x2, x3)) + ((*pressure)(x1m, x2, x3)))
-							+ (((*pressure)(x1, x2p, x3)) + ((*pressure)(x1, x2m, x3)))
-							+ (((*pressure)(x1, x2, x3p)) + ((*pressure)(x1, x2, x3m)))
-							);
-						sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
-						(*pressureOld)(x1, x2, x3) = sum;
 
+						//int x1p = (x1 < maxX1) ? x1 + 1 : 0;
+						//int x1m = (x1 > 0) ? x1 - 1 : maxX1;
+						//int x2p = (x2 < maxX2) ? x2 + 1 : 0;
+						//int x2m = (x2 > 0) ? x2 - 1 : maxX2;
+						//int x3p = (x3 < maxX3) ? x3 + 1 : 0;
+						//int x3m = (x3 > 0) ? x3 - 1 : maxX3;
+						//sum += WEIGTH[TNE] * (((((*pressure)(x1p, x2p, x3p)) + ((*pressure)(x1m, x2m, x3m))) + (((*pressure)(x1p, x2p, x3m)) + ((*pressure)(x1m, x2m, x3p))))
+						//	+ ((((*pressure)(x1p, x2m, x3p)) + ((*pressure)(x1m, x2p, x3m))) + (((*pressure)(x1p, x2m, x3m)) + ((*pressure)(x1m, x2p, x3p)))));
+						//sum += WEIGTH[TN] * (
+						//	((((*pressure)(x1p, x2p, x3)) + ((*pressure)(x1m, x2m, x3))) + (((*pressure)(x1p, x2m, x3)) + ((*pressure)(x1m, x2p, x3))))
+						//	+ ((((*pressure)(x1p, x2, x3p)) + ((*pressure)(x1m, x2, x3m))) + (((*pressure)(x1p, x2, x3m)) + ((*pressure)(x1m, x2, x3p))))
+						//	+ ((((*pressure)(x1, x2p, x3p)) + ((*pressure)(x1, x2m, x3m))) + (((*pressure)(x1, x2p, x3m) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2m, x3p))))
+						//	);
+						//sum += WEIGTH[T] * (
+						//	(((*pressure)(x1p, x2, x3)) + ((*pressure)(x1m, x2, x3)))
+						//	+ (((*pressure)(x1, x2p, x3)) + ((*pressure)(x1, x2m, x3)))
+						//	+ (((*pressure)(x1, x2, x3p)) + ((*pressure)(x1, x2, x3m)))
+						//	);
+						//sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
+						//(*pressureOld)(x1, x2, x3) = sum;
+						 
+						///Version for boundaries
+						for (int xx = -1; xx <= 1; xx++) {
+							int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+
+							for (int yy = -1; yy <= 1; yy++) {
+								int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+
+								for (int zz = -1; zz <= 1; zz++) {
+									int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+
+									if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+										sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressure)(xxx, yyy, zzz);
+									}
+									else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressure)(x1, x2, x3);
+									}
+
+
+								}
+							}
+						}
+						(*pressureOld)(x1, x2, x3) = sum;
 
 
 
@@ -416,7 +440,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			}
 		}
 
-
+#pragma omp parallel for
 		for (int x3 = 0; x3 <= maxX3; x3++) {
 			for (int x2 = 0; x2 <= maxX2; x2++) {
 				for (int x1 = 0; x1 <= maxX1; x1++) {
@@ -431,7 +455,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 		////!filter
 
 
-
+#pragma omp parallel for
         for (int x3 = minX3; x3 < maxX3; x3++) {
             for (int x2 = minX2; x2 < maxX2; x2++) {
                 for (int x1 = minX1; x1 < maxX1; x1++) {
@@ -585,30 +609,81 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   //LBMReal gradPy = c1o2 * ((*pressure)(x1, x2 + 1, x3) - (*pressure)(x1, x2 - 1, x3));
 			   //LBMReal gradPz = c1o2 * ((*pressure)(x1, x2, x3 + 1) - (*pressure)(x1, x2, x3 - 1));
 
-			   LBMReal gradPx = 3.0 * (WEIGTH[TNE] * (
-				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1)))
-				   + (((*pressure)(x1 + 1, x2 - 1, x3 - 1) - (*pressure)(x1 - 1, x2 + 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
-				   + WEIGTH[NE] * (
-				   (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
-					   + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
-				   + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
-
-			   LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
-				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
-				   + (((*pressure)(x1 - 1, x2 + 1, x3 - 1) - (*pressure)(x1 + 1, x2 - 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
-				   + WEIGTH[NE] * (
-				   (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
-					   + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
-				   + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
-
-			   LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
-				   (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
-				   + (((*pressure)(x1 - 1, x2 - 1, x3 + 1) - (*pressure)(x1 + 1, x2 + 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1))))
-				   + WEIGTH[NE] * (
-				   (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
-					   + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
-				   + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
-
+			   //LBMReal gradPx = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1)))
+				  // + (((*pressure)(x1 + 1, x2 - 1, x3 - 1) - (*pressure)(x1 - 1, x2 + 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
+					 //  + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
+
+			   //LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				  // + (((*pressure)(x1 - 1, x2 + 1, x3 - 1) - (*pressure)(x1 + 1, x2 - 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
+					 //  + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
+
+			   //LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				  // + (((*pressure)(x1 - 1, x2 - 1, x3 + 1) - (*pressure)(x1 + 1, x2 + 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
+					 //  + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
+			  
+			   
+			   LBMReal gradPx = 0.0;
+			   LBMReal gradPy = 0.0;
+			   LBMReal gradPz = 0.0;
+			   for (int dir1 = -1; dir1 <= 1; dir1++) {
+				   for (int dir2 = -1; dir2 <= 1; dir2++) {
+					   int yyy = x2 + dir1;
+					   int zzz = x3 + dir2;
+					   if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+						   gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 - 1, yyy, zzz)) {
+						   gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+					   int xxx = x1 + dir1;
+					   if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+						   gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+						   gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+					   yyy = x2 + dir2;
+					   if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+						   gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+						   gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+				   }
+			   }
 
 			   //3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
 			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
-- 
GitLab


From 7f779ad7f922ad0c1ef5ca2fe0da235d1eee439b Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 2 Aug 2021 12:34:40 +0200
Subject: [PATCH 012/179] add Local Connector for two phase fields velocity
 kernel

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   10 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |    7 +-
 src/cpu/VirtualFluids.h                       |    2 +
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |   22 +-
 ...ThreeDistributionsFullDirectConnector2.cpp |  243 ++
 .../ThreeDistributionsFullDirectConnector2.h  |  234 ++
 src/cpu/VirtualFluidsCore/Grid/Grid3D.h       |    2 +-
 ...oPhaseFieldsVelocityCumulantLBMKernel2.cpp | 3498 +++++++++++++++++
 ...TwoPhaseFieldsVelocityCumulantLBMKernel2.h |  119 +
 .../Visitors/SetConnectorsBlockVisitor.h      |    2 +
 10 files changed, 4120 insertions(+), 19 deletions(-)
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index cbc225aff..8ab087bde 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,5 +1,5 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTestSigma
+pathname = E:/Multiphase/DropletTestSigma2
 
 numOfThreads = 4
 availMem = 10e9
@@ -7,8 +7,10 @@ availMem = 10e9
 #Grid
 
 boundingBox = 0 128 0 64 0 64
-#blocknx = 8 8 8
-blocknx= 128 64 64
+#boundingBox = 0 8 0 8 0 8
+blocknx = 8 8 8
+#blocknx = 64 32 32
+#blocknx= 128 64 64
 
 dx = 1
 refineLevel = 0
@@ -39,5 +41,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 100
+outTime = 1
 endTime = 10000
\ No newline at end of file
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 99c9e26e1..06038f3be 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -80,7 +80,7 @@ void run(string configname)
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(gr);
@@ -231,7 +231,7 @@ void run(string configname)
                 SPtr<UbScheduler> geoSch(new UbScheduler(1));
                 SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
                     grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-                ppgeo->process(0);
+                //ppgeo->process(0);
                 ppgeo.reset();
             }
 
@@ -260,12 +260,13 @@ void run(string configname)
         //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
-        ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        ThreeDistributionsSetConnectorsBlockVisitor2 setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+        //pp->process(0);
         //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(
         //    grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
 
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 754c8854d..9020eab4f 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -153,6 +153,7 @@
 #include <Connectors/RemoteBlock3DConnector.h>
 #include <Connectors/TwoDistributionsFullDirectConnector.h>
 #include <Connectors/TwoDistributionsFullVectorConnector.h>
+#include <Connectors/ThreeDistributionsFullDirectConnector2.h>
 
 #include <Data/D3Q27EsoTwist3DSplittedVector.h>
 #include <Data/D3Q27EsoTwist3DSplittedVectorEx.h>
@@ -245,6 +246,7 @@
 #include <LBM/MultiphaseScratchCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h>
+#include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h>
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 05ec0c36c..1388f369d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -36,7 +36,7 @@
 #include "LBMKernel.h"
 #include <string>
 #include <vector>
-#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h"
+#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h"
 
 #include "BCArray3D.h"
 #include "Block3D.h"
@@ -157,7 +157,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     datanames.push_back("Vz");
     datanames.push_back("P1");
     datanames.push_back("Phi2");
-    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) datanames.push_back("Pressure");
+    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) datanames.push_back("Pressure");
 
     data.resize(datanames.size());
 
@@ -195,9 +195,9 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     int maxX2 = (int)(distributionsF->getNX2());
     int maxX3 = (int)(distributionsF->getNX3());
 
-    int minX1 = 0;
-    int minX2 = 0;
-    int minX3 = 0;
+    int minX1 = 1;
+    int minX2 = 1;
+    int minX3 = 1;
 
     // int maxX1 = (int)(distributions->getNX1());
     // int maxX2 = (int)(distributions->getNX2());
@@ -235,9 +235,9 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
         }
     }
 
-    maxX1 -= 2;
-    maxX2 -= 2;
-    maxX3 -= 2;
+    maxX1 -= 3;
+    maxX2 -= 3;
+    maxX3 -= 3;
 
     // maxX1 -= 1;
     // maxX2 -= 1;
@@ -347,7 +347,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     // rho = phi[ZERO] + (1.0 - phi[ZERO])*1.0/densityRatio;
                     rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
-                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) {
+                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) {
                         vx1 =
                             ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
                             (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) ;
@@ -429,8 +429,8 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     data[index++].push_back(vx3);
                     data[index++].push_back(p1);
                     data[index++].push_back(phi2[REST]);
-                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure) {
-                        data[index++].push_back((*dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel>(kernel)->pressure)(ix1, ix2, ix3));
+                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) {
+                        data[index++].push_back((*dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure)(ix1, ix2, ix3));
                     }
                    // else { data[index++].push_back(999); }
                 }
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
new file mode 100644
index 000000000..dd6ea50e2
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
@@ -0,0 +1,243 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file ThreeDistributionsFullDirectConnector2.cpp
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "ThreeDistributionsFullDirectConnector2.h"
+#include "LBMKernel.h"
+#include "DataSet3D.h"
+
+ThreeDistributionsFullDirectConnector2::ThreeDistributionsFullDirectConnector2(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+    : FullDirectConnector(from, to, sendDir)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullDirectConnector2::init()
+{
+    FullDirectConnector::init();
+
+	fFrom =dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions());
+	fTo = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions());
+	hFrom = dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getHdistributions());
+	hTo = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getHdistributions());
+    hFrom2 = dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getH2distributions());
+    hTo2  = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getH2distributions());
+}
+//////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullDirectConnector2::sendVectors()
+{
+    updatePointers();
+    exchangeData();
+}
+//////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullDirectConnector2::exchangeData()
+{
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    int minX1p3 = minX1 + 3;
+    int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    int minX2p3 = minX2 + 3;
+    int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    int minX3p3 = minX3 + 3;
+    int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    int maxX3m3 = maxX3 - 3;
+
+    // EAST
+    if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                exchangeData(maxX1m3, x2, x3, minX1, x2, x3);
+                exchangeData(maxX1m2, x2, x3, minX1p1, x2, x3);
+            }
+        }
+    }
+    // WEST
+    else if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                exchangeData(minX1p3, x2, x3, maxX1, x2, x3);
+                exchangeData(minX1p2, x2, x3, maxX1m1, x2, x3);
+            }
+        }
+    }
+    // NORTH
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, maxX2m3, x3, x1, minX2, x3);
+                exchangeData(x1, maxX2m2, x3, x1, minX2p1, x3);
+            }
+        }
+    }
+    // SOUTH
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, minX2p3, x3, x1, maxX2, x3);
+                exchangeData(x1, minX2p2, x3, x1, maxX2m1, x3);
+            }
+        }
+    }
+
+    // TOP
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, x2, maxX3m3, x1, x2, minX3);
+                exchangeData(x1, x2, maxX3m2, x1, x2, minX3p1);
+            }
+        }
+    }
+    // BOTTOM
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, x2, minX3p3, x1, x2, maxX3);
+                exchangeData(x1, x2, minX3p2, x1, x2, maxX3m1);
+            }
+        }
+    }
+    // NORTHEAST
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(maxX1m3, maxX2m3, x3, minX1, minX2, x3);
+            exchangeData(maxX1m2, maxX2m2, x3, minX1p1, minX2p1, x3);
+        }
+    }
+    // NORTHWEST
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(minX1p3, maxX2m3, x3, maxX1, minX2, x3);
+            exchangeData(minX1p2, maxX2m2, x3, maxX1m1, minX2p1, x3);
+        }
+    }
+    // SOUTHWEST
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(minX1p3, minX2p3, x3, maxX1, maxX2, x3);
+            exchangeData(minX1p2, minX2p2, x3, maxX1m1, maxX2m1, x3);
+        }
+    }
+    // SOUTHEAST
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(maxX1m3, minX2p3, x3, minX1, maxX2, x3);
+            exchangeData(maxX1m2, minX2p2, x3, minX1p1, maxX2m1, x3);
+        }
+    } else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(maxX1m3, x2, maxX3m3, minX1, x2, minX3);
+            exchangeData(maxX1m2, x2, maxX3m2, minX1p1, x2, minX3p1);
+        }
+    else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(minX1p3, x2, minX3p3, maxX1, x2, maxX3);
+            exchangeData(minX1p2, x2, minX3p2, maxX1m1, x2, maxX3m1);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(maxX1m3, x2, minX3p3, minX1, x2, maxX3);
+            exchangeData(maxX1m2, x2, minX3p2, minX1p1, x2, maxX3m1);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(minX1p3, x2, maxX3m3, maxX1, x2, minX3);
+            exchangeData(minX1p2, x2, maxX3m2, maxX1m1, x2, minX3p1);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, maxX2m3, maxX3m3, x1, minX2, minX3);
+            exchangeData(x1, maxX2m2, maxX3m2, x1, minX2p1, minX3p1);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, minX2p3, minX3p3, x1, maxX2, maxX3);
+            exchangeData(x1, minX2p2, minX3p2, x1, maxX2m1, maxX3m1);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, maxX2m3, minX3p3, x1, minX2, maxX3);
+            exchangeData(x1, maxX2m2, minX3p2, x1, minX2p1, maxX3m1);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, minX2p3, maxX3m3, x1, maxX2, minX3);
+            exchangeData(x1, minX2p2, maxX3m2, x1, maxX2m1, minX3p1);
+        }
+    else if (sendDir == D3Q27System::TSW) {
+        exchangeData(minX1p3, minX2p3, maxX3m3, maxX1, maxX2, minX3);
+        exchangeData(minX1p2, minX2p2, maxX3m2, maxX1m1, maxX2m1, minX3p1);
+    } else if (sendDir == D3Q27System::TSE) {
+        exchangeData(maxX1m3, minX1p3, maxX3m3, minX1, maxX2, minX3);
+        exchangeData(maxX1m2, minX1p2, maxX3m2, minX1p1, maxX2m1, minX3p1);
+    } else if (sendDir == D3Q27System::TNW) {
+        exchangeData(minX1p3, maxX2m3, maxX3m3, maxX1, minX2, minX3);
+        exchangeData(minX1p2, maxX2m2, maxX3m2, maxX1m1, minX2p1, minX3p1);
+    } else if (sendDir == D3Q27System::TNE) {
+        exchangeData(maxX1m3, maxX2m3, maxX3m3, minX1, minX2, minX3);
+        exchangeData(maxX1m2, maxX2m2, maxX3m2, minX1p1, minX2p1, minX3p1);
+    } else if (sendDir == D3Q27System::BSW) {
+        exchangeData(minX1p3, minX2p3, minX3p3, maxX1, maxX2, maxX3);
+        exchangeData(minX1p2, minX2p2, minX3p2, maxX1m1, maxX2m1, maxX3m1);
+    } else if (sendDir == D3Q27System::BSE) {
+        exchangeData(maxX1m3, minX2p3, minX3p3, minX1, maxX2, maxX3);
+        exchangeData(maxX1m2, minX2p2, minX3p2, minX1p1, maxX2m1, maxX3m1);
+    } else if (sendDir == D3Q27System::BNW) {
+        exchangeData(minX1p3, maxX2m3, minX3p3, maxX1, minX2, maxX3);
+        exchangeData(minX1p2, maxX2m2, minX3p2, maxX1m1, minX2p1, maxX3m1);
+    } else if (sendDir == D3Q27System::BNE) {
+        exchangeData(maxX1m3, maxX2m3, minX3p3, minX1, minX2, maxX3);
+        exchangeData(maxX1m2, maxX2m2, minX3p2, minX1p1, minX2p1, maxX3m1);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+
+}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
new file mode 100644
index 000000000..1ced5129b
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
@@ -0,0 +1,234 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file ThreeDistributionsFullDirectConnector2.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef ThreeDistributionsFullDirectConnector2_H
+#define ThreeDistributionsFullDirectConnector2_H
+
+#include "FullDirectConnector.h"
+#include "Block3D.h"
+#include "D3Q27System.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+
+//! \brief   Exchange data between blocks. 
+//! \details Connector send and receive full distributions between two blocks in shared memory.
+
+class ThreeDistributionsFullDirectConnector2 : public FullDirectConnector
+{
+public:
+	ThreeDistributionsFullDirectConnector2(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
+    void init() override;
+    void sendVectors() override;
+
+protected:
+    inline void updatePointers() override;
+    void exchangeData();
+    inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) override;
+
+private:
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFromf;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFromf;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFromf;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTof;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTof;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsTof;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFromh;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFromh;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFromh;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsToh;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsToh;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsToh;
+
+	CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFromh2;
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFromh2;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsFromh2;
+
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsToh2;
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsToh2;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsToh2;
+
+	SPtr<EsoTwist3D> fFrom, hFrom, hFrom2;
+    SPtr<EsoTwist3D> fTo, hTo, hTo2;
+};
+//////////////////////////////////////////////////////////////////////////
+inline void ThreeDistributionsFullDirectConnector2::updatePointers()
+{
+    localDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions();
+    nonLocalDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions();
+    zeroDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions();
+
+    localDistributionsTof    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions();
+    nonLocalDistributionsTof = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions();
+    zeroDistributionsTof     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions();
+
+    localDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getLocalDistributions();
+    nonLocalDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getNonLocalDistributions();
+    zeroDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getZeroDistributions();
+
+    localDistributionsToh    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getLocalDistributions();
+    nonLocalDistributionsToh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getNonLocalDistributions();
+    zeroDistributionsToh     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getZeroDistributions();
+
+    localDistributionsFromh2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom2)->getLocalDistributions();
+    nonLocalDistributionsFromh2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom2)->getNonLocalDistributions();
+    zeroDistributionsFromh2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom2)->getZeroDistributions();
+
+    localDistributionsToh2    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo2)->getLocalDistributions();
+    nonLocalDistributionsToh2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo2)->getNonLocalDistributions();
+    zeroDistributionsToh2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo2)->getZeroDistributions();
+}
+//////////////////////////////////////////////////////////////////////////
+inline void ThreeDistributionsFullDirectConnector2::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
+{
+	(*this->localDistributionsTof)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_E, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_N, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_T, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_NE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TN, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+	(*this->zeroDistributionsTof)(x1To, x2To, x3To) = (*this->zeroDistributionsFromf)(x1From, x2From, x3From);
+
+
+	(*this->localDistributionsToh)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_E, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_N, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_T, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_NE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TN, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+	(*this->zeroDistributionsToh)(x1To, x2To, x3To) = (*this->zeroDistributionsFromh)(x1From, x2From, x3From);
+
+	(*this->localDistributionsToh2)(D3Q27System::ET_E, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_E, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_N, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_N, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_T, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_T, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_NE, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_NE, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TE, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TE, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TN, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TN, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TNE, x1To, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+    (*this->localDistributionsToh2)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) =
+        (*this->localDistributionsFromh2)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_W, x1To + 1, x2To, x3To) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_S, x1To, x2To + 1, x3To) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_B, x1To, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+    (*this->nonLocalDistributionsToh2)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) =
+        (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+    (*this->zeroDistributionsToh2)(x1To, x2To, x3To) = (*this->zeroDistributionsFromh2)(x1From, x2From, x3From);
+}
+#endif
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
index f3aa96831..585aaa5d0 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
@@ -51,7 +51,7 @@ class Communicator;
 class Block3D;
 class Interactor3D;
 
-#define OFFSET 0.5
+#define OFFSET 1.5
 
 //! A class implements block grid
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
new file mode 100644
index 000000000..13f8ce77f
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
@@ -0,0 +1,3498 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
+//! \ingroup LBMKernel
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h"
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "D3Q27System.h"
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include <cmath>
+
+#define PROOF_CORRECTNESS
+
+//////////////////////////////////////////////////////////////////////////
+MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2() { this->compressible = false; }
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::initDataSet()
+{
+    SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+    SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+    SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+    SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	pressure= CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+    dataSet->setFdistributions(f);
+    dataSet->setHdistributions(h); // For phase-field
+    dataSet->setH2distributions(h2); // For phase-field
+    dataSet->setPhaseField(divU);
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
+{
+    SPtr<LBMKernel> kernel(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2());
+    kernel->setNX(nx);
+    dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->initDataSet();
+    kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+    kernel->setDensityRatio(this->densityRatio);
+    kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+    kernel->setContactAngle(this->contactAngle);
+    kernel->setPhiL(this->phiL);
+    kernel->setPhiH(this->phiH);
+    kernel->setPhaseFieldRelaxation(this->tauH);
+    kernel->setMobility(this->mob);
+
+    kernel->setBCProcessor(bcProcessor->clone(kernel));
+    kernel->setWithForcing(withForcing);
+    kernel->setForcingX1(muForcingX1);
+    kernel->setForcingX2(muForcingX2);
+    kernel->setForcingX3(muForcingX3);
+    kernel->setIndex(ix1, ix2, ix3);
+    kernel->setDeltaT(deltaT);
+	kernel->setGhostLayerWidth(2);
+
+    return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+    LBMReal m2 = mfa + mfc;
+	LBMReal m1 = mfc - mfa;
+	LBMReal m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += oneMinusRho;
+	mfb = (m1 * Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+    LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+    LBMReal m1 = (mfa + mfc) + mfb;
+	LBMReal m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+	mfb = m2 - vv * m1;
+	mfa = m1;
+}
+
+
+ void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+    LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::calculate(int step)
+{
+    using namespace D3Q27System;
+    using namespace UbMath;
+
+    forcingX1 = 0.0;
+    forcingX2 = 0.0;
+    forcingX3 = 0.0;
+
+	LBMReal oneOverInterfaceScale = 1.0;
+    /////////////////////////////////////
+
+    localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+    nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+    zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+    localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+    nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+    zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+
+	localDistributionsH2    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getLocalDistributions();
+    nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions();
+    zeroDistributionsH2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions();
+
+    SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+    const int bcArrayMaxX1 = (int)bcArray->getNX1();
+    const int bcArrayMaxX2 = (int)bcArray->getNX2();
+    const int bcArrayMaxX3 = (int)bcArray->getNX3();
+	    
+	int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+    int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+    int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+
+    //TODO
+	//very expensive !!!!!
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField(
+            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2(
+        new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+        CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU(
+            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+
+//#pragma omp parallel for
+	  for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+            for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+                for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+                    if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+                        int x1p = x1 + 1;
+                        int x2p = x2 + 1;
+                        int x3p = x3 + 1;
+
+                        LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                        LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                        LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                        LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                        LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                        LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                        LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                        LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                        LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                        LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                        LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                        LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                        LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                        LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                        LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                        LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                        LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+                        (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+                                                    (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+                                                    ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+                                                    (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+
+                        mfcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+                        mfbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+                        mfbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+                        mfccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+                        mfacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+                        mfcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+                        mfabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+                        mfbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+                        mfbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+                        mfccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+                        mfacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        mfcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        mfaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        mfabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+                        mfbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+                        mfbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+                        mfaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        mfcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+                        mfaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        mfcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+                        mfbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        mfbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+                        mfaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        mfcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        mfaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+                        (*phaseField2)(x1, x2, x3) =
+                            (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) +
+                            (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+                             ((mfbaa + mfbac) + (mfbca + mfbcc))) +
+                            ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+						//(*phaseField)(x1, x2, x3) = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+						//	(mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+						//	(mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) +
+						//	(mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+////// read F-distributions for velocity formalism
+
+
+						 mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+						 mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+						 mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+						 mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+						 mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+						 mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+						 mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+						 mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+						 mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+						 mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+						 mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+						 mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+						 mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+						 mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+						 mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+						 mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+						 mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+						 mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+						 mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+						 mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+						 mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+						 mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+						 mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+						 mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+						 mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+						 mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+						 mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+						LBMReal rhoH = 1.0;
+						LBMReal rhoL = 1.0 / densityRatio;
+
+						LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+						LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+						LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
+
+						////!!!!!! relplace by pointer swap!
+						(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+                    }
+                }
+            }
+        }
+
+        LBMReal collFactorM;
+        //LBMReal forcingTerm[D3Q27System::ENDF + 1];
+
+		////filter
+
+		//for (int x3 = minX3; x3 < maxX3; x3++) {
+		//	for (int x2 = minX2; x2 < maxX2; x2++) {
+		//		for (int x1 = minX1; x1 < maxX1; x1++) {
+		//			if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+		//				LBMReal sum = 0.;
+
+		//				//Lapalce pressure
+		//				//sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1+1, x2-1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3+1) - (*pressure)(x1, x2, x3)))));
+		//				//sum += WEIGTH[TN] * (
+		//				//	((((*pressure)(x1+1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1+1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	+ ((((*pressure)(x1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+		//				//	);
+		//				//sum += WEIGTH[T] * (
+		//				//	(((*pressure)(x1+1, x2, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3) - (*pressure)(x1, x2, x3)))
+		//				//	+ (((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3) - (*pressure)(x1, x2, x3)))
+		//				//	+ (((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2, x3-1) - (*pressure)(x1, x2, x3)))
+		//				//	);
+
+
+		//				//LBMReal pressureFilter = 100;
+		//				//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + pressureFilter * sum * (sqrt(fabs(sum)));
+
+		//				//Situpol Eq. 81
+		//				sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1)) + ((*pressure)(x1-1, x2-1, x3-1) )) + (((*pressure)(x1+1, x2+1, x3-1) ) + ((*pressure)(x1-1, x2-1, x3+1) )))
+		//					+ ((((*pressure)(x1+1, x2-1, x3+1) ) + ((*pressure)(x1-1, x2+1, x3-1) )) + (((*pressure)(x1+1, x2-1, x3-1) ) + ((*pressure)(x1-1, x2+1, x3+1) ))));
+		//				sum += WEIGTH[TN] * (
+		//					((((*pressure)(x1+1, x2+1, x3) ) + ((*pressure)(x1-1, x2-1, x3) )) + (((*pressure)(x1+1, x2-1, x3) ) + ((*pressure)(x1-1, x2+1, x3) )))
+		//					+ ((((*pressure)(x1+1, x2, x3+1) ) + ((*pressure)(x1-1, x2, x3-1) )) + (((*pressure)(x1+1, x2, x3-1) ) + ((*pressure)(x1-1, x2, x3+1) )))
+		//					+ ((((*pressure)(x1, x2+1, x3+1) ) + ((*pressure)(x1, x2-1, x3-1) )) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) )))
+		//					);
+		//				sum += WEIGTH[T] * (
+		//					(((*pressure)(x1+1, x2, x3) ) + ((*pressure)(x1-1, x2, x3) ))
+		//					+ (((*pressure)(x1, x2+1, x3) ) + ((*pressure)(x1, x2-1, x3) ))
+		//					+ (((*pressure)(x1, x2, x3+1)) + ((*pressure)(x1, x2, x3-1) ))
+		//					);
+		//				sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
+		//				(*pressureOld)(x1, x2, x3) = sum;
+
+
+
+
+		//			}
+		//		}
+		//	}
+		//}
+
+		////Periodic Filter
+//#pragma omp parallel for
+		for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+			for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+				for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+					if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+						LBMReal sum = 0.;
+
+
+
+						//Lapalce pressure
+						//sum += WEIGTH[TNE] * (((((*pressure)(x1+1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1+1, x2-1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3+1) - (*pressure)(x1, x2, x3)))));
+						//sum += WEIGTH[TN] * (
+						//	((((*pressure)(x1+1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2-1, x3) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2-1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2+1, x3) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1+1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1+1, x2, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3+1) - (*pressure)(x1, x2, x3))))
+						//	+ ((((*pressure)(x1, x2+1, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3-1) - (*pressure)(x1, x2, x3))) + (((*pressure)(x1, x2+1, x3-1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3+1) - (*pressure)(x1, x2, x3))))
+						//	);
+						//sum += WEIGTH[T] * (
+						//	(((*pressure)(x1+1, x2, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1-1, x2, x3) - (*pressure)(x1, x2, x3)))
+						//	+ (((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2-1, x3) - (*pressure)(x1, x2, x3)))
+						//	+ (((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2, x3-1) - (*pressure)(x1, x2, x3)))
+						//	);
+
+
+						//LBMReal pressureFilter = 100;
+						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + pressureFilter * sum * (sqrt(fabs(sum)));
+
+						//Situpol Eq. 81
+
+						//int x1p = (x1 < maxX1) ? x1 + 1 : 0;
+						//int x1m = (x1 > 0) ? x1 - 1 : maxX1;
+						//int x2p = (x2 < maxX2) ? x2 + 1 : 0;
+						//int x2m = (x2 > 0) ? x2 - 1 : maxX2;
+						//int x3p = (x3 < maxX3) ? x3 + 1 : 0;
+						//int x3m = (x3 > 0) ? x3 - 1 : maxX3;
+						//sum += WEIGTH[TNE] * (((((*pressure)(x1p, x2p, x3p)) + ((*pressure)(x1m, x2m, x3m))) + (((*pressure)(x1p, x2p, x3m)) + ((*pressure)(x1m, x2m, x3p))))
+						//	+ ((((*pressure)(x1p, x2m, x3p)) + ((*pressure)(x1m, x2p, x3m))) + (((*pressure)(x1p, x2m, x3m)) + ((*pressure)(x1m, x2p, x3p)))));
+						//sum += WEIGTH[TN] * (
+						//	((((*pressure)(x1p, x2p, x3)) + ((*pressure)(x1m, x2m, x3))) + (((*pressure)(x1p, x2m, x3)) + ((*pressure)(x1m, x2p, x3))))
+						//	+ ((((*pressure)(x1p, x2, x3p)) + ((*pressure)(x1m, x2, x3m))) + (((*pressure)(x1p, x2, x3m)) + ((*pressure)(x1m, x2, x3p))))
+						//	+ ((((*pressure)(x1, x2p, x3p)) + ((*pressure)(x1, x2m, x3m))) + (((*pressure)(x1, x2p, x3m) - (*pressure)(x1, x2, x3)) + ((*pressure)(x1, x2m, x3p))))
+						//	);
+						//sum += WEIGTH[T] * (
+						//	(((*pressure)(x1p, x2, x3)) + ((*pressure)(x1m, x2, x3)))
+						//	+ (((*pressure)(x1, x2p, x3)) + ((*pressure)(x1, x2m, x3)))
+						//	+ (((*pressure)(x1, x2, x3p)) + ((*pressure)(x1, x2, x3m)))
+						//	);
+						//sum += WEIGTH[REST] * (*pressure)(x1, x2, x3);
+						//(*pressureOld)(x1, x2, x3) = sum;
+						 
+						///Version for boundaries
+						for (int xx = -1; xx <= 1; xx++) {
+							//int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+							int xxx = xx + x1;
+
+							for (int yy = -1; yy <= 1; yy++) {
+								//int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+								int yyy = yy + x2;
+
+								for (int zz = -1; zz <= 1; zz++) {
+									//int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+									int zzz = zz + x3;
+									
+									if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+										sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressure)(xxx, yyy, zzz);
+									}
+									else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressure)(x1, x2, x3);
+									}
+
+
+								}
+							}
+						}
+						(*pressureOld)(x1, x2, x3) = sum;
+
+
+
+					}
+				}
+			}
+		}
+
+//#pragma omp parallel for
+		for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+			for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+				for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+					if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+						///filter!
+
+						(*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3);
+					}
+				}
+			}
+		}
+		////!filter
+
+
+//#pragma omp parallel for
+        for (int x3 = minX3; x3 < maxX3; x3++) {
+            for (int x2 = minX2; x2 < maxX2; x2++) {
+                for (int x1 = minX1; x1 < maxX1; x1++) {
+                    if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+                        int x1p = x1 + 1;
+                        int x2p = x2 + 1;
+                        int x3p = x3 + 1;
+
+
+
+                        //////////////////////////////////////////////////////////////////////////
+                        // Read distributions and phase field
+                        ////////////////////////////////////////////////////////////////////////////
+                        //////////////////////////////////////////////////////////////////////////
+
+                        // E   N  T
+                        // c   c  c
+                        //////////
+                        // W   S  B
+                        // a   a  a
+
+                        // Rest ist b
+
+                        // mfxyz
+                        // a - negative
+                        // b - null
+                        // c - positive
+
+                        // a b c
+                        //-1 0 1
+
+                        findNeighbors(phaseField, x1, x2, x3);
+						findNeighbors2(phaseField2, x1, x2, x3);
+
+                        LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+                        LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+                        LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+                        LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+                        LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+                        LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+                        LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+                        LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+                        LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+                        LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+                        LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+                        LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+                        LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+                        LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+                        LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+                        LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+                        LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+                        LBMReal rhoH = 1.0;
+                        LBMReal rhoL = 1.0 / densityRatio;
+
+                        LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+                        LBMReal dX1_phi = gradX1_phi();
+                        LBMReal dX2_phi = gradX2_phi();
+                        LBMReal dX3_phi = gradX3_phi();
+
+						//LBMReal dX1_phi2 = gradX1_phi2();
+						//LBMReal dX2_phi2 = gradX2_phi2();
+						//LBMReal dX3_phi2 = gradX3_phi2();
+
+
+      //                  LBMReal denom2 = sqrt(dX1_phi * dX1_phi+ dX1_phi2 * dX1_phi2 + dX2_phi * dX2_phi + dX2_phi2 * dX2_phi2 + dX3_phi * dX3_phi+ dX3_phi2 * dX3_phi2) + 1e-9;
+      //                  LBMReal normX1 = (dX1_phi-dX1_phi2)/denom2;
+						//LBMReal normX2 = (dX2_phi-dX2_phi2)/denom2;
+						//LBMReal normX3 = (dX3_phi-dX3_phi2)/denom2;
+
+						LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
+						LBMReal normX1 = dX1_phi / denom;
+						LBMReal normX2 = dX2_phi / denom;
+						LBMReal normX3 = dX3_phi / denom;
+
+
+
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+
+
+                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+
+                        //----------- Calculating Macroscopic Values -------------
+                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+
+                            			   ////Incompressible Kernal
+
+						//mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)         ;// / rho * c3;
+						//mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)         ;// / rho * c3;
+						//mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)        ;// / rho * c3;
+						//mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)       ;// / rho * c3;
+						//mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)         ;// / rho * c3;
+						//mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)        ;// / rho * c3;
+						//mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)       ;// / rho * c3;
+						//mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)        ;// / rho * c3;
+						//mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)       ;// / rho * c3;
+						//mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)       ;// / rho * c3;
+						//mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)      ;// / rho * c3;
+						//mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)      ;// / rho * c3;
+						//mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3)     ;// / rho * c3;																								    
+						//mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     ;// / rho * c3;
+						//mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     ;// / rho * c3;
+						//mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     ;// / rho * c3;
+						//mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   ;// / rho * c3;
+						//mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    ;// / rho * c3;
+						//mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   ;// / rho * c3;
+						//mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    ;// / rho * c3;
+						//mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   ;// / rho * c3;
+						//mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    ;// / rho * c3;
+						//mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) ;// / rho * c3;
+						//mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  ;// / rho * c3;
+						//mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  ;// / rho * c3;
+						//mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   ;// / rho * c3;
+
+						//mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);// / rho * c3;
+
+
+			   LBMReal m0, m1, m2;
+			   LBMReal rhoRef=c1;
+
+			  //LBMReal 
+			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+				   (mfcbb - mfabb))/rhoRef;
+			   LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+				   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+				   (mfbcb - mfbab))/rhoRef;
+			   LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+				   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+				   (mfbbc - mfbba))/rhoRef;
+
+			 //  (*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3)+rho*c1o3*drho;
+
+			   //LBMReal gradPx = c1o2 * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3));
+			   //LBMReal gradPy = c1o2 * ((*pressure)(x1, x2 + 1, x3) - (*pressure)(x1, x2 - 1, x3));
+			   //LBMReal gradPz = c1o2 * ((*pressure)(x1, x2, x3 + 1) - (*pressure)(x1, x2, x3 - 1));
+
+			   //LBMReal gradPx = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1)))
+				  // + (((*pressure)(x1 + 1, x2 - 1, x3 - 1) - (*pressure)(x1 - 1, x2 + 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
+					 //  + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
+
+			   //LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				  // + (((*pressure)(x1 - 1, x2 + 1, x3 - 1) - (*pressure)(x1 + 1, x2 - 1, x3 + 1)) + ((*pressure)(x1 + 1, x2 + 1, x3 - 1) - (*pressure)(x1 - 1, x2 - 1, x3 + 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
+					 //  + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
+
+			   //LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
+				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
+				  // + (((*pressure)(x1 - 1, x2 - 1, x3 + 1) - (*pressure)(x1 + 1, x2 + 1, x3 - 1)) + ((*pressure)(x1 + 1, x2 - 1, x3 + 1) - (*pressure)(x1 - 1, x2 + 1, x3 - 1))))
+				  // + WEIGTH[NE] * (
+				  // (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
+					 //  + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
+				  // + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
+			  
+			   
+			   LBMReal gradPx = 0.0;
+			   LBMReal gradPy = 0.0;
+			   LBMReal gradPz = 0.0;
+			   for (int dir1 = -1; dir1 <= 1; dir1++) {
+				   for (int dir2 = -1; dir2 <= 1; dir2++) {
+					   int yyy = x2 + dir1;
+					   int zzz = x3 + dir2;
+					   if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+						   gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 - 1, yyy, zzz)) {
+						   gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+					   int xxx = x1 + dir1;
+					   if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+						   gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+						   gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+					   yyy = x2 + dir2;
+					   if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+						   gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+						   gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+					   else {
+						   gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					   }
+
+				   }
+			   }
+
+			   //3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+			   //+WEIGTH[N] * (phi2[T] - phi2[B]));
+
+			   if (withForcing) {
+				   // muX1 = static_cast<double>(x1-1+ix1*maxX1);
+				   // muX2 = static_cast<double>(x2-1+ix2*maxX2);
+				   // muX3 = static_cast<double>(x3-1+ix3*maxX3);
+
+				  // forcingX1 = muForcingX1.Eval()+c1o3*drho*dX1_phi*rhoToPhi/rho;//-gradPx/rho;
+				  // forcingX2 = muForcingX2.Eval() + c1o3*drho*dX2_phi * rhoToPhi / rho;//-gradPy/rho;
+				   //forcingX3 = muForcingX3.Eval() + c1o3*drho*dX3_phi * rhoToPhi / rho;//-gradPz/rho;
+
+				   forcingX1 = muForcingX1.Eval() -gradPx/rho;
+				   forcingX2 = muForcingX2.Eval() -gradPy/rho;
+				   forcingX3 = muForcingX3.Eval() -gradPz/rho;
+
+				   //LBMReal rho_m = 1.0 / densityRatio;
+				   //forcingX1 = forcingX1 * (rho - rho_m);
+				   //forcingX2 = forcingX2 * (rho - rho_m);
+				   //forcingX3 = forcingX3 * (rho - rho_m);
+				   vvx += forcingX1 * deltaT * 0.5; // X
+				   vvy += forcingX2 * deltaT * 0.5; // Y
+				   vvz += forcingX3 * deltaT * 0.5; // Z
+
+			   }
+
+
+			   ///surface tension force
+			   vvx += mu * dX1_phi*c1o2;
+			   vvy += mu * dX2_phi * c1o2 ;
+			   vvz += mu * dX3_phi * c1o2;
+
+			   //////classic source term
+			   ///----Classic source term 8.4.2021
+
+			   //LBMReal vvxF, vvyF, vvzF;
+			   //vvxF = vvx;//-2*c1o24 * lap_vx;// 
+			   //vvyF = vvy;//-2*c1o24 * lap_vy;// 
+			   //vvzF = vvz;//-2*c1o24 * lap_vz;// 
+
+//			   vvxF = 1.2* vvx- 0.2*0.5 * ((*velocityX)(x1 - 1, x2, x3) + (*velocityX)(x1 + 1, x2, x3));
+//			   vvyF = 1.2 *vvy- 0.2*0.5* ((*velocityY)(x1 , x2-1, x3) + (*velocityY)(x1 , x2+1, x3));
+//			   vvzF = 1.2 *vvz-0.2*0.5* ((*velocityZ)(x1 , x2, x3-1) + (*velocityZ)(x1 , x2, x3+1));
+			   //if (vvxF != vvx) {
+				  // vvxF = vvxF;
+			   //}
+			   //LBMReal weightGrad = 1.0;// -denom * denom / (denom * denom + 0.0001 * 0.001);
+			   //LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
+			   //LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
+			   //LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+
+			   //dX1_phiF *= 1.2;
+			   //dX2_phiF *= 1.2;
+			   //dX3_phiF *= 1.2;
+
+			   //LBMReal gradFD = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi);
+			   //LBMReal gradPhi = (1.0 - phi[REST]) * (phi[REST]);
+			   //gradPhi = (gradPhi > gradFD) ? gradPhi : gradFD;
+			   //dX1_phiF = gradPhi * normX1;
+				  // dX2_phiF = gradPhi * normX2;
+				  // dX3_phiF = gradPhi * normX3;
+
+			   //LBMReal ux2;
+			   //LBMReal uy2;
+			   //LBMReal uz2;
+			   //ux2 = vvxF * vvxF;
+			   //uy2 = vvyF * vvyF;
+			   //uz2 = vvzF * vvzF;
+			   //LBMReal forcingTerm[D3Q27System::ENDF + 1];
+			   //for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+				  // LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
+				  // LBMReal velSq1 = velProd * velProd;
+				  // LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
+
+				  // //LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
+
+				  // //forcingTerm[dir] =
+					 // // (-vvxF) * (fac1 * dX1_phiF) +
+					 // // (-vvyF) * (fac1 * dX2_phiF) +
+					 // // (-vvzF) * (fac1 * dX3_phiF) +
+					 // // (DX1[dir]) * (fac1 * dX1_phiF) +
+					 // // (DX2[dir]) * (fac1 * dX2_phiF) +
+					 // // (DX3[dir]) * (fac1 * dX3_phiF);
+
+
+				  // //LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 ;
+
+				  // //forcingTerm[dir] =
+					 // // (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL)) +
+					 // // (DX1[dir]) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (DX2[dir]) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+					 // // (DX3[dir]) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+
+
+			   //}
+
+			   //LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+			   //LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
+			   //forcingTerm[REST] =	 (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+				  // (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
+				  // (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
+
+			   ////////
+			  // LBMReal divAfterSource=
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfacb + 3.0 * (0.5 * forcingTerm[NW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcbc + 3.0 * (0.5 * forcingTerm[TE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabc + 3.0 * (0.5 * forcingTerm[TW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbcc + 3.0 * (0.5 * forcingTerm[TN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfbac + 3.0 * (0.5 * forcingTerm[TS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfccc + 3.0 * (0.5 * forcingTerm[TNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfacc + 3.0 * (0.5 * forcingTerm[TNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfcac + 3.0 * (0.5 * forcingTerm[TSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfaac + 3.0 * (0.5 * forcingTerm[TSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF-1)*(vvzF-1)-1)+
+			  //( mfabb + 3.0 * (0.5 * forcingTerm[W]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfbab + 3.0 * (0.5 * forcingTerm[S]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfbba + 3.0 * (0.5 * forcingTerm[B]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaab + 3.0 * (0.5 * forcingTerm[SW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfcab + 3.0 * (0.5 * forcingTerm[SE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF)  *(vvzF)-1)+
+			  //( mfaba + 3.0 * (0.5 * forcingTerm[BW]) / rho	) *((vvxF+1)*(vvxF+1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcba + 3.0 * (0.5 * forcingTerm[BE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbaa + 3.0 * (0.5 * forcingTerm[BS]) / rho	) *((vvxF)  *(vvxF)  +(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbca + 3.0 * (0.5 * forcingTerm[BN]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaaa + 3.0 * (0.5 * forcingTerm[BSW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcaa + 3.0 * (0.5 * forcingTerm[BSE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF+1)*(vvyF+1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfaca + 3.0 * (0.5 * forcingTerm[BNW]) / rho) *((vvxF+1)*(vvxF+1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfcca + 3.0 * (0.5 * forcingTerm[BNE]) / rho) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF+1)*(vvzF+1)-1)+
+			  //( mfbbb + 3.0 * (0.5 * forcingTerm[REST]) / rho)*((vvxF)*(vvxF)+(vvyF)*(vvyF)+(vvzF)*(vvzF)-1);
+
+			  // LBMReal divBeforeSource =
+				 //  (mfcbb)    * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbcb)    * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbbc)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccb)   * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfacb)   * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcbc)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabc)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbcc)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfbac)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfccc)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfacc)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfcac)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfaac)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF - 1) * (vvzF - 1)-1) +
+				 //  (mfabb)    * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF) * (vvzF)-1) +
+				 //  (mfbab)    * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfbba)    * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaab)   * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfcab)   * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF) * (vvzF)-1) +
+				 //  (mfaba)   * ((vvxF + 1) * (vvxF + 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcba)   * ((vvxF - 1) * (vvxF - 1) + (vvyF) * (vvyF)+(vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbaa)   * ((vvxF) * (vvxF)+(vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbca)   * ((vvxF) * (vvxF)+(vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaaa)  * ((vvxF + 1) * (vvxF + 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcaa)  * ((vvxF - 1) * (vvxF - 1) + (vvyF + 1) * (vvyF + 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfaca)  * ((vvxF + 1) * (vvxF + 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfcca)  * ((vvxF - 1) * (vvxF - 1) + (vvyF - 1) * (vvyF - 1) + (vvzF + 1) * (vvzF + 1)-1) +
+				 //  (mfbbb) * ((vvxF) * (vvxF)+(vvyF) * (vvyF)+(vvzF) * (vvzF)-1);
+			   //if (divAfterSource - divBeforeSource != 0 && phi[REST]>0.0001 && phi[REST]<0.999) {
+				  // std::cout << phi[REST]<<" "<< divAfterSource << " " << divBeforeSource <<" "<< divAfterSource/ divBeforeSource << std::endl;
+			   //}
+
+			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
+				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
+
+				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[N]	 *=scaleDiv;
+				  // forcingTerm[T]	 *=scaleDiv;
+				  // forcingTerm[NE]	 *=scaleDiv;
+				  // forcingTerm[NW]	 *=scaleDiv;
+				  // forcingTerm[TE]	 *=scaleDiv;
+				  // forcingTerm[TW]	 *=scaleDiv;
+				  // forcingTerm[TN]	 *=scaleDiv;
+				  // forcingTerm[TS]	 *=scaleDiv;
+				  // forcingTerm[TNE]	 *=scaleDiv;
+				  // forcingTerm[TNW]	 *=scaleDiv;
+				  // forcingTerm[TSE]	 *=scaleDiv;
+				  // forcingTerm[TSW]	 *=scaleDiv;
+				  // forcingTerm[W]	 *=scaleDiv;
+				  // forcingTerm[S]	 *=scaleDiv;
+				  // forcingTerm[B]	 *=scaleDiv;
+				  // forcingTerm[SW]	 *=scaleDiv;
+				  // forcingTerm[SE]	 *=scaleDiv;
+				  // forcingTerm[BW]	 *=scaleDiv;
+				  // forcingTerm[BE]	 *=scaleDiv;
+				  // forcingTerm[BS]	 *=scaleDiv;
+				  // forcingTerm[BN]	 *=scaleDiv;
+				  // forcingTerm[BSW]	 *=scaleDiv;
+				  // forcingTerm[BSE]	 *=scaleDiv;
+				  // forcingTerm[BNW]	 *=scaleDiv;
+				  // forcingTerm[BNE]	 *=scaleDiv;
+				  // forcingTerm[REST] *=scaleDiv;
+			   //}
+			   ////////
+
+
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   //mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   //mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   //mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   //mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   //mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   //mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   //mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   //mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   //mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   //mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   //mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   //mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   //mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   //mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   //mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   //mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   //mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   //mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   //mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   //mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   //mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   //mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   //mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+			   //--------------------------------------------------------
+
+
+
+
+
+			   //////end classic source term
+
+
+
+
+			   //forcing 
+			   ///////////////////////////////////////////////////////////////////////////////////////////
+			   if (withForcing)
+			   {
+				   muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
+				   muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
+				   muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
+
+				   //forcingX1 = muForcingX1.Eval();
+				   //forcingX2 = muForcingX2.Eval();
+				   //forcingX3 = muForcingX3.Eval();
+
+				   //vvx += forcingX1 * deltaT * 0.5; // X
+				   //vvy += forcingX2 * deltaT * 0.5; // Y
+				   //vvz += forcingX3 * deltaT * 0.5; // Z
+			   }
+
+			   LBMReal vx2;
+               LBMReal vy2;
+               LBMReal vz2;
+               vx2 = vvx * vvx;
+               vy2 = vvy * vvy;
+               vz2 = vvz * vvz;
+			   ///////////////////////////////////////////////////////////////////////////////////////////               
+			   LBMReal oMdrho;
+
+
+			   oMdrho = mfccc + mfaaa;
+			   m0 = mfaca + mfcac;
+			   m1 = mfacc + mfcaa;
+			   m2 = mfaac + mfcca;
+			   oMdrho += m0;
+			   m1 += m2;
+			   oMdrho += m1;
+			   m0 = mfbac + mfbca;
+			   m1 = mfbaa + mfbcc;
+			   m0 += m1;
+			   m1 = mfabc + mfcba;
+			   m2 = mfaba + mfcbc;
+			   m1 += m2;
+			   m0 += m1;
+			   m1 = mfacb + mfcab;
+			   m2 = mfaab + mfccb;
+			   m1 += m2;
+			   m0 += m1;
+			   oMdrho += m0;
+			   m0 = mfabb + mfcbb;
+			   m1 = mfbab + mfbcb;
+			   m2 = mfbba + mfbbc;
+			   m0 += m1 + m2;
+			   m0 += mfbbb; //hat gefehlt
+			   oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   LBMReal wadjust;
+			   LBMReal qudricLimit = 0.01;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //Hin
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   m2 = mfaaa + mfaac;
+			   m1 = mfaac - mfaaa;
+			   m0 = m2 + mfaab;
+			   mfaaa = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfaab = m1 - m0 * vvz;
+			   mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaba + mfabc;
+			   m1 = mfabc - mfaba;
+			   m0 = m2 + mfabb;
+			   mfaba = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfabb = m1 - m0 * vvz;
+			   mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaca + mfacc;
+			   m1 = mfacc - mfaca;
+			   m0 = m2 + mfacb;
+			   mfaca = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfacb = m1 - m0 * vvz;
+			   mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbaa + mfbac;
+			   m1 = mfbac - mfbaa;
+			   m0 = m2 + mfbab;
+			   mfbaa = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbab = m1 - m0 * vvz;
+			   mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbba + mfbbc;
+			   m1 = mfbbc - mfbba;
+			   m0 = m2 + mfbbb;
+			   mfbba = m0;
+			   m0 += c4o9 * oMdrho;
+			   mfbbb = m1 - m0 * vvz;
+			   mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbca + mfbcc;
+			   m1 = mfbcc - mfbca;
+			   m0 = m2 + mfbcb;
+			   mfbca = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbcb = m1 - m0 * vvz;
+			   mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcaa + mfcac;
+			   m1 = mfcac - mfcaa;
+			   m0 = m2 + mfcab;
+			   mfcaa = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfcab = m1 - m0 * vvz;
+			   mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcba + mfcbc;
+			   m1 = mfcbc - mfcba;
+			   m0 = m2 + mfcbb;
+			   mfcba = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfcbb = m1 - m0 * vvz;
+			   mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcca + mfccc;
+			   m1 = mfccc - mfcca;
+			   m0 = m2 + mfccb;
+			   mfcca = m0;
+			   m0 += c1o36 * oMdrho;
+			   mfccb = m1 - m0 * vvz;
+			   mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   m2 = mfaaa + mfaca;
+			   m1 = mfaca - mfaaa;
+			   m0 = m2 + mfaba;
+			   mfaaa = m0;
+			   m0 += c1o6 * oMdrho;
+			   mfaba = m1 - m0 * vvy;
+			   mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaab + mfacb;
+			   m1 = mfacb - mfaab;
+			   m0 = m2 + mfabb;
+			   mfaab = m0;
+			   mfabb = m1 - m0 * vvy;
+			   mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaac + mfacc;
+			   m1 = mfacc - mfaac;
+			   m0 = m2 + mfabc;
+			   mfaac = m0;
+			   m0 += c1o18 * oMdrho;
+			   mfabc = m1 - m0 * vvy;
+			   mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbaa + mfbca;
+			   m1 = mfbca - mfbaa;
+			   m0 = m2 + mfbba;
+			   mfbaa = m0;
+			   m0 += c2o3 * oMdrho;
+			   mfbba = m1 - m0 * vvy;
+			   mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbab + mfbcb;
+			   m1 = mfbcb - mfbab;
+			   m0 = m2 + mfbbb;
+			   mfbab = m0;
+			   mfbbb = m1 - m0 * vvy;
+			   mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfbac + mfbcc;
+			   m1 = mfbcc - mfbac;
+			   m0 = m2 + mfbbc;
+			   mfbac = m0;
+			   m0 += c2o9 * oMdrho;
+			   mfbbc = m1 - m0 * vvy;
+			   mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcaa + mfcca;
+			   m1 = mfcca - mfcaa;
+			   m0 = m2 + mfcba;
+			   mfcaa = m0;
+			   m0 += c1o6 * oMdrho;
+			   mfcba = m1 - m0 * vvy;
+			   mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcab + mfccb;
+			   m1 = mfccb - mfcab;
+			   m0 = m2 + mfcbb;
+			   mfcab = m0;
+			   mfcbb = m1 - m0 * vvy;
+			   mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfcac + mfccc;
+			   m1 = mfccc - mfcac;
+			   m0 = m2 + mfcbc;
+			   mfcac = m0;
+			   m0 += c1o18 * oMdrho;
+			   mfcbc = m1 - m0 * vvy;
+			   mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   m2 = mfaaa + mfcaa;
+			   m1 = mfcaa - mfaaa;
+			   m0 = m2 + mfbaa;
+			   mfaaa = m0;
+			   m0 += 1. * oMdrho;
+			   mfbaa = m1 - m0 * vvx;
+			   mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaba + mfcba;
+			   m1 = mfcba - mfaba;
+			   m0 = m2 + mfbba;
+			   mfaba = m0;
+			   mfbba = m1 - m0 * vvx;
+			   mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaca + mfcca;
+			   m1 = mfcca - mfaca;
+			   m0 = m2 + mfbca;
+			   mfaca = m0;
+			   m0 += c1o3 * oMdrho;
+			   mfbca = m1 - m0 * vvx;
+			   mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaab + mfcab;
+			   m1 = mfcab - mfaab;
+			   m0 = m2 + mfbab;
+			   mfaab = m0;
+			   mfbab = m1 - m0 * vvx;
+			   mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfabb + mfcbb;
+			   m1 = mfcbb - mfabb;
+			   m0 = m2 + mfbbb;
+			   mfabb = m0;
+			   mfbbb = m1 - m0 * vvx;
+			   mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfacb + mfccb;
+			   m1 = mfccb - mfacb;
+			   m0 = m2 + mfbcb;
+			   mfacb = m0;
+			   mfbcb = m1 - m0 * vvx;
+			   mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfaac + mfcac;
+			   m1 = mfcac - mfaac;
+			   m0 = m2 + mfbac;
+			   mfaac = m0;
+			   m0 += c1o3 * oMdrho;
+			   mfbac = m1 - m0 * vvx;
+			   mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfabc + mfcbc;
+			   m1 = mfcbc - mfabc;
+			   m0 = m2 + mfbbc;
+			   mfabc = m0;
+			   mfbbc = m1 - m0 * vvx;
+			   mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m2 = mfacc + mfccc;
+			   m1 = mfccc - mfacc;
+			   m0 = m2 + mfbcc;
+			   mfacc = m0;
+			   m0 += c1o9 * oMdrho;
+			   mfbcc = m1 - m0 * vvx;
+			   mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Cumulants
+			   ////////////////////////////////////////////////////////////////////////////////////
+
+
+			  // mfaaa = 0.0;
+			   LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity
+			 //  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+			 //  LBMReal OxyyMxzz  = 1.;//2+s9;//
+			   LBMReal O4 = 1.;
+			   LBMReal O5 = 1.;
+			   LBMReal O6 = 1.;
+
+
+
+			   /////fourth order parameters; here only for test. Move out of loop!
+
+			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+
+
+			   //Cum 4.
+			   //LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+			   //LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+			   //LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+			   LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+			   LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+			   LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+			   LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+			   LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+			   LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+
+			   //Cum 5.
+			   LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+			   LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+			   LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+
+			   //Cum 6.
+			   LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+				   - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+				   - 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+				   - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+				   + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+					   + 2. * (mfcaa * mfaca * mfaac)
+					   + 16. * mfbba * mfbab * mfabb)
+				   - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+				   - c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+				   + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+
+			   //2.
+			   // linear combinations
+			   LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+
+			//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+			  mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+				//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
+			   LBMReal mxxMyy = mfcaa - mfaca;
+			   LBMReal mxxMzz = mfcaa - mfaac;
+
+			   //applying phase field gradients first part:
+			  // mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
+               // 17.03.2021 attempt for statililization by assymptotically vanishing bias
+               //LBMReal correctionScaling =
+               //    rhoToPhi / rho; // +0.5;// (vx2 + vy2 + vz2) * 100;// +0.5;//(vx2 + vy2 + vz2)*1000;
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+			   LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+			   LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+			   LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+
+			   LBMReal Dxy = -three * collFactorM * mfbba;
+			   LBMReal Dxz = -three * collFactorM * mfbab;
+			   LBMReal Dyz = -three * collFactorM * mfabb;
+
+
+			   //relax
+			   mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+			   mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+			   mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+
+			   mfabb += collFactorM * (-mfabb);
+			   mfbab += collFactorM * (-mfbab);
+			   mfbba += collFactorM * (-mfbba);
+
+			   //applying phase field gradients second part:
+			   //mxxPyyPzz += c2o3 * rhoToPhi * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz);
+               //mxxPyyPzz += (1.0 / 6.0) * (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) *
+               //             correctionScaling; // As in Hesam's code
+               //mxxMyy += c1o3 * (dX1_phi * vvx - dX2_phi * vvy) * correctionScaling;
+               //mxxMzz += c1o3 * (dX1_phi * vvx - dX3_phi * vvz) * correctionScaling;
+               //mfabb += c1o6 * (dX2_phi * vvz + dX3_phi * vvy) * correctionScaling;
+               //mfbab += c1o6 * (dX1_phi * vvz + dX3_phi * vvx) * correctionScaling;
+               //mfbba += c1o6 * (dX1_phi * vvy + dX2_phi * vvx) * correctionScaling;
+
+               ////updated pressure
+               //mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+			   mfaaa = 0.0; // Pressure elimination as in standard velocity model
+			 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
+
+               mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+
+			  // mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+			   //mfaaa = mfaaaS;
+			   // linear combinations back
+			   mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+			   mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+			   mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+
+			   //3.
+			   // linear combinations
+			   LBMReal mxxyPyzz = mfcba + mfabc;
+			   LBMReal mxxyMyzz = mfcba - mfabc;
+
+			   LBMReal mxxzPyyz = mfcab + mfacb;
+			   LBMReal mxxzMyyz = mfcab - mfacb;
+
+			   LBMReal mxyyPxzz = mfbca + mfbac;
+			   LBMReal mxyyMxzz = mfbca - mfbac;
+
+			   //relax
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+			   mfbbb += wadjust * (-mfbbb);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+			   mxxyPyzz += wadjust * (-mxxyPyzz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+			   mxxyMyzz += wadjust * (-mxxyMyzz);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+			   mxxzPyyz += wadjust * (-mxxzPyyz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+			   mxxzMyyz += wadjust * (-mxxzMyyz);
+			   wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+			   mxyyPxzz += wadjust * (-mxyyPxzz);
+			   wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+			   mxyyMxzz += wadjust * (-mxyyMxzz);
+
+			   // linear combinations back
+			   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+			   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+			   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+			   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+			   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+			   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+			   //4.
+			   //CUMacc += O4 * (-CUMacc);
+			   //CUMcac += O4 * (-CUMcac);
+			   //CUMcca += O4 * (-CUMcca);
+
+			   //CUMbbc += O4 * (-CUMbbc);
+			   //CUMbcb += O4 * (-CUMbcb);
+			   //CUMcbb += O4 * (-CUMcbb);
+			   CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+			   CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+			   CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+			   CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+			   CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+			   CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+
+			   //5.
+			   CUMbcc += O5 * (-CUMbcc);
+			   CUMcbc += O5 * (-CUMcbc);
+			   CUMccb += O5 * (-CUMccb);
+
+			   //6.
+			   CUMccc += O6 * (-CUMccc);
+
+			   //back cumulants to central moments
+			   //4.
+			   //mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+			   //mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+			   //mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+			   mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+			   mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+			   mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+			   mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+			   mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+			   mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+
+			   //5.
+			   mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+			   mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+			   mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+
+			   //6.
+			   mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+				   - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+				   - 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+				   - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+				   + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+					   + 2. * (mfcaa * mfaca * mfaac)
+					   + 16. * mfbba * mfbab * mfabb)
+				   - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+				   - c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+				   + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+
+
+			   ////////
+
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //forcing
+			   mfbaa = -mfbaa;
+			   mfaba = -mfaba;
+			   mfaab = -mfaab;
+			   //////////////////////////////////////////////////////////////////////////////////////
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //back
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+			   m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfaaa = m0;
+			   mfaab = m1;
+			   mfaac = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+			   m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+			   m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+			   mfaba = m0;
+			   mfabb = m1;
+			   mfabc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+			   m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfaca = m0;
+			   mfacb = m1;
+			   mfacc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+			   m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+			   m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+			   mfbaa = m0;
+			   mfbab = m1;
+			   mfbac = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+			   m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+			   m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+			   mfbba = m0;
+			   mfbbb = m1;
+			   mfbbc = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+			   m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+			   m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+			   mfbca = m0;
+			   mfbcb = m1;
+			   mfbcc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+			   m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfcaa = m0;
+			   mfcab = m1;
+			   mfcac = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+			   m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+			   m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+			   mfcba = m0;
+			   mfcbb = m1;
+			   mfcbc = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+			   m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+			   m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+			   mfcca = m0;
+			   mfccb = m1;
+			   mfccc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+			   m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaaa = m0;
+			   mfaba = m1;
+			   mfaca = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+			   m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaab = m0;
+			   mfabb = m1;
+			   mfacb = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+			   m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfaac = m0;
+			   mfabc = m1;
+			   mfacc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+			   m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+			   m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+			   mfbaa = m0;
+			   mfbba = m1;
+			   mfbca = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+			   m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+			   m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+			   mfbab = m0;
+			   mfbbb = m1;
+			   mfbcb = m2;
+			   /////////b//////////////////////////////////////////////////////////////////////////
+			   m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+			   m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+			   m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+			   mfbac = m0;
+			   mfbbc = m1;
+			   mfbcc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+			   m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcaa = m0;
+			   mfcba = m1;
+			   mfcca = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+			   m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcab = m0;
+			   mfcbb = m1;
+			   mfccb = m2;
+			   /////////c//////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+			   m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+			   m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+			   mfcac = m0;
+			   mfcbc = m1;
+			   mfccc = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaaa = m0;
+			   mfbaa = m1;
+			   mfcaa = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaba = m0;
+			   mfbba = m1;
+			   mfcba = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaca = m0;
+			   mfbca = m1;
+			   mfcca = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaab = m0;
+			   mfbab = m1;
+			   mfcab = m2;
+			   ///////////b////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+			   m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfabb = m0;
+			   mfbbb = m1;
+			   mfcbb = m2;
+			   ///////////b////////////////////////////////////////////////////////////////////////
+			   m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfacb = m0;
+			   mfbcb = m1;
+			   mfccb = m2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfaac = m0;
+			   mfbac = m1;
+			   mfcac = m2;
+			   ///////////c////////////////////////////////////////////////////////////////////////
+			   m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+			   m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfabc = m0;
+			   mfbbc = m1;
+			   mfcbc = m2;
+			   ///////////c////////////////////////////////////////////////////////////////////////
+			   m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+			   m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+			   m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+			   mfacc = m0;
+			   mfbcc = m1;
+			   mfccc = m2;
+
+			   /////classical source term 8.4.2021
+
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   //mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   //mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   //mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   //mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   //mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   //mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   //mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   //mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   //mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   //mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   //mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   //mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   //mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   //mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   //mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   //mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   //mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   //mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   //mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   //mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   //mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   //mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   //mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+
+
+
+			   //////////////////////////////////////////////////////////////////////////
+			   //proof correctness
+			   //////////////////////////////////////////////////////////////////////////
+//#ifdef  PROOF_CORRECTNESS
+			   LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+//			   //LBMReal dif = fabs(drho - rho_post);
+//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+//#ifdef SINGLEPRECISION
+//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+//#else
+//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+//#endif
+//			   {
+//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+//					   + " dif=" + UbSystem::toString(dif)
+//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+//				   //exit(EXIT_FAILURE);
+//			   }
+//#endif
+
+			   if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post))
+				   UB_THROW(UbException(
+					   UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," +
+					   UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+
+			   //////////////////////////////////////////////////////////////////////////
+			   //write distribution
+			   //////////////////////////////////////////////////////////////////////////
+			   (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba         ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa        ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa       ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa      ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca      ;//* rho * c1o3;
+			   (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc     ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc   ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac    ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc  ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac  ;//* rho * c1o3;
+			   (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
+
+			   (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+			   //////////////////////////////////////////////////////////////////////////
+
+			   ////!Incompressible Kernal
+
+                            
+//                            ///////Old Kernel \|/
+//                            // ux += forcingX1*deltaT*0.5; // X
+//                            // uy += forcingX2*deltaT*0.5; // Y
+//                            // uz += forcingX3*deltaT*0.5; // Z
+//                        }
+//
+//                        LBMReal ux = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//                                      (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//                                      (mfcbb - mfabb)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX1_phi + forcingX1) / (2 * rho);
+//
+//                        LBMReal uy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//                                      (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//                                      (mfbcb - mfbab)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX2_phi + forcingX2) / (2 * rho);
+//
+//                        LBMReal uz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//                                      (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//                                      (mfbbc - mfbba)) /
+//                                         (rho * c1o3) +
+//                                     (mu * dX3_phi + forcingX3) / (2 * rho);
+//
+//                        //--------------------------------------------------------
+//
+//                        LBMReal ux2 = ux * ux;
+//                        LBMReal uy2 = uy * uy;
+//                        LBMReal uz2 = uz * uz;
+//
+//                        //----------- Calculating Forcing Terms * -------------
+//                        for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+//                            LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
+//                            LBMReal velSq1  = velProd * velProd;
+//                            LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2));
+//
+//                            LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi;
+//
+//                            forcingTerm[dir] = ((-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                                (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                                (-uz) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3))) +
+//                                               (DX1[dir]) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                               (DX2[dir]) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                               (DX3[dir]) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
+//                        }
+//
+//                        LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+//                        LBMReal fac1      = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
+//                        forcingTerm[REST] = (-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+//                                            (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
+//                                            (-uz) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
+//
+//                        //--------------------------------------------------------
+//
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+//                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+//                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+//                        mfacb = 3.0 * (mfacb + 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+//                        mfcbc = 3.0 * (mfcbc + 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+//                        mfabc = 3.0 * (mfabc + 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+//                        mfbcc = 3.0 * (mfbcc + 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+//                        mfbac = 3.0 * (mfbac + 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+//                        mfccc = 3.0 * (mfccc + 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+//                        mfacc = 3.0 * (mfacc + 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+//                        mfcac = 3.0 * (mfcac + 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+//                        mfaac = 3.0 * (mfaac + 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+//                        mfabb = 3.0 * (mfabb + 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+//                        mfbab = 3.0 * (mfbab + 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+//                        mfbba = 3.0 * (mfbba + 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+//                        mfaab = 3.0 * (mfaab + 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+//                        mfcab = 3.0 * (mfcab + 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+//                        mfaba = 3.0 * (mfaba + 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+//                        mfcba = 3.0 * (mfcba + 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+//                        mfbaa = 3.0 * (mfbaa + 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+//                        mfbca = 3.0 * (mfbca + 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+//                        mfaaa = 3.0 * (mfaaa + 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+//                        mfcaa = 3.0 * (mfcaa + 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+//                        mfaca = 3.0 * (mfaca + 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+//                        mfcca = 3.0 * (mfcca + 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+//                        mfbbb = 3.0 * (mfbbb + 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST];
+//
+//                        LBMReal rho1 = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+//                                       (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+//                                       (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) +
+//                                       (mfbba + mfbbc) + mfbbb;
+//
+//
+//                        LBMReal oMdrho, m0, m1, m2;
+//
+//                        oMdrho = mfccc + mfaaa;
+//                        m0     = mfaca + mfcac;
+//                        m1     = mfacc + mfcaa;
+//                        m2     = mfaac + mfcca;
+//                        oMdrho += m0;
+//                        m1 += m2;
+//                        oMdrho += m1;
+//                        m0 = mfbac + mfbca;
+//                        m1 = mfbaa + mfbcc;
+//                        m0 += m1;
+//                        m1 = mfabc + mfcba;
+//                        m2 = mfaba + mfcbc;
+//                        m1 += m2;
+//                        m0 += m1;
+//                        m1 = mfacb + mfcab;
+//                        m2 = mfaab + mfccb;
+//                        m1 += m2;
+//                        m0 += m1;
+//                        oMdrho += m0;
+//                        m0 = mfabb + mfcbb;
+//                        m1 = mfbab + mfbcb;
+//                        m2 = mfbba + mfbbc;
+//                        m0 += m1 + m2;
+//                        m0 += mfbbb; // hat gefehlt
+//                        oMdrho = 1. - (oMdrho + m0);
+//                        // oMdrho = rho - (oMdrho + m0);
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        LBMReal wadjust;
+//                        LBMReal qudricLimit = 0.01;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Hin
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Z - Dir
+//                        m2    = mfaaa + mfaac;
+//                        m1    = mfaac - mfaaa;
+//                        m0    = m2 + mfaab;
+//                        mfaaa = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfaab = m1 - m0 * uz;
+//                        mfaac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaba + mfabc;
+//                        m1    = mfabc - mfaba;
+//                        m0    = m2 + mfabb;
+//                        mfaba = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfabb = m1 - m0 * uz;
+//                        mfabc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaca + mfacc;
+//                        m1    = mfacc - mfaca;
+//                        m0    = m2 + mfacb;
+//                        mfaca = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfacb = m1 - m0 * uz;
+//                        mfacc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbaa + mfbac;
+//                        m1    = mfbac - mfbaa;
+//                        m0    = m2 + mfbab;
+//                        mfbaa = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbab = m1 - m0 * uz;
+//                        mfbac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbba + mfbbc;
+//                        m1    = mfbbc - mfbba;
+//                        m0    = m2 + mfbbb;
+//                        mfbba = m0;
+//                        m0 += c4o9 * oMdrho;
+//                        mfbbb = m1 - m0 * uz;
+//                        mfbbc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbca + mfbcc;
+//                        m1    = mfbcc - mfbca;
+//                        m0    = m2 + mfbcb;
+//                        mfbca = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbcb = m1 - m0 * uz;
+//                        mfbcc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcaa + mfcac;
+//                        m1    = mfcac - mfcaa;
+//                        m0    = m2 + mfcab;
+//                        mfcaa = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfcab = m1 - m0 * uz;
+//                        mfcac = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcba + mfcbc;
+//                        m1    = mfcbc - mfcba;
+//                        m0    = m2 + mfcbb;
+//                        mfcba = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfcbb = m1 - m0 * uz;
+//                        mfcbc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcca + mfccc;
+//                        m1    = mfccc - mfcca;
+//                        m0    = m2 + mfccb;
+//                        mfcca = m0;
+//                        m0 += c1o36 * oMdrho;
+//                        mfccb = m1 - m0 * uz;
+//                        mfccc = m2 - 2. * m1 * uz + uz2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Y - Dir
+//                        m2    = mfaaa + mfaca;
+//                        m1    = mfaca - mfaaa;
+//                        m0    = m2 + mfaba;
+//                        mfaaa = m0;
+//                        m0 += c1o6 * oMdrho;
+//                        mfaba = m1 - m0 * uy;
+//                        mfaca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaab + mfacb;
+//                        m1    = mfacb - mfaab;
+//                        m0    = m2 + mfabb;
+//                        mfaab = m0;
+//                        mfabb = m1 - m0 * uy;
+//                        mfacb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaac + mfacc;
+//                        m1    = mfacc - mfaac;
+//                        m0    = m2 + mfabc;
+//                        mfaac = m0;
+//                        m0 += c1o18 * oMdrho;
+//                        mfabc = m1 - m0 * uy;
+//                        mfacc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbaa + mfbca;
+//                        m1    = mfbca - mfbaa;
+//                        m0    = m2 + mfbba;
+//                        mfbaa = m0;
+//                        m0 += c2o3 * oMdrho;
+//                        mfbba = m1 - m0 * uy;
+//                        mfbca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbab + mfbcb;
+//                        m1    = mfbcb - mfbab;
+//                        m0    = m2 + mfbbb;
+//                        mfbab = m0;
+//                        mfbbb = m1 - m0 * uy;
+//                        mfbcb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfbac + mfbcc;
+//                        m1    = mfbcc - mfbac;
+//                        m0    = m2 + mfbbc;
+//                        mfbac = m0;
+//                        m0 += c2o9 * oMdrho;
+//                        mfbbc = m1 - m0 * uy;
+//                        mfbcc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcaa + mfcca;
+//                        m1    = mfcca - mfcaa;
+//                        m0    = m2 + mfcba;
+//                        mfcaa = m0;
+//                        m0 += c1o6 * oMdrho;
+//                        mfcba = m1 - m0 * uy;
+//                        mfcca = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcab + mfccb;
+//                        m1    = mfccb - mfcab;
+//                        m0    = m2 + mfcbb;
+//                        mfcab = m0;
+//                        mfcbb = m1 - m0 * uy;
+//                        mfccb = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfcac + mfccc;
+//                        m1    = mfccc - mfcac;
+//                        m0    = m2 + mfcbc;
+//                        mfcac = m0;
+//                        m0 += c1o18 * oMdrho;
+//                        mfcbc = m1 - m0 * uy;
+//                        mfccc = m2 - 2. * m1 * uy + uy2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // X - Dir
+//                        m2    = mfaaa + mfcaa;
+//                        m1    = mfcaa - mfaaa;
+//                        m0    = m2 + mfbaa;
+//                        mfaaa = m0;
+//                        m0 += 1. * oMdrho;
+//                        mfbaa = m1 - m0 * ux;
+//                        mfcaa = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaba + mfcba;
+//                        m1    = mfcba - mfaba;
+//                        m0    = m2 + mfbba;
+//                        mfaba = m0;
+//                        mfbba = m1 - m0 * ux;
+//                        mfcba = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaca + mfcca;
+//                        m1    = mfcca - mfaca;
+//                        m0    = m2 + mfbca;
+//                        mfaca = m0;
+//                        m0 += c1o3 * oMdrho;
+//                        mfbca = m1 - m0 * ux;
+//                        mfcca = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaab + mfcab;
+//                        m1    = mfcab - mfaab;
+//                        m0    = m2 + mfbab;
+//                        mfaab = m0;
+//                        mfbab = m1 - m0 * ux;
+//                        mfcab = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfabb + mfcbb;
+//                        m1    = mfcbb - mfabb;
+//                        m0    = m2 + mfbbb;
+//                        mfabb = m0;
+//                        mfbbb = m1 - m0 * ux;
+//                        mfcbb = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfacb + mfccb;
+//                        m1    = mfccb - mfacb;
+//                        m0    = m2 + mfbcb;
+//                        mfacb = m0;
+//                        mfbcb = m1 - m0 * ux;
+//                        mfccb = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfaac + mfcac;
+//                        m1    = mfcac - mfaac;
+//                        m0    = m2 + mfbac;
+//                        mfaac = m0;
+//                        m0 += c1o3 * oMdrho;
+//                        mfbac = m1 - m0 * ux;
+//                        mfcac = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfabc + mfcbc;
+//                        m1    = mfcbc - mfabc;
+//                        m0    = m2 + mfbbc;
+//                        mfabc = m0;
+//                        mfbbc = m1 - m0 * ux;
+//                        mfcbc = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m2    = mfacc + mfccc;
+//                        m1    = mfccc - mfacc;
+//                        m0    = m2 + mfbcc;
+//                        mfacc = m0;
+//                        m0 += c1o9 * oMdrho;
+//                        mfbcc = m1 - m0 * ux;
+//                        mfccc = m2 - 2. * m1 * ux + ux2 * m0;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Cumulants
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        LBMReal OxxPyyPzz = 1.; // omega2 or bulk viscosity
+//                        LBMReal OxyyPxzz  = 1.; //-s9;//2+s9;//
+//                        LBMReal OxyyMxzz  = 1.; // 2+s9;//
+//                        LBMReal O4        = 1.;
+//                        LBMReal O5        = 1.;
+//                        LBMReal O6        = 1.;
+//
+//                        // Cum 4.
+//                        LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//                        LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//                        LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//                        LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) +
+//                                                  c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//                        LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) +
+//                                                  c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//                        LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) +
+//                                                  c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho);
+//
+//                        // Cum 5.
+//                        LBMReal CUMbcc = mfbcc -
+//                                         (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb +
+//                                          2. * (mfbab * mfacb + mfbba * mfabc)) -
+//                                         c1o3 * (mfbca + mfbac) * oMdrho;
+//                        LBMReal CUMcbc = mfcbc -
+//                                         (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb +
+//                                          2. * (mfabb * mfcab + mfbba * mfbac)) -
+//                                         c1o3 * (mfcba + mfabc) * oMdrho;
+//                        LBMReal CUMccb = mfccb -
+//                                         (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb +
+//                                          2. * (mfbab * mfbca + mfabb * mfcba)) -
+//                                         c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//                        // Cum 6.
+//                        LBMReal CUMccc =
+//                            mfccc +
+//                            ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+//                              4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) -
+//                              2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) +
+//                             (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+//                              2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) -
+//                             c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho -
+//                             c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) -
+//                             c1o27 * oMdrho * oMdrho * (-2. * oMdrho) +
+//                             (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+//                              (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) *
+//                                 c2o3 * oMdrho) +
+//                            c1o27 * oMdrho;
+//
+//                        // 2.
+//                        // linear combinations
+//                        LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+//                        LBMReal mxxMyy    = mfcaa - mfaca;
+//                        LBMReal mxxMzz    = mfcaa - mfaac;
+//
+//                        LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz);
+//                        LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy;
+//                        LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz;
+//
+//                        (*divU)(x1, x2, x3) = dxux + dyuy + dzuz;
+//
+//                        // relax
+//                        mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) -
+//                                     3. * (1. - c1o2 * OxxPyyPzz) * (ux2 * dxux + uy2 * dyuy + uz2 * dzuz);
+//                        mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (ux2 * dxux - uy2 * dyuy);
+//                        mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (ux2 * dxux - uz2 * dzuz);
+//
+//                        mfabb += collFactorM * (-mfabb);
+//                        mfbab += collFactorM * (-mfbab);
+//                        mfbba += collFactorM * (-mfbba);
+//
+//                        // linear combinations back
+//                        mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+//                        mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+//                        mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+//
+//                        // 3.
+//                        // linear combinations
+//                        LBMReal mxxyPyzz = mfcba + mfabc;
+//                        LBMReal mxxyMyzz = mfcba - mfabc;
+//
+//                        LBMReal mxxzPyyz = mfcab + mfacb;
+//                        LBMReal mxxzMyyz = mfcab - mfacb;
+//
+//                        LBMReal mxyyPxzz = mfbca + mfbac;
+//                        LBMReal mxyyMxzz = mfbca - mfbac;
+//
+//                        // relax
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+//                        mfbbb += wadjust * (-mfbbb);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+//                        mxxyPyzz += wadjust * (-mxxyPyzz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+//                        mxxyMyzz += wadjust * (-mxxyMyzz);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+//                        mxxzPyyz += wadjust * (-mxxzPyyz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+//                        mxxzMyyz += wadjust * (-mxxzMyyz);
+//                        wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+//                        mxyyPxzz += wadjust * (-mxyyPxzz);
+//                        wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+//                        mxyyMxzz += wadjust * (-mxyyMxzz);
+//
+//                        // linear combinations back
+//                        mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+//                        mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+//                        mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+//                        mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+//                        mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+//                        mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+//
+//                        // 4.
+//                        CUMacc += O4 * (-CUMacc);
+//                        CUMcac += O4 * (-CUMcac);
+//                        CUMcca += O4 * (-CUMcca);
+//
+//                        CUMbbc += O4 * (-CUMbbc);
+//                        CUMbcb += O4 * (-CUMbcb);
+//                        CUMcbb += O4 * (-CUMcbb);
+//
+//                        // 5.
+//                        CUMbcc += O5 * (-CUMbcc);
+//                        CUMcbc += O5 * (-CUMcbc);
+//                        CUMccb += O5 * (-CUMccb);
+//
+//                        // 6.
+//                        CUMccc += O6 * (-CUMccc);
+//
+//                        // back cumulants to central moments
+//                        // 4.
+//                        mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//                        mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//                        mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//                        mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//                        mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//                        mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho +
+//                                c1o9 * (oMdrho - 1) * oMdrho;
+//
+//                        // 5.
+//                        mfbcc = CUMbcc +
+//                                (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb +
+//                                 2. * (mfbab * mfacb + mfbba * mfabc)) +
+//                                c1o3 * (mfbca + mfbac) * oMdrho;
+//                        mfcbc = CUMcbc +
+//                                (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb +
+//                                 2. * (mfabb * mfcab + mfbba * mfbac)) +
+//                                c1o3 * (mfcba + mfabc) * oMdrho;
+//                        mfccb = CUMccb +
+//                                (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb +
+//                                 2. * (mfbab * mfbca + mfabb * mfcba)) +
+//                                c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//                        // 6.
+//                        mfccc = CUMccc -
+//                                ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+//                                  4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) -
+//                                  2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) +
+//                                 (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+//                                  2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) -
+//                                 c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho -
+//                                 c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) -
+//                                 c1o27 * oMdrho * oMdrho * (-2. * oMdrho) +
+//                                 (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+//                                  (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) *
+//                                     c2o3 * oMdrho) -
+//                                c1o27 * oMdrho;
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // forcing
+//                        mfbaa = -mfbaa;
+//                        mfaba = -mfaba;
+//                        mfaab = -mfaab;
+//                        //////////////////////////////////////////////////////////////////////////////////////
+//
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // back
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Z - Dir
+//                        m0    = mfaac * c1o2 + mfaab * (uz - c1o2) + (mfaaa + 1. * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfaac - 2. * mfaab * uz + mfaaa * (1. - uz2) - 1. * oMdrho * uz2;
+//                        m2    = mfaac * c1o2 + mfaab * (uz + c1o2) + (mfaaa + 1. * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfaaa = m0;
+//                        mfaab = m1;
+//                        mfaac = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfabc * c1o2 + mfabb * (uz - c1o2) + mfaba * (uz2 - uz) * c1o2;
+//                        m1    = -mfabc - 2. * mfabb * uz + mfaba * (1. - uz2);
+//                        m2    = mfabc * c1o2 + mfabb * (uz + c1o2) + mfaba * (uz2 + uz) * c1o2;
+//                        mfaba = m0;
+//                        mfabb = m1;
+//                        mfabc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacc * c1o2 + mfacb * (uz - c1o2) + (mfaca + c1o3 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfacc - 2. * mfacb * uz + mfaca * (1. - uz2) - c1o3 * oMdrho * uz2;
+//                        m2    = mfacc * c1o2 + mfacb * (uz + c1o2) + (mfaca + c1o3 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfaca = m0;
+//                        mfacb = m1;
+//                        mfacc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbac * c1o2 + mfbab * (uz - c1o2) + mfbaa * (uz2 - uz) * c1o2;
+//                        m1    = -mfbac - 2. * mfbab * uz + mfbaa * (1. - uz2);
+//                        m2    = mfbac * c1o2 + mfbab * (uz + c1o2) + mfbaa * (uz2 + uz) * c1o2;
+//                        mfbaa = m0;
+//                        mfbab = m1;
+//                        mfbac = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbbc * c1o2 + mfbbb * (uz - c1o2) + mfbba * (uz2 - uz) * c1o2;
+//                        m1    = -mfbbc - 2. * mfbbb * uz + mfbba * (1. - uz2);
+//                        m2    = mfbbc * c1o2 + mfbbb * (uz + c1o2) + mfbba * (uz2 + uz) * c1o2;
+//                        mfbba = m0;
+//                        mfbbb = m1;
+//                        mfbbc = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcc * c1o2 + mfbcb * (uz - c1o2) + mfbca * (uz2 - uz) * c1o2;
+//                        m1    = -mfbcc - 2. * mfbcb * uz + mfbca * (1. - uz2);
+//                        m2    = mfbcc * c1o2 + mfbcb * (uz + c1o2) + mfbca * (uz2 + uz) * c1o2;
+//                        mfbca = m0;
+//                        mfbcb = m1;
+//                        mfbcc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcac * c1o2 + mfcab * (uz - c1o2) + (mfcaa + c1o3 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfcac - 2. * mfcab * uz + mfcaa * (1. - uz2) - c1o3 * oMdrho * uz2;
+//                        m2    = mfcac * c1o2 + mfcab * (uz + c1o2) + (mfcaa + c1o3 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfcaa = m0;
+//                        mfcab = m1;
+//                        mfcac = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbc * c1o2 + mfcbb * (uz - c1o2) + mfcba * (uz2 - uz) * c1o2;
+//                        m1    = -mfcbc - 2. * mfcbb * uz + mfcba * (1. - uz2);
+//                        m2    = mfcbc * c1o2 + mfcbb * (uz + c1o2) + mfcba * (uz2 + uz) * c1o2;
+//                        mfcba = m0;
+//                        mfcbb = m1;
+//                        mfcbc = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfccb * (uz - c1o2) + (mfcca + c1o9 * oMdrho) * (uz2 - uz) * c1o2;
+//                        m1    = -mfccc - 2. * mfccb * uz + mfcca * (1. - uz2) - c1o9 * oMdrho * uz2;
+//                        m2    = mfccc * c1o2 + mfccb * (uz + c1o2) + (mfcca + c1o9 * oMdrho) * (uz2 + uz) * c1o2;
+//                        mfcca = m0;
+//                        mfccb = m1;
+//                        mfccc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // Y - Dir
+//                        m0    = mfaca * c1o2 + mfaba * (uy - c1o2) + (mfaaa + c1o6 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfaca - 2. * mfaba * uy + mfaaa * (1. - uy2) - c1o6 * oMdrho * uy2;
+//                        m2    = mfaca * c1o2 + mfaba * (uy + c1o2) + (mfaaa + c1o6 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaaa = m0;
+//                        mfaba = m1;
+//                        mfaca = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacb * c1o2 + mfabb * (uy - c1o2) + (mfaab + c2o3 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfacb - 2. * mfabb * uy + mfaab * (1. - uy2) - c2o3 * oMdrho * uy2;
+//                        m2    = mfacb * c1o2 + mfabb * (uy + c1o2) + (mfaab + c2o3 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaab = m0;
+//                        mfabb = m1;
+//                        mfacb = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfacc * c1o2 + mfabc * (uy - c1o2) + (mfaac + c1o6 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfacc - 2. * mfabc * uy + mfaac * (1. - uy2) - c1o6 * oMdrho * uy2;
+//                        m2    = mfacc * c1o2 + mfabc * (uy + c1o2) + (mfaac + c1o6 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfaac = m0;
+//                        mfabc = m1;
+//                        mfacc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbca * c1o2 + mfbba * (uy - c1o2) + mfbaa * (uy2 - uy) * c1o2;
+//                        m1    = -mfbca - 2. * mfbba * uy + mfbaa * (1. - uy2);
+//                        m2    = mfbca * c1o2 + mfbba * (uy + c1o2) + mfbaa * (uy2 + uy) * c1o2;
+//                        mfbaa = m0;
+//                        mfbba = m1;
+//                        mfbca = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcb * c1o2 + mfbbb * (uy - c1o2) + mfbab * (uy2 - uy) * c1o2;
+//                        m1    = -mfbcb - 2. * mfbbb * uy + mfbab * (1. - uy2);
+//                        m2    = mfbcb * c1o2 + mfbbb * (uy + c1o2) + mfbab * (uy2 + uy) * c1o2;
+//                        mfbab = m0;
+//                        mfbbb = m1;
+//                        mfbcb = m2;
+//                        /////////b//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfbcc * c1o2 + mfbbc * (uy - c1o2) + mfbac * (uy2 - uy) * c1o2;
+//                        m1    = -mfbcc - 2. * mfbbc * uy + mfbac * (1. - uy2);
+//                        m2    = mfbcc * c1o2 + mfbbc * (uy + c1o2) + mfbac * (uy2 + uy) * c1o2;
+//                        mfbac = m0;
+//                        mfbbc = m1;
+//                        mfbcc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcca * c1o2 + mfcba * (uy - c1o2) + (mfcaa + c1o18 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfcca - 2. * mfcba * uy + mfcaa * (1. - uy2) - c1o18 * oMdrho * uy2;
+//                        m2    = mfcca * c1o2 + mfcba * (uy + c1o2) + (mfcaa + c1o18 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcaa = m0;
+//                        mfcba = m1;
+//                        mfcca = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccb * c1o2 + mfcbb * (uy - c1o2) + (mfcab + c2o9 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfccb - 2. * mfcbb * uy + mfcab * (1. - uy2) - c2o9 * oMdrho * uy2;
+//                        m2    = mfccb * c1o2 + mfcbb * (uy + c1o2) + (mfcab + c2o9 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcab = m0;
+//                        mfcbb = m1;
+//                        mfccb = m2;
+//                        /////////c//////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfcbc * (uy - c1o2) + (mfcac + c1o18 * oMdrho) * (uy2 - uy) * c1o2;
+//                        m1    = -mfccc - 2. * mfcbc * uy + mfcac * (1. - uy2) - c1o18 * oMdrho * uy2;
+//                        m2    = mfccc * c1o2 + mfcbc * (uy + c1o2) + (mfcac + c1o18 * oMdrho) * (uy2 + uy) * c1o2;
+//                        mfcac = m0;
+//                        mfcbc = m1;
+//                        mfccc = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        // X - Dir
+//                        m0    = mfcaa * c1o2 + mfbaa * (ux - c1o2) + (mfaaa + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcaa - 2. * mfbaa * ux + mfaaa * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcaa * c1o2 + mfbaa * (ux + c1o2) + (mfaaa + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaaa = m0;
+//                        mfbaa = m1;
+//                        mfcaa = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcba * c1o2 + mfbba * (ux - c1o2) + (mfaba + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcba - 2. * mfbba * ux + mfaba * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcba * c1o2 + mfbba * (ux + c1o2) + (mfaba + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaba = m0;
+//                        mfbba = m1;
+//                        mfcba = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcca * c1o2 + mfbca * (ux - c1o2) + (mfaca + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcca - 2. * mfbca * ux + mfaca * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcca * c1o2 + mfbca * (ux + c1o2) + (mfaca + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaca = m0;
+//                        mfbca = m1;
+//                        mfcca = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcab * c1o2 + mfbab * (ux - c1o2) + (mfaab + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcab - 2. * mfbab * ux + mfaab * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcab * c1o2 + mfbab * (ux + c1o2) + (mfaab + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaab = m0;
+//                        mfbab = m1;
+//                        mfcab = m2;
+//                        ///////////b////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbb * c1o2 + mfbbb * (ux - c1o2) + (mfabb + c4o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcbb - 2. * mfbbb * ux + mfabb * (1. - ux2) - c4o9 * oMdrho * ux2;
+//                        m2    = mfcbb * c1o2 + mfbbb * (ux + c1o2) + (mfabb + c4o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfabb = m0;
+//                        mfbbb = m1;
+//                        mfcbb = m2;
+//                        ///////////b////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccb * c1o2 + mfbcb * (ux - c1o2) + (mfacb + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfccb - 2. * mfbcb * ux + mfacb * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfccb * c1o2 + mfbcb * (ux + c1o2) + (mfacb + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfacb = m0;
+//                        mfbcb = m1;
+//                        mfccb = m2;
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        ////////////////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcac * c1o2 + mfbac * (ux - c1o2) + (mfaac + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcac - 2. * mfbac * ux + mfaac * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfcac * c1o2 + mfbac * (ux + c1o2) + (mfaac + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfaac = m0;
+//                        mfbac = m1;
+//                        mfcac = m2;
+//                        ///////////c////////////////////////////////////////////////////////////////////////
+//                        m0    = mfcbc * c1o2 + mfbbc * (ux - c1o2) + (mfabc + c1o9 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfcbc - 2. * mfbbc * ux + mfabc * (1. - ux2) - c1o9 * oMdrho * ux2;
+//                        m2    = mfcbc * c1o2 + mfbbc * (ux + c1o2) + (mfabc + c1o9 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfabc = m0;
+//                        mfbbc = m1;
+//                        mfcbc = m2;
+//                        ///////////c////////////////////////////////////////////////////////////////////////
+//                        m0    = mfccc * c1o2 + mfbcc * (ux - c1o2) + (mfacc + c1o36 * oMdrho) * (ux2 - ux) * c1o2;
+//                        m1    = -mfccc - 2. * mfbcc * ux + mfacc * (1. - ux2) - c1o36 * oMdrho * ux2;
+//                        m2    = mfccc * c1o2 + mfbcc * (ux + c1o2) + (mfacc + c1o36 * oMdrho) * (ux2 + ux) * c1o2;
+//                        mfacc = m0;
+//                        mfbcc = m1;
+//                        mfccc = m2;
+//
+//                        ///////////////////////////////////////////////////////////////////////////
+//
+//                        //////////////////////////////////////////////////////////////////////////
+//                        // proof correctness
+//                        //////////////////////////////////////////////////////////////////////////
+//#ifdef PROOF_CORRECTNESS
+//                        LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+//                                           (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+//                                           (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) +
+//                                           (mfbba + mfbbc) + mfbbb;
+//
+//                        LBMReal dif = rho1 - rho_post;
+//#ifdef SINGLEPRECISION
+//                        if (dif > 10.0E-7 || dif < -10.0E-7)
+//#else
+//                        if (dif > 10.0E-15 || dif < -10.0E-15)
+//#endif
+//                        {
+//                            UB_THROW(UbException(UB_EXARGS,
+//                                                 "rho=" + UbSystem::toString(rho) + ", rho_post=" +
+//                                                     UbSystem::toString(rho_post) + " dif=" + UbSystem::toString(dif) +
+//                                                     " rho is not correct for node " + UbSystem::toString(x1) + "," +
+//                                                     UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//                        }
+//#endif
+//
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
+//                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
+//                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
+//                        mfacb = rho * c1o3 * (mfacb) + 0.5 * forcingTerm[NW];
+//                        mfcbc = rho * c1o3 * (mfcbc) + 0.5 * forcingTerm[TE];
+//                        mfabc = rho * c1o3 * (mfabc) + 0.5 * forcingTerm[TW];
+//                        mfbcc = rho * c1o3 * (mfbcc) + 0.5 * forcingTerm[TN];
+//                        mfbac = rho * c1o3 * (mfbac) + 0.5 * forcingTerm[TS];
+//                        mfccc = rho * c1o3 * (mfccc) + 0.5 * forcingTerm[TNE];
+//                        mfacc = rho * c1o3 * (mfacc) + 0.5 * forcingTerm[TNW];
+//                        mfcac = rho * c1o3 * (mfcac) + 0.5 * forcingTerm[TSE];
+//                        mfaac = rho * c1o3 * (mfaac) + 0.5 * forcingTerm[TSW];
+//                        mfabb = rho * c1o3 * (mfabb) + 0.5 * forcingTerm[W];
+//                        mfbab = rho * c1o3 * (mfbab) + 0.5 * forcingTerm[S];
+//                        mfbba = rho * c1o3 * (mfbba) + 0.5 * forcingTerm[B];
+//                        mfaab = rho * c1o3 * (mfaab) + 0.5 * forcingTerm[SW];
+//                        mfcab = rho * c1o3 * (mfcab) + 0.5 * forcingTerm[SE];
+//                        mfaba = rho * c1o3 * (mfaba) + 0.5 * forcingTerm[BW];
+//                        mfcba = rho * c1o3 * (mfcba) + 0.5 * forcingTerm[BE];
+//                        mfbaa = rho * c1o3 * (mfbaa) + 0.5 * forcingTerm[BS];
+//                        mfbca = rho * c1o3 * (mfbca) + 0.5 * forcingTerm[BN];
+//                        mfaaa = rho * c1o3 * (mfaaa) + 0.5 * forcingTerm[BSW];
+//                        mfcaa = rho * c1o3 * (mfcaa) + 0.5 * forcingTerm[BSE];
+//                        mfaca = rho * c1o3 * (mfaca) + 0.5 * forcingTerm[BNW];
+//                        mfcca = rho * c1o3 * (mfcca) + 0.5 * forcingTerm[BNE];
+//                        mfbbb = rho * c1o3 * (mfbbb) + 0.5 * forcingTerm[REST];
+//
+//                        //////////////////////////////////////////////////////////////////////////
+//                        // write distribution for F
+//                        //////////////////////////////////////////////////////////////////////////
+//
+//                        (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)     = mfabb;
+//                        (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)     = mfbab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)     = mfbba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)    = mfaab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)   = mfcab;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)    = mfaba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)   = mfcba;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)    = mfbaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)   = mfbca;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)   = mfaaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)  = mfcaa;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)  = mfaca;
+//                        (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+//
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     = mfcbb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     = mfbcb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     = mfbbc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfccb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    = mfacb;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfcbc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    = mfabc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfbcc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    = mfbac;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfacc;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfcac;
+//                        (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfaac;
+//
+//                        (*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;
+// !Old Kernel
+                        /////////////////////  P H A S E - F I E L D   S O L V E R
+                        ////////////////////////////////////////////
+		/////CUMULANT PHASE-FIELD
+				LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+				{
+			   mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+			   mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+			   mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+			   mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+			   mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+			   mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+			   mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+			   mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+			   mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+			   mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+			   mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+			   mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+			   mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+			   mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+			   mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+			   mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+			   mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+			   mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+			   mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+			   mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+			   mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+			   mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+			   mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+			   mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+			   mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+			   mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+			   mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+
+
+					////////////////////////////////////////////////////////////////////////////////////
+		//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//!
+		////////////////////////////////////////////////////////////////////////////////////
+		// fluid component
+			   //LBMReal drhoFluid =
+				  // ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) +
+				  // (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) +
+					 //  ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb;
+
+			   //LBMReal rhoFluid = c1 + drhoFluid;
+			   //LBMReal OOrhoFluid = c1 / rhoFluid;
+
+
+			   //LBMReal vvx =
+				  // ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) +
+				  // (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) +
+					 //  (fcbb - fabb)) * OOrhoFluid;
+			   //LBMReal vvy =
+				  // ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) +
+				  // (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) +
+					 //  (fbcb - fbab)) * OOrhoFluid;
+			   //LBMReal vvz =
+				  // ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) +
+				  // (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) +
+					 //  (fbbc - fbba)) * OOrhoFluid;
+
+			 //  LBMReal vvx = ux;
+			 //  LBMReal vvy = uy;
+			 //  LBMReal vvz = uz;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // second component
+			   LBMReal concentration =
+				   ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+				   (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+					   ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //!
+			  // LBMReal fx = forces[0];
+			  // LBMReal fy = forces[1];
+			  // LBMReal fz = -concentration * forces[2];
+			  // vvx += fx * c1o2;
+			  // vvy += fy * c1o2;
+			  // vvz += fz * c1o2;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   LBMReal oneMinusRho = c1- concentration;
+
+			   LBMReal cx =
+				   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+					   (mfcbb - mfabb));
+			   LBMReal cy =
+				   ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+				   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+					   (mfbcb - mfbab));
+			   LBMReal cz =
+				   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+				   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+					   (mfbbc - mfbba));
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // calculate the square of velocities for this lattice node
+			   LBMReal cx2 = cx * cx;
+			   LBMReal cy2 = cy * cy;
+			   LBMReal cz2 = cz * cz;
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //! see also Eq. (6)-(14) in \ref
+			   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+			   //!
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+			   forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+			   forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+			   forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+			   forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+			   forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+			   forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+			   forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+			   forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+			   forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+			   forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+			   forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - experimental Cumulant ... to be published ... hopefully
+			   //!
+
+			   // linearized orthogonalization of 3rd order central moments
+			   LBMReal Mabc = mfabc - mfaba * c1o3;
+			   LBMReal Mbca = mfbca - mfbaa * c1o3;
+			   LBMReal Macb = mfacb - mfaab * c1o3;
+			   LBMReal Mcba = mfcba - mfaba * c1o3;
+			   LBMReal Mcab = mfcab - mfaab * c1o3;
+			   LBMReal Mbac = mfbac - mfbaa * c1o3;
+			   // linearized orthogonalization of 5th order central moments
+			   LBMReal Mcbc = mfcbc - mfaba * c1o9;
+			   LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+			   LBMReal Mccb = mfccb - mfaab * c1o9;
+
+			   // collision of 1st order moments
+			  // LBMReal ccx, ccy, ccz;
+			   
+
+               cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+               cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+               cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+
+			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
+			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
+			//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
+
+
+			   cx2 = cx * cx;
+			   cy2 = cy * cy;
+			   cz2 = cz * cz;
+
+			   // equilibration of 2nd order moments
+			   mfbba = zeroReal;
+			   mfbab = zeroReal;
+			   mfabb = zeroReal;
+
+			   mfcaa = c1o3 * concentration;
+			   mfaca = c1o3 * concentration;
+			   mfaac = c1o3 * concentration;
+
+
+			   //LBMReal omega2 = 1.0f;// omegaD;
+			   //mfbba *= (c1 - omega2);
+			   //mfbab *= (c1 - omega2);
+			   //mfabb *= (c1 - omega2);
+
+			   //mfcaa = mfcaa*(c1 - omega2) + omega2*c1o3 * concentration;
+			   //mfaca = mfaca*(c1 - omega2) + omega2*c1o3 * concentration;
+			   //mfaac = mfaac*(c1 - omega2) + omega2*c1o3 * concentration;
+
+			   // equilibration of 3rd order moments
+			   Mabc = zeroReal;
+			   Mbca = zeroReal;
+			   Macb = zeroReal;
+			   Mcba = zeroReal;
+			   Mcab = zeroReal;
+			   Mbac = zeroReal;
+			   mfbbb = zeroReal;
+
+			   // from linearized orthogonalization 3rd order central moments to central moments
+			   mfabc = Mabc + mfaba * c1o3;
+			   mfbca = Mbca + mfbaa * c1o3;
+			   mfacb = Macb + mfaab * c1o3;
+			   mfcba = Mcba + mfaba * c1o3;
+			   mfcab = Mcab + mfaab * c1o3;
+			   mfbac = Mbac + mfbaa * c1o3;
+
+			   // equilibration of 4th order moments
+			   mfacc = c1o9 * concentration;
+			   mfcac = c1o9 * concentration;
+			   mfcca = c1o9 * concentration;
+
+			   mfcbb = zeroReal;
+			   mfbcb = zeroReal;
+			   mfbbc = zeroReal;
+
+			   // equilibration of 5th order moments
+			   Mcbc = zeroReal;
+			   Mbcc = zeroReal;
+			   Mccb = zeroReal;
+
+			   // from linearized orthogonalization 5th order central moments to central moments
+			   mfcbc = Mcbc + mfaba * c1o9;
+			   mfbcc = Mbcc + mfbaa * c1o9;
+			   mfccb = Mccb + mfaab * c1o9;
+
+			   // equilibration of 6th order moment
+			   mfccc = c1o27 * concentration;
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+			   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+			   //! see also Eq. (88)-(96) in
+			   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+			   //!
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // X - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+			   backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+			   backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+			   backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+			   backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+			   backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+			   backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Y - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+			   backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+			   backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+			   backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+			   backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+			   ////////////////////////////////////////////////////////////////////////////////////
+			   // Z - Dir
+			   backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+			   backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+			   (*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+   (*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+   (*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+   (*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+   (*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+   (*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+   (*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+   (*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+   (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+   (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+   (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+   (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+
+   (*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+   }
+
+   ////Phasefield 2:
+
+   {
+
+   normX1 *= -1;
+   normX2 *= -1;
+   normX3 *= -1;
+
+   mfcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+   mfbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+   mfbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+   mfccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+   mfacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+   mfcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+   mfabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+   mfbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+   mfbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+   mfccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+   mfacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+   mfcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+   mfaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+   mfabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+   mfbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+   mfbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+   mfaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+   mfcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+   mfaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+   mfcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+   mfbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+   mfbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+   mfaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+   mfcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+   mfaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+   mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+   mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+
+
+   ////////////////////////////////////////////////////////////////////////////////////
+//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//!
+////////////////////////////////////////////////////////////////////////////////////
+// fluid component
+	   //LBMReal drhoFluid =
+		  // ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) +
+		  // (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) +
+			 //  ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb;
+
+	   //LBMReal rhoFluid = c1 + drhoFluid;
+	   //LBMReal OOrhoFluid = c1 / rhoFluid;
+
+
+	   //LBMReal vvx =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) +
+		  // (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) +
+			 //  (fcbb - fabb)) * OOrhoFluid;
+	   //LBMReal vvy =
+		  // ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) +
+		  // (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) +
+			 //  (fbcb - fbab)) * OOrhoFluid;
+	   //LBMReal vvz =
+		  // ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) +
+		  // (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) +
+			 //  (fbbc - fbba)) * OOrhoFluid;
+
+	 //  LBMReal vvx = ux;
+	 //  LBMReal vvy = uy;
+	 //  LBMReal vvz = uz;
+	   ////////////////////////////////////////////////////////////////////////////////////
+	   // second component
+   LBMReal concentration =
+	   ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+	   (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+		   ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //!
+  // LBMReal fx = forces[0];
+  // LBMReal fy = forces[1];
+  // LBMReal fz = -concentration * forces[2];
+  // vvx += fx * c1o2;
+  // vvy += fy * c1o2;
+  // vvz += fz * c1o2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   LBMReal oneMinusRho = c1 - concentration;
+
+   LBMReal cx =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+	   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+		   (mfcbb - mfabb));
+   LBMReal cy =
+	   ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+	   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+		   (mfbcb - mfbab));
+   LBMReal cz =
+	   ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+	   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+		   (mfbbc - mfbba));
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // calculate the square of velocities for this lattice node
+   LBMReal cx2 = cx * cx;
+   LBMReal cy2 = cy * cy;
+   LBMReal cz2 = cz * cz;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (6)-(14) in \ref
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - experimental Cumulant ... to be published ... hopefully
+   //!
+
+   // linearized orthogonalization of 3rd order central moments
+   LBMReal Mabc = mfabc - mfaba * c1o3;
+   LBMReal Mbca = mfbca - mfbaa * c1o3;
+   LBMReal Macb = mfacb - mfaab * c1o3;
+   LBMReal Mcba = mfcba - mfaba * c1o3;
+   LBMReal Mcab = mfcab - mfaab * c1o3;
+   LBMReal Mbac = mfbac - mfbaa * c1o3;
+   // linearized orthogonalization of 5th order central moments
+   LBMReal Mcbc = mfcbc - mfaba * c1o9;
+   LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+   LBMReal Mccb = mfccb - mfaab * c1o9;
+
+   // collision of 1st order moments
+   cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+   cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+
+   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
+   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
+//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
+
+
+   cx2 = cx * cx;
+   cy2 = cy * cy;
+   cz2 = cz * cz;
+
+   // equilibration of 2nd order moments
+   mfbba = zeroReal;
+   mfbab = zeroReal;
+   mfabb = zeroReal;
+
+   mfcaa = c1o3 * concentration;
+   mfaca = c1o3 * concentration;
+   mfaac = c1o3 * concentration;
+
+
+   //LBMReal omega2 = 1.0f;// omegaD;
+   //mfbba *= (c1 - omega2);
+   //mfbab *= (c1 - omega2);
+   //mfabb *= (c1 - omega2);
+
+   //mfcaa = mfcaa*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaca = mfaca*(c1 - omega2) + omega2*c1o3 * concentration;
+   //mfaac = mfaac*(c1 - omega2) + omega2*c1o3 * concentration;
+
+   // equilibration of 3rd order moments
+   Mabc = zeroReal;
+   Mbca = zeroReal;
+   Macb = zeroReal;
+   Mcba = zeroReal;
+   Mcab = zeroReal;
+   Mbac = zeroReal;
+   mfbbb = zeroReal;
+
+   // from linearized orthogonalization 3rd order central moments to central moments
+   mfabc = Mabc + mfaba * c1o3;
+   mfbca = Mbca + mfbaa * c1o3;
+   mfacb = Macb + mfaab * c1o3;
+   mfcba = Mcba + mfaba * c1o3;
+   mfcab = Mcab + mfaab * c1o3;
+   mfbac = Mbac + mfbaa * c1o3;
+
+   // equilibration of 4th order moments
+   mfacc = c1o9 * concentration;
+   mfcac = c1o9 * concentration;
+   mfcca = c1o9 * concentration;
+
+   mfcbb = zeroReal;
+   mfbcb = zeroReal;
+   mfbbc = zeroReal;
+
+   // equilibration of 5th order moments
+   Mcbc = zeroReal;
+   Mbcc = zeroReal;
+   Mccb = zeroReal;
+
+   // from linearized orthogonalization 5th order central moments to central moments
+   mfcbc = Mcbc + mfaba * c1o9;
+   mfbcc = Mbcc + mfbaa * c1o9;
+   mfccb = Mccb + mfaab * c1o9;
+
+   // equilibration of 6th order moment
+   mfccc = c1o27 * concentration;
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+   //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+   //! see also Eq. (88)-(96) in
+   //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+   //!
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+   backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+   backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+   backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+   backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+   backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+   backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+   backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+   backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+   backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+   (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3) = mfabb;
+   (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3) = mfbab;
+   (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3) = mfbba;
+   (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;
+   (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;
+   (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;
+   (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;
+   (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;
+   (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;
+
+   (*this->zeroDistributionsH2)(x1, x2, x3) = mfbbb;
+
+   }
+
+
+
+		/////!CUMULANT PHASE-FIELD
+
+
+
+                        /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
+
+                        //h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        //h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
+                        //h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
+                        //h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
+                        //h[NW]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
+                        //h[TE]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
+                        //h[TW]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
+                        //h[TN]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
+                        //h[TS]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
+                        //h[TNE] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
+                        //h[TNW] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        //h[TSE] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        //h[TSW] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+                        //h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
+                        //h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
+                        //h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
+                        //h[SW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        //h[SE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
+                        //h[BW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        //h[BE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
+                        //h[BS]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        //h[BN]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
+                        //h[BSW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        //h[BSE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        //h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        //h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                        //h[REST] = (*this->zeroDistributionsH)(x1, x2, x3);
+
+                        //for (int dir = STARTF; dir < (ENDF + 1); dir++) {
+                        //    LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
+                        //    LBMReal velSq1  = velProd * velProd;
+                        //    LBMReal hEq; //, gEq;
+
+                        //    if (dir != REST) {
+                        //        LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]]) / 2.0;
+                        //        LBMReal hSource     = (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST]) * (dirGrad_phi) / denom; 
+                        //        hEq = phi[REST] * WEIGTH[dir] * (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) +                                 hSource * WEIGTH[dir];
+
+                        //        // This corresponds with the collision factor of 1.0 which equals (tauH + 0.5).
+                        //        h[dir] = h[dir] - (h[dir] - hEq) / (tauH); 
+
+                        //    } else {
+                        //        hEq = phi[REST] * WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+                        //        h[REST] = h[REST] - (h[REST] - hEq) / (tauH); 
+                        //    }
+                        //}
+
+                        //(*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3)     = h[D3Q27System::INV_E];
+                        //(*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3)     = h[D3Q27System::INV_N];
+                        //(*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3)     = h[D3Q27System::INV_T];
+                        //(*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3)    = h[D3Q27System::INV_NE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3)   = h[D3Q27System::INV_NW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3)    = h[D3Q27System::INV_TE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3)   = h[D3Q27System::INV_TW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3)    = h[D3Q27System::INV_TN];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3)   = h[D3Q27System::INV_TS];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3)   = h[D3Q27System::INV_TNE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3)  = h[D3Q27System::INV_TNW];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3)  = h[D3Q27System::INV_TSE];
+                        //(*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3) = h[D3Q27System::INV_TSW];
+
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3)     = h[D3Q27System::INV_W];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3)     = h[D3Q27System::INV_S];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p)     = h[D3Q27System::INV_B];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3)   = h[D3Q27System::INV_SW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3)    = h[D3Q27System::INV_SE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p)   = h[D3Q27System::INV_BW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p)    = h[D3Q27System::INV_BE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p)   = h[D3Q27System::INV_BS];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p)    = h[D3Q27System::INV_BN];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p) = h[D3Q27System::INV_BSW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p)  = h[D3Q27System::INV_BSE];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p)  = h[D3Q27System::INV_BNW];
+                        //(*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p)   = h[D3Q27System::INV_BNE];
+
+                        //(*this->zeroDistributionsH)(x1, x2, x3) = h[D3Q27System::REST];
+
+                        /////////////////////   END OF OLD BGK SOLVER ///////////////////////////////
+                    }
+                }
+            }
+        
+       // dataSet->setPhaseField(divU);
+		}
+}
+//////////////////////////////////////////////////////////////////////////
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi()
+{
+    using namespace D3Q27System;
+	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
+		+WEIGTH[N] * (phi[E] - phi[W]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX1[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi()
+{
+    using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
+		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+		+WEIGTH[N] * (phi[N] - phi[S]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX2[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi()
+{
+    using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+		+WEIGTH[N] * (phi[T] - phi[B]));
+    //LBMReal sum = 0.0;
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * DX3[k] * phi[k];
+    //}
+    //return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+		+WEIGTH[N] * (phi2[N] - phi2[S]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+		+WEIGTH[N] * (phi2[T] - phi2[B]));
+	//LBMReal sum = 0.0;
+	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
+	//}
+	//return 3.0 * sum;
+}
+
+
+
+
+
+LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::nabla2_phi()
+{
+    using namespace D3Q27System;
+    LBMReal sum = 0.0;
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
+		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TN] * (
+			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
+		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
+		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		);
+	sum += WEIGTH[T] * (
+			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
+		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
+		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		);
+    //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+    //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
+    //}
+    return 6.0 * sum;
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::computePhasefield()
+{
+    using namespace D3Q27System;
+    SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+
+    int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+    int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+    int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+
+    //------------- Computing the phase-field ------------------
+    for (int x3 = minX3; x3 < maxX3; x3++) {
+        for (int x2 = minX2; x2 < maxX2; x2++) {
+            for (int x1 = minX1; x1 < maxX1; x1++) {
+                // if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+                {
+                    int x1p = x1 + 1;
+                    int x2p = x2 + 1;
+                    int x3p = x3 + 1;
+
+                    h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                    h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                    h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                    h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+                    h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                    h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+                }
+            }
+        }
+    }
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+                                                int x3)
+{
+    using namespace D3Q27System;
+
+    SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+    phi[REST] = (*ph)(x1, x2, x3);
+
+
+    for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+        if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+            phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+        } else {
+			phi[k] = 0.0;
+         }
+    }
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.0;
+		}
+	}
+}
+
+void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::swapDistributions()
+{
+    LBMKernel::swapDistributions();
+    dataSet->getHdistributions()->swap();
+	dataSet->getH2distributions()->swap();
+}
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
new file mode 100644
index 000000000..2b899d0ea
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
@@ -0,0 +1,119 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
+//! \ingroup LBMKernel
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2_H
+#define MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief  Multiphase Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  H. Safari, K. Kutscher, M. Geier
+class MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2 : public LBMKernel
+{
+public:
+   MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2();
+   virtual ~MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2(void) = default;
+   void calculate(int step) override;
+   SPtr<LBMKernel> clone() override;
+   void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+   void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+   ///refactor
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
+   double getCalculationTime() override { return .0; }
+protected:
+   virtual void initDataSet();
+   void swapDistributions() override;
+   LBMReal f1[D3Q27System::ENDF+1];
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH1;
+
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2;
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2;
+
+   //CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   phaseField;
+
+
+   LBMReal h  [D3Q27System::ENDF+1];
+   LBMReal h2[D3Q27System::ENDF + 1];
+   LBMReal g  [D3Q27System::ENDF+1];
+   LBMReal phi[D3Q27System::ENDF+1];
+   LBMReal phi2[D3Q27System::ENDF + 1];
+   LBMReal pr1[D3Q27System::ENDF+1];
+   LBMReal phi_cutoff[D3Q27System::ENDF+1];
+
+   LBMReal gradX1_phi();
+   LBMReal gradX2_phi();
+   LBMReal gradX3_phi();
+   LBMReal gradX1_phi2();
+   LBMReal gradX2_phi2();
+   LBMReal gradX3_phi2();
+   //LBMReal gradX1_pr1();
+   //LBMReal gradX2_pr1();
+   //LBMReal gradX3_pr1();
+   //LBMReal dirgradC_phi(int n, int k);
+   void computePhasefield();
+   void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+   void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
+   //void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, int x1, int x2, int x3);
+   //void pressureFiltering(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf /*Pressure-Field*/, CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr pf_filtered /*Pressure-Field*/);
+
+   LBMReal nabla2_phi();
+
+
+   mu::value_type muX1,muX2,muX3;
+   mu::value_type muDeltaT;
+   mu::value_type muNu;
+   LBMReal forcingX1;
+   LBMReal forcingX2;
+   LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 827a8263a..37a414515 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -47,6 +47,7 @@
 #include "TwoDistributionsFullDirectConnector.h"
 #include "TwoDistributionsFullVectorConnector.h"
 #include "ThreeDistributionsFullDirectConnector.h"
+#include "ThreeDistributionsFullDirectConnector2.h"
 #include "ThreeDistributionsFullVectorConnector.h"
 #include <basics/transmitter/TbTransmitterLocal.h>
 
@@ -158,5 +159,6 @@ void SetConnectorsBlockVisitor<T1, T2>::setRemoteConnectors(SPtr<Block3D> sblock
 using OneDistributionSetConnectorsBlockVisitor  = SetConnectorsBlockVisitor<OneDistributionFullDirectConnector, OneDistributionFullVectorConnector>;
 using TwoDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsFullDirectConnector, TwoDistributionsFullVectorConnector>;
 using ThreeDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector, ThreeDistributionsFullVectorConnector>;
+using ThreeDistributionsSetConnectorsBlockVisitor2 = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector2, ThreeDistributionsFullVectorConnector>;
 
 #endif // SETCONNECTORSBLOCKVISITOR_H
-- 
GitLab


From 1f7ec97a56d8953b93993d81774b33c20cbe0259 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 2 Aug 2021 16:10:16 +0200
Subject: [PATCH 013/179] add pressure field to local connector for two phase
 fields velocity kernel

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |   4 +-
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |  12 +-
 .../Connectors/FullDirectConnector.h          |   2 +-
 .../Connectors/FullVectorConnector.h          |   4 +-
 ...ThreeDistributionsFullDirectConnector2.cpp |  74 +++++
 .../ThreeDistributionsFullDirectConnector2.h  |   7 +-
 ...ThreeDistributionsFullVectorConnector2.cpp |  99 ++++++
 .../ThreeDistributionsFullVectorConnector2.h  | 293 ++++++++++++++++++
 src/cpu/VirtualFluidsCore/Data/DataSet3D.h    |  10 +
 ...oPhaseFieldsVelocityCumulantLBMKernel2.cpp |  11 +-
 ...TwoPhaseFieldsVelocityCumulantLBMKernel2.h |   5 +-
 11 files changed, 504 insertions(+), 17 deletions(-)
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 06038f3be..9764094fc 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -266,13 +266,15 @@ void run(string configname)
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-        //pp->process(0);
+        pp->process(0);
         //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(
         //    grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
 
         SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
         SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
 
+        omp_set_num_threads(numOfThreads);
+
         SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
         SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
         calculator->addCoProcessor(npr);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 1388f369d..42cec5c5e 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -157,7 +157,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     datanames.push_back("Vz");
     datanames.push_back("P1");
     datanames.push_back("Phi2");
-    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) datanames.push_back("Pressure");
+    if (kernel->getDataSet()->getPressureField()) datanames.push_back("Pressure");
 
     data.resize(datanames.size());
 
@@ -168,6 +168,9 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     SPtr<DistributionArray3D> distributionsH2 = kernel->getDataSet()->getH2distributions();
     SPtr<PhaseFieldArray3D> divU             = kernel->getDataSet()->getPhaseField();
 
+    SPtr<PressureFieldArray3D> pressure;
+    if (kernel->getDataSet()->getPressureField()) pressure = kernel->getDataSet()->getPressureField();
+
     LBMReal f[D3Q27System::ENDF + 1];
     LBMReal phi[D3Q27System::ENDF + 1];
     LBMReal phi2[D3Q27System::ENDF + 1];
@@ -347,7 +350,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     // rho = phi[ZERO] + (1.0 - phi[ZERO])*1.0/densityRatio;
                     rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
-                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) {
+                    if (pressure) {
                         vx1 =
                             ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
                             (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) ;
@@ -429,10 +432,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     data[index++].push_back(vx3);
                     data[index++].push_back(p1);
                     data[index++].push_back(phi2[REST]);
-                    if (dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure) {
-                        data[index++].push_back((*dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->pressure)(ix1, ix2, ix3));
-                    }
-                   // else { data[index++].push_back(999); }
+                    if (pressure) data[index++].push_back((*pressure)(ix1, ix2, ix3));
                 }
             }
         }
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.h
index fb04de68a..81984eee9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.h
@@ -49,7 +49,7 @@ public:
 
 protected:
     virtual void updatePointers() = 0;
-    void exchangeData();
+    virtual void exchangeData();
     virtual void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) = 0;
 
     int maxX1;
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.h
index 39fc3d1af..802a91290 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.h
@@ -56,8 +56,8 @@ public:
 
 protected:
     virtual void updatePointers() = 0;
-    void fillData();
-    void distributeData();
+    virtual void fillData();
+    virtual void distributeData();
     virtual void fillData(vector_type &sdata, int &index, int x1, int x2, int x3) = 0;
     virtual void distributeData(vector_type &rdata, int &index, int x1, int x2, int x3) = 0;
     
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
index dd6ea50e2..78cc34f20 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
@@ -51,6 +51,8 @@ void ThreeDistributionsFullDirectConnector2::init()
 	hTo = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getHdistributions());
     hFrom2 = dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getH2distributions());
     hTo2  = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getH2distributions());
+    pressureFrom = from.lock()->getKernel()->getDataSet()->getPressureField();
+    pressureTo   = to.lock()->getKernel()->getDataSet()->getPressureField();
 }
 //////////////////////////////////////////////////////////////////////////
 void ThreeDistributionsFullDirectConnector2::sendVectors()
@@ -151,6 +153,8 @@ void ThreeDistributionsFullDirectConnector2::exchangeData()
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, maxX2m3, x3, minX1, minX2, x3);
             exchangeData(maxX1m2, maxX2m2, x3, minX1p1, minX2p1, x3);
+            exchangeData(maxX1m3, maxX2m2, x3, minX1, minX2p1, x3);
+            exchangeData(maxX1m2, maxX2m3, x3, minX1p1, minX2, x3);
         }
     }
     // NORTHWEST
@@ -158,6 +162,8 @@ void ThreeDistributionsFullDirectConnector2::exchangeData()
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, maxX2m3, x3, maxX1, minX2, x3);
             exchangeData(minX1p2, maxX2m2, x3, maxX1m1, minX2p1, x3);
+            exchangeData(minX1p3, maxX2m2, x3, maxX1, minX2p1, x3);
+            exchangeData(minX1p2, maxX2m3, x3, maxX1m1, minX2, x3);
         }
     }
     // SOUTHWEST
@@ -165,6 +171,8 @@ void ThreeDistributionsFullDirectConnector2::exchangeData()
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, minX2p3, x3, maxX1, maxX2, x3);
             exchangeData(minX1p2, minX2p2, x3, maxX1m1, maxX2m1, x3);
+            exchangeData(minX1p3, minX2p2, x3, maxX1, maxX2m1, x3);
+            exchangeData(minX1p2, minX2p3, x3, maxX1m1, maxX2, x3);
         }
     }
     // SOUTHEAST
@@ -172,71 +180,137 @@ void ThreeDistributionsFullDirectConnector2::exchangeData()
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, minX2p3, x3, minX1, maxX2, x3);
             exchangeData(maxX1m2, minX2p2, x3, minX1p1, maxX2m1, x3);
+            exchangeData(maxX1m3, minX2p2, x3, minX1, maxX2m1, x3);
+            exchangeData(maxX1m2, minX2p3, x3, minX1p1, maxX2, x3);
         }
     } else if (sendDir == D3Q27System::TE)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, maxX3m3, minX1, x2, minX3);
             exchangeData(maxX1m2, x2, maxX3m2, minX1p1, x2, minX3p1);
+            exchangeData(maxX1m3, x2, maxX3m2, minX1, x2, minX3p1);
+            exchangeData(maxX1m2, x2, maxX3m3, minX1p1, x2, minX3);
         }
     else if (sendDir == D3Q27System::BW)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, minX3p3, maxX1, x2, maxX3);
             exchangeData(minX1p2, x2, minX3p2, maxX1m1, x2, maxX3m1);
+            exchangeData(minX1p3, x2, minX3p2, maxX1, x2, maxX3m1);
+            exchangeData(minX1p2, x2, minX3p3, maxX1m1, x2, maxX3);
         }
     else if (sendDir == D3Q27System::BE)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, minX3p3, minX1, x2, maxX3);
             exchangeData(maxX1m2, x2, minX3p2, minX1p1, x2, maxX3m1);
+            exchangeData(maxX1m3, x2, minX3p2, minX1, x2, maxX3m1);
+            exchangeData(maxX1m2, x2, minX3p3, minX1p1, x2, maxX3);
         }
     else if (sendDir == D3Q27System::TW)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, maxX3m3, maxX1, x2, minX3);
             exchangeData(minX1p2, x2, maxX3m2, maxX1m1, x2, minX3p1);
+            exchangeData(minX1p3, x2, maxX3m2, maxX1, x2, minX3p1);
+            exchangeData(minX1p2, x2, maxX3m3, maxX1m1, x2, minX3);
         }
     else if (sendDir == D3Q27System::TN)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, maxX3m3, x1, minX2, minX3);
             exchangeData(x1, maxX2m2, maxX3m2, x1, minX2p1, minX3p1);
+            exchangeData(x1, maxX2m3, maxX3m2, x1, minX2, minX3p1);
+            exchangeData(x1, maxX2m2, maxX3m3, x1, minX2p1, minX3);
         }
     else if (sendDir == D3Q27System::BS)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, minX3p3, x1, maxX2, maxX3);
             exchangeData(x1, minX2p2, minX3p2, x1, maxX2m1, maxX3m1);
+            exchangeData(x1, minX2p3, minX3p2, x1, maxX2, maxX3m1);
+            exchangeData(x1, minX2p2, minX3p3, x1, maxX2m1, maxX3);
         }
     else if (sendDir == D3Q27System::BN)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, minX3p3, x1, minX2, maxX3);
             exchangeData(x1, maxX2m2, minX3p2, x1, minX2p1, maxX3m1);
+            exchangeData(x1, maxX2m3, minX3p2, x1, minX2, maxX3m1);
+            exchangeData(x1, maxX2m2, minX3p3, x1, minX2p1, maxX3);
         }
     else if (sendDir == D3Q27System::TS)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, maxX3m3, x1, maxX2, minX3);
             exchangeData(x1, minX2p2, maxX3m2, x1, maxX2m1, minX3p1);
+            exchangeData(x1, minX2p3, maxX3m2, x1, maxX2, minX3p1);
+            exchangeData(x1, minX2p2, maxX3m3, x1, maxX2m1, minX3);
         }
     else if (sendDir == D3Q27System::TSW) {
         exchangeData(minX1p3, minX2p3, maxX3m3, maxX1, maxX2, minX3);
         exchangeData(minX1p2, minX2p2, maxX3m2, maxX1m1, maxX2m1, minX3p1);
+        exchangeData(minX1p3, minX2p2, maxX3m2, maxX1, maxX2m1, minX3p1);
+        exchangeData(minX1p2, minX2p3, maxX3m2, maxX1m1, maxX2, minX3p1);
+        exchangeData(minX1p2, minX2p2, maxX3m3, maxX1m1, maxX2m1, minX3);
+        exchangeData(minX1p3, minX2p3, maxX3m2, maxX1, maxX2, minX3p1);
+        exchangeData(minX1p3, minX2p2, maxX3m3, maxX1, maxX2m1, minX3);
+        exchangeData(minX1p2, minX2p3, maxX3m3, maxX1m1, maxX2, minX3);
     } else if (sendDir == D3Q27System::TSE) {
         exchangeData(maxX1m3, minX1p3, maxX3m3, minX1, maxX2, minX3);
         exchangeData(maxX1m2, minX1p2, maxX3m2, minX1p1, maxX2m1, minX3p1);
+        exchangeData(maxX1m3, minX1p2, maxX3m2, minX1, maxX2m1, minX3p1);
+        exchangeData(maxX1m2, minX1p3, maxX3m2, minX1p1, maxX2, minX3p1);
+        exchangeData(maxX1m2, minX1p2, maxX3m3, minX1p1, maxX2m1, minX3);
+        exchangeData(maxX1m3, minX1p3, maxX3m2, minX1, maxX2, minX3p1);
+        exchangeData(maxX1m3, minX1p2, maxX3m3, minX1, maxX2m1, minX3);
+        exchangeData(maxX1m2, minX1p3, maxX3m3, minX1p1, maxX2, minX3);
     } else if (sendDir == D3Q27System::TNW) {
         exchangeData(minX1p3, maxX2m3, maxX3m3, maxX1, minX2, minX3);
         exchangeData(minX1p2, maxX2m2, maxX3m2, maxX1m1, minX2p1, minX3p1);
+        exchangeData(minX1p3, maxX2m2, maxX3m2, maxX1, minX2p1, minX3p1);
+        exchangeData(minX1p2, maxX2m3, maxX3m2, maxX1m1, minX2, minX3p1);
+        exchangeData(minX1p2, maxX2m2, maxX3m3, maxX1m1, minX2p1, minX3);
+        exchangeData(minX1p3, maxX2m3, maxX3m2, maxX1, minX2, minX3p1);
+        exchangeData(minX1p3, maxX2m2, maxX3m3, maxX1, minX2p1, minX3);
+        exchangeData(minX1p2, maxX2m3, maxX3m3, maxX1m1, minX2, minX3);
     } else if (sendDir == D3Q27System::TNE) {
         exchangeData(maxX1m3, maxX2m3, maxX3m3, minX1, minX2, minX3);
         exchangeData(maxX1m2, maxX2m2, maxX3m2, minX1p1, minX2p1, minX3p1);
+        exchangeData(maxX1m3, maxX2m2, maxX3m2, minX1, minX2p1, minX3p1);
+        exchangeData(maxX1m2, maxX2m3, maxX3m2, minX1p1, minX2, minX3p1);
+        exchangeData(maxX1m2, maxX2m2, maxX3m3, minX1p1, minX2p1, minX3);
+        exchangeData(maxX1m3, maxX2m3, maxX3m2, minX1, minX2, minX3p1);
+        exchangeData(maxX1m3, maxX2m2, maxX3m3, minX1, minX2p1, minX3);
+        exchangeData(maxX1m2, maxX2m3, maxX3m3, minX1p1, minX2, minX3);
     } else if (sendDir == D3Q27System::BSW) {
         exchangeData(minX1p3, minX2p3, minX3p3, maxX1, maxX2, maxX3);
         exchangeData(minX1p2, minX2p2, minX3p2, maxX1m1, maxX2m1, maxX3m1);
+        exchangeData(minX1p3, minX2p2, minX3p2, maxX1, maxX2m1, maxX3m1);
+        exchangeData(minX1p2, minX2p3, minX3p2, maxX1m1, maxX2, maxX3m1);
+        exchangeData(minX1p2, minX2p2, minX3p3, maxX1m1, maxX2m1, maxX3);
+        exchangeData(minX1p3, minX2p3, minX3p2, maxX1, maxX2, maxX3m1);
+        exchangeData(minX1p3, minX2p2, minX3p3, maxX1, maxX2m1, maxX3);
+        exchangeData(minX1p2, minX2p3, minX3p3, maxX1m1, maxX2, maxX3);
     } else if (sendDir == D3Q27System::BSE) {
         exchangeData(maxX1m3, minX2p3, minX3p3, minX1, maxX2, maxX3);
         exchangeData(maxX1m2, minX2p2, minX3p2, minX1p1, maxX2m1, maxX3m1);
+        exchangeData(maxX1m3, minX2p2, minX3p2, minX1, maxX2m1, maxX3m1);
+        exchangeData(maxX1m2, minX2p3, minX3p2, minX1p1, maxX2, maxX3m1);
+        exchangeData(maxX1m2, minX2p2, minX3p3, minX1p1, maxX2m1, maxX3);
+        exchangeData(maxX1m3, minX2p3, minX3p2, minX1, maxX2, maxX3m1);
+        exchangeData(maxX1m3, minX2p2, minX3p3, minX1, maxX2m1, maxX3);
+        exchangeData(maxX1m2, minX2p3, minX3p3, minX1p1, maxX2, maxX3);
     } else if (sendDir == D3Q27System::BNW) {
         exchangeData(minX1p3, maxX2m3, minX3p3, maxX1, minX2, maxX3);
         exchangeData(minX1p2, maxX2m2, minX3p2, maxX1m1, minX2p1, maxX3m1);
+        exchangeData(minX1p3, maxX2m2, minX3p2, maxX1, minX2p1, maxX3m1);
+        exchangeData(minX1p2, maxX2m3, minX3p2, maxX1m1, minX2, maxX3m1);
+        exchangeData(minX1p2, maxX2m2, minX3p3, maxX1m1, minX2p1, maxX3);
+        exchangeData(minX1p3, maxX2m3, minX3p2, maxX1, minX2, maxX3m1);
+        exchangeData(minX1p3, maxX2m2, minX3p3, maxX1, minX2p1, maxX3);
+        exchangeData(minX1p2, maxX2m3, minX3p3, maxX1m1, minX2, maxX3);
     } else if (sendDir == D3Q27System::BNE) {
         exchangeData(maxX1m3, maxX2m3, minX3p3, minX1, minX2, maxX3);
         exchangeData(maxX1m2, maxX2m2, minX3p2, minX1p1, minX2p1, maxX3m1);
+        exchangeData(maxX1m3, maxX2m2, minX3p2, minX1, minX2p1, maxX3m1);
+        exchangeData(maxX1m2, maxX2m3, minX3p2, minX1p1, minX2, maxX3m1);
+        exchangeData(maxX1m2, maxX2m2, minX3p3, minX1p1, minX2p1, maxX3);
+        exchangeData(maxX1m3, maxX2m3, minX3p2, minX1, minX2, maxX3m1);
+        exchangeData(maxX1m3, maxX2m2, minX3p3, minX1, minX2p1, maxX3);
+        exchangeData(maxX1m2, maxX2m3, minX3p3, minX1p1, minX2, maxX3);
     } else
         UB_THROW(UbException(UB_EXARGS, "unknown dir"));
 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
index 1ced5129b..3375f570d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
@@ -40,6 +40,7 @@
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "basics/container/CbArray3D.h"
 #include "basics/container/CbArray4D.h"
+#include "DataSet3D.h"
 
 //! \brief   Exchange data between blocks. 
 //! \details Connector send and receive full distributions between two blocks in shared memory.
@@ -53,7 +54,7 @@ public:
 
 protected:
     inline void updatePointers() override;
-    void exchangeData();
+    void exchangeData() override;
     inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) override;
 
 private:
@@ -83,6 +84,8 @@ private:
 
 	SPtr<EsoTwist3D> fFrom, hFrom, hFrom2;
     SPtr<EsoTwist3D> fTo, hTo, hTo2;
+
+    SPtr<PressureFieldArray3D> pressureFrom, pressureTo;
 };
 //////////////////////////////////////////////////////////////////////////
 inline void ThreeDistributionsFullDirectConnector2::updatePointers()
@@ -230,5 +233,7 @@ inline void ThreeDistributionsFullDirectConnector2::exchangeData(int x1From, int
         (*this->nonLocalDistributionsFromh2)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
 
     (*this->zeroDistributionsToh2)(x1To, x2To, x3To) = (*this->zeroDistributionsFromh2)(x1From, x2From, x3From);
+
+    (*this->pressureTo)(x1To, x2To, x3To) = (*this->pressureFrom)(x1From, x2From, x3From);
 }
 #endif
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
new file mode 100644
index 000000000..a9e3c7e74
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
@@ -0,0 +1,99 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file ThreeDistributionsFullVectorConnector2.cpp
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "ThreeDistributionsFullVectorConnector2.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "EsoTwist3D.h"
+#include "DataSet3D.h"
+
+//////////////////////////////////////////////////////////////////////////
+ThreeDistributionsFullVectorConnector2::ThreeDistributionsFullVectorConnector2(SPtr<Block3D> block,
+                                                                         VectorTransmitterPtr sender,
+                                                                         VectorTransmitterPtr receiver, int sendDir)
+    : FullVectorConnector(block, sender, receiver, sendDir)
+{
+   if (!block || !sender || !receiver)
+      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
+
+}
+//////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullVectorConnector2::init()
+{
+   FullVectorConnector::init();
+
+   fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions());
+   hDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getHdistributions());
+   h2Dis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getH2distributions());
+
+   int anz = 3*27;
+   switch (sendDir)
+   {
+   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::E:
+   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
+   case D3Q27System::N:
+   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
+   case D3Q27System::T:
+   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
+
+   case D3Q27System::NE:
+   case D3Q27System::SW:
+   case D3Q27System::SE:
+   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
+
+   case D3Q27System::TE:
+   case D3Q27System::BW:
+   case D3Q27System::BE:
+   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
+
+   case D3Q27System::TN:
+   case D3Q27System::BS:
+   case D3Q27System::BN:
+   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
+
+   case D3Q27System::TNE:
+   case D3Q27System::BSW:
+   case D3Q27System::BNE:
+   case D3Q27System::TSW:
+   case D3Q27System::TSE:
+   case D3Q27System::BNW:
+   case D3Q27System::BSE:
+   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
+
+   default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
+   }
+}
+
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
new file mode 100644
index 000000000..87448a414
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
@@ -0,0 +1,293 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file ThreeDistributionsFullVectorConnector2.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef ThreeDistributionsFullVectorConnector2_H
+#define ThreeDistributionsFullVectorConnector2_H
+
+#include <vector>
+
+#include "FullVectorConnector.h"
+#include "D3Q27System.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+
+class EsoTwist3D;
+class Block3D;
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+class ThreeDistributionsFullVectorConnector2 : public FullVectorConnector
+{
+public:
+   ThreeDistributionsFullVectorConnector2(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir);
+
+   void init() override;
+
+   void fillSendVectors() override;
+   void distributeReceiveVectors() override;
+
+protected:
+   inline void updatePointers() override;
+   inline void fillData(vector_type &sdata, int &index, int x1, int x2, int x3) override;
+   inline void distributeData(vector_type &rdata, int &index, int x1, int x2, int x3) override;
+
+private:
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
+
+   SPtr<EsoTwist3D>  fDis;
+
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localHdistributions;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalHdistributions;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroHdistributions;
+
+   SPtr<EsoTwist3D>  hDis;
+
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localH2distributions;
+   CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalH2distributions;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroH2distributions;
+
+   SPtr<EsoTwist3D> h2Dis;
+
+};
+//////////////////////////////////////////////////////////////////////////
+inline void ThreeDistributionsFullVectorConnector2::updatePointers()
+{
+    localDistributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
+    nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
+    zeroDistributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
+
+    localHdistributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getLocalDistributions();
+    nonLocalHdistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getNonLocalDistributions();
+    zeroHdistributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getZeroDistributions();
+
+    localH2distributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->h2Dis)->getLocalDistributions();
+    nonLocalH2distributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->h2Dis)->getNonLocalDistributions();
+    zeroH2distributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->h2Dis)->getZeroDistributions();
+}
+//////////////////////////////////////////////////////////////////////////
+inline void ThreeDistributionsFullVectorConnector2::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
+{
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroDistributions)(x1, x2, x3);
+
+
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroHdistributions)(x1, x2, x3);
+
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localH2distributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroH2distributions)(x1, x2, x3);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void ThreeDistributionsFullVectorConnector2::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
+{
+   (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
+
+   (*this->zeroDistributions)(x1, x2, x3) = rdata[index++];
+
+   
+   (*this->localHdistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalHdistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
+
+   (*this->zeroHdistributions)(x1, x2, x3) = rdata[index++];
+
+   (*this->localH2distributions)(D3Q27System::ET_E, x1, x2, x3)           = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_N, x1, x2, x3)           = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_T, x1, x2, x3)           = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_NE, x1, x2, x3)          = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_NW, x1 + 1, x2, x3)      = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TE, x1, x2, x3)          = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TW, x1 + 1, x2, x3)      = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TN, x1, x2, x3)          = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TS, x1, x2 + 1, x3)      = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TNE, x1, x2, x3)         = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3)     = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3)     = rdata[index++];
+   (*this->localH2distributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalH2distributions)(D3Q27System::ET_W, x1 + 1, x2, x3)           = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_S, x1, x2 + 1, x3)           = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_B, x1, x2, x3 + 1)           = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3)      = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_SE, x1, x2 + 1, x3)          = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1)      = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BE, x1, x2, x3 + 1)          = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1)      = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BN, x1, x2, x3 + 1)          = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1)     = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = rdata[index++];
+   (*this->nonLocalH2distributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = rdata[index++];
+
+   (*this->zeroH2distributions)(x1, x2, x3) = rdata[index++];
+}
+
+
+#endif 
+
diff --git a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
index e53e38a74..6b858e6ec 100644
--- a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
@@ -44,6 +44,7 @@ using AverageValuesArray3D     = CbArray4D<LBMReal, IndexerX4X3X2X1>;
 using ShearStressValuesArray3D = CbArray4D<LBMReal, IndexerX4X3X2X1>;
 using RelaxationFactorArray3D  = CbArray3D<LBMReal, IndexerX3X2X1>;
 using PhaseFieldArray3D        = CbArray3D<LBMReal, IndexerX3X2X1>;
+using PressureFieldArray3D     = CbArray3D<LBMReal, IndexerX3X2X1>;
 
 //! A class provides an interface for data structures in the kernel.
 class DataSet3D
@@ -88,6 +89,9 @@ public:
     SPtr<PhaseFieldArray3D> getPhaseField2() const;
     void setPhaseField2(SPtr<PhaseFieldArray3D> values);
 
+    SPtr<PressureFieldArray3D> DataSet3D::getPressureField() const;
+    void DataSet3D::setPressureField(SPtr<PressureFieldArray3D> values);
+
 protected:
 private:
     SPtr<DistributionArray3D> fdistributions;
@@ -103,8 +107,10 @@ private:
     SPtr<ShearStressValuesArray3D> shearStressValues;
 
     SPtr<RelaxationFactorArray3D> relaxationFactor;
+    
     SPtr<PhaseFieldArray3D> phaseField;
     SPtr<PhaseFieldArray3D> phaseField2;
+    SPtr<PressureFieldArray3D> pressureField;
 };
 
 inline SPtr<DistributionArray3D> DataSet3D::getFdistributions() const { return fdistributions; }
@@ -162,4 +168,8 @@ inline SPtr<PhaseFieldArray3D> DataSet3D::getPhaseField2() const { return phaseF
 
 inline void DataSet3D::setPhaseField2(SPtr<PhaseFieldArray3D> values) { phaseField2 = values; }
 
+inline SPtr<PressureFieldArray3D> DataSet3D::getPressureField() const { return pressureField; }
+
+inline void DataSet3D::setPressureField(SPtr<PressureFieldArray3D> values) { pressureField = values; }
+
 #endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
index 13f8ce77f..97a8196db 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
@@ -51,12 +51,13 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::initDataSet()
     SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
     SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
     SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
-	pressure= CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
     dataSet->setFdistributions(f);
     dataSet->setHdistributions(h); // For phase-field
     dataSet->setH2distributions(h2); // For phase-field
     dataSet->setPhaseField(divU);
+	dataSet->setPressureField(pressure);
 }
 //////////////////////////////////////////////////////////////////////////
 SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
@@ -153,6 +154,8 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::calculate(int step)
     nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions();
     zeroDistributionsH2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions();
 
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
+
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
     const int bcArrayMaxX1 = (int)bcArray->getNX1();
@@ -176,9 +179,9 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::calculate(int step)
             new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
 
 //#pragma omp parallel for
-	  for (int x3 = minX3-1; x3 <= maxX3; x3++) {
-            for (int x2 = minX2-1; x2 <= maxX2; x2++) {
-                for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+	  for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
+            for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
+                for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
                     if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
                         int x1p = x1 + 1;
                         int x2p = x2 + 1;
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
index 2b899d0ea..d3be0fa92 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
@@ -57,8 +57,8 @@ public:
    void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
 
    ///refactor
-   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
-   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+   //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+   
 
    double getCalculationTime() override { return .0; }
 protected:
@@ -80,6 +80,7 @@ protected:
 
    //CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   phaseField;
 
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
 
    LBMReal h  [D3Q27System::ENDF+1];
    LBMReal h2[D3Q27System::ENDF + 1];
-- 
GitLab


From e0e794de3621d01babcc9481403d6886f492320d Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 2 Aug 2021 19:07:59 +0200
Subject: [PATCH 014/179] add remote connector for for two phase fields
 velocity kernel

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   2 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |  12 +-
 ...ThreeDistributionsFullVectorConnector2.cpp | 544 +++++++++++++++++-
 .../ThreeDistributionsFullVectorConnector2.h  |   9 +
 .../Interactors/InteractorsHelper.cpp         |   2 +-
 .../Visitors/SetConnectorsBlockVisitor.h      |   3 +-
 6 files changed, 555 insertions(+), 17 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 8ab087bde..243e04299 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,7 +1,7 @@
 #pathname = d:/temp/MultiphaseDropletTest
 pathname = E:/Multiphase/DropletTestSigma2
 
-numOfThreads = 4
+numOfThreads = 1
 availMem = 10e9
 
 #Grid
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 9764094fc..01660db88 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -151,16 +151,16 @@ void run(string configname)
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
 
-            //SPtr<Grid3DVisitor> metisVisitor(
-            //    new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-            //InteractorsHelper intHelper(grid, metisVisitor);
-            //intHelper.selectBlocks();
+            SPtr<Grid3DVisitor> metisVisitor(
+                new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+            InteractorsHelper intHelper(grid, metisVisitor, true);
+            intHelper.selectBlocks();
 
             ppblocks->process(0);
             ppblocks.reset();
 
             unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-            int ghostLayer                    = 3;
+            int ghostLayer                    = 5;
             unsigned long long numberOfNodesPerBlock =
                 (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
             unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
@@ -196,7 +196,7 @@ void run(string configname)
             }
 
 
-            //intHelper.setBC();
+            intHelper.setBC();
 
             //grid->accept(bcVisitor);
 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
index a9e3c7e74..c8528b1e7 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
@@ -55,32 +55,33 @@ void ThreeDistributionsFullVectorConnector2::init()
    fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions());
    hDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getHdistributions());
    h2Dis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getH2distributions());
+   pressure   = block.lock()->getKernel()->getDataSet()->getPressureField();
 
-   int anz = 3*27;
+   int anz = 3*27+1;
    switch (sendDir)
    {
    case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
    case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
+   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
    case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
+   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
    case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
+   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
 
    case D3Q27System::NE:
    case D3Q27System::SW:
    case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
+   case D3Q27System::NW:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
 
    case D3Q27System::TE:
    case D3Q27System::BW:
    case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
+   case D3Q27System::TW:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
 
    case D3Q27System::TN:
    case D3Q27System::BS:
    case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
+   case D3Q27System::TS:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
 
    case D3Q27System::TNE:
    case D3Q27System::BSW:
@@ -89,11 +90,538 @@ void ThreeDistributionsFullVectorConnector2::init()
    case D3Q27System::TSE:
    case D3Q27System::BNW:
    case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
+   case D3Q27System::TNW:  sender->getData().resize(anz*8, 0.0);   break;
 
    default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
    }
 }
+//////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullVectorConnector2::fillSendVectors() 
+{ 
+    updatePointers();
+    fillData();
+}
+////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullVectorConnector2::fillData()
+{
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    int minX1p3 = minX1 + 3;
+    int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    int minX2p3 = minX2 + 3;
+    int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    int minX3p3 = minX3 + 3;
+    int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    int maxX3m3 = maxX3 - 3;
 
+    vector_type &sdata = sender->getData();
+
+    int index = 0;
+    // EAST
+    if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                fillData(sdata, index, maxX1m3, x2, x3);
+                fillData(sdata, index, maxX1m2, x2, x3);
+            }
+        }
+    }
+    // WEST
+    else if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                fillData(sdata, index, minX1p3, x2, x3);
+                fillData(sdata, index, minX1p2, x2, x3);
+            }
+        }
+    }
+    // NORTH
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, maxX2m3, x3);
+                fillData(sdata, index, x1, maxX2m2, x3);
+            }
+        }
+    }
+    // SOUTH
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, minX2p3, x3);
+                fillData(sdata, index, x1, minX2p2, x3);
+            }
+        }
+    }
+
+    // TOP
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, x2, maxX3m3);
+                fillData(sdata, index, x1, x2, maxX3m2);
+            }
+        }
+    }
+    // BOTTOM
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, x2, minX3p3);
+                fillData(sdata, index, x1, x2, minX3p2);
+            }
+        }
+    }
+    // NORTHEAST
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, maxX1m3, maxX2m3, x3);
+            fillData(sdata, index, maxX1m2, maxX2m2, x3);
+            fillData(sdata, index, maxX1m3, maxX2m2, x3);
+            fillData(sdata, index, maxX1m2, maxX2m3, x3);
+        }
+    }
+    // NORTHWEST
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, minX1p3, maxX2m3, x3);
+            fillData(sdata, index, minX1p2, maxX2m2, x3);
+            fillData(sdata, index, minX1p3, maxX2m2, x3);
+            fillData(sdata, index, minX1p2, maxX2m3, x3);
+        }
+    }
+    // SOUTHWEST
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, minX1p3, minX2p3, x3);
+            fillData(sdata, index, minX1p2, minX2p2, x3);
+            fillData(sdata, index, minX1p3, minX2p2, x3);
+            fillData(sdata, index, minX1p2, minX2p3, x3);
+        }
+    }
+    // SOUTHEAST
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, maxX1m3, minX2p3, x3);
+            fillData(sdata, index, maxX1m2, minX2p2, x3);
+            fillData(sdata, index, maxX1m3, minX2p2, x3);
+            fillData(sdata, index, maxX1m2, minX2p3, x3);
+        }
+    } else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, maxX1m3, x2, maxX3m3);
+            fillData(sdata, index, maxX1m2, x2, maxX3m2);
+            fillData(sdata, index, maxX1m3, x2, maxX3m2);
+            fillData(sdata, index, maxX1m2, x2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, minX1p3, x2, minX3p3);
+            fillData(sdata, index, minX1p2, x2, minX3p2);
+            fillData(sdata, index, minX1p3, x2, minX3p2);
+            fillData(sdata, index, minX1p2, x2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, maxX1m3, x2, minX3p3);
+            fillData(sdata, index, maxX1m2, x2, minX3p2);
+            fillData(sdata, index, maxX1m3, x2, minX3p2);
+            fillData(sdata, index, maxX1m2, x2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, minX1p3, x2, maxX3m3);
+            fillData(sdata, index, minX1p2, x2, maxX3m2);
+            fillData(sdata, index, minX1p3, x2, maxX3m2);
+            fillData(sdata, index, minX1p2, x2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, maxX2m3, maxX3m3);
+            fillData(sdata, index, x1, maxX2m2, maxX3m2);
+            fillData(sdata, index, x1, maxX2m3, maxX3m2);
+            fillData(sdata, index, x1, maxX2m2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, minX2p3, minX3p3);
+            fillData(sdata, index, x1, minX2p2, minX3p2);
+            fillData(sdata, index, x1, minX2p3, minX3p2);
+            fillData(sdata, index, x1, minX2p2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, maxX2m3, minX3p3);
+            fillData(sdata, index, x1, maxX2m2, minX3p2);
+            fillData(sdata, index, x1, maxX2m3, minX3p2);
+            fillData(sdata, index, x1, maxX2m2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, minX2p3, maxX3m3);
+            fillData(sdata, index, x1, minX2p2, maxX3m2);
+            fillData(sdata, index, x1, minX2p3, maxX3m2);
+            fillData(sdata, index, x1, minX2p2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::TSW) {
+        fillData(sdata, index, minX1p3, minX2p3, maxX3m3);
+        fillData(sdata, index, minX1p2, minX2p2, maxX3m2);
+        fillData(sdata, index, minX1p3, minX2p2, maxX3m2);
+        fillData(sdata, index, minX1p2, minX2p3, maxX3m2);
+        fillData(sdata, index, minX1p2, minX2p2, maxX3m3);
+        fillData(sdata, index, minX1p3, minX2p3, maxX3m2);
+        fillData(sdata, index, minX1p3, minX2p2, maxX3m3);
+        fillData(sdata, index, minX1p2, minX2p3, maxX3m3);
+    } else if (sendDir == D3Q27System::TSE) {
+        fillData(sdata, index, maxX1m3, minX1p3, maxX3m3);
+        fillData(sdata, index, maxX1m2, minX1p2, maxX3m2);
+        fillData(sdata, index, maxX1m3, minX1p2, maxX3m2);
+        fillData(sdata, index, maxX1m2, minX1p3, maxX3m2);
+        fillData(sdata, index, maxX1m2, minX1p2, maxX3m3);
+        fillData(sdata, index, maxX1m3, minX1p3, maxX3m2);
+        fillData(sdata, index, maxX1m3, minX1p2, maxX3m3);
+        fillData(sdata, index, maxX1m2, minX1p3, maxX3m3);
+    } else if (sendDir == D3Q27System::TNW) {
+        fillData(sdata, index, minX1p3, maxX2m3, maxX3m3);
+        fillData(sdata, index, minX1p2, maxX2m2, maxX3m2);
+        fillData(sdata, index, minX1p3, maxX2m2, maxX3m2);
+        fillData(sdata, index, minX1p2, maxX2m3, maxX3m2);
+        fillData(sdata, index, minX1p2, maxX2m2, maxX3m3);
+        fillData(sdata, index, minX1p3, maxX2m3, maxX3m2);
+        fillData(sdata, index, minX1p3, maxX2m2, maxX3m3);
+        fillData(sdata, index, minX1p2, maxX2m3, maxX3m3);
+    } else if (sendDir == D3Q27System::TNE) {
+        fillData(sdata, index, maxX1m3, maxX2m3, maxX3m3);
+        fillData(sdata, index, maxX1m2, maxX2m2, maxX3m2);
+        fillData(sdata, index, maxX1m3, maxX2m2, maxX3m2);
+        fillData(sdata, index, maxX1m2, maxX2m3, maxX3m2);
+        fillData(sdata, index, maxX1m2, maxX2m2, maxX3m3);
+        fillData(sdata, index, maxX1m3, maxX2m3, maxX3m2);
+        fillData(sdata, index, maxX1m3, maxX2m2, maxX3m3);
+        fillData(sdata, index, maxX1m2, maxX2m3, maxX3m3);
+    } else if (sendDir == D3Q27System::BSW) {
+        fillData(sdata, index, minX1p3, minX2p3, minX3p3);
+        fillData(sdata, index, minX1p2, minX2p2, minX3p2);
+        fillData(sdata, index, minX1p3, minX2p2, minX3p2);
+        fillData(sdata, index, minX1p2, minX2p3, minX3p2);
+        fillData(sdata, index, minX1p2, minX2p2, minX3p3);
+        fillData(sdata, index, minX1p3, minX2p3, minX3p2);
+        fillData(sdata, index, minX1p3, minX2p2, minX3p3);
+        fillData(sdata, index, minX1p2, minX2p3, minX3p3);
+    } else if (sendDir == D3Q27System::BSE) {
+        fillData(sdata, index, maxX1m3, minX2p3, minX3p3);
+        fillData(sdata, index, maxX1m2, minX2p2, minX3p2);
+        fillData(sdata, index, maxX1m3, minX2p2, minX3p2);
+        fillData(sdata, index, maxX1m2, minX2p3, minX3p2);
+        fillData(sdata, index, maxX1m2, minX2p2, minX3p3);
+        fillData(sdata, index, maxX1m3, minX2p3, minX3p2);
+        fillData(sdata, index, maxX1m3, minX2p2, minX3p3);
+        fillData(sdata, index, maxX1m2, minX2p3, minX3p3);
+    } else if (sendDir == D3Q27System::BNW) {
+        fillData(sdata, index, minX1p3, maxX2m3, minX3p3);
+        fillData(sdata, index, minX1p2, maxX2m2, minX3p2);
+        fillData(sdata, index, minX1p3, maxX2m2, minX3p2);
+        fillData(sdata, index, minX1p2, maxX2m3, minX3p2);
+        fillData(sdata, index, minX1p2, maxX2m2, minX3p3);
+        fillData(sdata, index, minX1p3, maxX2m3, minX3p2);
+        fillData(sdata, index, minX1p3, maxX2m2, minX3p3);
+        fillData(sdata, index, minX1p2, maxX2m3, minX3p3);
+    } else if (sendDir == D3Q27System::BNE) {
+        fillData(sdata, index, maxX1m3, maxX2m3, minX3p3);
+        fillData(sdata, index, maxX1m2, maxX2m2, minX3p2);
+        fillData(sdata, index, maxX1m3, maxX2m2, minX3p2);
+        fillData(sdata, index, maxX1m2, maxX2m3, minX3p2);
+        fillData(sdata, index, maxX1m2, maxX2m2, minX3p3);
+        fillData(sdata, index, maxX1m3, maxX2m3, minX3p2);
+        fillData(sdata, index, maxX1m3, maxX2m2, minX3p3);
+        fillData(sdata, index, maxX1m2, maxX2m3, minX3p3);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+}
+////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullVectorConnector2::distributeReceiveVectors() 
+{
+    updatePointers();
+    distributeData();
+}
+////////////////////////////////////////////////////////////////////////
+void ThreeDistributionsFullVectorConnector2::distributeData()
+{
+    vector_type &rdata = receiver->getData();
+
+    int index = 0;
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    int minX1p3 = minX1 + 3;
+    int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    int minX2p3 = minX2 + 3;
+    int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    int minX3p3 = minX3 + 3;
+    int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    int maxX3m3 = maxX3 - 3;
+
+    // EAST
+    if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                distributeData(rdata, index, minX1, x2, x3);
+                distributeData(rdata, index, minX1p1, x2, x3);
+            }
+        }
+    }
+    // WEST
+    else if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                distributeData(rdata, index, maxX1, x2, x3);
+                distributeData(rdata, index, maxX1m1, x2, x3);
+            }
+        }
+    }
+    // NORTH
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, minX2, x3);
+                distributeData(rdata, index, x1, minX2p1, x3);
+            }
+        }
+    }
+    // SOUTH
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, maxX2, x3);
+                distributeData(rdata, index, x1, maxX2m1, x3);
+            }
+        }
+    }
+
+    // TOP
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, x2, minX3);
+                distributeData(rdata, index, x1, x2, minX3p1);
+            }
+        }
+    }
+    // BOTTOM
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, x2, maxX3);
+                distributeData(rdata, index, x1, x2, maxX3m1);
+            }
+        }
+    }
+    // NORTHEAST
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, minX1, minX2, x3);
+            distributeData(rdata, index, minX1p1, minX2p1, x3);
+            distributeData(rdata, index, minX1, minX2p1, x3);
+            distributeData(rdata, index, minX1p1, minX2, x3);
+        }
+    }
+    // NORTHWEST
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, maxX1, minX2, x3);
+            distributeData(rdata, index, maxX1m1, minX2p1, x3);
+            distributeData(rdata, index, maxX1, minX2p1, x3);
+            distributeData(rdata, index, maxX1m1, minX2, x3);
+        }
+    }
+    // SOUTHWEST
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, maxX1, maxX2, x3);
+            distributeData(rdata, index, maxX1m1, maxX2m1, x3);
+            distributeData(rdata, index, maxX1, maxX2m1, x3);
+            distributeData(rdata, index, maxX1m1, maxX2, x3);
+        }
+    }
+    // SOUTHEAST
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, minX1, maxX2, x3);
+            distributeData(rdata, index, minX1p1, maxX2m1, x3);
+            distributeData(rdata, index, minX1, maxX2m1, x3);
+            distributeData(rdata, index, minX1p1, maxX2, x3);
+        }
+    } else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, minX1, x2, minX3);
+            distributeData(rdata, index, minX1p1, x2, minX3p1);
+            distributeData(rdata, index, minX1, x2, minX3p1);
+            distributeData(rdata, index, minX1p1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, maxX1, x2, maxX3);
+            distributeData(rdata, index, maxX1m1, x2, maxX3m1);
+            distributeData(rdata, index, maxX1, x2, maxX3m1);
+            distributeData(rdata, index, maxX1m1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, minX1, x2, maxX3);
+            distributeData(rdata, index, minX1p1, x2, maxX3m1);
+            distributeData(rdata, index, minX1, x2, maxX3m1);
+            distributeData(rdata, index, minX1p1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, maxX1, x2, minX3);
+            distributeData(rdata, index, maxX1m1, x2, minX3p1);
+            distributeData(rdata, index, maxX1, x2, minX3p1);
+            distributeData(rdata, index, maxX1m1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, minX2, minX3);
+            distributeData(rdata, index, x1, minX2p1, minX3p1);
+            distributeData(rdata, index, x1, minX2, minX3p1);
+            distributeData(rdata, index, x1, minX2p1, minX3);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, maxX2, maxX3);
+            distributeData(rdata, index, x1, maxX2m1, maxX3m1);
+            distributeData(rdata, index, x1, maxX2, maxX3m1);
+            distributeData(rdata, index, x1, maxX2m1, maxX3);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, minX2, maxX3);
+            distributeData(rdata, index, x1, minX2p1, maxX3m1);
+            distributeData(rdata, index, x1, minX2, maxX3m1);
+            distributeData(rdata, index, x1, minX2p1, maxX3);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, maxX2, minX3);
+            distributeData(rdata, index, x1, maxX2m1, minX3p1);
+            distributeData(rdata, index, x1, maxX2, minX3p1);
+            distributeData(rdata, index, x1, maxX2m1, minX3);
+        }
+    else if (sendDir == D3Q27System::BNE) {
+        distributeData(rdata, index, maxX1, maxX2, minX3);
+        distributeData(rdata, index, maxX1m1, maxX2m1, minX3p1);
+        distributeData(rdata, index, maxX1, maxX2m1, minX3p1);
+        distributeData(rdata, index, maxX1m1, maxX2, minX3p1);
+        distributeData(rdata, index, maxX1m1, maxX2m1, minX3);
+        distributeData(rdata, index, maxX1, maxX2, minX3p1);
+        distributeData(rdata, index, maxX1, maxX2m1, minX3);
+        distributeData(rdata, index, maxX1m1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::BNW) {
+        distributeData(rdata, index, minX1, maxX2, minX3);
+        distributeData(rdata, index, minX1p1, maxX2m1, minX3p1);
+        distributeData(rdata, index, minX1, maxX2m1, minX3p1);
+        distributeData(rdata, index, minX1p1, maxX2, minX3p1);
+        distributeData(rdata, index, minX1p1, maxX2m1, minX3);
+        distributeData(rdata, index, minX1, maxX2, minX3p1);
+        distributeData(rdata, index, minX1, maxX2m1, minX3);
+        distributeData(rdata, index, minX1p1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::BSE) {
+        distributeData(rdata, index, maxX1, minX2, minX3);
+        distributeData(rdata, index, maxX1m1, minX2p1, minX3p1);
+        distributeData(rdata, index, maxX1, minX2p1, minX3p1);
+        distributeData(rdata, index, maxX1m1, minX2, minX3p1);
+        distributeData(rdata, index, maxX1m1, minX2p1, minX3);
+        distributeData(rdata, index, maxX1, minX2, minX3p1);
+        distributeData(rdata, index, maxX1, minX2p1, minX3);
+        distributeData(rdata, index, maxX1m1, minX2, minX3);
+    } else if (sendDir == D3Q27System::BSW) {
+        distributeData(rdata, index, minX1, minX2, minX3);
+        distributeData(rdata, index, minX1p1, minX2p1, minX3p1);
+        distributeData(rdata, index, minX1, minX2p1, minX3p1);
+        distributeData(rdata, index, minX1p1, minX2, minX3p1);
+        distributeData(rdata, index, minX1p1, minX2p1, minX3);
+        distributeData(rdata, index, minX1, minX2, minX3p1);
+        distributeData(rdata, index, minX1, minX2p1, minX3);
+        distributeData(rdata, index, minX1p1, minX2, minX3);
+    } else if (sendDir == D3Q27System::TNE) {
+        distributeData(rdata, index, maxX1, maxX2, maxX3);
+        distributeData(rdata, index, maxX1m1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, maxX1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, maxX1m1, maxX2, maxX3m1);
+        distributeData(rdata, index, maxX1m1, maxX2m1, maxX3);
+        distributeData(rdata, index, maxX1, maxX2, maxX3m1);
+        distributeData(rdata, index, maxX1, maxX2m1, maxX3);
+        distributeData(rdata, index, maxX1m1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::TNW) {
+        distributeData(rdata, index, minX1, maxX2, maxX3);
+        distributeData(rdata, index, minX1p1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, minX1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, minX1p1, maxX2, maxX3m1);
+        distributeData(rdata, index, minX1p1, maxX2m1, maxX3);
+        distributeData(rdata, index, minX1, maxX2, maxX3m1);
+        distributeData(rdata, index, minX1, maxX2m1, maxX3);
+        distributeData(rdata, index, minX1p1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::TSE) {
+        distributeData(rdata, index, maxX1, minX2, maxX3);
+        distributeData(rdata, index, maxX1m1, minX2p1, maxX3m1);
+        distributeData(rdata, index, maxX1, minX2p1, maxX3m1);
+        distributeData(rdata, index, maxX1m1, minX2, maxX3m1);
+        distributeData(rdata, index, maxX1m1, minX2p1, maxX3);
+        distributeData(rdata, index, maxX1, minX2, maxX3m1);
+        distributeData(rdata, index, maxX1, minX2p1, maxX3);
+        distributeData(rdata, index, maxX1m1, minX2, maxX3);
+    } else if (sendDir == D3Q27System::TSW) {
+        distributeData(rdata, index, minX1, minX2, maxX3);
+        distributeData(rdata, index, minX1p1, minX2p1, maxX3m1);
+        distributeData(rdata, index, minX1, minX2p1, maxX3m1);
+        distributeData(rdata, index, minX1p1, minX2, maxX3m1);
+        distributeData(rdata, index, minX1p1, minX2p1, maxX3);
+        distributeData(rdata, index, minX1, minX2, maxX3m1);
+        distributeData(rdata, index, minX1, minX2p1, maxX3);
+        distributeData(rdata, index, minX1p1, minX2, maxX3);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+
+}
+//////////////////////////////////////////////////////////////////////////
 
 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
index 87448a414..eb3c1e084 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
@@ -41,6 +41,7 @@
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "basics/container/CbArray3D.h"
 #include "basics/container/CbArray4D.h"
+#include "DataSet3D.h"
 
 class EsoTwist3D;
 class Block3D;
@@ -61,6 +62,8 @@ public:
 
 protected:
    inline void updatePointers() override;
+   void fillData() override;
+   void distributeData() override;
    inline void fillData(vector_type &sdata, int &index, int x1, int x2, int x3) override;
    inline void distributeData(vector_type &rdata, int &index, int x1, int x2, int x3) override;
 
@@ -83,6 +86,8 @@ private:
 
    SPtr<EsoTwist3D> h2Dis;
 
+   SPtr<PressureFieldArray3D> pressure;
+
 };
 //////////////////////////////////////////////////////////////////////////
 inline void ThreeDistributionsFullVectorConnector2::updatePointers()
@@ -192,6 +197,8 @@ inline void ThreeDistributionsFullVectorConnector2::fillData(vector_type& sdata,
    sdata[index++] = (*this->nonLocalH2distributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
 
    sdata[index++] = (*this->zeroH2distributions)(x1, x2, x3);
+
+   sdata[index++] = (*this->pressure)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 inline void ThreeDistributionsFullVectorConnector2::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
@@ -286,6 +293,8 @@ inline void ThreeDistributionsFullVectorConnector2::distributeData(vector_type&
    (*this->nonLocalH2distributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = rdata[index++];
 
    (*this->zeroH2distributions)(x1, x2, x3) = rdata[index++];
+
+   (*this->pressure)(x1, x2, x3) = rdata[index++];
 }
 
 
diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
index d8ee65934..6739e5599 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
@@ -80,7 +80,7 @@ void InteractorsHelper::deleteSolidBlocks()
         }
     }
 
-    if (deleteBlocks)
+    if (interactors.size() > 0 && deleteBlocks)
         updateGrid();
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 37a414515..57d61fced 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -49,6 +49,7 @@
 #include "ThreeDistributionsFullDirectConnector.h"
 #include "ThreeDistributionsFullDirectConnector2.h"
 #include "ThreeDistributionsFullVectorConnector.h"
+#include "ThreeDistributionsFullVectorConnector2.h"
 #include <basics/transmitter/TbTransmitterLocal.h>
 
 //! \brief  A class sets connectors between blocks.
@@ -159,6 +160,6 @@ void SetConnectorsBlockVisitor<T1, T2>::setRemoteConnectors(SPtr<Block3D> sblock
 using OneDistributionSetConnectorsBlockVisitor  = SetConnectorsBlockVisitor<OneDistributionFullDirectConnector, OneDistributionFullVectorConnector>;
 using TwoDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsFullDirectConnector, TwoDistributionsFullVectorConnector>;
 using ThreeDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector, ThreeDistributionsFullVectorConnector>;
-using ThreeDistributionsSetConnectorsBlockVisitor2 = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector2, ThreeDistributionsFullVectorConnector>;
+using ThreeDistributionsSetConnectorsBlockVisitor2 = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector2, ThreeDistributionsFullVectorConnector2>;
 
 #endif // SETCONNECTORSBLOCKVISITOR_H
-- 
GitLab


From 02c99514d93daffbb8c2f1e799d6987596584005 Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Tue, 3 Aug 2021 12:38:37 +0200
Subject: [PATCH 015/179] Create Metis class object outside of
 MPIIOMigrationCoProcessor and pass it as a parameter to them

---
 apps/cpu/LaminarTubeFlow/ltf.cpp                           | 7 ++++---
 .../CoProcessors/MPIIOMigrationBECoProcessor.cpp           | 6 +++---
 .../CoProcessors/MPIIOMigrationBECoProcessor.h             | 6 +++---
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp             | 5 +++--
 .../CoProcessors/MPIIOMigrationCoProcessor.h               | 4 +++-
 5 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index e65631afd..ca1b2b53a 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -105,10 +105,11 @@ void run(string configname)
       kernel->setBCProcessor(bcProc);
 
       //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      //SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname + "/mig", comm));
-      SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, pathname + "/mig", comm));
+      //SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, pathname + "/mig", comm));
+      SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, metisVisitor, pathname + "/mig", comm));
       migCoProcessor->setLBMKernel(kernel);
       migCoProcessor->setBCProcessor(bcProc);
       migCoProcessor->setNu(nuLB);
@@ -216,7 +217,7 @@ void run(string configname)
          //outflow
          SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
 
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
          InteractorsHelper intHelper(grid, metisVisitor);
          intHelper.addInteractor(cylinderInt);
          intHelper.addInteractor(inflowInt);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index ef2c9d07a..5f4dde11d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -25,10 +25,11 @@ using namespace MPIIODataStructures;
 #define MESSAGE_TAG 80
 #define SEND_BLOCK_SIZE 100000
 
-MPIIOMigrationBECoProcessor::MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<Communicator> comm)
+MPIIOMigrationBECoProcessor::MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm)
     : MPIIOCoProcessor(grid, s, path, comm), nue(-999.999), nuL(-999.999), nuG(-999.999), densityRatio(-999.999)
 {
     memset(&boundCondParamStr, 0, sizeof(boundCondParamStr));
+    metisVisitor = mV;
 
     //-------------------------   define MPI types  ---------------------------------
 
@@ -831,8 +832,7 @@ void MPIIOMigrationBECoProcessor::restart(int step)
         UBLOG(logINFO, "Load check point - start");
 
     readBlocks(step);
-    SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-    grid->accept(newMetisVisitor);
+    grid->accept(metisVisitor);
 
     readDataSet(step);
     readBoundaryConds(step);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
index 9a89ada1a..ee8766eeb 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
@@ -13,6 +13,7 @@ class UbScheduler;
 class Communicator;
 class BCProcessor;
 class LBMKernel;
+class Grid3DVisitor;
 
 //! \class MPIWriteBlocksBECoProcessor
 //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating
@@ -30,8 +31,7 @@ class MPIIOMigrationBECoProcessor : public MPIIOCoProcessor
     };
 
 public:
-    MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
-                                SPtr<Communicator> comm);
+    MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm);
     ~MPIIOMigrationBECoProcessor() override;
     //! Each timestep writes the grid into the files
     void process(double step) override;
@@ -93,11 +93,11 @@ private:
     MPIIODataStructures::boundCondParam boundCondParamStr;
     SPtr<LBMKernel> lbmKernel;
     SPtr<BCProcessor> bcProcessor;
+    SPtr<Grid3DVisitor> metisVisitor;
     double nue;
     double nuL;
     double nuG;
     double densityRatio;
-
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index c7f0b8cd1..a107977d3 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -22,10 +22,11 @@
 
 using namespace MPIIODataStructures;
 
-MPIIOMigrationCoProcessor::MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<Communicator> comm)
+MPIIOMigrationCoProcessor::MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm)
     : MPIIOCoProcessor(grid, s, path, comm)
 {
     memset(&boundCondParamStr, 0, sizeof(boundCondParamStr));
+    metisVisitor = mV;
 
     //-------------------------   define MPI types  ---------------------------------
 
@@ -145,6 +146,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
     bool multiPhase1 = false;
     bool multiPhase2 = false;
     DSArraysPresence arrPresence;
+    memset(&arrPresence, 0, sizeof(arrPresence));
     bool firstBlock           = true;
     size_t doubleCountInBlock = 0;
     int ic                    = 0;
@@ -1614,7 +1616,6 @@ void MPIIOMigrationCoProcessor::restart(int step)
 
     readBlocks(step);
 
-    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
     grid->accept(metisVisitor);
 
     readDataSet(step);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
index ca0de8f3e..f2fa6cc94 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
@@ -12,6 +12,7 @@ class UbScheduler;
 class Communicator;
 class BCProcessor;
 class LBMKernel;
+class Grid3DVisitor;
 
 //! \class MPIWriteBlocksCoProcessor
 //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating
@@ -29,7 +30,7 @@ public:
         PhaseField2 = 8
     };
 
-    MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<Communicator> comm);
+    MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm);
     ~MPIIOMigrationCoProcessor() override;
     //! Each timestep writes the grid into the files
     void process(double step) override;
@@ -84,6 +85,7 @@ private:
     SPtr<LBMKernel> lbmKernel;
     SPtr<BCProcessor> bcProcessor;
     // double nue;
+    SPtr<Grid3DVisitor> metisVisitor;
 };
 
 #endif
-- 
GitLab


From fabad09fd4d0d715485d018bbc774b7fedf42d7b Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 3 Aug 2021 16:26:31 +0200
Subject: [PATCH 016/179] renaming and refactoring for double ghost layer

---
 apps/cpu/Multiphase/Multiphase.cpp            | 20 ++++----
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |  5 +-
 src/cpu/VirtualFluids.h                       |  4 +-
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  | 34 +++++++++-----
 ...nsDoubleGhostLayerFullDirectConnector.cpp} | 12 ++---
 ...ionsDoubleGhostLayerFullDirectConnector.h} | 14 +++---
 ...nsDoubleGhostLayerFullVectorConnector.cpp} | 27 ++++-------
 ...ionsDoubleGhostLayerFullVectorConnector.h} | 16 +++----
 src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp     | 12 ++++-
 src/cpu/VirtualFluidsCore/Grid/Grid3D.h       |  9 ++--
 ...TwoPhaseFieldsPressureFilterLBMKernel.cpp} | 46 +++++++++----------
 ...seTwoPhaseFieldsPressureFilterLBMKernel.h} | 12 ++---
 .../Visitors/SetConnectorsBlockVisitor.h      |  6 +--
 13 files changed, 116 insertions(+), 101 deletions(-)
 rename src/cpu/VirtualFluidsCore/Connectors/{ThreeDistributionsFullDirectConnector2.cpp => ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp} (96%)
 rename src/cpu/VirtualFluidsCore/Connectors/{ThreeDistributionsFullDirectConnector2.h => ThreeDistributionsDoubleGhostLayerFullDirectConnector.h} (96%)
 rename src/cpu/VirtualFluidsCore/Connectors/{ThreeDistributionsFullVectorConnector2.cpp => ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp} (97%)
 rename src/cpu/VirtualFluidsCore/Connectors/{ThreeDistributionsFullVectorConnector2.h => ThreeDistributionsDoubleGhostLayerFullVectorConnector.h} (96%)
 rename src/cpu/VirtualFluidsCore/LBM/{MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp => MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp} (98%)
 rename src/cpu/VirtualFluidsCore/LBM/{MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h => MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h} (93%)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index a0972b8fd..be017881c 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -85,10 +85,11 @@ void run(string configname)
 
         SPtr<LBMKernel> kernel;
 
-        kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
-                kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(0.0);
@@ -109,15 +110,16 @@ void run(string configname)
         // grid->setPeriodicX1(true);
         // grid->setPeriodicX2(true);
         // grid->setPeriodicX3(true);
+        grid->setGhostLayerWidth(2);
         //////////////////////////////////////////////////////////////////////////
         // restart
         SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
         //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-        //SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
-        SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
-        rcp->setNu(nuLB);
-        rcp->setNuLG(nuL, nuG);
-        rcp->setDensityRatio(densityRatio);
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
+        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
+        //rcp->setNu(nuLB);
+        //rcp->setNuLG(nuL, nuG);
+        //rcp->setDensityRatio(densityRatio);
 
         rcp->setLBMKernel(kernel);
         rcp->setBCProcessor(bcProc);
@@ -392,7 +394,9 @@ void run(string configname)
       //  TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
       //  grid->accept(setConnsVisitor);
 
-        ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+       //ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+
+        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 01660db88..a6892cad1 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -80,7 +80,7 @@ void run(string configname)
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2());
+        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(gr);
@@ -103,6 +103,7 @@ void run(string configname)
         grid->setPeriodicX1(true);
         grid->setPeriodicX2(true);
         grid->setPeriodicX3(true);
+        grid->setGhostLayerWidth(2);
 
         //////////////////////////////////////////////////////////////////////////
         // restart
@@ -260,7 +261,7 @@ void run(string configname)
         //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
-        ThreeDistributionsSetConnectorsBlockVisitor2 setConnsVisitor(comm);
+        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 9020eab4f..315de6dd7 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -153,7 +153,7 @@
 #include <Connectors/RemoteBlock3DConnector.h>
 #include <Connectors/TwoDistributionsFullDirectConnector.h>
 #include <Connectors/TwoDistributionsFullVectorConnector.h>
-#include <Connectors/ThreeDistributionsFullDirectConnector2.h>
+
 
 #include <Data/D3Q27EsoTwist3DSplittedVector.h>
 #include <Data/D3Q27EsoTwist3DSplittedVectorEx.h>
@@ -246,7 +246,7 @@
 #include <LBM/MultiphaseScratchCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h>
-#include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h>
+#include <LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h>
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 42cec5c5e..37eb51038 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -36,7 +36,6 @@
 #include "LBMKernel.h"
 #include <string>
 #include <vector>
-#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h"
 
 #include "BCArray3D.h"
 #include "Block3D.h"
@@ -198,9 +197,16 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     int maxX2 = (int)(distributionsF->getNX2());
     int maxX3 = (int)(distributionsF->getNX3());
 
-    int minX1 = 1;
-    int minX2 = 1;
-    int minX3 = 1;
+    int minX1 = 0;
+    int minX2 = 0;
+    int minX3 = 0;
+    
+    if (kernel->getGhostLayerWidth() == 2)
+    {
+        minX1 = 1;
+        minX2 = 1;
+        minX3 = 1;
+    }
 
     // int maxX1 = (int)(distributions->getNX1());
     // int maxX2 = (int)(distributions->getNX2());
@@ -238,15 +244,19 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
         }
     }
 
-    maxX1 -= 3;
-    maxX2 -= 3;
-    maxX3 -= 3;
-
-    // maxX1 -= 1;
-    // maxX2 -= 1;
-    // maxX3 -= 1;
+    if (kernel->getGhostLayerWidth() == 1)
+    {
+        maxX1 -= 2;
+        maxX2 -= 2;
+        maxX3 -= 2;
+    }
+    else if (kernel->getGhostLayerWidth() == 2)
+    {
+        maxX1 -= 3;
+        maxX2 -= 3;
+        maxX3 -= 3;
+    }
 
-    // D3Q27BoundaryConditionPtr bcPtr;
     int nr = (int)nodes.size();
     LBMReal dX1_phi;
     LBMReal dX2_phi;
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
similarity index 96%
rename from src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
rename to src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
index 78cc34f20..d0ff594f7 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
@@ -26,22 +26,22 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file ThreeDistributionsFullDirectConnector2.cpp
+//! \file ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
 //! \ingroup Connectors
 //! \author Konstantin Kutscher
 //=======================================================================================
 
-#include "ThreeDistributionsFullDirectConnector2.h"
+#include "ThreeDistributionsDoubleGhostLayerFullDirectConnector.h"
 #include "LBMKernel.h"
 #include "DataSet3D.h"
 
-ThreeDistributionsFullDirectConnector2::ThreeDistributionsFullDirectConnector2(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+ThreeDistributionsDoubleGhostLayerFullDirectConnector::ThreeDistributionsDoubleGhostLayerFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
     : FullDirectConnector(from, to, sendDir)
 {
 
 }
 //////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullDirectConnector2::init()
+void ThreeDistributionsDoubleGhostLayerFullDirectConnector::init()
 {
     FullDirectConnector::init();
 
@@ -55,13 +55,13 @@ void ThreeDistributionsFullDirectConnector2::init()
     pressureTo   = to.lock()->getKernel()->getDataSet()->getPressureField();
 }
 //////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullDirectConnector2::sendVectors()
+void ThreeDistributionsDoubleGhostLayerFullDirectConnector::sendVectors()
 {
     updatePointers();
     exchangeData();
 }
 //////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullDirectConnector2::exchangeData()
+void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
 {
     ////////////////////////////////////////////////////////////
     // relation between ghost layer and regular nodes
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.h
similarity index 96%
rename from src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
rename to src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.h
index 3375f570d..1f53ca70a 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullDirectConnector2.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.h
@@ -26,13 +26,13 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file ThreeDistributionsFullDirectConnector2.h
+//! \file ThreeDistributionsDoubleGhostLayerFullDirectConnector.h
 //! \ingroup Connectors
 //! \author Konstantin Kutscher
 //=======================================================================================
 
-#ifndef ThreeDistributionsFullDirectConnector2_H
-#define ThreeDistributionsFullDirectConnector2_H
+#ifndef ThreeDistributionsDoubleGhostLayerFullDirectConnector_H
+#define ThreeDistributionsDoubleGhostLayerFullDirectConnector_H
 
 #include "FullDirectConnector.h"
 #include "Block3D.h"
@@ -45,10 +45,10 @@
 //! \brief   Exchange data between blocks. 
 //! \details Connector send and receive full distributions between two blocks in shared memory.
 
-class ThreeDistributionsFullDirectConnector2 : public FullDirectConnector
+class ThreeDistributionsDoubleGhostLayerFullDirectConnector : public FullDirectConnector
 {
 public:
-	ThreeDistributionsFullDirectConnector2(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
+	ThreeDistributionsDoubleGhostLayerFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
     void init() override;
     void sendVectors() override;
 
@@ -88,7 +88,7 @@ private:
     SPtr<PressureFieldArray3D> pressureFrom, pressureTo;
 };
 //////////////////////////////////////////////////////////////////////////
-inline void ThreeDistributionsFullDirectConnector2::updatePointers()
+inline void ThreeDistributionsDoubleGhostLayerFullDirectConnector::updatePointers()
 {
     localDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions();
     nonLocalDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions();
@@ -115,7 +115,7 @@ inline void ThreeDistributionsFullDirectConnector2::updatePointers()
     zeroDistributionsToh2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo2)->getZeroDistributions();
 }
 //////////////////////////////////////////////////////////////////////////
-inline void ThreeDistributionsFullDirectConnector2::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
+inline void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
 {
 	(*this->localDistributionsTof)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_E, x1From, x2From, x3From);
 	(*this->localDistributionsTof)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_N, x1From, x2From, x3From);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
similarity index 97%
rename from src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
rename to src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
index c8528b1e7..39b98661a 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -26,19 +26,19 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file ThreeDistributionsFullVectorConnector2.cpp
+//! \file ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
 //! \ingroup Connectors
 //! \author Konstantin Kutscher
 //=======================================================================================
 
-#include "ThreeDistributionsFullVectorConnector2.h"
+#include "ThreeDistributionsDoubleGhostLayerFullVectorConnector.h"
 #include "Block3D.h"
 #include "LBMKernel.h"
 #include "EsoTwist3D.h"
 #include "DataSet3D.h"
 
 //////////////////////////////////////////////////////////////////////////
-ThreeDistributionsFullVectorConnector2::ThreeDistributionsFullVectorConnector2(SPtr<Block3D> block,
+ThreeDistributionsDoubleGhostLayerFullVectorConnector::ThreeDistributionsDoubleGhostLayerFullVectorConnector(SPtr<Block3D> block,
                                                                          VectorTransmitterPtr sender,
                                                                          VectorTransmitterPtr receiver, int sendDir)
     : FullVectorConnector(block, sender, receiver, sendDir)
@@ -48,7 +48,7 @@ ThreeDistributionsFullVectorConnector2::ThreeDistributionsFullVectorConnector2(S
 
 }
 //////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullVectorConnector2::init()
+void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init()
 {
    FullVectorConnector::init();
 
@@ -96,13 +96,13 @@ void ThreeDistributionsFullVectorConnector2::init()
    }
 }
 //////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullVectorConnector2::fillSendVectors() 
+void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillSendVectors() 
 { 
     updatePointers();
     fillData();
 }
 ////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullVectorConnector2::fillData()
+void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
 {
     ////////////////////////////////////////////////////////////
     // relation between ghost layer and regular nodes
@@ -359,13 +359,13 @@ void ThreeDistributionsFullVectorConnector2::fillData()
         UB_THROW(UbException(UB_EXARGS, "unknown dir"));
 }
 ////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullVectorConnector2::distributeReceiveVectors() 
+void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeReceiveVectors() 
 {
     updatePointers();
     distributeData();
 }
 ////////////////////////////////////////////////////////////////////////
-void ThreeDistributionsFullVectorConnector2::distributeData()
+void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
 {
     vector_type &rdata = receiver->getData();
 
@@ -400,7 +400,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
     int maxX3m2 = maxX3 - 2;
     int maxX3m3 = maxX3 - 3;
 
-    // EAST
     if (sendDir == D3Q27System::W) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
@@ -409,7 +408,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-    // WEST
     else if (sendDir == D3Q27System::E) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
@@ -418,7 +416,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-    // NORTH
     else if (sendDir == D3Q27System::S) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
@@ -427,7 +424,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-    // SOUTH
     else if (sendDir == D3Q27System::N) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
@@ -436,8 +432,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-
-    // TOP
     else if (sendDir == D3Q27System::B) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
@@ -446,7 +440,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-    // BOTTOM
     else if (sendDir == D3Q27System::T) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
@@ -455,7 +448,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             }
         }
     }
-    // NORTHEAST
     else if (sendDir == D3Q27System::SW) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, minX2, x3);
@@ -464,7 +456,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             distributeData(rdata, index, minX1p1, minX2, x3);
         }
     }
-    // NORTHWEST
     else if (sendDir == D3Q27System::SE) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, minX2, x3);
@@ -473,7 +464,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             distributeData(rdata, index, maxX1m1, minX2, x3);
         }
     }
-    // SOUTHWEST
     else if (sendDir == D3Q27System::NE) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, maxX2, x3);
@@ -482,7 +472,6 @@ void ThreeDistributionsFullVectorConnector2::distributeData()
             distributeData(rdata, index, maxX1m1, maxX2, x3);
         }
     }
-    // SOUTHEAST
     else if (sendDir == D3Q27System::NW) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, maxX2, x3);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h
similarity index 96%
rename from src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
rename to src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h
index eb3c1e084..408a8e79d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector2.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h
@@ -26,13 +26,13 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file ThreeDistributionsFullVectorConnector2.h
+//! \file ThreeDistributionsDoubleGhostLayerFullVectorConnector.h
 //! \ingroup Connectors
 //! \author Konstantin Kutscher
 //=======================================================================================
 
-#ifndef ThreeDistributionsFullVectorConnector2_H
-#define ThreeDistributionsFullVectorConnector2_H
+#ifndef ThreeDistributionsDoubleGhostLayerFullVectorConnector_H
+#define ThreeDistributionsDoubleGhostLayerFullVectorConnector_H
 
 #include <vector>
 
@@ -50,10 +50,10 @@ class Block3D;
 //der vector wird via transmitter uebertragen
 //transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
 //transmitter sein, der von Transmitter abgeleitet ist ;-)
-class ThreeDistributionsFullVectorConnector2 : public FullVectorConnector
+class ThreeDistributionsDoubleGhostLayerFullVectorConnector : public FullVectorConnector
 {
 public:
-   ThreeDistributionsFullVectorConnector2(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir);
+   ThreeDistributionsDoubleGhostLayerFullVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir);
 
    void init() override;
 
@@ -90,7 +90,7 @@ private:
 
 };
 //////////////////////////////////////////////////////////////////////////
-inline void ThreeDistributionsFullVectorConnector2::updatePointers()
+inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::updatePointers()
 {
     localDistributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
     nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
@@ -105,7 +105,7 @@ inline void ThreeDistributionsFullVectorConnector2::updatePointers()
     zeroH2distributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->h2Dis)->getZeroDistributions();
 }
 //////////////////////////////////////////////////////////////////////////
-inline void ThreeDistributionsFullVectorConnector2::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
+inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
 {
    sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
    sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
@@ -201,7 +201,7 @@ inline void ThreeDistributionsFullVectorConnector2::fillData(vector_type& sdata,
    sdata[index++] = (*this->pressure)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
-inline void ThreeDistributionsFullVectorConnector2::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
+inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
 {
    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
index 1d37e4a09..361b06a5d 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
@@ -501,7 +501,7 @@ double Grid3D::getDeltaX(SPtr<Block3D> block) const { return getDeltaX(block->ge
 UbTupleDouble3 Grid3D::getNodeOffset(SPtr<Block3D> block) const
 {
     double delta = this->getDeltaX(block);
-    return makeUbTuple(OFFSET * delta, OFFSET * delta, OFFSET * delta);
+    return makeUbTuple(offset * delta, offset * delta, offset * delta);
 }
 ////////////////////////////////////////////////////////////////////////////
 Vector3D Grid3D::getNodeCoordinates(SPtr<Block3D> block, int ix1, int ix2, int ix3) const
@@ -2221,6 +2221,16 @@ void Grid3D::calcStartCoordinatesWithOutOverlap(SPtr<Block3D> block, double &wor
     }
 }
 //////////////////////////////////////////////////////////////////////////
+int Grid3D::getGhostLayerWidth() const
+{
+    return static_cast<int>(offset + 0.5);
+}
+//////////////////////////////////////////////////////////////////////////
+void Grid3D::setGhostLayerWidth(int ghostLayerWidth)
+{
+    this->offset = static_cast<double>(ghostLayerWidth) - 0.5;
+}
+//////////////////////////////////////////////////////////////////////////
 void Grid3D::setTimeStep(double step) { timeStep = step; }
 //////////////////////////////////////////////////////////////////////////
 double Grid3D::getTimeStep() const { return timeStep; }
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
index 585aaa5d0..5e1eb0da8 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h
@@ -51,8 +51,6 @@ class Communicator;
 class Block3D;
 class Interactor3D;
 
-#define OFFSET 1.5
-
 //! A class implements block grid
 //////////////////////////////////////////////////////////////////////////
 class Grid3D : public enableSharedFromThis<Grid3D>
@@ -214,9 +212,10 @@ public:
     int getNX1() const;
     int getNX2() const;
     int getNX3() const;
-    void calcStartCoordinatesAndDelta(SPtr<Block3D> block, double &worldX1, double &worldX2, double &worldX3,
-                                      double &deltaX);
+    void calcStartCoordinatesAndDelta(SPtr<Block3D> block, double &worldX1, double &worldX2, double &worldX3, double &deltaX);
     void calcStartCoordinatesWithOutOverlap(SPtr<Block3D> block, double &worldX1, double &worldX2, double &worldX3);
+    int getGhostLayerWidth() const;
+    void setGhostLayerWidth(int ghostLayerWidth);
     //////////////////////////////////////////////////////////////////////////
     // LBM
     // double getDeltaT(SPtr<Block3D>) const;
@@ -313,6 +312,8 @@ private:
     double orgDeltaX{ 1.0 };
 
     double timeStep{ 0.0 };
+
+    double offset{ 0.5 };
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
similarity index 98%
rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
rename to src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 97a8196db..0be9c7e3d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -26,12 +26,12 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.cpp
+//! \file MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
 //! \ingroup LBMKernel
 //! \author Hesameddin Safari
 //=======================================================================================
 
-#include "MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h"
+#include "MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h"
 #include "BCArray3D.h"
 #include "Block3D.h"
 #include "D3Q27EsoTwist3DSplittedVector.h"
@@ -43,9 +43,9 @@
 #define PROOF_CORRECTNESS
 
 //////////////////////////////////////////////////////////////////////////
-MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2() { this->compressible = false; }
+MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::MultiphaseTwoPhaseFieldsPressureFilterLBMKernel() { this->compressible = false; }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::initDataSet()
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::initDataSet()
 {
     SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
     SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
@@ -60,11 +60,11 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::initDataSet()
 	dataSet->setPressureField(pressure);
 }
 //////////////////////////////////////////////////////////////////////////
-SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
+SPtr<LBMKernel> MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::clone()
 {
-    SPtr<LBMKernel> kernel(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2());
+    SPtr<LBMKernel> kernel(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
     kernel->setNX(nx);
-    dynamicPointerCast<MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2>(kernel)->initDataSet();
+    dynamicPointerCast<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(kernel)->initDataSet();
     kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
     kernel->setDensityRatio(this->densityRatio);
     kernel->setMultiphaseModelParameters(this->beta, this->kappa);
@@ -86,7 +86,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
     return kernel;
 }
 //////////////////////////////////////////////////////////////////////////
- void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+ void  MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
 	using namespace UbMath;
     LBMReal m2 = mfa + mfc;
 	LBMReal m1 = mfc - mfa;
@@ -99,7 +99,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
- void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+ void  MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
 	using namespace UbMath;
     LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
 	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
@@ -110,7 +110,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
 
 
 ////////////////////////////////////////////////////////////////////////////////
- void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+ void  MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
 	using namespace UbMath;
     LBMReal m1 = (mfa + mfc) + mfb;
 	LBMReal m2 = mfc - mfa;
@@ -120,7 +120,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
 }
 
 
- void  MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+ void  MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
 	using namespace UbMath;
     LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
 	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
@@ -130,7 +130,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::clone()
 }
 
 
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::calculate(int step)
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 {
     using namespace D3Q27System;
     using namespace UbMath;
@@ -3291,7 +3291,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::calculate(int step)
 }
 //////////////////////////////////////////////////////////////////////////
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
 	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
@@ -3304,7 +3304,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi()
     //return 3.0 * sum;
 }
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
@@ -3317,7 +3317,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi()
     //return 3.0 * sum;
 }
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
@@ -3330,7 +3330,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi()
     //return 3.0 * sum;
 }
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi2()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
@@ -3343,7 +3343,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX1_phi2()
 	//return 3.0 * sum;
 }
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi2()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
@@ -3356,7 +3356,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX2_phi2()
 	//return 3.0 * sum;
 }
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi2()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
@@ -3373,7 +3373,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::gradX3_phi2()
 
 
 
-LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::nabla2_phi()
+LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
@@ -3395,7 +3395,7 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::nabla2_phi()
     return 6.0 * sum;
 }
 
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::computePhasefield()
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::computePhasefield()
 {
     using namespace D3Q27System;
     SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
@@ -3452,7 +3452,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::computePhasefield()
     }
 }
 
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
                                                 int x3)
 {
     using namespace D3Q27System;
@@ -3472,7 +3472,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors(CbArray3D
     }
 }
 
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
 	int x3)
 {
 	using namespace D3Q27System;
@@ -3493,7 +3493,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::findNeighbors2(CbArray3
 	}
 }
 
-void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2::swapDistributions()
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::swapDistributions()
 {
     LBMKernel::swapDistributions();
     dataSet->getHdistributions()->swap();
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
similarity index 93%
rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
rename to src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
index d3be0fa92..4ea4492a7 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
@@ -26,13 +26,13 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2.h
+//! \file MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
 //! \ingroup LBMKernel
 //! \author Hesameddin Safari
 //=======================================================================================
 
-#ifndef MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2_H
-#define MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2_H
+#ifndef MultiphaseTwoPhaseFieldsPressureFilterLBMKernel_H
+#define MultiphaseTwoPhaseFieldsPressureFilterLBMKernel_H
 
 #include "LBMKernel.h"
 #include "BCProcessor.h"
@@ -44,11 +44,11 @@
 //! \brief  Multiphase Cascaded Cumulant LBM kernel. 
 //! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
 //! \author  H. Safari, K. Kutscher, M. Geier
-class MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2 : public LBMKernel
+class MultiphaseTwoPhaseFieldsPressureFilterLBMKernel : public LBMKernel
 {
 public:
-   MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2();
-   virtual ~MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel2(void) = default;
+   MultiphaseTwoPhaseFieldsPressureFilterLBMKernel();
+   virtual ~MultiphaseTwoPhaseFieldsPressureFilterLBMKernel(void) = default;
    void calculate(int step) override;
    SPtr<LBMKernel> clone() override;
    void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 57d61fced..c9fa88791 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -47,9 +47,9 @@
 #include "TwoDistributionsFullDirectConnector.h"
 #include "TwoDistributionsFullVectorConnector.h"
 #include "ThreeDistributionsFullDirectConnector.h"
-#include "ThreeDistributionsFullDirectConnector2.h"
+#include "ThreeDistributionsDoubleGhostLayerFullDirectConnector.h"
 #include "ThreeDistributionsFullVectorConnector.h"
-#include "ThreeDistributionsFullVectorConnector2.h"
+#include "ThreeDistributionsDoubleGhostLayerFullVectorConnector.h"
 #include <basics/transmitter/TbTransmitterLocal.h>
 
 //! \brief  A class sets connectors between blocks.
@@ -160,6 +160,6 @@ void SetConnectorsBlockVisitor<T1, T2>::setRemoteConnectors(SPtr<Block3D> sblock
 using OneDistributionSetConnectorsBlockVisitor  = SetConnectorsBlockVisitor<OneDistributionFullDirectConnector, OneDistributionFullVectorConnector>;
 using TwoDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsFullDirectConnector, TwoDistributionsFullVectorConnector>;
 using ThreeDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector, ThreeDistributionsFullVectorConnector>;
-using ThreeDistributionsSetConnectorsBlockVisitor2 = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector2, ThreeDistributionsFullVectorConnector2>;
+using ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsDoubleGhostLayerFullDirectConnector, ThreeDistributionsDoubleGhostLayerFullVectorConnector>;
 
 #endif // SETCONNECTORSBLOCKVISITOR_H
-- 
GitLab


From b67e12967ff30077390203e6722d4ad0a5fb27b8 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Tue, 3 Aug 2021 17:00:32 +0200
Subject: [PATCH 017/179] compute density form both phase fields

---
 apps/cpu/Multiphase/MultiphaseGeier.cfg            | 14 +++++++++++---
 ...iphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp | 11 +++++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/apps/cpu/Multiphase/MultiphaseGeier.cfg b/apps/cpu/Multiphase/MultiphaseGeier.cfg
index 6196da093..d70172583 100644
--- a/apps/cpu/Multiphase/MultiphaseGeier.cfg
+++ b/apps/cpu/Multiphase/MultiphaseGeier.cfg
@@ -1,7 +1,7 @@
 #pathname = E:/Multiphase/HesamCodeWithCumulantsDensRatio
 #pathname = E:/Multiphase/HesamCodeWithCumulantsQuartic
 #pathname = E:/Multiphase/HesamCode
-pathname = E:/Multiphase/VelocityForm
+pathname = E:/Multiphase/VelocityFormSig1e-3SVarDens
 pathGeo = C:/Users/geier/Documents/VirtualFluids_dev_Kostya/apps/cpu/Multiphase/backup
 geoFile=tubeTransformed.stl
 #geoFile = JetBreakup2.ASCII.stl
@@ -22,8 +22,15 @@ availMem = 10e9
 #dx = 0.5
 
 #boundingBox = 6.0e-3 46.0e-3 -5e-3 5e-3 -5e-3 5e-3
+#boundingBox = 6.0e-3 86.0e-3 -5e-3 5e-3 -5e-3 5e-3
+#blocknx = 480 60 60 #20 20 20
+
 boundingBox = 6.0e-3 16.0e-3 -5e-3 5e-3 -5e-3 5e-3
-blocknx = 60 60 60 #20 20 20
+blocknx = 20 20 20
+
+#boundingBox = 6.0e-3 16.0e-3 -5e-3 5e-3 -5e-3 5e-3
+#blocknx = 60 60 60 #20 20 20
+
 
 dx = 1.66666666667e-4
 
@@ -31,12 +38,13 @@ refineLevel = 0
 
 #Simulation
 uLB =0.005# 0.0000005 #inlet velocity
+#uLB=0.001
 uF2 = 0.0001
 Re = 10
 nuL =1e-3#1e-2# 1.0e-5  #!1e-2
 nuG =1e-6#1e-2# 1.16e-4 #!1e-2
 densityRatio = 1000#1000#1000 #30
-sigma =1e-4# 1e-4 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+sigma =1e-3# 1e-4 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 5
 radius = 615.0   (Jet Breakup)
 contactAngle = 110.0
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 0be9c7e3d..1f339353b 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -299,7 +299,10 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
 							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
-						LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+						//LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+						//! variable density -> TRANSFER!
+						LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+
 						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
 						////!!!!!! relplace by pointer swap!
@@ -558,7 +561,11 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                       // LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+
+						//! variable density -> TRANSFER!
+						LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+
 
                             			   ////Incompressible Kernal
 
-- 
GitLab


From 74f343455b71946bde6c50a81d597cb835e47b8c Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin1.usr.hlrn.de>
Date: Wed, 4 Aug 2021 16:48:07 +0200
Subject: [PATCH 018/179] fix compiler warnings for two phase fields

---
 ...onsDoubleGhostLayerFullVectorConnector.cpp | 24 +++++++++----------
 src/cpu/VirtualFluidsCore/Data/DataSet3D.h    |  4 ++--
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp |  8 +++----
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 12 +++++-----
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp | 12 +++++-----
 ...eInitDistributionsBlockVisitorVelocity.cpp |  2 +-
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
index 39b98661a..3e314fbce 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -111,26 +111,26 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
     ////////////////////////////////////////////////////////////
 
     int minX1   = 0;
-    int minX1p1 = minX1 + 1;
+    //int minX1p1 = minX1 + 1;
     int minX1p2 = minX1 + 2;
     int minX1p3 = minX1 + 3;
-    int maxX1m1 = maxX1 - 1;
+    //int maxX1m1 = maxX1 - 1;
     int maxX1m2 = maxX1 - 2;
     int maxX1m3 = maxX1 - 3;
 
     int minX2   = 0;
-    int minX2p1 = minX2 + 1;
+    //int minX2p1 = minX2 + 1;
     int minX2p2 = minX2 + 2;
     int minX2p3 = minX2 + 3;
-    int maxX2m1 = maxX2 - 1;
+    //int maxX2m1 = maxX2 - 1;
     int maxX2m2 = maxX2 - 2;
     int maxX2m3 = maxX2 - 3;
 
     int minX3   = 0;
-    int minX3p1 = minX3 + 1;
+    //int minX3p1 = minX3 + 1;
     int minX3p2 = minX3 + 2;
     int minX3p3 = minX3 + 3;
-    int maxX3m1 = maxX3 - 1;
+    //int maxX3m1 = maxX3 - 1;
     int maxX3m2 = maxX3 - 2;
     int maxX3m3 = maxX3 - 3;
 
@@ -379,26 +379,26 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
     int minX1   = 0;
     int minX1p1 = minX1 + 1;
     int minX1p2 = minX1 + 2;
-    int minX1p3 = minX1 + 3;
+    //int minX1p3 = minX1 + 3;
     int maxX1m1 = maxX1 - 1;
     int maxX1m2 = maxX1 - 2;
-    int maxX1m3 = maxX1 - 3;
+    //int maxX1m3 = maxX1 - 3;
 
     int minX2   = 0;
     int minX2p1 = minX2 + 1;
     int minX2p2 = minX2 + 2;
-    int minX2p3 = minX2 + 3;
+    //int minX2p3 = minX2 + 3;
     int maxX2m1 = maxX2 - 1;
     int maxX2m2 = maxX2 - 2;
-    int maxX2m3 = maxX2 - 3;
+    //int maxX2m3 = maxX2 - 3;
 
     int minX3   = 0;
     int minX3p1 = minX3 + 1;
     int minX3p2 = minX3 + 2;
-    int minX3p3 = minX3 + 3;
+    //int minX3p3 = minX3 + 3;
     int maxX3m1 = maxX3 - 1;
     int maxX3m2 = maxX3 - 2;
-    int maxX3m3 = maxX3 - 3;
+    //int maxX3m3 = maxX3 - 3;
 
     if (sendDir == D3Q27System::W) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
diff --git a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
index 6b858e6ec..12b9e5748 100644
--- a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
@@ -89,8 +89,8 @@ public:
     SPtr<PhaseFieldArray3D> getPhaseField2() const;
     void setPhaseField2(SPtr<PhaseFieldArray3D> values);
 
-    SPtr<PressureFieldArray3D> DataSet3D::getPressureField() const;
-    void DataSet3D::setPressureField(SPtr<PressureFieldArray3D> values);
+    SPtr<PressureFieldArray3D> getPressureField() const;
+    void setPressureField(SPtr<PressureFieldArray3D> values);
 
 protected:
 private:
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index cc90f0fc9..f226b8ecf 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -391,9 +391,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   LBMReal rhoRef=c1;
 
 			  //LBMReal 
-			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+			//    LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+			// 	   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+			// 	   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -938,7 +938,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 1f339353b..679a749b8 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -293,7 +293,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 						LBMReal rhoH = 1.0;
 						LBMReal rhoL = 1.0 / densityRatio;
 
-						LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+						//LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
 
 						LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
@@ -532,7 +532,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal rhoH = 1.0;
                         LBMReal rhoL = 1.0 / densityRatio;
 
-                        LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+                        //LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
 
                         LBMReal dX1_phi = gradX1_phi();
                         LBMReal dX2_phi = gradX2_phi();
@@ -603,9 +603,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   LBMReal rhoRef=c1;
 
 			  //LBMReal 
-			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+			//    LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+			// 	   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+			// 	   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -1242,7 +1242,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index e72c27c74..faa9bd438 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -416,10 +416,10 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 							int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
 
 							for (int yy = -1; yy <= 1; yy++) {
-								int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+								int yyy = (yy+x2 <= maxX2) ? ((yy + x2 > 0) ? yy + x2 : maxX2) : 0;
 
 								for (int zz = -1; zz <= 1; zz++) {
-									int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+									int zzz = (zz+x3 <= maxX3) ? ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
 
 									if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
 										sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressure)(xxx, yyy, zzz);
@@ -589,9 +589,9 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   LBMReal rhoRef=c1;
 
 			  //LBMReal 
-			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+			//    LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+			// 	   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+			// 	   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -1228,7 +1228,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
index f96aaa996..425eeb1cd 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
@@ -165,7 +165,7 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
 	this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3);
 	this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3);
 
-	LBMReal vx1, vx2, vx3, rho, p1, phi;
+	LBMReal vx1 = 0, vx2 = 0, vx3 = 0, rho = 0, p1 = 0, phi = 0;
 
 	int gridRank = grid->getRank();
 	int blockRank = block->getRank();
-- 
GitLab


From 6699ae8ccd89f3f5817ec8f74d015f2ce006760e Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin1.usr.hlrn.de>
Date: Wed, 4 Aug 2021 16:57:40 +0200
Subject: [PATCH 019/179] fix warnings

---
 ...iphaseInitDistributionsBlockVisitorVelocity.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
index 425eeb1cd..8c0d19570 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
@@ -165,7 +165,7 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
 	this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3);
 	this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3);
 
-	LBMReal vx1 = 0, vx2 = 0, vx3 = 0, rho = 0, p1 = 0, phi = 0;
+	
 
 	int gridRank = grid->getRank();
 	int blockRank = block->getRank();
@@ -181,8 +181,8 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
 		SPtr<EsoTwist3D> distributionsH = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getHdistributions());
         SPtr<EsoTwist3D> distributionsH2 = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getH2distributions());
 
-		LBMReal phiL = kernel->getPhiL();
-		LBMReal phiH = kernel->getPhiH();
+		//LBMReal phiL = kernel->getPhiL();
+		//LBMReal phiH = kernel->getPhiH();
 
 		LBMReal f[D3Q27System::ENDF+1];
 
@@ -195,7 +195,7 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
                     x2              = coords[1];
                     x3              = coords[2];
 
-					
+					LBMReal vx1 = 0, vx2 = 0, vx3 = 0, p1 = 0, phi = 0;
 					p1  = 0.0;
 					//p1 = muRho.Eval();
 					vx1 = muVx1.Eval();
@@ -204,9 +204,9 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
 					phi = muPhi.Eval();
 					
 					//rho = phi*1.0 + (1.0-phi)/densityRatio;
-					LBMReal rhoH = 1.0;
-					LBMReal rhoL = 1.0/densityRatio;
-					rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL);
+					//LBMReal rhoH = 1.0;
+					//LBMReal rhoL = 1.0/densityRatio;
+					//LBMReal rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL);
 
 			
 					LBMReal feq[27];
-- 
GitLab


From 7a531b7130e4cc0789f224f95bde5bbb8e484a36 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin1.usr.hlrn.de>
Date: Wed, 4 Aug 2021 17:06:26 +0200
Subject: [PATCH 020/179] fix warnings

---
 .../MultiphaseInitDistributionsBlockVisitorVelocity.cpp       | 4 ++--
 .../MultiphaseInitDistributionsBlockVisitorVelocity.h         | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
index 8c0d19570..bd08dada8 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
@@ -50,8 +50,8 @@ MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBloc
 	this->setRho(0.0);
 }
 //////////////////////////////////////////////////////////////////////////
-MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3)
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) /*, intThickness(intThickness), radius(radius) */
+MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity( /*LBMReal densityRatio,*/ LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3)
+	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)/*, densityRatio(densityRatio), intThickness(intThickness), radius(radius) */
 {
     (void) intThickness;
     (void) radius;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
index fa66633ac..5426817d5 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
@@ -56,7 +56,7 @@ public:
 	//! \param vx1 - velocity in x
 	//! \param vx2 - velocity in y
 	//! \param vx3 - velocity in z
-	MultiphaseInitDistributionsBlockVisitorVelocity( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
+	MultiphaseInitDistributionsBlockVisitorVelocity( /*LBMReal densityRatio, */LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
 	//////////////////////////////////////////////////////////////////////////
 	//automatic vars are: x1,x2, x3
 	//ussage example: setVx1("x1*0.01+x2*0.003")
@@ -94,7 +94,7 @@ private:
 	mu::Parser muPhi;
 
 	LBMReal nu;
-	LBMReal densityRatio;
+	//LBMReal densityRatio;
 	//LBMReal intThickness;
 	//LBMReal radius;
 };
-- 
GitLab


From 7e67dc6f023d0efd558c336f57eba8d5ddfe29f8 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 6 Aug 2021 15:42:18 +0200
Subject: [PATCH 021/179] remove ViskomatXL_2 app

---
 apps/cpu/ViskomatXL_2/CMakeLists.txt |   6 -
 apps/cpu/ViskomatXL_2/viscosity.cfg  |   1 -
 apps/cpu/ViskomatXL_2/viskomat2.cfg  |  55 ----
 apps/cpu/ViskomatXL_2/viskomat2.cpp  | 446 ---------------------------
 4 files changed, 508 deletions(-)
 delete mode 100644 apps/cpu/ViskomatXL_2/CMakeLists.txt
 delete mode 100644 apps/cpu/ViskomatXL_2/viscosity.cfg
 delete mode 100644 apps/cpu/ViskomatXL_2/viskomat2.cfg
 delete mode 100644 apps/cpu/ViskomatXL_2/viskomat2.cpp

diff --git a/apps/cpu/ViskomatXL_2/CMakeLists.txt b/apps/cpu/ViskomatXL_2/CMakeLists.txt
deleted file mode 100644
index 41cab00e2..000000000
--- a/apps/cpu/ViskomatXL_2/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(viskomat2)
-
-vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES viskomat2.cpp )
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viscosity.cfg b/apps/cpu/ViskomatXL_2/viscosity.cfg
deleted file mode 100644
index bf2822c7b..000000000
--- a/apps/cpu/ViskomatXL_2/viscosity.cfg
+++ /dev/null
@@ -1 +0,0 @@
-nuLB = 1.5e-3
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viskomat2.cfg b/apps/cpu/ViskomatXL_2/viskomat2.cfg
deleted file mode 100644
index b76a38d12..000000000
--- a/apps/cpu/ViskomatXL_2/viskomat2.cfg
+++ /dev/null
@@ -1,55 +0,0 @@
-outputPath = d:/temp/viskomatCylinderSBB_16_dx_1_gen_2
-#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
-geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
-#geoFile = fishbone.stl
-geoFile = cylinder.stl
-
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-
-#blocknx = 8 8 8
-blocknx = 2 32 32
-#blocknx = 1 8 8
-#boundingBox = -4 171 -9.5 155.5 -76.5 82.5
-#boundingBox = -4 166 -9.5 155.5 -76.5 82.5
-
-#boundingBox = -4 166 0 165 0 165
-
-#boundingBox = -4 166 -82.5 82.5 -82.5 82.5
-
-#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
-
-boundingBox = 0 2 -16 16 -16 16
-
-# around X
-#blocknx = 1 16 16
-#boundingBox = 0 1 0 165 0 165
-
-# around Y
-#blocknx = 16 1 16
-#boundingBox =  0 165 0 1 0 165
-
-#zero test
-#blocknx = 8 8 8
-#boundingBox =  0 8 0 8 0 8
-
-deltax = 1
-refineLevel = 0
-
-#nuLB = 1.5e-4
-OmegaLB = 1e-4
-N = 80 #rpm
-tau0 = 20e-7
-
-resolution = 32
-scaleFactor = 1
-
-newStart = true
-restartStep = 10000
-
-cpStart = 10000
-cpStep = 10000
-
-outTime = 10000
-endTime = 20 #0000
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL_2/viskomat2.cpp b/apps/cpu/ViskomatXL_2/viskomat2.cpp
deleted file mode 100644
index b8784b40b..000000000
--- a/apps/cpu/ViskomatXL_2/viskomat2.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-#include <iostream>
-#include <string>
-
-#include <VirtualFluids.h>
-
-using namespace std;
-
-
-void bflow(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          outputPath = config.getValue<string>("outputPath");
-      string          geoPath = config.getValue<string>("geoPath");
-      string          geoFile = config.getValue<string>("geoFile");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          deltax = config.getValue<double>("deltax");
-      double          cpStep = config.getValue<double>("cpStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      bool            newStart = config.getValue<bool>("newStart");
-      double          OmegaLB = config.getValue<double>("OmegaLB");
-      double          tau0 = config.getValue<double>("tau0");
-      double          N = config.getValue<double>("N");
-
-
-      ConfigurationFile   viscosity;
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = outputPath.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      LBMReal rhoLB = 0.0;
-
-      //double N  = 70; //rpm
-      double Omega = 2 * UbMath::PI / 60.0 * N; //rad/s
-      double mu    = 1; //Pa s
-      double R     = 0.165 / 2.0; //m
-      double rho   = 970; //kg/m^3
-      double Re    = Omega * R * R * rho / mu;
-
-      //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
-
-      double nuLB = 0.01230579456896098; // OmegaLB* (R / deltax * 1e-3)* (R / deltax * 1e-3) / Re;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-      //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(1, 1461, 970, 1e3));
-      //UBLOG(logINFO, conv->toString());
-
-      //bounding box
-
-      double g_minX1 = boundingBox[0];
-      double g_maxX1 = boundingBox[1];
-
-      double g_minX2 = boundingBox[2];
-      double g_maxX2 = boundingBox[3];
-      
-      double g_minX3 = boundingBox[4];
-      double g_maxX3 = boundingBox[5];
-
-      SPtr<Rheology> thix = Rheology::getInstance();
-      //thix->setPowerIndex(n);
-      //thix->setViscosityParameter(k);
-      thix->setYieldStress(tau0);
-      //thix->setOmegaMin(omegaMin);
-
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm()));
-      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm()));
-      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      //// rotation around X-axis
-      mu::Parser fctVy;
-      fctVy.SetExpr("-Omega*(x3-z0-r)");
-      fctVy.DefineConst("Omega", OmegaLB);
-      fctVy.DefineConst("r", 0.5 * (g_maxX3 - g_minX3));
-      fctVy.DefineConst("z0", g_minX3);
-
-      mu::Parser fctVz;
-      fctVz.SetExpr("Omega*(x2-y0-r)");
-      fctVz.DefineConst("Omega", OmegaLB);
-      fctVz.DefineConst("r", 0.5 * (g_maxX2 - g_minX2));
-      fctVz.DefineConst("y0", g_minX2);
-
-      mu::Parser fctVx;
-      fctVx.SetExpr("0.0");
-
-      // rotation around Y-axis
-      //mu::Parser fctVz;
-      //// fctVx.SetExpr("omega*(r-x2)");
-      //fctVz.SetExpr("Omega*(x1-r)");
-      //fctVz.DefineConst("Omega", OmegaLB);
-      //fctVz.DefineConst("r", 0.5 * (g_maxX1 - g_minX1));
-
-      //mu::Parser fctVx;
-      //fctVx.SetExpr("-Omega*(x3-r)");
-      //fctVx.DefineConst("Omega", OmegaLB);
-      //fctVx.DefineConst("r", 0.5 * (g_maxX1 - g_minX1));
-
-      //mu::Parser fctVy;
-      //fctVy.SetExpr("0.0");
-
-      SPtr<BCAdapter> velocityBCAdapter(new VelocityBCAdapter(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST));
-      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-      velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm()));
-      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-      //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelVelocityBCAlgorithm()));
-
-      //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter());
-      //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-      ////densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      //bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(slipBCAdapter);
-      bcVisitor.addBC(velocityBCAdapter);
-      //bcVisitor.addBC(densityBCAdapter);
-      
-      SPtr<BCProcessor> bcProc;
-      bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BGKLBMKernel());
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel());
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); 
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); 
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel());
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel());
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BinghamModelLBMKernel());
-      kernel->setBCProcessor(bcProc);
-      //kernel->setForcingX1(forcing);
-      //kernel->setWithForcing(true);
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(false);
-      grid->setDeltaX(deltax);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm));
-      //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, mSch, outputPath, comm));
-      restartCoProcessor->setLBMKernel(kernel);
-      restartCoProcessor->setBCProcessor(bcProc);
-      //restartCoProcessor->setNu(k);
-      //////////////////////////////////////////////////////////////////////////
-
-      ////stator
-      // rotation around X-axis 
-       //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
-       //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-       //    g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3) * 0.5));
-
-       SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 4.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
-                                                g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-           g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 12.0*0.5));
-
-      //  // rotation around Y-axis 
-      // //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax, 
-      // //                                         g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
-      // //                                         g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
-      // //                                         0.5 * (g_maxX3 - g_minX3) * 0.5));
-
-       SPtr<D3Q27Interactor> statorInt =
-          SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID));
-      
-      //SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
-      //stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
-      ////stator->translate(4.0, -73.0, -6.0);
-
-      //SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
-      //   new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-
-      GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance());
-
-      ////rotor (cylinder)
-      // rotation around X-axis 
-      SPtr<GbObject3D> rotor(new GbCylinder3D(
-          g_minX1 - 3.0 * deltax, g_minX2 + 0.5 * (g_maxX2 - g_minX2),
-                                              g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_maxX1 + 3.0 * deltax,
-          g_minX2 + 0.5 * (g_maxX2 - g_minX2), g_minX3 + 0.5 * (g_maxX3 - g_minX3), 0.5 * (g_maxX3 - g_minX3)));
-      // rotation around Y-axis
-      //SPtr<GbObject3D> rotor(new GbCylinder3D(g_minX1 + 0.5 * (g_maxX1 - g_minX1), g_minX2 - 3.0 * deltax,
-      //                                        g_minX3 + 0.5 * (g_maxX3 - g_minX3), g_minX1 + 0.5 * (g_maxX1 - g_minX1),
-      //                                        g_maxX2 + 3.0 * deltax, g_minX3 + 0.5 * (g_maxX3 - g_minX3),
-      //                                        0.5 * (g_maxX3 - g_minX3)));
-
-      GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<D3Q27Interactor> rotorInt =
-          SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBCAdapter, Interactor3D::INVERSESOLID));
-
-      //walls
-      GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - deltax, g_minX2 - deltax, g_minX3 - deltax, g_minX1,
-          g_maxX2 + deltax, g_maxX3 + deltax));
-      if (myid == 0) GbSystem3D::writeGeoObject(wallXmin.get(), outputPath + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - deltax, g_minX3 - deltax, g_maxX1 +  (double)blocknx[0]*deltax,
-          g_maxX2 + deltax, g_maxX3 + deltax));
-      if (myid == 0) GbSystem3D::writeGeoObject(wallXmax.get(), outputPath + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
-
-      //wall interactors
-      SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
-      SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "Parameters:");
-         UBLOG(logINFO, "N = " << N << " rpm");
-         UBLOG(logINFO, "Omega = " << Omega << " rad/s");
-         UBLOG(logINFO, "Re = " << Re);
-         UBLOG(logINFO, "rho = " << rhoLB);
-         UBLOG(logINFO, "uLB = " << OmegaLB);
-         UBLOG(logINFO, "nuLB = " << nuLB);
-         UBLOG(logINFO, "tau0 = " << tau0);
-         UBLOG(logINFO, "deltax = " << deltax);
-         UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-         UBLOG(logINFO, "number of threads = " << numOfThreads);
-         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
-         UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
-         UBLOG(logINFO, "output path = " << outputPath);
-         UBLOG(logINFO, "Preprozess - start");
-      }
-
-      if (newStart)
-      {
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (refineLevel > 0)
-         {
-            GbCuboid3DPtr refCube(new GbCuboid3D(-10, -10, -10, 0, 0, 0));
-            if (myid == 0) GbSystem3D::writeGeoObject(refCube.get(), outputPath + "/geo/refCube", WbWriterVtkXmlASCII::getInstance());
-            
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            //refineHelper.addGbObject(sphere, refineLevel);
-            refineHelper.addGbObject(refCube, refineLevel);
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(wallXmaxInt);
-         intHelper.addInteractor(statorInt);
-         intHelper.addInteractor(rotorInt);
-         intHelper.addInteractor(wallXminInt);
-         
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->process(0);
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
-         double needMemAll = double(nodg * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //BC
-         intHelper.setBC();
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         grid->accept(initVisitor);
-
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm);
-         ppgeo.process(0);
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         restartCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         
-         SetBcBlocksBlockVisitor v2(wallXmaxInt);
-         grid->accept(v2);
-         wallXmaxInt->initInteractor();
-
-         SetBcBlocksBlockVisitor v3(statorInt);
-         grid->accept(v3);
-         statorInt->initInteractor();
-
-         SetBcBlocksBlockVisitor v4(rotorInt);
-         grid->accept(v4);
-         rotorInt->initInteractor();
-
-         SetBcBlocksBlockVisitor v1(wallXminInt);
-         grid->accept(v1);
-         wallXminInt->initInteractor();
-      }
-      
-      omp_set_num_threads(numOfThreads);
-
-      //set connectors
-      //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor());
-      //static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin());
-      //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      //grid->accept(setConnsVisitor);
-
-      OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
-      grid->accept(setConnsVisitor);
-
-      grid->accept(bcVisitor);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      //write data for visualization of macroscopic quantities
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-      //SPtr<UbScheduler> visSch(new UbScheduler(10,1));
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
-      //writeMQCoProcessor->process(100);
-
-      SPtr<UbScheduler> forceSch(new UbScheduler(10));
-      SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
-      fp->addInteractor(rotorInt);
-      SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
-      fp2->addInteractor(statorInt);
-
-      //SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
-
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      //calculator->addCoProcessor(npr);
-      //calculator->addCoProcessor(fp);
-      calculator->addCoProcessor(fp2);
-      //calculator->addCoProcessor(writeMQCoProcessor);
-      //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
-      //calculator->addCoProcessor(restartCoProcessor);
-
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         //pflowForcing(string(argv[1]));
-         bflow(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
-- 
GitLab


From 27124530749fcde5dc9d17d79275d2290c955bda Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 6 Aug 2021 16:04:01 +0200
Subject: [PATCH 022/179] new restart interface in Multiphase app

---
 apps/cpu/Multiphase/Multiphase.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index be017881c..2d5d6f882 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -111,11 +111,14 @@ void run(string configname)
         // grid->setPeriodicX2(true);
         // grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
+        
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+
         //////////////////////////////////////////////////////////////////////////
         // restart
         SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
         //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
         //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
         //rcp->setNu(nuLB);
         //rcp->setNuLG(nuL, nuG);
@@ -289,8 +292,7 @@ void run(string configname)
             cylInt->addBCAdapter(velBCAdapterF2);
             //SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
-            SPtr<Grid3DVisitor> metisVisitor(
-                new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
+
             InteractorsHelper intHelper(grid, metisVisitor, true);
             intHelper.addInteractor(cylInt);
             intHelper.addInteractor(tubes);
-- 
GitLab


From e6b7c509f53562ada7c77f4cc35a5fd53a88c364 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 6 Aug 2021 16:26:58 +0200
Subject: [PATCH 023/179] remove fs variable in restart CoProcessors

---
 .../CoProcessors/MPIIOMigrationBECoProcessor.cpp                | 2 +-
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp                  | 2 +-
 .../VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 366166a86..42166cb60 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -1070,7 +1070,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
-    fs = MPI_File_get_size(file_handler, &fsize);
+    MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
         multiPhase2 = true;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index a392bd33e..ea6139354 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -1733,7 +1733,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
 
-    fs = MPI_File_get_size(file_handler, &fsize);
+    MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
         multiPhase2 = true;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 9f9590e34..02537d739 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -1736,7 +1736,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
 
-    fs = MPI_File_get_size(file_handler, &fsize);
+    MPI_File_get_size(file_handler, &fsize);
     if (fsize > 0)
     {
         multiPhase2 = true;
-- 
GitLab


From 206472f787f0efd284445a4d6c805fc26574eb8d Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Fri, 6 Aug 2021 16:54:19 +0200
Subject: [PATCH 024/179] commit test

---
 apps/cpu/Multiphase/Multiphase.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 2d5d6f882..e100d4e15 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -10,7 +10,7 @@ void run(string configname)
 {
     try {
 
-        //Sleep(20000);
+        //Sleep(30000);
 
         ConfigurationFile config;
         config.load(configname);
-- 
GitLab


From ac3e59772e630ee33ddc77a6c73537f3cb598bee Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 9 Aug 2021 09:41:31 +0200
Subject: [PATCH 025/179] add Pressure Field to MPIIO CoProcessor

---
 .../MPIIOMigrationCoProcessor.cpp             | 20 +++++++++++++++++++
 .../CoProcessors/MPIIOMigrationCoProcessor.h  |  3 ++-
 .../Parallel/MPIIODataStructures.h            |  1 +
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index ea6139354..4c2c10a0e 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -278,6 +278,12 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
                 else
                     arrPresence.isPhaseField2Present = false;
 
+                SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> pressureFieldPtr = block->getKernel()->getDataSet()->getPressureField();
+                if (pressureFieldPtr)
+                    arrPresence.isPressureFieldPresent = true;
+                else
+                    arrPresence.isPressureFieldPresent = false;
+
                 firstBlock = false;
             }
 
@@ -446,6 +452,9 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
     if (arrPresence.isPhaseField2Present)
         write3DArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
 
+    if (arrPresence.isPressureFieldPresent)
+        write3DArray(step, PressureField, std::string("/cpPressureField.bin"));
+
 }
 
 void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::string fname)
@@ -625,6 +634,9 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st
                 case PhaseField2:
                     ___Array = block->getKernel()->getDataSet()->getPhaseField2();
                     break;
+                case PressureField:
+                    ___Array = block->getKernel()->getDataSet()->getPressureField();
+                    break;
                 default:
                     UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationCoProcessor::write3DArray : 3D array type does not exist!"));
                     break;
@@ -1909,6 +1921,9 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     if (arrPresence.isPhaseField2Present)
         readArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
 
+    if (arrPresence.isPressureFieldPresent)
+        readArray(step, PressureField, std::string("/cpPressureField.bin"));
+
 }
 
 void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string fname)
@@ -2040,6 +2055,11 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string
                     vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
                 block->getKernel()->getDataSet()->setPhaseField2(___3DArray);
                 break;
+            case PressureField:
+                ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                    vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+                block->getKernel()->getDataSet()->setPressureField(___3DArray);
+                break;
             default:
                 UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationCoProcessor::readArray : array type does not exist!"));
                 break;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
index f2fa6cc94..b2a0b029d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
@@ -27,7 +27,8 @@ public:
         ShearStressVal      = 5,
         RelaxationFactor = 6,
         PhaseField1 = 7,
-        PhaseField2 = 8
+        PhaseField2 = 8,
+        PressureField = 9
     };
 
     MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm);
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
index a7272a307..b79006be6 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
@@ -166,6 +166,7 @@ struct DSArraysPresence {
     bool isRelaxationFactorPresent;
     bool isPhaseField1Present;
     bool isPhaseField2Present;
+    bool isPressureFieldPresent;
 };
 } // namespace MPIIODataStructures
 #endif
\ No newline at end of file
-- 
GitLab


From 13316ac18e7d3c6761d4d729939fa37539d965a1 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 9 Aug 2021 11:19:37 +0200
Subject: [PATCH 026/179] remove warning

---
 src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
index 78001c1d5..caad0f726 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp
@@ -377,7 +377,7 @@ void CheckpointConverter::convertDataSet(int step, int procCount)
         }
 
         //-------------------------------------- H1 -----------------------------
-        int fs = MPI_File_get_size(file_handlerR1, &fsize);
+        MPI_File_get_size(file_handlerR1, &fsize);
         if (fsize > 0)
         {
             doubleValuesArrayH1.resize(blocksCount * doubleCountInBlock);
-- 
GitLab


From 91788f64aabbbddb6a2b9bbb7f77ce947b1156df Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Mon, 9 Aug 2021 17:34:46 +0200
Subject: [PATCH 027/179] Fix issures adding of PressureField

---
 .../CoProcessors/MPIIOCoProcessor.cpp         |    9 +-
 .../MPIIOMigrationCoProcessor.cpp             | 1357 +----------------
 2 files changed, 10 insertions(+), 1356 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
index bc25bf37f..1ef3f3bc0 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
@@ -70,7 +70,7 @@ MPIIOCoProcessor::MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const
 
     //---------------------------------------
 
-    MPI_Type_contiguous(8, MPI_CHAR, &arrayPresenceType);
+    MPI_Type_contiguous(9, MPI_CHAR, &arrayPresenceType);
     MPI_Type_commit(&arrayPresenceType);
 }
 
@@ -468,6 +468,13 @@ void MPIIOCoProcessor::clearAllFiles(int step)
     MPI_File_set_size(file_handler, new_size);
     MPI_File_close(&file_handler);
 
+    std::string filename12 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPressureField.bin";
+    int rc12 = MPI_File_open(MPI_COMM_WORLD, filename12.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
+    if (rc12 != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename12);
+    MPI_File_set_size(file_handler, new_size);
+    MPI_File_close(&file_handler);
+
 }
 
 void MPIIOCoProcessor::writeCpTimeStep(int step)
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index 4c2c10a0e..fe84de2d1 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -425,23 +425,18 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
 
     if (arrPresence.isAverageDensityArrayPresent)
         write4DArray(step, AverageDensity, std::string("/cpAverageDensityArray.bin"));
-    // writeAverageDensityArray(step);
 
     if (arrPresence.isAverageVelocityArrayPresent)
         write4DArray(step, AverageVelocity, std::string("/cpAverageVelocityArray.bin"));
-    // writeAverageVelocityArray(step);
 
     if (arrPresence.isAverageFluktuationsArrayPresent)
         write4DArray(step, AverageFluktuations, std::string("/cpAverageFluktuationsArray.bin"));
-    // writeAverageFluktuationsArray(step);
 
     if (arrPresence.isAverageTripleArrayPresent)
         write4DArray(step, AverageTriple, std::string("/cpAverageTripleArray.bin"));
-    // writeAverageTripleArray(step);
 
     if (arrPresence.isShearStressValArrayPresent)
         write4DArray(step, ShearStressVal, std::string("/cpShearStressValArray.bin"));
-    // writeShearStressValArray(step);
 
     if (arrPresence.isRelaxationFactorPresent)
         write3DArray(step, RelaxationFactor, std::string("/cpRelaxationFactor.bin"));
@@ -716,720 +711,6 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st
     delete[] dataSetSmallArray;
 }
 
-/*
-void MPIIOMigrationCoProcessor::writeAverageDensityArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values of the AverageDensityArray in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageDensityArray start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray4D<LBMReal, IndexerX4X3X2X1> > averageDensityArray =
-block->getKernel()->getDataSet()->getAverageDensity();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (averageDensityArray)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(averageDensityArray->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(averageDensityArray->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(averageDensityArray->getNX3());
-            dataSetParamStr.nx[3] = static_cast<int>(averageDensityArray->getNX4());
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (averageDensityArray && (dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2]
-> 0) && (dataSetParamStr.nx[3] > 0)) doubleValuesArray.insert(doubleValuesArray.end(),
-averageDensityArray->getDataVector().begin(), averageDensityArray->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageDensityArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageDensityArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageDensityArray time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::writeAverageVelocityArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageVelocityArray start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageVelocityArray3DPtr =
-block->getKernel()->getDataSet()->getAverageVelocity();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (AverageVelocityArray3DPtr)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(AverageVelocityArray3DPtr->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(AverageVelocityArray3DPtr->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(AverageVelocityArray3DPtr->getNX3());
-            dataSetParamStr.nx[3] = static_cast<int>(AverageVelocityArray3DPtr->getNX4());
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (AverageVelocityArray3DPtr && (dataSetParamStr.nx[0]>0) && (dataSetParamStr.nx[1]>0) &&
-(dataSetParamStr.nx[2]>0) && (dataSetParamStr.nx[3]>0)) doubleValuesArray.insert(doubleValuesArray.end(),
-AverageVelocityArray3DPtr->getDataVector().begin(), AverageVelocityArray3DPtr->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageVelocityArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageVelocityArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageVelocityArray time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::writeAverageFluktuationsArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageFluktuationsArray start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageFluctArray3DPtr =
-block->getKernel()->getDataSet()->getAverageFluctuations();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (AverageFluctArray3DPtr)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(AverageFluctArray3DPtr->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(AverageFluctArray3DPtr->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(AverageFluctArray3DPtr->getNX3());
-            dataSetParamStr.nx[3] = static_cast<int>(AverageFluctArray3DPtr->getNX4());
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (AverageFluctArray3DPtr && (dataSetParamStr.nx[0]>0) && (dataSetParamStr.nx[1]>0) &&
-(dataSetParamStr.nx[2]>0) && (dataSetParamStr.nx[3]>0)) doubleValuesArray.insert(doubleValuesArray.end(),
-AverageFluctArray3DPtr->getDataVector().begin(), AverageFluctArray3DPtr->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageFluktuationsArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-#ifdef HLRN_LUSTRE
-   MPI_Info_create(&info);
-   MPI_Info_set(info, "striping_factor", "40");
-   MPI_Info_set(info, "striping_unit", "4M");
-#endif
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageFluktuationsArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageFluktuationsArray time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::writeAverageTripleArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageTripleArray start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray4D<LBMReal, IndexerX4X3X2X1> > AverageTripleArray3DPtr =
-block->getKernel()->getDataSet()->getAverageTriplecorrelations();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (AverageTripleArray3DPtr)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(AverageTripleArray3DPtr->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(AverageTripleArray3DPtr->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(AverageTripleArray3DPtr->getNX3());
-            dataSetParamStr.nx[3] = static_cast<int>(AverageTripleArray3DPtr->getNX4());
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (AverageTripleArray3DPtr && (dataSetParamStr.nx[0]>0) && (dataSetParamStr.nx[1]>0) &&
-(dataSetParamStr.nx[2]>0) && (dataSetParamStr.nx[3]>0)) doubleValuesArray.insert(doubleValuesArray.end(),
-AverageTripleArray3DPtr->getDataVector().begin(), AverageTripleArray3DPtr->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageTripleArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-
-#ifdef HLRN_LUSTRE
-   MPI_Info_create(&info);
-   MPI_Info_set(info, "striping_factor", "40");
-   MPI_Info_set(info, "striping_unit", "4M");
-#endif
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageTripleArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageTripleArray time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::writeShearStressValArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeShearStressValArray start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray4D<LBMReal, IndexerX4X3X2X1> > ShearStressValArray3DPtr =
-block->getKernel()->getDataSet()->getShearStressValues();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (ShearStressValArray3DPtr)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(ShearStressValArray3DPtr->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(ShearStressValArray3DPtr->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(ShearStressValArray3DPtr->getNX3());
-            dataSetParamStr.nx[3] = static_cast<int>(ShearStressValArray3DPtr->getNX4());
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (ShearStressValArray3DPtr && (dataSetParamStr.nx[0]>0) && (dataSetParamStr.nx[1]>0) &&
-(dataSetParamStr.nx[2]>0) && (dataSetParamStr.nx[3]>0)) doubleValuesArray.insert(doubleValuesArray.end(),
-ShearStressValArray3DPtr->getDataVector().begin(), ShearStressValArray3DPtr->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeShearStressValArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-
-#ifdef HLRN_LUSTRE
-   MPI_Info_create(&info);
-   MPI_Info_set(info, "striping_factor", "40");
-   MPI_Info_set(info, "striping_unit", "4M");
-#endif
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpShearStressValArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeShearStressValArray time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::writeRelaxationFactor(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
-
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
-   dataSetParam dataSetParamStr;
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeRelaxationFactor start collect data rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   bool firstBlock = true;
-   size_t doubleCountInBlock = 0;
-   int ic = 0;
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         dataSetSmallArray[ic].globalID = block->getGlobalID();     // id of the block needed to find it while
-regenerating the grid
-
-         SPtr< CbArray3D<LBMReal, IndexerX3X2X1> > relaxationFactor3DPtr =
-block->getKernel()->getDataSet()->getRelaxationFactor();
-
-         if (firstBlock) // when first (any) valid block...
-         {
-            //if (relaxationFactor3DPtr)
-            //{
-            dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-            dataSetParamStr.nx[0] = static_cast<int>(relaxationFactor3DPtr->getNX1());
-            dataSetParamStr.nx[1] = static_cast<int>(relaxationFactor3DPtr->getNX2());
-            dataSetParamStr.nx[2] = static_cast<int>(relaxationFactor3DPtr->getNX3());
-            dataSetParamStr.nx[3] = 1;
-            doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3];
-            //}
-            //else
-            //   break;
-
-            firstBlock = false;
-         }
-
-         if (relaxationFactor3DPtr && (dataSetParamStr.nx[0]>0) && (dataSetParamStr.nx[1]>0) &&
-(dataSetParamStr.nx[2]>0)) doubleValuesArray.insert(doubleValuesArray.end(),
-relaxationFactor3DPtr->getDataVector().begin(), relaxationFactor3DPtr->getDataVector().end());
-
-         ic++;
-      }
-   }
-
-   // register new MPI-types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeRelaxationFactor start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_Info info = MPI_INFO_NULL;
-
-#ifdef HLRN_LUSTRE
-   MPI_Info_create(&info);
-   MPI_Info_set(info, "striping_factor", "40");
-   MPI_Info_set(info, "striping_unit", "4M");
-#endif
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpRelaxationFactor.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // each process writes common parameters of a dataSet
-   MPI_File_write_at(file_handler, 0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   MPI_Offset write_offset;
-   size_t sizeofOneDataSet = sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double);
-
-   for (size_t nb = 0; nb < blocksCount; nb++)
-   {
-      write_offset = (MPI_Offset)(sizeof(dataSetParam) + dataSetSmallArray[nb].globalID * sizeofOneDataSet);
-      MPI_File_write_at(file_handler, write_offset, &dataSetSmallArray[nb], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-      MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[nb
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE);
-   }
-
-   MPI_File_sync(file_handler);
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeRelaxationFactor time: " << finish - start << " s");
-   }
-
-   delete[] dataSetSmallArray;
-}
-*/
 void MPIIOMigrationCoProcessor::writeBoundaryConds(int step)
 {
     int rank, size;
@@ -1713,6 +994,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     MPI_File_close(&file_handler);
 
     //----------------------------------------- H1 ----------------------------------------------------
+    ic = 0;
     MPI_Offset fsize;
     filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH1.bin";
     rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
@@ -1740,6 +1022,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
     MPI_File_close(&file_handler);
 
     //----------------------------------------- H2 ----------------------------------------------------
+    ic = 0;
     filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
     rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
     if (rc != MPI_SUCCESS)
@@ -1893,27 +1176,21 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
 
     if (arrPresence.isAverageDensityArrayPresent)
         readArray(step, AverageDensity, std::string("/cpAverageDensityArray.bin"));
-    // readAverageDensityArray(step);
 
     if (arrPresence.isAverageVelocityArrayPresent)
         readArray(step, AverageVelocity, std::string("/cpAverageVelocityArray.bin"));
-    //   readAverageVelocityArray(step);
 
     if (arrPresence.isAverageFluktuationsArrayPresent)
         readArray(step, AverageFluktuations, std::string("/cpAverageFluktuationsArray.bin"));
-    //   readAverageFluktuationsArray(step);
 
     if (arrPresence.isAverageTripleArrayPresent)
         readArray(step, AverageTriple, std::string("/cpAverageTripleArray.bin"));
-    //  readAverageTripleArray(step);
 
     if (arrPresence.isShearStressValArrayPresent)
         readArray(step, ShearStressVal, std::string("/cpShearStressValArray.bin"));
-    //   readShearStressValArray(step);
 
     if (arrPresence.isRelaxationFactorPresent)
         readArray(step, RelaxationFactor, std::string("/cpRelaxationFactor.bin"));
-    //   readRelaxationFactor(step);
  
     if (arrPresence.isPhaseField1Present)
         readArray(step, PhaseField1, std::string("/cpPhaseField1.bin"));
@@ -2075,636 +1352,6 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string
     delete[] dataSetSmallArray;
 }
 
-/*void MPIIOMigrationCoProcessor::readAverageDensityArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageDensityArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageDensityArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   size_t doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageDensityArray time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageDensityArray start of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill mAverageDensity arrays
-      SPtr<AverageValuesArray3D> mAverageDensity;
-      //if
-((dataSetParamStr.nx[0]==0)&&(dataSetParamStr.nx[1]==0)&&(dataSetParamStr.nx[2]==0)&&(dataSetParamStr.nx[3]==0))
-      //   mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr();
-      //else
-      mAverageDensity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,
-IndexerX4X3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2],
-dataSetParamStr.nx[3]));
-
-      //std::cout << "rank=" << rank << ", dataSetArray[n].globalID=" << dataSetSmallArray[n].globalID << std::endl;
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setAverageDensity(mAverageDensity);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageDensityArray end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::readAverageVelocityArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageVelocityArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageVelocityArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   size_t doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageVelocityArray time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageVelocityArray start of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill mAverageVelocity array
-      SPtr<AverageValuesArray3D> mAverageVelocity;
-      //if ((dataSetParamStr.nx[0] == 0) && (dataSetParamStr.nx[1] == 0) && (dataSetParamStr.nx[2] == 0) &&
-(dataSetParamStr.nx[3] == 0))
-      //   mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr();
-      //else
-      mAverageVelocity = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,
-IndexerX4X3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2],
-dataSetParamStr.nx[3]));
-
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setAverageVelocity(mAverageVelocity);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageVelocityArray end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::readAverageFluktuationsArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageFluktuationsArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageFluktuationsArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   int doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageFluktuationsArray time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageFluktuationsArray start of restore of data, rank = " <<
-rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill AverageFluktuations array
-      SPtr<AverageValuesArray3D> mAverageFluktuations;
-      //if ((dataSetParamStr.nx[0] == 0) && (dataSetParamStr.nx[1] == 0) && (dataSetParamStr.nx[2] == 0) &&
-(dataSetParamStr.nx[3] == 0))
-      //   mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr();
-      //else
-      mAverageFluktuations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,
-IndexerX4X3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2],
-dataSetParamStr.nx[3]));
-
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setAverageFluctuations(mAverageFluktuations);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageFluktuationsArray end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::readAverageTripleArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageTripleArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpAverageTripleArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   size_t doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageTripleArray time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageTripleArray start of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill AverageTriplecorrelations array
-      SPtr<AverageValuesArray3D> mAverageTriplecorrelations;
-      //if ((dataSetParamStr.nx[0] == 0) && (dataSetParamStr.nx[1] == 0) && (dataSetParamStr.nx[2] == 0) &&
-(dataSetParamStr.nx[3] == 0))
-      //   mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr();
-      //else
-      mAverageTriplecorrelations = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,
-IndexerX4X3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2],
-dataSetParamStr.nx[3]));
-
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setAverageTriplecorrelations(mAverageTriplecorrelations);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readAverageTripleArray end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::readShearStressValArray(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readShearStressValArray start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpShearStressValArray.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   size_t doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readShearStressValArray time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readShearStressValArray start of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill ShearStressValuesArray array
-      SPtr<ShearStressValuesArray3D> mShearStressValues;
-      //if ((dataSetParamStr.nx[0] == 0) && (dataSetParamStr.nx[1] == 0) && (dataSetParamStr.nx[2] == 0) &&
-(dataSetParamStr.nx[3] == 0))
-      //   mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr();
-      //else
-      mShearStressValues = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,
-IndexerX4X3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2],
-dataSetParamStr.nx[3]));
-
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setShearStressValues(mShearStressValues);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readShearStressValArray end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-
-void MPIIOMigrationCoProcessor::readRelaxationFactor(int step)
-{
-   int rank, size;
-   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
-   MPI_Comm_size(MPI_COMM_WORLD, &size);
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readRelaxationFactor start MPI IO rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-   double start, finish;
-   if (comm->isRoot()) start = MPI_Wtime();
-
-   MPI_File file_handler;
-   std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpRelaxationFactor.bin";
-   int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
-   if (rc != MPI_SUCCESS) throw UbException(UB_EXARGS, "couldn't open file " + filename);
-
-   // read count of blocks
-   size_t blocksCount = 0;
-   dataSetParam dataSetParamStr;
-   memset(&dataSetParamStr, 0, sizeof(dataSetParam));
-
-   // read from the grid the blocks, that belong to this process
-   std::vector<SPtr<Block3D>> blocksVector[25];
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, rank, blocksVector[level]);
-      blocksCount += static_cast<int>(blocksVector[level].size());
-   }
-
-   MPI_File_read_at(file_handler, (MPI_Offset)0, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
-
-   DataSetSmallMigration* dataSetSmallArray = new DataSetSmallMigration[blocksCount];
-   size_t doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all
-blocks
-
-   // define MPI_types depending on the block-specific information
-   MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
-   MPI_Type_commit(&dataSetDoubleType);
-
-   size_t ic = 0;
-   MPI_Offset read_offset;
-   size_t sizeofOneDataSet = size_t(sizeof(DataSetSmallMigration) + doubleCountInBlock * sizeof(double));
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for (SPtr<Block3D> block : blocksVector[level])  //	blocks of the current level
-      {
-         read_offset = (MPI_Offset)(sizeof(dataSetParam) + block->getGlobalID() * sizeofOneDataSet);
-         MPI_File_read_at(file_handler, read_offset, &dataSetSmallArray[ic], 1, dataSetSmallType, MPI_STATUS_IGNORE);
-         MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(DataSetSmallMigration)), &doubleValuesArray[ic
-* doubleCountInBlock], 1, dataSetDoubleType, MPI_STATUS_IGNORE); ic++;
-      }
-   }
-
-   MPI_File_close(&file_handler);
-   MPI_Type_free(&dataSetDoubleType);
-
-   if (comm->isRoot())
-   {
-      finish = MPI_Wtime();
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readRelaxationFactor time: " << finish - start << " s");
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readRelaxationFactor start of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   size_t index = 0;
-   size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] *
-dataSetParamStr.nx[3]; std::vector<double> vectorsOfValues; for (int n = 0; n < blocksCount; n++)
-   {
-      vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
-      index += nextVectorSize;
-
-      // fill RelaxationFactor array
-      SPtr<RelaxationFactorArray3D> mRelaxationFactor;
-      //if ((dataSetParamStr.nx[0] == 0) && (dataSetParamStr.nx[1] == 0) && (dataSetParamStr.nx[2] == 0))
-      //   mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr();
-      //else
-      mRelaxationFactor = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,
-IndexerX3X2X1>(vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
-
-      // find the nesessary block and fill it
-      SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
-      block->getKernel()->getDataSet()->setRelaxationFactor(mRelaxationFactor);
-   }
-
-   if (comm->isRoot())
-   {
-      UBLOG(logINFO, "MPIIOMigrationCoProcessor::readRelaxationFactor end of restore of data, rank = " << rank);
-      UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() /
-1073741824.0 << " GB");
-   }
-
-   delete[] dataSetSmallArray;
-}
-*/
-
 void MPIIOMigrationCoProcessor::readBoundaryConds(int step)
 {
     int rank, size;
-- 
GitLab


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 028/179] 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


From 72790148de40f01724025ecb09df2f2d8bf348a9 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Tue, 17 Aug 2021 17:12:40 +0200
Subject: [PATCH 029/179] Implements a phase distrortion limiter which is
 supposed to improve stability. The limiter value is currently hard code to an
 arbitrary value: limVis = 0.0000001;

---
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 29 ++++++++++++++-----
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 1f339353b..5b5702bed 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -139,7 +139,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
     forcingX2 = 0.0;
     forcingX3 = 0.0;
 
-	LBMReal oneOverInterfaceScale = 1.0;
+	LBMReal oneOverInterfaceScale = 1.5;
     /////////////////////////////////////
 
     localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
@@ -299,9 +299,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
 							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
-						//LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+						LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
 						//! variable density -> TRANSFER!
-						LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+						//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
 						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
@@ -561,10 +561,10 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                       // LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
 
 						//! variable density -> TRANSFER!
-						LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+						//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
 
                             			   ////Incompressible Kernal
@@ -661,7 +661,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 					   else {
 						   gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
 					   }
-					   if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 - 1, yyy, zzz)) {
+					   if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) {
 						   gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
 					   }
 					   else {
@@ -675,7 +675,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 					   else {
 						   gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
 					   }
-					   if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+					   if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) {
 						   gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
 					   }
 					   else {
@@ -699,6 +699,14 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				   }
 			   }
 
+			   //Viscosity increase by pressure gradient
+			   LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+			   LBMReal limVis = 0.0000001;//0.01;
+			  // collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
+			  // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
+			   errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
+			   collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+
 			   //3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
 			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
 			   //+WEIGTH[N] * (phi2[T] - phi2[B]));
@@ -2745,6 +2753,13 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
                     normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
 
+			   //cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+				  // normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST])*(phi[REST]+phi2[REST]) * c1o3 * oneOverInterfaceScale;
+			   //cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+				  // normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * (phi[REST] + phi2[REST]) * c1o3 * oneOverInterfaceScale;
+			   //cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+				  // normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * (phi[REST] + phi2[REST]) * c1o3 * oneOverInterfaceScale;
+
 			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
 			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
 			//mhz = (uz * phi[REST] + normX3 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhz;
-- 
GitLab


From fa72b3a4e2176478ddfc05031f1db8155e5f73d3 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 10 Sep 2021 14:53:44 +0200
Subject: [PATCH 030/179] remove LODI in BoundaryConditions

---
 apps/cpu/HerschelBulkleySphere/hbsphere.cpp   |  6 +-
 apps/cpu/Multiphase/Multiphase.cpp            | 64 +++++++++----------
 apps/cpu/PoiseuilleFlow/pf1.cpp               |  2 +-
 apps/cpu/ViskomatXL/viskomat.cpp              | 11 ++--
 apps/cpu/rheometer/rheometer.cpp              |  6 +-
 .../BoundaryConditions/BoundaryConditions.h   | 31 ---------
 .../TimeAveragedValuesCoProcessor.cpp         |  4 +-
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp |  4 +-
 8 files changed, 53 insertions(+), 75 deletions(-)

diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
index f4b50325d..38affd7e5 100644
--- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
+++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
@@ -159,10 +159,14 @@ void bflow(string configname)
       GbSystem3D::writeGeoObject(sphere.get(), outputPath + "/geo/sphere", WbWriterVtkXmlBinary::getInstance());
       SPtr<D3Q27Interactor> sphereInt(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
+      ////////////////////////////////////////////
+      //METIS
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm));
+      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, outputPath, comm));
       restartCoProcessor->setLBMKernel(kernel);
       restartCoProcessor->setBCProcessor(bcProc);
       //restartCoProcessor->setNu(k);
diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index d4f06e6ea..187e655eb 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -118,7 +118,8 @@ void run(string configname)
         // grid->setPeriodicX2(true);
         // grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
-        
+
+       
         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
 
         //////////////////////////////////////////////////////////////////////////
@@ -134,7 +135,8 @@ void run(string configname)
         rcp->setLBMKernel(kernel);
         rcp->setBCProcessor(bcProc);
         //////////////////////////////////////////////////////////////////////////
-
+        // BC Adapter
+        //////////////////////////////////////////////////////////////////////////////
         mu::Parser fctF1;
         // fctF1.SetExpr("vy1*(1-((x1-x0)^2+(x3-z0)^2)/(R^2))");
         // fctF1.SetExpr("vy1*(1-(sqrt((x1-x0)^2+(x3-z0)^2)/R))^0.1");
@@ -154,6 +156,32 @@ void run(string configname)
         SPtr<BCAdapter> velBCAdapterF1(new MultiphaseVelocityBCAdapter(true, false, false, fctF1, phiH, 0.0, startTime));
         SPtr<BCAdapter> velBCAdapterF2(new MultiphaseVelocityBCAdapter(true, false, false, fctF2, phiH, startTime, endTime));
 
+        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+
+        SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+        denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm()));
+
+        mu::Parser fctPhi_F1;
+        fctPhi_F1.SetExpr("phiH");
+        fctPhi_F1.DefineConst("phiH", phiH);
+
+        mu::Parser fctPhi_F2;
+        fctPhi_F2.SetExpr("phiL");
+        fctPhi_F2.DefineConst("phiL", phiL);
+
+        mu::Parser fctvel_F2_init;
+        fctvel_F2_init.SetExpr("U");
+        fctvel_F2_init.DefineConst("U", 0);
+
+        velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
+        //////////////////////////////////////////////////////////////////////////////////
+        // BC visitor
+        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+        bcVisitor.addBC(noSlipBCAdapter);
+        bcVisitor.addBC(denBCAdapter); //Ohne das BB?
+        bcVisitor.addBC(velBCAdapterF1);
+
         SPtr<D3Q27Interactor> inflowF1Int;
         SPtr<D3Q27Interactor> cylInt;
         if (newStart) {
@@ -233,34 +261,6 @@ void run(string configname)
             GenBlocksGridVisitor genBlocks(gridCube);
             grid->accept(genBlocks);
 
-            // BC Adapter
-            //////////////////////////////////////////////////////////////////////////////
-            SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-            noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
-
-            SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-            denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm()));
-
-            mu::Parser fctPhi_F1;
-            fctPhi_F1.SetExpr("phiH");
-            fctPhi_F1.DefineConst("phiH", phiH);
-
-            mu::Parser fctPhi_F2;
-            fctPhi_F2.SetExpr("phiL");
-            fctPhi_F2.DefineConst("phiL", phiL);
-
-            mu::Parser fctvel_F2_init;
-            fctvel_F2_init.SetExpr("U");
-            fctvel_F2_init.DefineConst("U", 0);
-
-            velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
-            //////////////////////////////////////////////////////////////////////////////////
-            // BC visitor
-            MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
-            bcVisitor.addBC(noSlipBCAdapter);
-            bcVisitor.addBC(denBCAdapter); //Ohne das BB?
-            bcVisitor.addBC(velBCAdapterF1);
-
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
 
@@ -359,8 +359,6 @@ void run(string configname)
 
             intHelper.setBC();
 
-            grid->accept(bcVisitor);
-
             // initialization of distributions
             mu::Parser fct1;
             fct1.SetExpr("phiL");
@@ -405,6 +403,8 @@ void run(string configname)
 
        //ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
 
+       grid->accept(bcVisitor);
+
         ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
diff --git a/apps/cpu/PoiseuilleFlow/pf1.cpp b/apps/cpu/PoiseuilleFlow/pf1.cpp
index 3880e9583..f565aad1c 100644
--- a/apps/cpu/PoiseuilleFlow/pf1.cpp
+++ b/apps/cpu/PoiseuilleFlow/pf1.cpp
@@ -169,7 +169,7 @@ void pf1()
 
    //grid=SPtr<Grid3D>(new Grid3D(comm));
    //restartCoProcessor->restart(200);
-   SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, pathOut + "/mig", comm));
+   SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, metisVisitor, pathOut + "/mig", comm));
    migCoProcessor->setLBMKernel(kernel);
    migCoProcessor->setBCProcessor(bcProc);
    migCoProcessor->setNu(nuLB);
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 3beef8dd3..3cbc797f8 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -172,10 +172,14 @@ void bflow(string configname)
       SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
       if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
 
+      ////////////////////////////////////////////
+      //METIS
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+      ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm));
+      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, outputPath, comm));
       //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, mSch, outputPath, comm));
       restartCoProcessor->setLBMKernel(kernel);
       restartCoProcessor->setBCProcessor(bcProc);
@@ -277,10 +281,7 @@ void bflow(string configname)
          }
 
 
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
-         ////////////////////////////////////////////
+
          /////delete solid blocks
          if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
          InteractorsHelper intHelper(grid, metisVisitor);
diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp
index f6f98c122..cf70525b8 100644
--- a/apps/cpu/rheometer/rheometer.cpp
+++ b/apps/cpu/rheometer/rheometer.cpp
@@ -221,10 +221,14 @@ void bflow(string configname)
       SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
       if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
 
+      ////////////////////////////////////////////
+      //METIS
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm));
+      SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, outputPath, comm));
       restartCoProcessor->setLBMKernel(kernel);
       restartCoProcessor->setBCProcessor(bcProc);
       //restartCoProcessor->setNu(k);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
index f59a89949..555ef9852 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
@@ -280,30 +280,6 @@ public:
     void setBoundaryDensity(float density) { this->bcDensity = density; }
     float getBoundaryDensity() { return this->bcDensity; }
 
-    ////Lodi extension
-    void setDensityLodiDensity(const float &bcLodiDensity) { this->bcLodiDensity = bcLodiDensity; }
-    void setDensityLodiVelocityX1(const float &bcLodiVelocityX1) { this->bcLodiVelocityX1 = bcLodiVelocityX1; }
-    void setDensityLodiVelocityX2(const float &bcLodiVelocityX2) { this->bcLodiVelocityX2 = bcLodiVelocityX2; }
-    void setDensityLodiVelocityX3(const float &bcLodiVelocityX3) { this->bcLodiVelocityX3 = bcLodiVelocityX3; }
-    void setDensityLodiLength(const float &bcLodiLentgh) { this->bcLodiLentgh = bcLodiLentgh; }
-    float getDensityLodiDensity() const { return this->bcLodiDensity; }
-    float getDensityLodiVelocityX1() const { return this->bcLodiVelocityX1; }
-    float getDensityLodiVelocityX2() const { return this->bcLodiVelocityX2; }
-    float getDensityLodiVelocityX3() const { return this->bcLodiVelocityX3; }
-    float getDensityLodiLength() const { return this->bcLodiLentgh; }
-
-    float &densityLodiDensity() { return this->bcLodiDensity; }
-    float &densityLodiVelocityX1() { return this->bcLodiVelocityX1; }
-    float &densityLodiVelocityX2() { return this->bcLodiVelocityX2; }
-    float &densityLodiVelocityX3() { return this->bcLodiVelocityX3; }
-    float &densityLodiLentgh() { return this->bcLodiLentgh; }
-
-    const float &densityLodiDensity() const { return this->bcLodiDensity; }
-    const float &densityLodiVelocityX1() const { return this->bcLodiVelocityX1; }
-    const float &densityLodiVelocityX2() const { return this->bcLodiVelocityX2; }
-    const float &densityLodiVelocityX3() const { return this->bcLodiVelocityX3; }
-    const float &densityLodiLentgh() const { return this->bcLodiLentgh; }
-
     /*======================= Qs =============================*/
     void setQ(const float &val, const int &direction) { q[direction] = val; }
     float getQ(const int &direction) { return q[direction]; }
@@ -354,13 +330,6 @@ protected:
     float bcDensity{ 0.0f };
     float bcPhaseField{ 0.0f };
 
-    //FIXME: remove LODI variables, don't forget to adjust MPIIOCoProcessors
-    float bcLodiDensity{ 0.0f };
-    float bcLodiVelocityX1{ 0.0f };
-    float bcLodiVelocityX2{ 0.0f };
-    float bcLodiVelocityX3{ 0.0f };
-    float bcLodiLentgh{ 0.0f };
-
     float nx1{ 0.0f }, nx2{ 0.0f }, nx3{ 0.0f };
 
     char algorithmType { -1 };
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp
index 27f25fbfe..700722238 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp
@@ -413,7 +413,7 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps)
                                     (*av)(Vz, ix1, ix2, ix3) = uz;
                                 }
 
-                                // fluctuations
+                                // mean fluctuations
                                 if ((options & Fluctuations) == Fluctuations) {
                                     uxx = (*af)(Vxx, ix1, ix2, ix3) / timeSteps;
                                     uyy = (*af)(Vyy, ix1, ix2, ix3) / timeSteps;
@@ -431,7 +431,7 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(double timeSteps)
                                 }
 
                                 if ((options & Triplecorrelations) == Triplecorrelations) {
-                                    // triple-correlations
+                                    // mean triple-correlations
                                     (*at)(Vxxx, ix1, ix2, ix3) =
                                         (*at)(Vxxx, ix1, ix2, ix3) / timeSteps - 3.0 * uxx * ux + 2.0 * ux * ux * ux;
                                     (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3) / timeSteps -
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index a1610dfd2..f64f2719c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -293,7 +293,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 						LBMReal rhoH = 1.0;
 						LBMReal rhoL = 1.0 / densityRatio;
 
-						//LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+						LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
 
 						LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
@@ -532,7 +532,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal rhoH = 1.0;
                         LBMReal rhoL = 1.0 / densityRatio;
 
-                        //LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+                        LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
 
                         LBMReal dX1_phi = gradX1_phi();
                         LBMReal dX2_phi = gradX2_phi();
-- 
GitLab


From 475db297bc90520d4ca045cc55ac9cd607faef35 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 13 Sep 2021 12:55:42 +0200
Subject: [PATCH 031/179] add bcPhaseField to MPIIO

---
 .../CoProcessors/MPIIOMigrationBECoProcessor.cpp                | 2 ++
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp                  | 2 ++
 .../VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp  | 2 ++
 src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h        | 1 +
 4 files changed, 7 insertions(+)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 42166cb60..8e1aa0f52 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -692,6 +692,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
+                    bouCond->bcPhaseField           = (float)bcArr->bcvector[bc]->getBoundaryPhaseField();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -1638,6 +1639,7 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step)
                     bc->bcVelocityX2           = bcArray[ibc].bcVelocityX2;
                     bc->bcVelocityX3           = bcArray[ibc].bcVelocityX3;
                     bc->bcDensity              = bcArray[ibc].bcDensity;
+                    bc->bcPhaseField           = bcArray[ibc].bcPhaseField;
 
                     bc->nx1 = bcArray[ibc].nx1;
                     bc->nx2 = bcArray[ibc].nx2;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index bbf2a2c50..7992bc08f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -777,6 +777,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
+                    bouCond->bcPhaseField           = (float)bcArr->bcvector[bc]->getBoundaryPhaseField();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -1459,6 +1460,7 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step)
                     bc->bcVelocityX2           = bcArray[ibc].bcVelocityX2;
                     bc->bcVelocityX3           = bcArray[ibc].bcVelocityX3;
                     bc->bcDensity              = bcArray[ibc].bcDensity;
+                    bc->bcPhaseField           = bcArray[ibc].bcPhaseField;
 
                     bc->nx1 = bcArray[ibc].nx1;
                     bc->nx2 = bcArray[ibc].nx2;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 02537d739..4f7abd241 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -1489,6 +1489,7 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step)
                     bouCond->bcVelocityX2           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX2();
                     bouCond->bcVelocityX3           = (float)bcArr->bcvector[bc]->getBoundaryVelocityX3();
                     bouCond->bcDensity              = (float)bcArr->bcvector[bc]->getBoundaryDensity();
+                    bouCond->bcPhaseField           = (float)bcArr->bcvector[bc]->getBoundaryPhaseField();
                     bouCond->nx1                    = (float)bcArr->bcvector[bc]->nx1;
                     bouCond->nx2                    = (float)bcArr->bcvector[bc]->nx2;
                     bouCond->nx3                    = (float)bcArr->bcvector[bc]->nx3;
@@ -2699,6 +2700,7 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step)
                 bc->bcVelocityX2           = bcArray[index].bcVelocityX2;
                 bc->bcVelocityX3           = bcArray[index].bcVelocityX3;
                 bc->bcDensity              = bcArray[index].bcDensity;
+                bc->bcPhaseField           = bcArray[ibc].bcPhaseField;
 
                 bc->nx1 = bcArray[index].nx1;
                 bc->nx2 = bcArray[index].nx2;
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
index b79006be6..74627f618 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h
@@ -117,6 +117,7 @@ struct BoundaryCondition {
     float bcVelocityX2;
     float bcVelocityX3;
     float bcDensity;
+    float bcPhaseField;
 
     float nx1, nx2, nx3;
     float q[26];
-- 
GitLab


From 6a96317d60ed0645b347fcbc2c49fd7ab0006e6b Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 17 Sep 2021 13:04:25 +0200
Subject: [PATCH 032/179] fix bug and remove redundant initialisation in
 MultiphaseSetKernelBlockVisitor / remove unused parameter in
 MultiphaseInitDistributionsBlockVisitor

---
 apps/cpu/Multiphase/Multiphase.cpp            |  2 +-
 .../cpu/MultiphaseDropletTest/DropletTest.cfg | 33 ++++++------
 apps/cpu/MultiphaseDropletTest/droplet.cpp    | 45 ++++++++++++----
 src/cpu/VirtualFluids.h                       |  2 +-
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 19 +++----
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp |  2 +-
 .../Parallel/MPICommunicator.h                | 21 +++++---
 ...ultiphaseInitDistributionsBlockVisitor.cpp |  7 +--
 .../MultiphaseInitDistributionsBlockVisitor.h |  4 +-
 .../MultiphaseSetKernelBlockVisitor.cpp       |  4 +-
 ...cityFormInitDistributionsBlockVisitor.cpp} | 53 ++++++++-----------
 ...locityFormInitDistributionsBlockVisitor.h} | 16 +++---
 12 files changed, 109 insertions(+), 99 deletions(-)
 rename src/cpu/VirtualFluidsCore/Visitors/{MultiphaseInitDistributionsBlockVisitorVelocity.cpp => MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp} (84%)
 rename src/cpu/VirtualFluidsCore/Visitors/{MultiphaseInitDistributionsBlockVisitorVelocity.h => MultiphaseVelocityFormInitDistributionsBlockVisitor.h} (86%)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 187e655eb..4c5904a21 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -363,7 +363,7 @@ void run(string configname)
             mu::Parser fct1;
             fct1.SetExpr("phiL");
             fct1.DefineConst("phiL", phiL);
-            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio, interfaceThickness, radius);
+            MultiphaseInitDistributionsBlockVisitor initVisitor(interfaceThickness);
             initVisitor.setPhi(fct1);
             grid->accept(initVisitor);
 
diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 243e04299..78b53897a 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,36 +1,33 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTestSigma2
+pathname = E:/Multiphase/DropletTest
 
-numOfThreads = 1
+numOfThreads = 4
 availMem = 10e9
 
 #Grid
 
-boundingBox = 0 128 0 64 0 64
-#boundingBox = 0 8 0 8 0 8
-blocknx = 8 8 8
-#blocknx = 64 32 32
-#blocknx= 128 64 64
+boundingBox = 0 50 0 150 0 50
+blocknx = 10 10 10
 
 dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0.01#0.005#0.005 
+uLB = 0#0.01#0.005#0.005 
 Re = 10
-nuL =1e-3# 1.0e-5 #!1e-2
-nuG =1e-6# 1.16e-4 #!1e-2
-densityRatio = 1000
-sigma =0.0001# 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+nuL = 1e-3 #1e-5# 1.0e-5 #!1e-2
+nuG = 1e-6 # 1e-8 # 1.16e-4 #!1e-2
+densityRatio = 10
+sigma = 1.111111111111111e-07 #1e-10 #1e-6  # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 5
-radius = 8#16
+radius = 5 #16
 contactAngle = 110.0
-gravity = 0.0
-#gravity = 5.04e-6
+#gravity = 0.0
+gravity = -1.111111111111111e-07 #-5.04e-6
 phi_L = 0.0
 phi_H = 1.0
 Phase-field Relaxation = 0.6
-Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
+Mobility = 0.1 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
 
 
 logToFile = false
@@ -41,5 +38,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1
-endTime = 10000
\ No newline at end of file
+outTime = 100
+endTime = 1000000
\ No newline at end of file
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index a6892cad1..e022ce0c3 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -72,6 +72,8 @@ void run(string configname)
         LBMReal rhoLB = 0.0;
         LBMReal nuLB  = nuL; //(uLB*dLB) / Re;
 
+        LBMReal D  = 2.0*radius;
+
         SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
 
         //const int baseLevel = 0;
@@ -82,9 +84,10 @@ void run(string configname)
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
+
         kernel->setWithForcing(true);
-        kernel->setForcingX1(gr);
-        kernel->setForcingX2(0.0);
+        kernel->setForcingX1(0.0);
+        kernel->setForcingX2(gr);
         kernel->setForcingX3(0.0);
 
         kernel->setPhiL(phiL);
@@ -92,16 +95,28 @@ void run(string configname)
         kernel->setPhaseFieldRelaxation(tauH);
         kernel->setMobility(mob);
 
+        kernel->setCollisionFactorMultiphase(nuL, nuG);
+        kernel->setDensityRatio(densityRatio);
+        kernel->setMultiphaseModelParameters(beta, kappa);
+        kernel->setContactAngle(theta);
+
         SPtr<BCProcessor> bcProc(new BCProcessor());
         // BCProcessorPtr bcProc(new ThinWallBCProcessor());
 
         kernel->setBCProcessor(bcProc);
 
+        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+        //////////////////////////////////////////////////////////////////////////////////
+        // BC visitor
+        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+        bcVisitor.addBC(noSlipBCAdapter);
+
         SPtr<Grid3D> grid(new Grid3D(comm));
         grid->setDeltaX(dx);
         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
         grid->setPeriodicX1(true);
-        grid->setPeriodicX2(true);
+        grid->setPeriodicX2(false);
         grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
@@ -148,6 +163,14 @@ void run(string configname)
             GenBlocksGridVisitor genBlocks(gridCube);
             grid->accept(genBlocks);
 
+            double dx2 = 2.0 * dx;
+            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
  
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
@@ -155,6 +178,8 @@ void run(string configname)
             SPtr<Grid3DVisitor> metisVisitor(
                 new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
             InteractorsHelper intHelper(grid, metisVisitor, true);
+            intHelper.addInteractor(wallYminInt);
+            intHelper.addInteractor(wallYmaxInt);
             intHelper.selectBlocks();
 
             ppblocks->process(0);
@@ -199,12 +224,10 @@ void run(string configname)
 
             intHelper.setBC();
 
-            //grid->accept(bcVisitor);
-
             // initialization of distributions
-            LBMReal x1c = (g_maxX1 - g_minX1-1)/2;
-            LBMReal x2c = (g_maxX2 - g_minX2-1)/2;
-            LBMReal x3c = (g_maxX3 - g_minX3-1)/2;
+            LBMReal x1c = 2.5 * D; // (g_maxX1 - g_minX1-1)/2; //
+            LBMReal x2c = 12.5 * D; //(g_maxX2 - g_minX2-1)/2;
+            LBMReal x3c = 2.5 * D; //(g_maxX3 - g_minX3-1)/2;
             mu::Parser fct1;
             fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
             fct1.DefineConst("x1c", x1c);
@@ -222,7 +245,7 @@ void run(string configname)
             fct2.DefineConst("radius", radius);
             fct2.DefineConst("interfaceThickness", interfaceThickness);
 
-            MultiphaseInitDistributionsBlockVisitorVelocity initVisitor(densityRatio, interfaceThickness, radius);
+            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
             initVisitor.setPhi(fct1);
             initVisitor.setVx1(fct2);
             grid->accept(initVisitor);
@@ -232,7 +255,7 @@ void run(string configname)
                 SPtr<UbScheduler> geoSch(new UbScheduler(1));
                 SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
                     grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-                //ppgeo->process(0);
+                ppgeo->process(0);
                 ppgeo.reset();
             }
 
@@ -258,6 +281,8 @@ void run(string configname)
                 UBLOG(logINFO, "Restart - end");
         }
 
+        grid->accept(bcVisitor);
+
         //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 315de6dd7..7edd56779 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -341,7 +341,7 @@
 #include <Visitors/MultiphaseSetKernelBlockVisitor.h>
 #include <Visitors/MultiphaseBoundaryConditionsBlockVisitor.h>
 #include <Visitors/MultiphaseInitDistributionsBlockVisitor.h>
-#include <Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h>
+#include <Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h>
 #include <Visitors/SetInterpolationConnectorsBlockVisitor.h>
 
 #include <RefineAroundGbObjectHelper.h>
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index f64f2719c..6ffbdb498 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -139,7 +139,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
     forcingX2 = 0.0;
     forcingX3 = 0.0;
 
-	LBMReal oneOverInterfaceScale = 1.5;
+	LBMReal oneOverInterfaceScale = 1.0;//1.5;
     /////////////////////////////////////
 
     localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
@@ -215,7 +215,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                         LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
-                        (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+						LBMReal testPhi1 = (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
                                                     (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
                                                     ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
                                                     (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
@@ -248,7 +248,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                         mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
-                        (*phaseField2)(x1, x2, x3) =
+						LBMReal testPhi2 = (*phaseField2)(x1, x2, x3) =
                             (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) +
                             (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
                              ((mfbaa + mfbac) + (mfbca + mfbcc))) +
@@ -305,8 +305,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
+						//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
 						////!!!!!! relplace by pointer swap!
-						(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+						//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
                     }
                 }
             }
@@ -603,9 +604,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   LBMReal rhoRef=c1;
 
 			  //LBMReal 
-			//    LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-			// 	   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-			// 	   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -701,7 +702,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   //Viscosity increase by pressure gradient
 			   LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
-			   LBMReal limVis = 0.0000001;//0.01;
+			   LBMReal limVis = 0.0000001*10;//0.01;
 			  // collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
 			  // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
 			   errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
@@ -1250,7 +1251,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index faa9bd438..294568b4f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -714,7 +714,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 
 			   ///surface tension force
-			   vvx += mu * dX1_phi*c1o2;
+			   vvx += mu * dX1_phi * c1o2;
 			   vvy += mu * dX2_phi * c1o2 ;
 			   vvz += mu * dX3_phi * c1o2;
 
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
index 3c25cc78f..19ad23a53 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
@@ -139,16 +139,23 @@ void MPICommunicator::allGather(std::vector<T> &svalues, std::vector<T> &rvalues
 
     rvalues.resize(displs[numprocs - 1] + rcounts[numprocs - 1]);
 
-    if (rvalues.size() == 0) {
-        rvalues.resize(1);
-        rvalues[0] = 999;
+    T* sval = NULL;
+    T* rval = NULL;
+
+    if (svalues.size() > 0) {
+        //svalues.resize(1);
+        //svalues[0] = 999;
+        sval = &svalues[0];
     }
-    if (scount == 0) {
-        svalues.resize(1);
-        svalues[0] = 999;
+
+    if (rvalues.size() > 0) {
+        //rvalues.resize(1);
+        //rvalues[0] = 999;
+        rval = &rvalues[0];
     }
 
-    MPI_Allgatherv(&svalues[0], scount, mpiDataType, &rvalues[0], &rcounts[0], &displs[0], mpiDataType, comm);
+    //MPI_Allgatherv(&svalues[0], scount, mpiDataType, &rvalues[0], &rcounts[0], &displs[0], mpiDataType, comm);
+    MPI_Allgatherv(sval, scount, mpiDataType, rval, &rcounts[0], &displs[0], mpiDataType, comm);
 }
 //////////////////////////////////////////////////////////////////////////
 template <class T>
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index 124e342d6..a59e8d476 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -50,12 +50,9 @@ MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor
 	this->setRho(0.0);
 }
 //////////////////////////////////////////////////////////////////////////
-MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3)
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) /*, intThickness(intThickness), radius(radius) */
+MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1, LBMReal vx2, LBMReal vx3)
+	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) 
 {
-    (void) intThickness;
-    (void) radius;
-
 	this->setVx1(vx1);
 	this->setVx2(vx2);
 	this->setVx3(vx3);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
index f94167040..e351b901c 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
@@ -56,7 +56,7 @@ public:
 	//! \param vx1 - velocity in x
 	//! \param vx2 - velocity in y
 	//! \param vx3 - velocity in z
-	MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
+	MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
 	//////////////////////////////////////////////////////////////////////////
 	//automatic vars are: x1,x2, x3
 	//ussage example: setVx1("x1*0.01+x2*0.003")
@@ -95,8 +95,6 @@ private:
 
 	LBMReal nu;
 	LBMReal densityRatio;
-	//LBMReal intThickness;
-	//LBMReal radius;
 };
 
 #endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
index e42cdb785..11863b691 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
@@ -35,8 +35,8 @@ 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->setCollisionFactorMultiphase(collFactorL, collFactorG);
+		
 		//kernel->setDensityRatio(densityRatio);
 		//kernel->setMultiphaseModelParameters(beta, kappa);
 		//kernel->setContactAngle(contactAngle);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
similarity index 84%
rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
index bd08dada8..8a201fa3e 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
@@ -26,12 +26,12 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file MultiphaseInitDistributionsBlockVisitorVelocity.cpp
+//! \file MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
 //! \ingroup Visitors
 //! \author Hesameddin Safari
 //=======================================================================================
 
-#include "MultiphaseInitDistributionsBlockVisitorVelocity.h"
+#include "MultiphaseVelocityFormInitDistributionsBlockVisitor.h"
 #include "BCArray3D.h"
 #include "BCProcessor.h"
 #include "Block3D.h"
@@ -41,7 +41,7 @@
 #include "Grid3DSystem.h"
 #include "LBMKernel.h"
 
-MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity() 
+MultiphaseVelocityFormInitDistributionsBlockVisitor::MultiphaseVelocityFormInitDistributionsBlockVisitor() 
 	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
 {
 	this->setVx1(0.0);
@@ -50,108 +50,97 @@ MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBloc
 	this->setRho(0.0);
 }
 //////////////////////////////////////////////////////////////////////////
-MultiphaseInitDistributionsBlockVisitorVelocity::MultiphaseInitDistributionsBlockVisitorVelocity( /*LBMReal densityRatio,*/ LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3)
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)/*, densityRatio(densityRatio), intThickness(intThickness), radius(radius) */
-{
-    (void) intThickness;
-    (void) radius;
-
-	this->setVx1(vx1);
-	this->setVx2(vx2);
-	this->setVx3(vx3);
-}
-//////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( const mu::Parser& parser)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( const mu::Parser& parser)  
 { 
 	this->checkFunction(parser); 
 	this->muVx1 = parser;  
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( const mu::Parser& parser)
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx2( const mu::Parser& parser)
 { 
 	this->checkFunction(parser); 
 	this->muVx2 = parser;  
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( const mu::Parser& parser)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx3( const mu::Parser& parser)  
 { 
 	this->checkFunction(parser); 
 	this->muVx3 = parser;  
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( const mu::Parser& parser)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setRho( const mu::Parser& parser)  
 { 
 	this->checkFunction(parser); 
 	this->muRho = parser;  
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( const mu::Parser& parser)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPhi( const mu::Parser& parser)  
 { 
 	this->checkFunction(parser); 
 	this->muPhi = parser;  
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( const std::string& muParserString)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( const std::string& muParserString)  
 { 
 	this->muVx1.SetExpr(muParserString); 
 	this->checkFunction(muVx1); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( const std::string& muParserString) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx2( const std::string& muParserString) 
 { 
 	this->muVx2.SetExpr(muParserString); 
 	this->checkFunction(muVx2); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( const std::string& muParserString)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx3( const std::string& muParserString)  
 { 
 	this->muVx3.SetExpr(muParserString); 
 	this->checkFunction(muVx3); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( const std::string& muParserString)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setRho( const std::string& muParserString)  
 { 
 	this->muRho.SetExpr(muParserString); 
 	this->checkFunction(muRho); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( const std::string& muParserString)  
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPhi( const std::string& muParserString)  
 { 
 	this->muPhi.SetExpr(muParserString); 
 	this->checkFunction(muPhi); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx1( LBMReal vx1 ) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( LBMReal vx1 ) 
 { 
 	this->muVx1.SetExpr( UbSystem::toString(vx1,D3Q27RealLim::digits10) );  
 	this->checkFunction(muVx1); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx2( LBMReal vx2 ) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx2( LBMReal vx2 ) 
 { 
 	this->muVx2.SetExpr( UbSystem::toString(vx2,D3Q27RealLim::digits10) );  
 	this->checkFunction(muVx2); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setVx3( LBMReal vx3 ) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx3( LBMReal vx3 ) 
 { 
 	this->muVx3.SetExpr( UbSystem::toString(vx3,D3Q27RealLim::digits10) );  
 	this->checkFunction(muVx3); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setRho( LBMReal rho ) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setRho( LBMReal rho ) 
 { 
 	this->muRho.SetExpr( UbSystem::toString(rho,D3Q27RealLim::digits10) );  
 	this->checkFunction(muRho); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setPhi( LBMReal phi ) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPhi( LBMReal phi ) 
 { 
 	this->muPhi.SetExpr( UbSystem::toString(phi,D3Q27RealLim::digits10) );  
 	this->checkFunction(muPhi); 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block) 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block) 
 {
 	using namespace D3Q27System;
 
@@ -336,7 +325,7 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::visit(const SPtr<Grid3D> g
 
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::checkFunction(mu::Parser fct)
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::checkFunction(mu::Parser fct)
 {
 	double x1=1.0,x2=1.0,x3=1.0;
 	fct.DefineVar("x1",&x1); 
@@ -355,7 +344,7 @@ void MultiphaseInitDistributionsBlockVisitorVelocity::checkFunction(mu::Parser f
 	}
 }
 //////////////////////////////////////////////////////////////////////////
-void MultiphaseInitDistributionsBlockVisitorVelocity::setNu( LBMReal nu )
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setNu( LBMReal nu )
 {
 	this->nu = nu;
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
similarity index 86%
rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
index 5426817d5..72841a7c5 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitorVelocity.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
@@ -26,13 +26,13 @@
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
-//! \file MultiphaseInitDistributionsBlockVisitorVelocity.h
+//! \file MultiphaseVelocityFormInitDistributionsBlockVisitor.h
 //! \ingroup Visitors
-//! \author Hesameddin Safari
+//! \author Hesameddin Safari, Martin Geier, Konstantin Kutscher
 //=======================================================================================
 
-#ifndef MultiphaseInitDistributionsBlockVisitorVelocity_H
-#define MultiphaseInitDistributionsBlockVisitorVelocity_H
+#ifndef MultiphaseVelocityFormInitDistributionsBlockVisitor_H
+#define MultiphaseVelocityFormInitDistributionsBlockVisitor_H
 
 #include "Block3DVisitor.h"
 #include "D3Q27System.h"
@@ -42,13 +42,13 @@
 
 
 
-class MultiphaseInitDistributionsBlockVisitorVelocity : public Block3DVisitor
+class MultiphaseVelocityFormInitDistributionsBlockVisitor : public Block3DVisitor
 {
 public:
 	typedef std::numeric_limits<LBMReal> D3Q27RealLim;
 
 public:
-	MultiphaseInitDistributionsBlockVisitorVelocity();
+	MultiphaseVelocityFormInitDistributionsBlockVisitor();
 	//D3Q27ETInitDistributionsBlockVisitor(LBMReal rho, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
 	//! Constructor
 	//! \param nu - viscosity
@@ -56,7 +56,6 @@ public:
 	//! \param vx1 - velocity in x
 	//! \param vx2 - velocity in y
 	//! \param vx3 - velocity in z
-	MultiphaseInitDistributionsBlockVisitorVelocity( /*LBMReal densityRatio, */LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
 	//////////////////////////////////////////////////////////////////////////
 	//automatic vars are: x1,x2, x3
 	//ussage example: setVx1("x1*0.01+x2*0.003")
@@ -94,9 +93,6 @@ private:
 	mu::Parser muPhi;
 
 	LBMReal nu;
-	//LBMReal densityRatio;
-	//LBMReal intThickness;
-	//LBMReal radius;
 };
 
 #endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_H
-- 
GitLab


From d54550dc9361afc5d4f2062f6c01d4ad95936a73 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 28 Sep 2021 17:46:01 +0200
Subject: [PATCH 033/179] add LIGGGHTS library coupling

---
 apps/cpu/Applications.cmake              |   1 +
 apps/cpu/LiggghtsApp/CMakeLists.txt      |   3 +
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp     | 358 +++++++++++++++++++++++
 src/cpu/VirtualFluidsCore/CMakeLists.txt |   6 +-
 4 files changed, 366 insertions(+), 2 deletions(-)
 create mode 100644 apps/cpu/LiggghtsApp/CMakeLists.txt
 create mode 100644 apps/cpu/LiggghtsApp/LiggghtsApp.cpp

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index e8902e5ff..37fc4de29 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -9,6 +9,7 @@ add_subdirectory(${APPS_ROOT_CPU}/sphere)
 add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
 add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
+add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
 
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
diff --git a/apps/cpu/LiggghtsApp/CMakeLists.txt b/apps/cpu/LiggghtsApp/CMakeLists.txt
new file mode 100644
index 000000000..ac8f9ef9a
--- /dev/null
+++ b/apps/cpu/LiggghtsApp/CMakeLists.txt
@@ -0,0 +1,3 @@
+PROJECT(LiggghtsApp)
+
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES LiggghtsApp.cpp )
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
new file mode 100644
index 000000000..64ec51a23
--- /dev/null
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -0,0 +1,358 @@
+#include <iostream>
+#include <string>
+#include <memory>
+
+#include "VirtualFluids.h"
+
+#include "lammps.h"
+
+using namespace std;
+
+//void run(string configname)
+//{
+//    try {
+//        ConfigurationFile config;
+//        config.load(configname);
+//
+//        string pathname            = config.getValue<string>("pathname");
+//        int numOfThreads           = config.getValue<int>("numOfThreads");
+//        vector<int> blocknx        = config.getVector<int>("blocknx");
+//        vector<double> boundingBox = config.getVector<double>("boundingBox");
+//        double uLB             = config.getValue<double>("uLB");
+//        double nuL             = config.getValue<double>("nuL");
+//        double nuG             = config.getValue<double>("nuG");
+//        double densityRatio    = config.getValue<double>("densityRatio");
+//        double sigma           = config.getValue<double>("sigma");
+//        int interfaceThickness = config.getValue<int>("interfaceThickness");
+//        double radius          = config.getValue<double>("radius");
+//        double theta           = config.getValue<double>("contactAngle");
+//        double gr              = config.getValue<double>("gravity");
+//        double phiL            = config.getValue<double>("phi_L");
+//        double phiH            = config.getValue<double>("phi_H");
+//        double tauH            = config.getValue<double>("Phase-field Relaxation");
+//        double mob             = config.getValue<double>("Mobility");
+//
+//        double endTime     = config.getValue<double>("endTime");
+//        double outTime     = config.getValue<double>("outTime");
+//        double availMem    = config.getValue<double>("availMem");
+//        int refineLevel    = config.getValue<int>("refineLevel");
+//        double Re          = config.getValue<double>("Re");
+//        double dx          = config.getValue<double>("dx");
+//        bool logToFile     = config.getValue<bool>("logToFile");
+//        //double restartStep = config.getValue<double>("restartStep");
+//        //double cpStart     = config.getValue<double>("cpStart");
+//        //double cpStep      = config.getValue<double>("cpStep");
+//        bool newStart      = config.getValue<bool>("newStart");
+//
+//        double beta  = 12 * sigma / interfaceThickness;
+//        double kappa = 1.5 * interfaceThickness * sigma;
+//
+//        SPtr<Communicator> comm = MPICommunicator::getInstance();
+//        int myid                = comm->getProcessID();
+//
+//        if (myid == 0)
+//            UBLOG(logINFO, "Droplet Test: Start!");
+//
+//        if (logToFile) {
+//#if defined(__unix__)
+//            if (myid == 0) {
+//                const char *str = pathname.c_str();
+//                mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+//            }
+//#endif
+//
+//            if (myid == 0) {
+//                stringstream logFilename;
+//                logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+//                UbLog::output_policy::setStream(logFilename.str());
+//            }
+//        }
+//
+//        //Sleep(30000);
+//
+//        // LBMReal dLB = 0; // = length[1] / dx;
+//        LBMReal rhoLB = 0.0;
+//        LBMReal nuLB  = nuL; //(uLB*dLB) / Re;
+//
+//        LBMReal D  = 2.0*radius;
+//
+//        SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
+//
+//        //const int baseLevel = 0;
+//
+//        SPtr<LBMKernel> kernel;
+//
+//        //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
+//        //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+//        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+//
+//
+//        kernel->setWithForcing(true);
+//        kernel->setForcingX1(0.0);
+//        kernel->setForcingX2(gr);
+//        kernel->setForcingX3(0.0);
+//
+//        kernel->setPhiL(phiL);
+//        kernel->setPhiH(phiH);
+//        kernel->setPhaseFieldRelaxation(tauH);
+//        kernel->setMobility(mob);
+//
+//        kernel->setCollisionFactorMultiphase(nuL, nuG);
+//        kernel->setDensityRatio(densityRatio);
+//        kernel->setMultiphaseModelParameters(beta, kappa);
+//        kernel->setContactAngle(theta);
+//
+//        SPtr<BCProcessor> bcProc(new BCProcessor());
+//        // BCProcessorPtr bcProc(new ThinWallBCProcessor());
+//
+//        kernel->setBCProcessor(bcProc);
+//
+//        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+//        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+//        //////////////////////////////////////////////////////////////////////////////////
+//        // BC visitor
+//        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+//        bcVisitor.addBC(noSlipBCAdapter);
+//
+//        SPtr<Grid3D> grid(new Grid3D(comm));
+//        grid->setDeltaX(dx);
+//        grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+//        grid->setPeriodicX1(true);
+//        grid->setPeriodicX2(false);
+//        grid->setPeriodicX3(true);
+//        grid->setGhostLayerWidth(2);
+//
+//        //////////////////////////////////////////////////////////////////////////
+//        // restart
+//        //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+//        ////SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+//        ////SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
+//        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
+//        //rcp->setNu(nuLB);
+//        //rcp->setNuLG(nuL, nuG);
+//        //rcp->setDensityRatio(densityRatio);
+//
+//        //rcp->setLBMKernel(kernel);
+//        //rcp->setBCProcessor(bcProc);
+//        //////////////////////////////////////////////////////////////////////////
+//
+//        if (newStart) {
+//
+//            // bounding box
+//            double g_minX1 = boundingBox[0];
+//            double g_minX2 = boundingBox[2];
+//            double g_minX3 = boundingBox[4];
+//
+//            double g_maxX1 = boundingBox[1];
+//            double g_maxX2 = boundingBox[3];
+//            double g_maxX3 = boundingBox[5];
+//
+//            // geometry
+//            SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+//            if (myid == 0)
+//                GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
+//                    WbWriterVtkXmlBinary::getInstance());
+//
+//            if (myid == 0) {
+//                UBLOG(logINFO, "uLb = " << uLB);
+//                UBLOG(logINFO, "rho = " << rhoLB);
+//                UBLOG(logINFO, "nuLb = " << nuLB);
+//                UBLOG(logINFO, "Re = " << Re);
+//                UBLOG(logINFO, "dx = " << dx);
+//                UBLOG(logINFO, "Preprocess - start");
+//            }
+//
+//            GenBlocksGridVisitor genBlocks(gridCube);
+//            grid->accept(genBlocks);
+//
+//            double dx2 = 2.0 * dx;
+//            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
+//            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+//            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+//            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+//
+//            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+//            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+// 
+//            SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
+//                grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+//
+//            SPtr<Grid3DVisitor> metisVisitor(
+//                new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+//            InteractorsHelper intHelper(grid, metisVisitor, true);
+//            intHelper.addInteractor(wallYminInt);
+//            intHelper.addInteractor(wallYmaxInt);
+//            intHelper.selectBlocks();
+//
+//            ppblocks->process(0);
+//            ppblocks.reset();
+//
+//            unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+//            int ghostLayer                    = 5;
+//            unsigned long long numberOfNodesPerBlock =
+//                (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
+//            unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+//            unsigned long long numberOfNodesPerBlockWithGhostLayer =
+//                numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+//            double needMemAll =
+//                double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+//            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+//
+//            if (myid == 0) {
+//                UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+//                UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+//                int minInitLevel = grid->getCoarsestInitializedLevel();
+//                int maxInitLevel = grid->getFinestInitializedLevel();
+//                for (int level = minInitLevel; level <= maxInitLevel; level++) {
+//                    int nobl = grid->getNumberOfBlocks(level);
+//                    UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+//                    UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
+//                }
+//                UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+//                UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+//                UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+//            }
+//
+//            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
+//                needMem);
+//
+//            grid->accept(kernelVisitor);
+//
+//            if (refineLevel > 0) {
+//                SetUndefinedNodesBlockVisitor undefNodesVisitor;
+//                grid->accept(undefNodesVisitor);
+//            }
+//
+//
+//            intHelper.setBC();
+//
+//            // initialization of distributions
+//            LBMReal x1c = 2.5 * D; // (g_maxX1 - g_minX1-1)/2; //
+//            LBMReal x2c = 12.5 * D; //(g_maxX2 - g_minX2-1)/2;
+//            LBMReal x3c = 2.5 * D; //(g_maxX3 - g_minX3-1)/2;
+//            mu::Parser fct1;
+//            fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+//            fct1.DefineConst("x1c", x1c);
+//            fct1.DefineConst("x2c", x2c);
+//            fct1.DefineConst("x3c", x3c);
+//            fct1.DefineConst("radius", radius);
+//            fct1.DefineConst("interfaceThickness", interfaceThickness);
+//
+//            mu::Parser fct2;
+//            fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+//            fct2.DefineConst("uLB", uLB);
+//            fct2.DefineConst("x1c", x1c);
+//            fct2.DefineConst("x2c", x2c);
+//            fct2.DefineConst("x3c", x3c);
+//            fct2.DefineConst("radius", radius);
+//            fct2.DefineConst("interfaceThickness", interfaceThickness);
+//
+//            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
+//            initVisitor.setPhi(fct1);
+//            initVisitor.setVx1(fct2);
+//            grid->accept(initVisitor);
+//
+//            // boundary conditions grid
+//            {
+//                SPtr<UbScheduler> geoSch(new UbScheduler(1));
+//                SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+//                    grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+//                ppgeo->process(0);
+//                ppgeo.reset();
+//            }
+//
+//            if (myid == 0)
+//                UBLOG(logINFO, "Preprocess - end");
+//        } else {
+//            if (myid == 0) {
+//                UBLOG(logINFO, "Parameters:");
+//                UBLOG(logINFO, "uLb = " << uLB);
+//                UBLOG(logINFO, "rho = " << rhoLB);
+//                UBLOG(logINFO, "nuLb = " << nuLB);
+//                UBLOG(logINFO, "Re = " << Re);
+//                UBLOG(logINFO, "dx = " << dx);
+//                UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+//                UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+//                UBLOG(logINFO, "path = " << pathname);
+//            }
+//
+//            //rcp->restart((int)restartStep);
+//            //grid->setTimeStep(restartStep);
+//
+//            if (myid == 0)
+//                UBLOG(logINFO, "Restart - end");
+//        }
+//
+//        grid->accept(bcVisitor);
+//
+//        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+//        //grid->accept(setConnsVisitor);
+//
+//        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+//        grid->accept(setConnsVisitor);
+//
+//        SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+//        SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
+//            grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+//        pp->process(0);
+//        //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(
+//        //    grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+//
+//        SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+//        SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+//
+//        omp_set_num_threads(numOfThreads);
+//
+//        SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+//        SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+//        calculator->addCoProcessor(npr);
+//        calculator->addCoProcessor(pp);
+//        //calculator->addCoProcessor(rcp);
+//
+//
+//
+//        if (myid == 0)
+//            UBLOG(logINFO, "Simulation-start");
+//        calculator->calculate();
+//        if (myid == 0)
+//            UBLOG(logINFO, "Simulation-end");
+//    } catch (std::exception &e) {
+//        cerr << e.what() << endl << flush;
+//    } catch (std::string &s) {
+//        cerr << s << endl;
+//    } catch (...) {
+//        cerr << "unknown exception" << endl;
+//    }
+//}
+int main(int argc, char *argv[])
+{
+	//void* lmp;
+ //   lammps_open_no_mpi(argc, argv, &lmp);
+ //   // Sleep(30000);
+ //   if (argv != NULL) {
+ //       if (argv[1] != NULL) {
+ //           run(string(argv[1]));
+ //       } else {
+ //           cout << "Configuration file is missing!" << endl;
+ //       }
+ //   }
+	
+	LAMMPS_NS::LAMMPS *lmp;
+    // custom argument vector for LAMMPS library
+    const char *lmpargv[] {"liblammps", "-log", "none"};
+    int lmpargc = sizeof(lmpargv)/sizeof(const char *);
+
+    // explicitly initialize MPI
+    MPI_Init(&argc, &argv);
+
+    // create LAMMPS instance
+    lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD);
+    // output numerical version string
+    //std::cout << "LAMMPS version ID: " << lmp->num_ver << std::endl;
+    // delete LAMMPS instance
+    delete lmp;
+
+    // stop MPI environment
+    MPI_Finalize();
+    return 0;
+}
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index 09766e266..7dce1da44 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -25,11 +25,13 @@ if(BUILD_USE_OPENMP)
    list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX)
 endif()
 
-vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX ${VF_LIBRARIES})
-
+vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX ${VF_LIBRARIES} liggghts)
 
 vf_get_library_name(library_name)
 
+target_link_directories(${library_name} PUBLIC d:/Tools/LIGGGHTS/build/Debug)
+target_include_directories(${library_name} PUBLIC d:/Tools/LIGGGHTS/src)
+
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
-- 
GitLab


From 2aa7d9471fabf9c5bbc4abdb293de6fd8b5fed9c Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 7 Oct 2021 10:49:27 +0200
Subject: [PATCH 034/179] add first LIGGGHTS test

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp | 61 +++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 64ec51a23..e1282a333 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -5,6 +5,10 @@
 #include "VirtualFluids.h"
 
 #include "lammps.h"
+#include "input.h"
+#include "atom.h"
+#include "modify.h"
+#include "fix_lb_coupling_onetoone.h"
 
 using namespace std;
 
@@ -347,8 +351,61 @@ int main(int argc, char *argv[])
 
     // create LAMMPS instance
     lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD);
-    // output numerical version string
-    //std::cout << "LAMMPS version ID: " << lmp->num_ver << std::endl;
+    lmp->input->file("in.chute_wear");
+    //lmp->input->one("run 1");
+    
+    //# Try extracting a global value
+    //    print("")
+    //    print("Attempting to get the number of atoms in simulation")
+    //    numAtoms = lmp.extract_global("natoms", 0)
+    //    print("natoms =", numAtoms)
+
+    //    # Try extracting atom's positions
+    //    print("")
+    //    print("Attempting to get the atom's positions")
+    //    pos = lmp.extract_atom("x",3)
+    //    for k in range(0,numAtoms):
+    //        print("Pos[%i] = [%f, %f, %f]" % (k, pos[k][0], pos[k][1], pos[k][2]))
+
+    LAMMPS_NS::FixLbCouplingOnetoone 
+        *couplingFix 
+        = dynamic_cast<LAMMPS_NS::FixLbCouplingOnetoone*>
+        (lmp->modify->find_fix_style("couple/lb/onetoone",0));
+
+    cout << "test1\n";
+    
+    //double **t_liggghts = couplingFix->get_torque_ptr();
+    cout << "test2\n";
+
+    lmp->input->one("run 9 upto");
+
+    for (int step = 0; step < 3; step++)
+    {
+        
+
+        int numAtoms = lmp->atom->natoms;
+
+        //double** pos = (double**)lmp->atom->extract("x");
+        double** pos = lmp->atom->x;
+        
+        //double* forceX = lmp->atom->fx;
+
+        for (int i = 0; i < numAtoms; i++)
+        {
+            double **f_liggghts = couplingFix->get_force_ptr();
+            double** force = lmp->atom->f;
+            cout << "Pos[" << i << "] = [" << pos[i][0] << ", " << pos[i][1] << ", " << pos[i][2] << "]\n";
+            cout << "Force[" << i << "] = [" << f_liggghts[i][0] << ", " << f_liggghts[i][1] << ", " << f_liggghts[i][2] << "]\n";
+            f_liggghts[i][2] += 500;
+            cout << "Force[" << i << "] = [" << force[i][0] << ", " << force[i][1] << ", " << force[i][2] << "]\n";
+        }
+
+        couplingFix->comm_force_torque();
+
+        lmp->input->one("run 10");
+       
+    }
+
     // delete LAMMPS instance
     delete lmp;
 
-- 
GitLab


From fef99247c1e3a51ee11fb5d9c9dfeff0868a96d7 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin4.usr.hlrn.de>
Date: Thu, 7 Oct 2021 10:54:57 +0200
Subject: [PATCH 035/179] fix droplet test not completely

---
 apps/cpu/Multiphase/Multiphase.cpp            |   2 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    | 150 +++++++++++++-----
 src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp   |   5 +-
 src/cpu/VirtualFluidsCore/LBM/LBMKernel.h     |   2 +
 .../LBM/MultiphaseCumulantLBMKernel.cpp       |   6 +
 .../LBM/MultiphaseCumulantLBMKernel.h         |   1 +
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp |  49 ++++--
 ...aseTwoPhaseFieldsPressureFilterLBMKernel.h |   1 +
 8 files changed, 162 insertions(+), 54 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 4c5904a21..964ae20fd 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -29,7 +29,7 @@ void run(string configname)
         double densityRatio    = config.getValue<double>("densityRatio");
         double sigma           = config.getValue<double>("sigma");
         int interfaceThickness = config.getValue<int>("interfaceThickness");
-        double radius          = config.getValue<double>("radius");
+        //double radius          = config.getValue<double>("radius");
         double theta           = config.getValue<double>("contactAngle");
         double gr              = config.getValue<double>("gravity");
         double phiL            = config.getValue<double>("phi_L");
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index e022ce0c3..51a1b7be1 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -2,6 +2,11 @@
 #include <string>
 #include <memory>
 
+#if defined(__unix__)
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
 #include "VirtualFluids.h"
 
 using namespace std;
@@ -24,7 +29,7 @@ void run(string configname)
         int interfaceThickness = config.getValue<int>("interfaceThickness");
         double radius          = config.getValue<double>("radius");
         double theta           = config.getValue<double>("contactAngle");
-        double gr              = config.getValue<double>("gravity");
+        //double gr              = config.getValue<double>("gravity");
         double phiL            = config.getValue<double>("phi_L");
         double phiH            = config.getValue<double>("phi_H");
         double tauH            = config.getValue<double>("Phase-field Relaxation");
@@ -37,13 +42,11 @@ void run(string configname)
         double Re          = config.getValue<double>("Re");
         double dx          = config.getValue<double>("dx");
         bool logToFile     = config.getValue<bool>("logToFile");
-        //double restartStep = config.getValue<double>("restartStep");
-        //double cpStart     = config.getValue<double>("cpStart");
-        //double cpStep      = config.getValue<double>("cpStep");
+        double restartStep = config.getValue<double>("restartStep");
+        double cpStart     = config.getValue<double>("cpStart");
+        double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
-
-        double beta  = 12 * sigma / interfaceThickness;
-        double kappa = 1.5 * interfaceThickness * sigma;
+        double rStep = config.getValue<double>("rStep");
 
         SPtr<Communicator> comm = MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
@@ -65,6 +68,22 @@ void run(string configname)
                 UbLog::output_policy::setStream(logFilename.str());
             }
         }
+        
+        std::string fileName = "./LastTimeStep" + std::to_string((int)boundingBox[1]) + ".txt";
+
+#if defined(__unix__)
+         double lastTimeStep = 0;
+         if (!newStart) 
+         {
+             std::ifstream ifstr(fileName);
+             ifstr >> lastTimeStep;
+             restartStep = lastTimeStep;
+             if(endTime >= lastTimeStep)
+                endTime = lastTimeStep + rStep;
+             else
+                return;
+         }    
+#endif
 
         //Sleep(30000);
 
@@ -72,8 +91,49 @@ void run(string configname)
         LBMReal rhoLB = 0.0;
         LBMReal nuLB  = nuL; //(uLB*dLB) / Re;
 
+        //diameter of circular droplet
         LBMReal D  = 2.0*radius;
 
+        //density retio
+        LBMReal r_rho = densityRatio;
+
+        //density of heavy fluid
+        LBMReal rho_h = 1.0;
+        //density of light fluid
+        LBMReal rho_l = rho_h / r_rho;
+
+        //kinimatic viscosity
+        LBMReal nu_h = nuL;
+        //LBMReal nu_l = nuG;
+        //#dynamic viscosity
+        LBMReal mu_h = rho_h * nu_h;
+        
+        //gravity
+        LBMReal g_y = Re*Re*mu_h*mu_h/(rho_h*(rho_h-rho_l)*D*D*D);
+        //Eotvos number
+        LBMReal Eo = 100;
+        //surface tension
+        sigma = rho_h*g_y*D*D/Eo;
+
+        //g_y = 0;
+
+        double beta  = 12.0 * sigma / interfaceThickness;
+        double kappa = 1.5 * interfaceThickness * sigma;
+
+        if (myid == 0) {
+                //UBLOG(logINFO, "uLb = " << uLB);
+                //UBLOG(logINFO, "rho = " << rhoLB);
+                UBLOG(logINFO, "D = " << D);
+                UBLOG(logINFO, "nuL = " << nuL);
+                UBLOG(logINFO, "nuL = " << nuG);
+                UBLOG(logINFO, "Re = " << Re);
+                UBLOG(logINFO, "Eo = " << Eo);
+                UBLOG(logINFO, "g_y = " << g_y);
+                UBLOG(logINFO, "sigma = " << sigma);
+                UBLOG(logINFO, "dx = " << dx);
+                UBLOG(logINFO, "Preprocess - start");
+        }
+
         SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
 
         //const int baseLevel = 0;
@@ -84,16 +144,22 @@ void run(string configname)
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
+        mu::Parser fgr;
+        fgr.SetExpr("-(rho-rho_l)*g_y");
+        fgr.DefineConst("rho_l", rho_l);
+        fgr.DefineConst("g_y", g_y);
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(0.0);
-        kernel->setForcingX2(gr);
+        kernel->setForcingX2(fgr);
         kernel->setForcingX3(0.0);
 
         kernel->setPhiL(phiL);
         kernel->setPhiH(phiH);
         kernel->setPhaseFieldRelaxation(tauH);
         kernel->setMobility(mob);
+        kernel->setInterfaceWidth(interfaceThickness);
+
 
         kernel->setCollisionFactorMultiphase(nuL, nuG);
         kernel->setDensityRatio(densityRatio);
@@ -116,22 +182,24 @@ void run(string configname)
         grid->setDeltaX(dx);
         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
         grid->setPeriodicX1(true);
-        grid->setPeriodicX2(false);
+        grid->setPeriodicX2(true);
         grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+
         //////////////////////////////////////////////////////////////////////////
         // restart
-        //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-        ////SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-        ////SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
+        SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+        //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
         //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
-        //rcp->setNu(nuLB);
-        //rcp->setNuLG(nuL, nuG);
-        //rcp->setDensityRatio(densityRatio);
+        // rcp->setNu(nuLB);
+        // rcp->setNuLG(nuL, nuG);
+        // rcp->setDensityRatio(densityRatio);
 
-        //rcp->setLBMKernel(kernel);
-        //rcp->setBCProcessor(bcProc);
+        rcp->setLBMKernel(kernel);
+        rcp->setBCProcessor(bcProc);
         //////////////////////////////////////////////////////////////////////////
 
         if (newStart) {
@@ -151,14 +219,7 @@ void run(string configname)
                 GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
                     WbWriterVtkXmlBinary::getInstance());
 
-            if (myid == 0) {
-                UBLOG(logINFO, "uLb = " << uLB);
-                UBLOG(logINFO, "rho = " << rhoLB);
-                UBLOG(logINFO, "nuLb = " << nuLB);
-                UBLOG(logINFO, "Re = " << Re);
-                UBLOG(logINFO, "dx = " << dx);
-                UBLOG(logINFO, "Preprocess - start");
-            }
+
 
             GenBlocksGridVisitor genBlocks(gridCube);
             grid->accept(genBlocks);
@@ -175,8 +236,6 @@ void run(string configname)
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
 
-            SPtr<Grid3DVisitor> metisVisitor(
-                new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
             InteractorsHelper intHelper(grid, metisVisitor, true);
             intHelper.addInteractor(wallYminInt);
             intHelper.addInteractor(wallYmaxInt);
@@ -227,7 +286,8 @@ void run(string configname)
             // initialization of distributions
             LBMReal x1c = 2.5 * D; // (g_maxX1 - g_minX1-1)/2; //
             LBMReal x2c = 12.5 * D; //(g_maxX2 - g_minX2-1)/2;
-            LBMReal x3c = 2.5 * D; //(g_maxX3 - g_minX3-1)/2;
+            LBMReal x3c = 1.5; //2.5 * D; //(g_maxX3 - g_minX3-1)/2;
+            //LBMReal x3c = 2.5 * D;
             mu::Parser fct1;
             fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
             fct1.DefineConst("x1c", x1c);
@@ -274,8 +334,8 @@ void run(string configname)
                 UBLOG(logINFO, "path = " << pathname);
             }
 
-            //rcp->restart((int)restartStep);
-            //grid->setTimeStep(restartStep);
+            rcp->restart((int)restartStep);
+            grid->setTimeStep(restartStep);
 
             if (myid == 0)
                 UBLOG(logINFO, "Restart - end");
@@ -283,8 +343,8 @@ void run(string configname)
 
         grid->accept(bcVisitor);
 
-        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        //grid->accept(setConnsVisitor);
+        // TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        // grid->accept(setConnsVisitor);
 
         ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
@@ -292,9 +352,8 @@ void run(string configname)
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-        pp->process(0);
-        //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(
-        //    grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+        if(grid->getTimeStep() == 0) 
+            pp->process(0);
 
         SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
         SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
@@ -305,7 +364,7 @@ void run(string configname)
         SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
         calculator->addCoProcessor(npr);
         calculator->addCoProcessor(pp);
-        //calculator->addCoProcessor(rcp);
+        calculator->addCoProcessor(rcp);
 
 
 
@@ -314,6 +373,25 @@ void run(string configname)
         calculator->calculate();
         if (myid == 0)
             UBLOG(logINFO, "Simulation-end");
+            
+#if defined(__unix__)
+         if (!newStart) 
+         {
+            if (myid == 0) 
+            {
+                std::ofstream ostr(fileName);
+                ostr << endTime;
+                cout << "start sbatch\n";
+                //system("./start.sh");
+                //system("echo test!");
+                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
+                //system("sbatch startJob512.sh");
+                system(str.c_str());
+            }   
+            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
+         }
+#endif
+
     } catch (std::exception &e) {
         cerr << e.what() << endl << flush;
     } catch (std::string &s) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp
index f3d168733..92a475c1e 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp
@@ -111,12 +111,13 @@ void LBMKernel::setForcingX3(const std::string &muParserString)
 //////////////////////////////////////////////////////////////////////////
 void LBMKernel::checkFunction(mu::Parser fct)
 {
-    double x1 = 1.0, x2 = 1.0, x3 = 1.0, dt = 1.0, nue = 1.0;
+    double x1 = 1.0, x2 = 1.0, x3 = 1.0, dt = 1.0, nue = 1.0, rho = 1.0;
     fct.DefineVar("x1", &x1);
     fct.DefineVar("x2", &x2);
     fct.DefineVar("x3", &x3);
     fct.DefineVar("dt", &dt);
     fct.DefineVar("nue", &nue);
+    fct.DefineVar("rho", &rho);
 
     try {
         fct.Eval();
@@ -231,3 +232,5 @@ double LBMKernel::getPhaseFieldRelaxation() const { return tauH; }
 //////////////////////////////////////////////////////////////////////////
 void LBMKernel::setMobility(double mob) { this->mob = mob; }
 //////////////////////////////////////////////////////////////////////////
+void LBMKernel::setInterfaceWidth(double w) { this->interfaceWidth = w; }
+//////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
index 5c3e06765..2c65e4d76 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
@@ -128,6 +128,7 @@ public:
     void setPhaseFieldRelaxation(double tauH);
     double getPhaseFieldRelaxation() const;
     void setMobility(double mob);
+    void setInterfaceWidth(double w);
 
 protected:
     SPtr<DataSet3D> dataSet;
@@ -163,6 +164,7 @@ protected:
     LBMReal phiH;
     LBMReal tauH;
     LBMReal mob;
+    LBMReal interfaceWidth;
 
 private:
     void checkFunction(mu::Parser fct);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
index e09230117..5cfee04e4 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
@@ -248,6 +248,12 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                             // muX2 = static_cast<double>(x2-1+ix2*maxX2);
                             // muX3 = static_cast<double>(x3-1+ix3*maxX3);
 
+                            muForcingX1.DefineVar("rho",&muRho); 
+				            muForcingX2.DefineVar("rho",&muRho); 
+				            muForcingX3.DefineVar("rho",&muRho); 
+
+				            muRho = rho;
+
                             forcingX1 = muForcingX1.Eval();
                             forcingX2 = muForcingX2.Eval();
                             forcingX3 = muForcingX3.Eval();
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h
index 0985242ba..fdc47f340 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h
@@ -91,6 +91,7 @@ protected:
    mu::value_type muX1,muX2,muX3;
    mu::value_type muDeltaT;
    mu::value_type muNu;
+   mu::value_type muRho;
    LBMReal forcingX1;
    LBMReal forcingX2;
    LBMReal forcingX3;
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 6ffbdb498..846dd8272 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -73,6 +73,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::clone()
     kernel->setPhiH(this->phiH);
     kernel->setPhaseFieldRelaxation(this->tauH);
     kernel->setMobility(this->mob);
+	kernel->setInterfaceWidth(this->interfaceWidth);
 
     kernel->setBCProcessor(bcProcessor->clone(kernel));
     kernel->setWithForcing(withForcing);
@@ -139,7 +140,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
     forcingX2 = 0.0;
     forcingX3 = 0.0;
 
-	LBMReal oneOverInterfaceScale = 1.0;//1.5;
+	LBMReal oneOverInterfaceScale = c4 / interfaceWidth; //1.0;//1.5;
     /////////////////////////////////////
 
     localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
@@ -215,7 +216,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                         LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
-						LBMReal testPhi1 = (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+						(*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
                                                     (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
                                                     ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
                                                     (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
@@ -248,7 +249,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
                         mfcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                         mfbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
-						LBMReal testPhi2 = (*phaseField2)(x1, x2, x3) =
+						(*phaseField2)(x1, x2, x3) =
                             (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) +
                             (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
                              ((mfbaa + mfbac) + (mfbca + mfbcc))) +
@@ -604,9 +605,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   LBMReal rhoRef=c1;
 
 			  //LBMReal 
-			   LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-				   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-				   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+			//    LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+			// 	   + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+			// 	   + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 			   LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 				   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -702,11 +703,11 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   //Viscosity increase by pressure gradient
 			   LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
-			   LBMReal limVis = 0.0000001*10;//0.01;
+			   //LBMReal limVis = 0.0000001*10;//0.01;
 			  // collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
 			  // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
 			   errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
-			   collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+			   //collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
 
 			   //3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
 			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
@@ -721,9 +722,15 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				  // forcingX2 = muForcingX2.Eval() + c1o3*drho*dX2_phi * rhoToPhi / rho;//-gradPy/rho;
 				   //forcingX3 = muForcingX3.Eval() + c1o3*drho*dX3_phi * rhoToPhi / rho;//-gradPz/rho;
 
-				   forcingX1 = muForcingX1.Eval() -gradPx/rho;
-				   forcingX2 = muForcingX2.Eval() -gradPy/rho;
-				   forcingX3 = muForcingX3.Eval() -gradPz/rho;
+				   muForcingX1.DefineVar("rho",&muRho); 
+				   muForcingX2.DefineVar("rho",&muRho); 
+				   muForcingX3.DefineVar("rho",&muRho); 
+
+				   muRho = rho;
+
+				   forcingX1 = muForcingX1.Eval()/rho - gradPx/rho;
+				   forcingX2 = muForcingX2.Eval()/rho - gradPy/rho;
+				   forcingX3 = muForcingX3.Eval()/rho - gradPz/rho;
 
 				   //LBMReal rho_m = 1.0 / densityRatio;
 				   //forcingX1 = forcingX1 * (rho - rho_m);
@@ -737,9 +744,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 
 			   ///surface tension force
-			   vvx += mu * dX1_phi*c1o2;
-			   vvy += mu * dX2_phi * c1o2 ;
-			   vvz += mu * dX3_phi * c1o2;
+			   vvx += mu * dX1_phi * c1o2 / rho;
+			   vvy += mu * dX2_phi * c1o2 / rho ;
+			   vvz += mu * dX3_phi * c1o2 / rho;
 
 			   //////classic source term
 			   ///----Classic source term 8.4.2021
@@ -1251,7 +1258,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-			   LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
@@ -1288,6 +1295,14 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				   + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
 					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
 
+				///storing pre collision second moments
+				LBMReal mbxx = mfcaa;
+				LBMReal mbyy = mfaca;
+				LBMReal mbzz = mfaac;
+				LBMReal mbxy = mfbba;
+				LBMReal mbxz = mfbab;
+				LBMReal mbyz = mfabb;
+
 			   //2.
 			   // linear combinations
 			   LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
@@ -1453,7 +1468,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   mfaba = -mfaba;
 			   mfaab = -mfaab;
 			   //////////////////////////////////////////////////////////////////////////////////////
-
+			   mfbaa += -rho * rhoToPhi * c1o2 * ((mbxx + mfcaa) * dX1_phi + (mbxy + mfbba) * dX2_phi + (mbxz + mfbab) * dX3_phi);
+			   mfaba += -rho * rhoToPhi * c1o2 * ((mbxy + mfbba) * dX1_phi + (mbyy + mfaca) * dX2_phi + (mbyz + mfabb) * dX3_phi);
+			   mfaab += -rho * rhoToPhi * c1o2 * ((mbxz + mfbab) * dX1_phi + (mbyz + mfabb) * dX2_phi + (mbzz + mfaac) * dX3_phi);
 			   ////////////////////////////////////////////////////////////////////////////////////
 			   //back
 			   ////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
index 4ea4492a7..302aaf508 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
@@ -112,6 +112,7 @@ protected:
    mu::value_type muX1,muX2,muX3;
    mu::value_type muDeltaT;
    mu::value_type muNu;
+   mu::value_type muRho;
    LBMReal forcingX1;
    LBMReal forcingX2;
    LBMReal forcingX3;
-- 
GitLab


From 0247591a6e9d1fe6713b6a77af37ee9eed69b9ac Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 13 Oct 2021 15:10:27 +0200
Subject: [PATCH 036/179] test momentum conservation for new phase field model

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg | 30 +++++++++---------
 apps/cpu/MultiphaseDropletTest/droplet.cpp    | 31 ++++++++++---------
 ...ultiphaseInitDistributionsBlockVisitor.cpp | 12 ++++---
 .../MultiphaseInitDistributionsBlockVisitor.h |  2 +-
 4 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 78b53897a..174066574 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,33 +1,33 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTest
+pathname = E:/Multiphase/DropletTestImpVel-Hesam2
 
 numOfThreads = 4
 availMem = 10e9
 
 #Grid
 
-boundingBox = 0 50 0 150 0 50
-blocknx = 10 10 10
+boundingBox = 0 256 512 768 0 3
+blocknx = 16 16 3
 
 dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0#0.01#0.005#0.005 
+uLB = 0.01#0.005#0.005 
 Re = 10
-nuL = 1e-3 #1e-5# 1.0e-5 #!1e-2
-nuG = 1e-6 # 1e-8 # 1.16e-4 #!1e-2
+nuL = 1e-2 #1e-5# 1.0e-5 #!1e-2
+nuG = 0.015811388300841892 #5e-2 #1e-4 # 1e-8 # 1.16e-4 #!1e-2
 densityRatio = 10
-sigma = 1.111111111111111e-07 #1e-10 #1e-6  # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
-interfaceThickness = 5
-radius = 5 #16
+sigma = 1.0850694444444444e-06 #1e-10 #1e-6  # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+interfaceThickness = 4.096
+radius = 25.6
 contactAngle = 110.0
 #gravity = 0.0
-gravity = -1.111111111111111e-07 #-5.04e-6
+gravity = -1.0348028606838648e-08 #-5.04e-6
 phi_L = 0.0
 phi_H = 1.0
 Phase-field Relaxation = 0.6
-Mobility = 0.1 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
+Mobility = 0.056 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
 
 
 logToFile = false
@@ -35,8 +35,10 @@ logToFile = false
 newStart = true
 restartStep = 100000
 
-cpStart = 100000
-cpStep = 100000
+cpStart = 1000
+cpStep = 1000
 
 outTime = 100
-endTime = 1000000
\ No newline at end of file
+endTime = 10000
+
+rStep = 159990 #160000
\ No newline at end of file
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 51a1b7be1..269544600 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -141,18 +141,18 @@ void run(string configname)
         SPtr<LBMKernel> kernel;
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
-        //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
-        mu::Parser fgr;
-        fgr.SetExpr("-(rho-rho_l)*g_y");
-        fgr.DefineConst("rho_l", rho_l);
-        fgr.DefineConst("g_y", g_y);
+        //mu::Parser fgr;
+        //fgr.SetExpr("-(rho-rho_l)*g_y");
+        //fgr.DefineConst("rho_l", rho_l);
+        //fgr.DefineConst("g_y", g_y);
 
-        kernel->setWithForcing(true);
-        kernel->setForcingX1(0.0);
-        kernel->setForcingX2(fgr);
-        kernel->setForcingX3(0.0);
+        //kernel->setWithForcing(true);
+        //kernel->setForcingX1(0.0);
+        //kernel->setForcingX2(fgr);
+        //kernel->setForcingX3(0.0);
 
         kernel->setPhiL(phiL);
         kernel->setPhiH(phiH);
@@ -184,7 +184,7 @@ void run(string configname)
         grid->setPeriodicX1(true);
         grid->setPeriodicX2(true);
         grid->setPeriodicX3(true);
-        grid->setGhostLayerWidth(2);
+        grid->setGhostLayerWidth(1);
 
         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
 
@@ -306,6 +306,7 @@ void run(string configname)
             fct2.DefineConst("interfaceThickness", interfaceThickness);
 
             MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
+            //MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
             initVisitor.setPhi(fct1);
             initVisitor.setVx1(fct2);
             grid->accept(initVisitor);
@@ -343,12 +344,12 @@ void run(string configname)
 
         grid->accept(bcVisitor);
 
-        // TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        // grid->accept(setConnsVisitor);
-
-        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
+        //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //grid->accept(setConnsVisitor);
+
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index a59e8d476..3df7fbcc9 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -50,13 +50,13 @@ MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor
 	this->setRho(0.0);
 }
 //////////////////////////////////////////////////////////////////////////
-MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1, LBMReal vx2, LBMReal vx3)
+MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1, LBMReal vx2, LBMReal vx3, LBMReal rho)
 	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) 
 {
 	this->setVx1(vx1);
 	this->setVx2(vx2);
 	this->setVx3(vx3);
-}
+	this->setRho(rho);}
 //////////////////////////////////////////////////////////////////////////
 void MultiphaseInitDistributionsBlockVisitor::setVx1( const mu::Parser& parser)  
 { 
@@ -194,7 +194,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 
 					
 					p1  = 0.0;
-					//p1 = muRho.Eval();
+					p1 = muRho.Eval();
 					vx1 = muVx1.Eval();
 					vx2 = muVx2.Eval();
 					vx3 = muVx3.Eval();
@@ -220,8 +220,10 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 						LBMReal gamma = WEIGTH[dir]*(3*velProd + 4.5*velSq1 - 1.5*(vx1Sq+vx2Sq+vx3Sq));
 
 						feq[dir] = rho*WEIGTH[dir]*(1 + 3*velProd + 4.5*velSq1 - 1.5*(vx1Sq+vx2Sq+vx3Sq));
-						//geq[dir] = p1*WEIGTH1[dir] + gamma;
-						geq[dir] = p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma*rho;
+						//geq[dir] = p1*WEIGTH[dir] + gamma;
+						//geq[dir] = p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma*rho;
+						//geq[dir] = (p1*WEIGTH[dir]/(rho*UbMath::c1o3) + gamma*rho)*UbMath::c1o3;
+						geq[dir] = (gamma*rho)*UbMath::c1o3;
 					}
 
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
index e351b901c..6ff60387d 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h
@@ -56,7 +56,7 @@ public:
 	//! \param vx1 - velocity in x
 	//! \param vx2 - velocity in y
 	//! \param vx3 - velocity in z
-	MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0);
+	MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0, LBMReal rho=0.0);
 	//////////////////////////////////////////////////////////////////////////
 	//automatic vars are: x1,x2, x3
 	//ussage example: setVx1("x1*0.01+x2*0.003")
-- 
GitLab


From 0ff440b98c76bd41bf1d9e349725ba9fae1b0f5a Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin3.usr.hlrn.de>
Date: Wed, 13 Oct 2021 16:15:14 +0200
Subject: [PATCH 037/179] fix torque calculation

---
 apps/cpu/ViskomatXL/viskomat.cpp              |  9 +++--
 .../CalculateTorqueCoProcessor.cpp            | 36 +++++++++----------
 .../D3Q27TriFaceMeshInteractor.cpp            |  3 +-
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 3beef8dd3..ff396a57e 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -32,6 +32,7 @@ void bflow(string configname)
       double          OmegaLB = config.getValue<double>("OmegaLB");
       double          tau0 = config.getValue<double>("tau0");
       double          N = config.getValue<double>("N");
+      double          mu = config.getValue<double>("mu");
 
 
       ConfigurationFile   viscosity;
@@ -61,14 +62,15 @@ void bflow(string configname)
 
       //double N  = 70; //rpm
       double Omega = 2 * UbMath::PI / 60.0 * N; //rad/s
-      double mu    = 1; //Pa s
+      //double mu    = 5; //Pa s
       double R     = 0.165 / 2.0; //m
       double rho   = 970; //kg/m^3
       double Re    = Omega * R * R * rho / mu;
 
       //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
 
-      double nuLB = OmegaLB * (R / deltax)*(R / deltax) / Re;
+      double dx = deltax * 1e-3;
+      double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
 
       SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
 
@@ -244,12 +246,13 @@ void bflow(string configname)
          UBLOG(logINFO, "Parameters:");
          UBLOG(logINFO, "N = " << N << " rpm");
          UBLOG(logINFO, "Omega = " << Omega << " rad/s");
+         UBLOG(logINFO, "mu = " << mu << " Pa s");
          UBLOG(logINFO, "Re = " << Re);
          UBLOG(logINFO, "rho = " << rhoLB);
          UBLOG(logINFO, "uLB = " << OmegaLB);
          UBLOG(logINFO, "nuLB = " << nuLB);
          UBLOG(logINFO, "tau0 = " << tau0);
-         UBLOG(logINFO, "deltax = " << deltax);
+         UBLOG(logINFO, "deltax = " << deltax << " mm");
          UBLOG(logINFO, "number of levels = " << refineLevel + 1);
          UBLOG(logINFO, "number of threads = " << numOfThreads);
          UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index 9fd6e8c28..e1b063141 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -196,9 +196,9 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
 
    LBMReal fs[D3Q27System::ENDF + 1];
    distributions->getDistributionInv(fs, x1, x2, x3);
-   LBMReal rho = 0.0, vx1 = 0.0, vx2 = 0.0, vx3 = 0.0, drho = 0.0;
+   LBMReal /*rho = 0.0,*/ vx1 = 0.0, vx2 = 0.0, vx3 = 0.0, drho = 0.0;
    calcMacrosFct(fs, drho, vx1, vx2, vx3);
-   rho = 1.0 + drho * compressibleFactor;
+   //rho = 1.0 + drho * compressibleFactor;
    
    if(bc)
    {
@@ -216,22 +216,22 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
             f = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1, x2, x3, invDir);
             fnbr = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
 
-            Vector3D boundaryVelocity;
-            boundaryVelocity[0] = bc->getBoundaryVelocityX1();
-            boundaryVelocity[1] = bc->getBoundaryVelocityX2();
-            boundaryVelocity[2] = bc->getBoundaryVelocityX3();
-            double correction[3] = { 0.0, 0.0, 0.0 };
-            if (bc->hasVelocityBoundaryFlag(fdir))
-            {
-               const double forceTerm = f - fnbr;
-               correction[0] = forceTerm * boundaryVelocity[0];
-               correction[1] = forceTerm * boundaryVelocity[1];
-               correction[2] = forceTerm * boundaryVelocity[2];
-            }
-
-            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
-            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
-            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir] - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
+            // Vector3D boundaryVelocity;
+            // boundaryVelocity[0] = bc->getBoundaryVelocityX1();
+            // boundaryVelocity[1] = bc->getBoundaryVelocityX2();
+            // boundaryVelocity[2] = bc->getBoundaryVelocityX3();
+            //double correction[3] = { 0.0, 0.0, 0.0 };
+            // if (bc->hasVelocityBoundaryFlag(fdir))
+            // {
+            //    const double forceTerm = f - fnbr;
+            //    correction[0] = forceTerm * boundaryVelocity[0];
+            //    correction[1] = forceTerm * boundaryVelocity[1];
+            //    correction[2] = forceTerm * boundaryVelocity[2];
+            // }
+
+            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
+            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
+            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
          }
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
index 37c6c47f0..452042791 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
@@ -522,7 +522,8 @@ void D3Q27TriFaceMeshInteractor::setQs(const double &timeStep)
                                         bc = SPtr<BoundaryConditions>(new BoundaryConditions);
                                         ;
                                         bcMatrix->setBC(ix1, ix2, ix3, bc);
-                                    } else if (UbMath::less(bc->getQ(fdir), q)) // schon ein kuerzeres q voehanden?
+                                    } else if (UbMath::less(bc->getQ(fdir), q) &&
+                                               UbMath::equal(-999.0, q)) // schon ein kuerzeres q voehanden?
                                     {
                                         // neu:: 18.05.2010
                                         // um falsche qs die evtl durch die "wand" gehen zu vermeiden
-- 
GitLab


From c9425d7971f353738c76c8991a969fa5988ac5be Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin3.usr.hlrn.de>
Date: Wed, 13 Oct 2021 17:13:43 +0200
Subject: [PATCH 038/179] resolve merge conflicts

---
 apps/cpu/Applications.cmake                   |  1 -
 apps/cpu/LaminarTubeFlow/ltf.cpp              |  2 +-
 .../CalculateTorqueCoProcessor.cpp            | 19 -------------------
 .../D3Q27TriFaceMeshInteractor.cpp            |  4 ----
 4 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index 88ada0577..e8902e5ff 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -5,7 +5,6 @@ add_subdirectory(${APPS_ROOT_CPU}/rheometer)
 add_subdirectory(${APPS_ROOT_CPU}/CouetteFlow)
 add_subdirectory(${APPS_ROOT_CPU}/Multiphase)
 add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL)
-add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL_2)
 add_subdirectory(${APPS_ROOT_CPU}/sphere)
 add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index 82f6c0063..c8c8e6cfd 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -73,7 +73,7 @@ void run(string configname)
       denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
       //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
 
-      double startTime = 5;
+      //double startTime = 5;
       mu::Parser fct1;
       fct1.SetExpr("U");
       fct1.DefineConst("U", uLB);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index d9379cb64..1daa28cba 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -224,7 +224,6 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
             f = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1, x2, x3, invDir);
             fnbr = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
 
-<<<<<<< HEAD
             // Vector3D boundaryVelocity;
             // boundaryVelocity[0] = bc->getBoundaryVelocityX1();
             // boundaryVelocity[1] = bc->getBoundaryVelocityX2();
@@ -241,24 +240,6 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
             forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
             forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
             forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
-=======
-            Vector3D boundaryVelocity;
-            boundaryVelocity[0] = bc->getBoundaryVelocityX1();
-            boundaryVelocity[1] = bc->getBoundaryVelocityX2();
-            boundaryVelocity[2] = bc->getBoundaryVelocityX3();
-            double correction[3] = { 0.0, 0.0, 0.0 };
-            if (bc->hasVelocityBoundaryFlag(fdir))
-            {
-               const double forceTerm = f - fnbr;
-               correction[0] = forceTerm * boundaryVelocity[0];
-               correction[1] = forceTerm * boundaryVelocity[1];
-               correction[2] = forceTerm * boundaryVelocity[2];
-            }
-
-            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
-            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
-            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];// -2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
->>>>>>> 27138b35e2fb7db7637caf13179316787ebf7cc7
          }
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
index b7ca47e56..452042791 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
@@ -523,11 +523,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const double &timeStep)
                                         ;
                                         bcMatrix->setBC(ix1, ix2, ix3, bc);
                                     } else if (UbMath::less(bc->getQ(fdir), q) &&
-<<<<<<< HEAD
                                                UbMath::equal(-999.0, q)) // schon ein kuerzeres q voehanden?
-=======
-                                        UbMath::equal(-999.0, q)) // schon ein kuerzeres q voehanden?
->>>>>>> 27138b35e2fb7db7637caf13179316787ebf7cc7
                                     {
                                         // neu:: 18.05.2010
                                         // um falsche qs die evtl durch die "wand" gehen zu vermeiden
-- 
GitLab


From a5891e8d8d13fdfae1ccdd846777fdc98f654c10 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 15 Oct 2021 15:22:29 +0200
Subject: [PATCH 039/179] include LIGGGHTS coupling in VirtualFluids

---
 .../cmake_config_files/BOMBADIL.config.cmake  |   9 +
 apps/cpu/LiggghtsApp/CMakeLists.txt           |   2 +-
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          | 342 +-----------
 cpu.cmake                                     |   6 +
 src/cpu/LiggghtsCoupling/CMakeLists.txt       |  10 +
 .../LiggghtsCoupling/LiggghtsCoProcessor.cpp  | 523 ++++++++++++++++++
 .../LiggghtsCoupling/LiggghtsCoProcessor.h    | 149 +++++
 src/cpu/VirtualFluidsCore/CMakeLists.txt      |   2 +
 8 files changed, 710 insertions(+), 333 deletions(-)
 create mode 100644 src/cpu/LiggghtsCoupling/CMakeLists.txt
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h

diff --git a/CMake/cmake_config_files/BOMBADIL.config.cmake b/CMake/cmake_config_files/BOMBADIL.config.cmake
index c0c5cf2f0..9c4bd4ecf 100644
--- a/CMake/cmake_config_files/BOMBADIL.config.cmake
+++ b/CMake/cmake_config_files/BOMBADIL.config.cmake
@@ -26,6 +26,15 @@ SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stageMSVC64/lib")
 #################################################################################
 set(VTK_DIR "d:/Tools/VTK/build/VTK-8.0.0")
 
+#################################################################################
+#  LIGGGHTS  
+#################################################################################
+set(LIGGGHTS_SOURCE_DIR "d:/Tools/LIGGGHTS/src")
+set(LIGGGHTS_DEBUG_LIBRARY "d:/Tools/LIGGGHTS/build/Debug/liggghts.lib")
+set(LIGGGHTS_RELEASE_LIBRARY "d:/Tools/LIGGGHTS/build/Release/liggghts.lib")
+
+
+
 #################################################################################
 #  METIS  
 #################################################################################
diff --git a/apps/cpu/LiggghtsApp/CMakeLists.txt b/apps/cpu/LiggghtsApp/CMakeLists.txt
index ac8f9ef9a..f3a2d925f 100644
--- a/apps/cpu/LiggghtsApp/CMakeLists.txt
+++ b/apps/cpu/LiggghtsApp/CMakeLists.txt
@@ -1,3 +1,3 @@
 PROJECT(LiggghtsApp)
 
-vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES LiggghtsApp.cpp )
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling FILES LiggghtsApp.cpp )
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index e1282a333..be4cc2470 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -10,337 +10,13 @@
 #include "modify.h"
 #include "fix_lb_coupling_onetoone.h"
 
+#include "LiggghtsCoProcessor.h"
+
 using namespace std;
 
-//void run(string configname)
-//{
-//    try {
-//        ConfigurationFile config;
-//        config.load(configname);
-//
-//        string pathname            = config.getValue<string>("pathname");
-//        int numOfThreads           = config.getValue<int>("numOfThreads");
-//        vector<int> blocknx        = config.getVector<int>("blocknx");
-//        vector<double> boundingBox = config.getVector<double>("boundingBox");
-//        double uLB             = config.getValue<double>("uLB");
-//        double nuL             = config.getValue<double>("nuL");
-//        double nuG             = config.getValue<double>("nuG");
-//        double densityRatio    = config.getValue<double>("densityRatio");
-//        double sigma           = config.getValue<double>("sigma");
-//        int interfaceThickness = config.getValue<int>("interfaceThickness");
-//        double radius          = config.getValue<double>("radius");
-//        double theta           = config.getValue<double>("contactAngle");
-//        double gr              = config.getValue<double>("gravity");
-//        double phiL            = config.getValue<double>("phi_L");
-//        double phiH            = config.getValue<double>("phi_H");
-//        double tauH            = config.getValue<double>("Phase-field Relaxation");
-//        double mob             = config.getValue<double>("Mobility");
-//
-//        double endTime     = config.getValue<double>("endTime");
-//        double outTime     = config.getValue<double>("outTime");
-//        double availMem    = config.getValue<double>("availMem");
-//        int refineLevel    = config.getValue<int>("refineLevel");
-//        double Re          = config.getValue<double>("Re");
-//        double dx          = config.getValue<double>("dx");
-//        bool logToFile     = config.getValue<bool>("logToFile");
-//        //double restartStep = config.getValue<double>("restartStep");
-//        //double cpStart     = config.getValue<double>("cpStart");
-//        //double cpStep      = config.getValue<double>("cpStep");
-//        bool newStart      = config.getValue<bool>("newStart");
-//
-//        double beta  = 12 * sigma / interfaceThickness;
-//        double kappa = 1.5 * interfaceThickness * sigma;
-//
-//        SPtr<Communicator> comm = MPICommunicator::getInstance();
-//        int myid                = comm->getProcessID();
-//
-//        if (myid == 0)
-//            UBLOG(logINFO, "Droplet Test: Start!");
-//
-//        if (logToFile) {
-//#if defined(__unix__)
-//            if (myid == 0) {
-//                const char *str = pathname.c_str();
-//                mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-//            }
-//#endif
-//
-//            if (myid == 0) {
-//                stringstream logFilename;
-//                logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-//                UbLog::output_policy::setStream(logFilename.str());
-//            }
-//        }
-//
-//        //Sleep(30000);
-//
-//        // LBMReal dLB = 0; // = length[1] / dx;
-//        LBMReal rhoLB = 0.0;
-//        LBMReal nuLB  = nuL; //(uLB*dLB) / Re;
-//
-//        LBMReal D  = 2.0*radius;
-//
-//        SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
-//
-//        //const int baseLevel = 0;
-//
-//        SPtr<LBMKernel> kernel;
-//
-//        //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
-//        //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-//        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
-//
-//
-//        kernel->setWithForcing(true);
-//        kernel->setForcingX1(0.0);
-//        kernel->setForcingX2(gr);
-//        kernel->setForcingX3(0.0);
-//
-//        kernel->setPhiL(phiL);
-//        kernel->setPhiH(phiH);
-//        kernel->setPhaseFieldRelaxation(tauH);
-//        kernel->setMobility(mob);
-//
-//        kernel->setCollisionFactorMultiphase(nuL, nuG);
-//        kernel->setDensityRatio(densityRatio);
-//        kernel->setMultiphaseModelParameters(beta, kappa);
-//        kernel->setContactAngle(theta);
-//
-//        SPtr<BCProcessor> bcProc(new BCProcessor());
-//        // BCProcessorPtr bcProc(new ThinWallBCProcessor());
-//
-//        kernel->setBCProcessor(bcProc);
-//
-//        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-//        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
-//        //////////////////////////////////////////////////////////////////////////////////
-//        // BC visitor
-//        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
-//        bcVisitor.addBC(noSlipBCAdapter);
-//
-//        SPtr<Grid3D> grid(new Grid3D(comm));
-//        grid->setDeltaX(dx);
-//        grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-//        grid->setPeriodicX1(true);
-//        grid->setPeriodicX2(false);
-//        grid->setPeriodicX3(true);
-//        grid->setGhostLayerWidth(2);
-//
-//        //////////////////////////////////////////////////////////////////////////
-//        // restart
-//        //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-//        ////SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-//        ////SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, pathname, comm));
-//        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
-//        //rcp->setNu(nuLB);
-//        //rcp->setNuLG(nuL, nuG);
-//        //rcp->setDensityRatio(densityRatio);
-//
-//        //rcp->setLBMKernel(kernel);
-//        //rcp->setBCProcessor(bcProc);
-//        //////////////////////////////////////////////////////////////////////////
-//
-//        if (newStart) {
-//
-//            // bounding box
-//            double g_minX1 = boundingBox[0];
-//            double g_minX2 = boundingBox[2];
-//            double g_minX3 = boundingBox[4];
-//
-//            double g_maxX1 = boundingBox[1];
-//            double g_maxX2 = boundingBox[3];
-//            double g_maxX3 = boundingBox[5];
-//
-//            // geometry
-//            SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-//            if (myid == 0)
-//                GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
-//                    WbWriterVtkXmlBinary::getInstance());
-//
-//            if (myid == 0) {
-//                UBLOG(logINFO, "uLb = " << uLB);
-//                UBLOG(logINFO, "rho = " << rhoLB);
-//                UBLOG(logINFO, "nuLb = " << nuLB);
-//                UBLOG(logINFO, "Re = " << Re);
-//                UBLOG(logINFO, "dx = " << dx);
-//                UBLOG(logINFO, "Preprocess - start");
-//            }
-//
-//            GenBlocksGridVisitor genBlocks(gridCube);
-//            grid->accept(genBlocks);
-//
-//            double dx2 = 2.0 * dx;
-//            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
-//            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
-//            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
-//            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
-//
-//            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-//            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-// 
-//            SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
-//                grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-//
-//            SPtr<Grid3DVisitor> metisVisitor(
-//                new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
-//            InteractorsHelper intHelper(grid, metisVisitor, true);
-//            intHelper.addInteractor(wallYminInt);
-//            intHelper.addInteractor(wallYmaxInt);
-//            intHelper.selectBlocks();
-//
-//            ppblocks->process(0);
-//            ppblocks.reset();
-//
-//            unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-//            int ghostLayer                    = 5;
-//            unsigned long long numberOfNodesPerBlock =
-//                (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
-//            unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-//            unsigned long long numberOfNodesPerBlockWithGhostLayer =
-//                numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-//            double needMemAll =
-//                double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-//            double needMem = needMemAll / double(comm->getNumberOfProcesses());
-//
-//            if (myid == 0) {
-//                UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-//                UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-//                int minInitLevel = grid->getCoarsestInitializedLevel();
-//                int maxInitLevel = grid->getFinestInitializedLevel();
-//                for (int level = minInitLevel; level <= maxInitLevel; level++) {
-//                    int nobl = grid->getNumberOfBlocks(level);
-//                    UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-//                    UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
-//                }
-//                UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-//                UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-//                UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-//            }
-//
-//            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
-//                needMem);
-//
-//            grid->accept(kernelVisitor);
-//
-//            if (refineLevel > 0) {
-//                SetUndefinedNodesBlockVisitor undefNodesVisitor;
-//                grid->accept(undefNodesVisitor);
-//            }
-//
-//
-//            intHelper.setBC();
-//
-//            // initialization of distributions
-//            LBMReal x1c = 2.5 * D; // (g_maxX1 - g_minX1-1)/2; //
-//            LBMReal x2c = 12.5 * D; //(g_maxX2 - g_minX2-1)/2;
-//            LBMReal x3c = 2.5 * D; //(g_maxX3 - g_minX3-1)/2;
-//            mu::Parser fct1;
-//            fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
-//            fct1.DefineConst("x1c", x1c);
-//            fct1.DefineConst("x2c", x2c);
-//            fct1.DefineConst("x3c", x3c);
-//            fct1.DefineConst("radius", radius);
-//            fct1.DefineConst("interfaceThickness", interfaceThickness);
-//
-//            mu::Parser fct2;
-//            fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
-//            fct2.DefineConst("uLB", uLB);
-//            fct2.DefineConst("x1c", x1c);
-//            fct2.DefineConst("x2c", x2c);
-//            fct2.DefineConst("x3c", x3c);
-//            fct2.DefineConst("radius", radius);
-//            fct2.DefineConst("interfaceThickness", interfaceThickness);
-//
-//            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
-//            initVisitor.setPhi(fct1);
-//            initVisitor.setVx1(fct2);
-//            grid->accept(initVisitor);
-//
-//            // boundary conditions grid
-//            {
-//                SPtr<UbScheduler> geoSch(new UbScheduler(1));
-//                SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
-//                    grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-//                ppgeo->process(0);
-//                ppgeo.reset();
-//            }
-//
-//            if (myid == 0)
-//                UBLOG(logINFO, "Preprocess - end");
-//        } else {
-//            if (myid == 0) {
-//                UBLOG(logINFO, "Parameters:");
-//                UBLOG(logINFO, "uLb = " << uLB);
-//                UBLOG(logINFO, "rho = " << rhoLB);
-//                UBLOG(logINFO, "nuLb = " << nuLB);
-//                UBLOG(logINFO, "Re = " << Re);
-//                UBLOG(logINFO, "dx = " << dx);
-//                UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-//                UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-//                UBLOG(logINFO, "path = " << pathname);
-//            }
-//
-//            //rcp->restart((int)restartStep);
-//            //grid->setTimeStep(restartStep);
-//
-//            if (myid == 0)
-//                UBLOG(logINFO, "Restart - end");
-//        }
-//
-//        grid->accept(bcVisitor);
-//
-//        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-//        //grid->accept(setConnsVisitor);
-//
-//        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
-//        grid->accept(setConnsVisitor);
-//
-//        SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-//        SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
-//            grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-//        pp->process(0);
-//        //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(
-//        //    grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-//
-//        SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-//        SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-//
-//        omp_set_num_threads(numOfThreads);
-//
-//        SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-//        SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-//        calculator->addCoProcessor(npr);
-//        calculator->addCoProcessor(pp);
-//        //calculator->addCoProcessor(rcp);
-//
-//
-//
-//        if (myid == 0)
-//            UBLOG(logINFO, "Simulation-start");
-//        calculator->calculate();
-//        if (myid == 0)
-//            UBLOG(logINFO, "Simulation-end");
-//    } catch (std::exception &e) {
-//        cerr << e.what() << endl << flush;
-//    } catch (std::string &s) {
-//        cerr << s << endl;
-//    } catch (...) {
-//        cerr << "unknown exception" << endl;
-//    }
-//}
+
 int main(int argc, char *argv[])
 {
-	//void* lmp;
- //   lammps_open_no_mpi(argc, argv, &lmp);
- //   // Sleep(30000);
- //   if (argv != NULL) {
- //       if (argv[1] != NULL) {
- //           run(string(argv[1]));
- //       } else {
- //           cout << "Configuration file is missing!" << endl;
- //       }
- //   }
-	
 	LAMMPS_NS::LAMMPS *lmp;
     // custom argument vector for LAMMPS library
     const char *lmpargv[] {"liblammps", "-log", "none"};
@@ -351,7 +27,7 @@ int main(int argc, char *argv[])
 
     // create LAMMPS instance
     lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD);
-    lmp->input->file("in.chute_wear");
+    lmp->input->file("in.lbdem");
     //lmp->input->one("run 1");
     
     //# Try extracting a global value
@@ -379,7 +55,7 @@ int main(int argc, char *argv[])
 
     lmp->input->one("run 9 upto");
 
-    for (int step = 0; step < 3; step++)
+    for (int step = 0; step < 10; step++)
     {
         
 
@@ -395,14 +71,16 @@ int main(int argc, char *argv[])
             double **f_liggghts = couplingFix->get_force_ptr();
             double** force = lmp->atom->f;
             cout << "Pos[" << i << "] = [" << pos[i][0] << ", " << pos[i][1] << ", " << pos[i][2] << "]\n";
-            cout << "Force[" << i << "] = [" << f_liggghts[i][0] << ", " << f_liggghts[i][1] << ", " << f_liggghts[i][2] << "]\n";
+            cout << "Force1[" << i << "] = [" << f_liggghts[i][0] << ", " << f_liggghts[i][1] << ", " << f_liggghts[i][2] << "]\n";
+            f_liggghts[i][0] += 0;
+            f_liggghts[i][1] += 0;
             f_liggghts[i][2] += 500;
-            cout << "Force[" << i << "] = [" << force[i][0] << ", " << force[i][1] << ", " << force[i][2] << "]\n";
+            cout << "Force2[" << i << "] = [" << force[i][0] << ", " << force[i][1] << ", " << force[i][2] << "]\n";
         }
 
         couplingFix->comm_force_torque();
 
-        lmp->input->one("run 10");
+        lmp->input->one("run 10000");
        
     }
 
diff --git a/cpu.cmake b/cpu.cmake
index 397d54c3a..c5f740674 100644
--- a/cpu.cmake
+++ b/cpu.cmake
@@ -30,6 +30,8 @@ SET(USE_CATALYST OFF CACHE BOOL "include Paraview Catalyst support")
 SET(USE_HLRN_LUSTRE OFF CACHE BOOL "include HLRN Lustre support")
 SET(USE_DEM_COUPLING OFF CACHE BOOL "PE plugin")
 
+SET(USE_LIGGGHTS ON CACHE BOOL "include LIGGGHTS library support")
+
 #MPI
 IF((NOT ${CMAKE_CXX_COMPILER} MATCHES mpicxx) AND (NOT ${CMAKE_CXX_COMPILER} MATCHES mpiicpc))# OR NOT ${CMAKE_CXX_COMPILER} MATCHES cc OR NOT ${CMAKE_CXX_COMPILER} MATCHES mpiCC)
     FIND_PACKAGE(MPI REQUIRED)
@@ -89,5 +91,9 @@ if(BUILD_VF_PYTHON_BINDINGS)
     add_subdirectory(src/cpu/pythonbindings)
 endif()
 
+if(USE_LIGGGHTS)
+    add_subdirectory(src/cpu/LiggghtsCoupling)
+endif()
+
 set (APPS_ROOT_CPU "${VF_ROOT_DIR}/apps/cpu/")
 include(${APPS_ROOT_CPU}/Applications.cmake)
\ No newline at end of file
diff --git a/src/cpu/LiggghtsCoupling/CMakeLists.txt b/src/cpu/LiggghtsCoupling/CMakeLists.txt
new file mode 100644
index 000000000..ed9d1f0e2
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+set(LIGGGHTS_LIBRARIES optimized ${LIGGGHTS_RELEASE_LIBRARY} debug ${LIGGGHTS_DEBUG_LIBRARY})
+
+vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX VirtualFluidsCore ${LIGGGHTS_LIBRARIES})
+
+vf_get_library_name(library_name)
+
+#target_link_directories(${library_name} PUBLIC ${LIGGGHTS_BINARY_DIR})
+target_include_directories(${library_name} PUBLIC ${LIGGGHTS_SOURCE_DIR})
+
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
new file mode 100644
index 000000000..550713f7f
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
@@ -0,0 +1,523 @@
+#include "LiggghtsCoProcessor.h"
+//
+//#include "BCProcessor.h"
+//#include "Communicator.h"
+//#include "DataSet3D.h"
+//#include "DistributionArray3D.h"
+//#include "ForceCalculator.h"
+//#include "GbSphere3D.h"
+//#include "Grid3D.h"
+//#include "ILBMKernel.h"
+//#include "MovableObjectInteractor.h"
+//#include "SetBcBlocksBlockVisitor.h"
+//#include "UbScheduler.h"
+//
+//#include "PePhysicsEngineGeometryAdapter.h"
+//#include "PePhysicsEngineSolverAdapter.h"
+//#include "PhysicsEngineGeometryAdapter.h"
+//#include "PhysicsEngineMaterialAdapter.h"
+//#include "PhysicsEngineSolverAdapter.h"
+//
+//#include "BCArray3D.h"
+//#include "Block3D.h"
+//#include "BoundaryConditions.h"
+//#include "BoundaryConditionsBlockVisitor.h"
+//#include "MPICommunicator.h"
+//
+//#include "UbLogger.h"
+//
+//#include <array>
+//#include <functional>
+//
+//DemCoProcessor::DemCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Communicator> comm,
+//                               std::shared_ptr<ForceCalculator> forceCalculator,
+//                               std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver,
+//                               double intermediatePeSteps)
+//    : CoProcessor(grid, s), comm(comm), forceCalculator(forceCalculator),
+//      physicsEngineSolver(std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)),
+//      intermediateDemSteps(intermediatePeSteps)
+//{
+//#ifdef TIMING
+//    timer.resetAndStart();
+//#endif
+//
+//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
+//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
+//
+//    for (auto blockIt = forest->begin(); blockIt != forest->end(); ++blockIt) {
+//        walberla::pe::Storage *storage                     = blockIt->getData<walberla::pe::Storage>(*storageId.get());
+//        walberla::pe::BodyStorage *bodyStorage             = &(*storage)[0];
+//        walberla::pe::BodyStorage *bodyStorageShadowCopies = &(*storage)[1];
+//
+//        bodyStorage->registerAddCallback("DemCoProcessor", std::bind1st(std::mem_fun(&DemCoProcessor::addPeGeo), this));
+//        bodyStorage->registerRemoveCallback("DemCoProcessor",
+//                                            std::bind1st(std::mem_fun(&DemCoProcessor::removePeGeo), this));
+//
+//        bodyStorageShadowCopies->registerAddCallback("DemCoProcessor",
+//                                                     std::bind1st(std::mem_fun(&DemCoProcessor::addPeShadowGeo), this));
+//        bodyStorageShadowCopies->registerRemoveCallback(
+//            "DemCoProcessor", std::bind1st(std::mem_fun(&DemCoProcessor::removePeShadowGeo), this));
+//    }
+//}
+//
+//DemCoProcessor::~DemCoProcessor()
+//{
+//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
+//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
+//
+//    for (auto &currentBlock : *forest) {
+//        walberla::pe::Storage *storage           = currentBlock.getData<walberla::pe::Storage>(*storageId.get());
+//        walberla::pe::BodyStorage &localStorage  = (*storage)[0];
+//        walberla::pe::BodyStorage &shadowStorage = (*storage)[1];
+//
+//        localStorage.clearAddCallbacks();
+//        localStorage.clearRemoveCallbacks();
+//
+//        shadowStorage.clearAddCallbacks();
+//        shadowStorage.clearRemoveCallbacks();
+//    }
+//}
+//
+//void DemCoProcessor::addInteractor(std::shared_ptr<MovableObjectInteractor> interactor,
+//                                   std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial,
+//                                   Vector3D initalVelocity)
+//{
+//    interactors.push_back(interactor);
+//    const int id = static_cast<int>(interactors.size() - 1);
+//    interactor->setID(id);
+//    const auto peGeometryAdapter = this->createPhysicsEngineGeometryAdapter(interactor, physicsEngineMaterial);
+//    if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)->isActive()) {
+//        peGeometryAdapter->setLinearVelolocity(initalVelocity);
+//        geoIdMap.insert(
+//            std::make_pair(std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)->getSystemID(),
+//                           std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)));
+//    }
+//    SetBcBlocksBlockVisitor setBcVisitor(interactor);
+//    grid->accept(setBcVisitor);
+//
+//    // std::vector< std::shared_ptr<Block3D> > blockVector;
+//    // UbTupleInt3 blockNX=grid->getBlockNX();
+//    // SPtr<GbObject3D> geoObject(interactor->getGbObject3D());
+//    // double ext = 0.0;
+//    // std::array<double, 6> AABB ={
+//    // geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum()
+//    // }; grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext,
+//    // AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext,
+//    // AABB[5]+(double)val<3>(blockNX)*ext, blockVector); for (std::shared_ptr<Block3D> block : blockVector)
+//    //{
+//    //   if (block->getKernel())
+//    //   {
+//    //      interactor->setBCBlock(block);
+//    //      //UBLOG(logINFO, "DemCoProcessor::addInteractor() rank = "<<comm->getProcessID());
+//    //   }
+//    //}
+//
+//    interactor->initInteractor();
+//
+//    physicsEngineGeometrieAdapters.push_back(peGeometryAdapter);
+//}
+//
+//std::shared_ptr<PhysicsEngineGeometryAdapter> DemCoProcessor::createPhysicsEngineGeometryAdapter(
+//    std::shared_ptr<MovableObjectInteractor> interactor,
+//    std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const
+//{
+//    const int id              = static_cast<int>(interactors.size() - 1);
+//    SPtr<GbSphere3D> vfSphere = std::static_pointer_cast<GbSphere3D>(interactor->getGbObject3D());
+//    const Vector3D position(vfSphere->getX1Centroid(), vfSphere->getX2Centroid(), vfSphere->getX3Centroid());
+//    auto peGeometryAdapter = this->physicsEngineSolver->createPhysicsEngineGeometryAdapter(
+//        id, position, vfSphere->getRadius(), physicsEngineMaterial);
+//    interactor->setPhysicsEngineGeometry(peGeometryAdapter);
+//    return peGeometryAdapter;
+//}
+//
+//void DemCoProcessor::process(double actualTimeStep)
+//{
+//#ifdef TIMING
+//    timer.resetAndStart();
+//#endif
+//
+//    this->applyForcesOnGeometries();
+//
+//#ifdef TIMING
+//    if (comm->isRoot())
+//        UBLOG(logINFO, "DemCoProcessor::process start step: " << actualTimeStep);
+//    if (comm->isRoot())
+//        UBLOG(logINFO, "DemCoProcessor::applyForcesOnGeometries() time = " << timer.stop() << " s");
+//#endif
+//
+//    if (scheduler->isDue(actualTimeStep)) {
+//        // UBLOG(logINFO, "DemCoProcessor::update - START - timestep = " << actualTimeStep);
+//        const double demTimeStepsPerIteration = scheduler->getMinStep();
+//
+//        if (demTimeStepsPerIteration != 1)
+//            this->scaleForcesAndTorques(1.0 / demTimeStepsPerIteration);
+//
+//#ifdef TIMING
+//        if (comm->isRoot())
+//            UBLOG(logINFO, "DemCoProcessor::scaleForcesAndTorques() time = " << timer.stop() << " s");
+//        if (comm->isRoot())
+//            UBLOG(logINFO, "DemCoProcessor::calculateDemTimeStep():");
+//#endif
+//
+//        if (this->intermediateDemSteps == 1)
+//            this->calculateDemTimeStep(demTimeStepsPerIteration);
+//
+//        //#ifdef TIMING
+//        //      if (comm->isRoot()) UBLOG(logINFO, "DemCoProcessor::calculateDemTimeStep() time = "<<timer.stop()<<"
+//        //      s");
+//        //#endif
+//        // if ((int)actualTimeStep % 100 == 0)
+//        //{
+//        //    if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometries[0])->isActive())
+//        //    {
+//        //        //UBLOG(logINFO, "v: (x,y,z) " << physicsEngineGeometries[0]->getLinearVelocity() << " actualTimeStep
+//        //        = " << UbSystem::toString(actualTimeStep));
+//        //    }
+//        //}
+//
+//        // during the intermediate time steps of the collision response, the currently acting forces
+//        // (interaction forces, gravitational force, ...) have to remain constant.
+//        // Since they are reset after the call to collision response, they have to be stored explicitly before.
+//        // Then they are set again after each intermediate step.
+//
+//        this->moveVfGeoObjects();
+//
+//#ifdef TIMING
+//        if (comm->isRoot())
+//            UBLOG(logINFO, "DemCoProcessor::moveVfGeoObject() time = " << timer.stop() << " s");
+//#endif
+//
+//        grid->accept(*boundaryConditionsBlockVisitor.get());
+//
+//#ifdef TIMING
+//        if (comm->isRoot())
+//            UBLOG(logINFO, "grid->accept(*boundaryConditionsBlockVisitor.get()) time = " << timer.stop() << " s");
+//#endif
+//
+//        // UBLOG(logINFO, "DemCoProcessor::update - END - timestep = " << actualTimeStep);
+//    }
+//
+//#ifdef TIMING
+//    if (comm->isRoot())
+//        UBLOG(logINFO, "DemCoProcessor::process stop step: " << actualTimeStep);
+//#endif
+//}
+////////////////////////////////////////////////////////////////////////////
+//std::shared_ptr<PhysicsEngineSolverAdapter> DemCoProcessor::getPhysicsEngineSolver() { return physicsEngineSolver; }
+//
+//void DemCoProcessor::applyForcesOnGeometries()
+//{
+//    for (int i = 0; i < physicsEngineGeometrieAdapters.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            this->setForcesToObject(grid, interactors[i], physicsEngineGeometrieAdapters[i]);
+//
+//            // physicsEngineGeometries[i]->setLinearVelolocity(Vector3D(-0.001, 0.0, 0.0));
+//            // physicsEngineGeometries[i]->setAngularVelocity(Vector3D(0.01, 0.01, 0.01));
+//            // UBLOG(logINFO, "v: (x,y,z) " << physicsEngineGeometries[i]->getLinearVelocity());
+//        }
+//    }
+//}
+//
+//void DemCoProcessor::setForcesToObject(SPtr<Grid3D> grid, SPtr<MovableObjectInteractor> interactor,
+//                                       std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry)
+//{
+//    for (BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) {
+//        SPtr<Block3D> block                     = t.first;
+//        SPtr<ILBMKernel> kernel                 = block->getKernel();
+//        SPtr<BCArray3D> bcArray                 = kernel->getBCProcessor()->getBCArray();
+//        SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+//        distributions->swap();
+//
+//        std::set<std::vector<int>> &transNodeIndicesSet = t.second;
+//        for (std::vector<int> node : transNodeIndicesSet) {
+//            int x1 = node[0];
+//            int x2 = node[1];
+//            int x3 = node[2];
+//
+//            if (kernel->isInsideOfDomain(x1, x2, x3) && bcArray->isFluid(x1, x2, x3)) {
+//                // TODO: calculate assumed boundary position
+//
+//                const Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3);
+//                const auto boundaryVelocity     = physicsEngineGeometry->getVelocityAtPosition(worldCoordinates);
+//
+//                SPtr<BoundaryConditions> bc = bcArray->getBC(x1, x2, x3);
+//                const Vector3D force = forceCalculator->getForces(x1, x2, x3, distributions, bc, boundaryVelocity);
+//                physicsEngineGeometry->addForceAtPosition(force, worldCoordinates);
+//            }
+//        }
+//        distributions->swap();
+//    }
+//}
+//
+//void DemCoProcessor::scaleForcesAndTorques(double scalingFactor)
+//{
+//    for (int i = 0; i < physicsEngineGeometrieAdapters.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            const Vector3D force  = physicsEngineGeometrieAdapters[i]->getForce() * scalingFactor;
+//            const Vector3D torque = physicsEngineGeometrieAdapters[i]->getTorque() * scalingFactor;
+//
+//            physicsEngineGeometrieAdapters[i]->resetForceAndTorque();
+//
+//            physicsEngineGeometrieAdapters[i]->setForce(force);
+//            physicsEngineGeometrieAdapters[i]->setTorque(torque);
+//
+//            // UBLOG(logINFO, "F: (x,y,z) " << force);
+//            // UBLOG(logINFO, "T: (x,y,z) " << torque);
+//        }
+//    }
+//}
+//
+//void DemCoProcessor::calculateDemTimeStep(double step)
+//{
+//    physicsEngineSolver->runTimestep(step);
+//
+//#ifdef TIMING
+//    if (comm->isRoot())
+//        UBLOG(logINFO, "  physicsEngineSolver->runTimestep() time = " << timer.stop() << " s");
+//#endif
+//}
+//
+//void DemCoProcessor::moveVfGeoObjects()
+//{
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                    ->getSemiactive()) {
+//                walberla::pe::RigidBody *peGeoObject = getPeGeoObject(
+//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                        ->getSystemID());
+//                if (peGeoObject != nullptr) {
+//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                        ->setGeometry(peGeoObject);
+//                    interactors[i]->moveGbObjectTo(physicsEngineGeometrieAdapters[i]->getPosition());
+//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                        ->setSemiactive(false);
+//                } else {
+//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                        ->setInactive();
+//                }
+//            } else {
+//                interactors[i]->moveGbObjectTo(physicsEngineGeometrieAdapters[i]->getPosition());
+//            }
+//        }
+//    }
+//}
+//
+//bool DemCoProcessor::isDemObjectInAABB(std::array<double, 6> AABB)
+//{
+//    bool result = false;
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            SPtr<GbObject3D> geoObject = interactors[i]->getGbObject3D();
+//            std::array<double, 2> minMax1;
+//            std::array<double, 2> minMax2;
+//            std::array<double, 2> minMax3;
+//            minMax1[0] = geoObject->getX1Minimum();
+//            minMax2[0] = geoObject->getX2Minimum();
+//            minMax3[0] = geoObject->getX3Minimum();
+//            minMax1[1] = geoObject->getX1Maximum();
+//            minMax2[1] = geoObject->getX2Maximum();
+//            minMax3[1] = geoObject->getX3Maximum();
+//
+//            for (int x3 = 0; x3 < 2; x3++)
+//                for (int x2 = 0; x2 < 2; x2++)
+//                    for (int x1 = 0; x1 < 2; x1++) {
+//                        result =
+//                            result || (minMax1[x1] >= AABB[0] && minMax2[x2] >= AABB[1] && minMax3[x3] >= AABB[2] &&
+//                                       minMax1[x1] <= AABB[3] && minMax2[x2] <= AABB[4] && minMax3[x3] <= AABB[5]);
+//                    }
+//        }
+//    }
+//
+//    std::vector<int> values;
+//    values.push_back((int)result);
+//    std::vector<int> rvalues = comm->gather(values);
+//
+//    if (comm->isRoot()) {
+//        for (int i = 0; i < (int)rvalues.size(); i++) {
+//            result = result || (bool)rvalues[i];
+//        }
+//    }
+//    int iresult = (int)result;
+//    comm->broadcast(iresult);
+//    result = (bool)iresult;
+//
+//    return result;
+//}
+//
+//int DemCoProcessor::addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles)
+//{
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            interactors[i]->getGbObject3D()->addSurfaceTriangleSet(nodes, triangles);
+//        }
+//    }
+//    return (int)interactors.size();
+//}
+//
+//void DemCoProcessor::getObjectsPropertiesVector(std::vector<double> &p)
+//{
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            p.push_back(i);
+//            p.push_back(interactors[i]->getGbObject3D()->getX1Centroid());
+//            p.push_back(interactors[i]->getGbObject3D()->getX2Centroid());
+//            p.push_back(interactors[i]->getGbObject3D()->getX3Centroid());
+//            Vector3D v = physicsEngineGeometrieAdapters[i]->getLinearVelocity();
+//            p.push_back(v[0]);
+//            p.push_back(v[1]);
+//            p.push_back(v[2]);
+//        }
+//    }
+//}
+//
+//void DemCoProcessor::addPeGeo(walberla::pe::RigidBody *peGeo)
+//{
+//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
+//    if (geometry != nullptr) {
+//        geometry->setActive();
+//        geometry->setGeometry(peGeo);
+//        return;
+//    } else
+//        return;
+//}
+//
+//void DemCoProcessor::removePeGeo(walberla::pe::RigidBody *peGeo)
+//{
+//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
+//    if (geometry != nullptr) {
+//        geometry->setSemiactive(true);
+//    } else
+//        throw UbException(UB_EXARGS, "PeGeo SystemId=" + UbSystem::toString(peGeo->getSystemID()) +
+//                                         " is not matching geometry ID");
+//}
+//
+//void DemCoProcessor::addPeShadowGeo(walberla::pe::RigidBody *peGeo)
+//{
+//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
+//    if (geometry != nullptr) {
+//        geometry->setActive();
+//        geometry->setGeometry(peGeo);
+//        return;
+//    } else
+//        throw UbException(UB_EXARGS,
+//                          "PeGeo ID=" + UbSystem::toString(peGeo->getSystemID()) + " is not matching geometry ID");
+//}
+//
+//void DemCoProcessor::removePeShadowGeo(walberla::pe::RigidBody *peGeo)
+//{
+//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
+//
+//    if (geometry != nullptr) {
+//        geometry->setSemiactive(true);
+//    } else
+//        throw UbException(UB_EXARGS,
+//                          "PeGeo ID=" + UbSystem::toString(peGeo->getSystemID()) + " is not matching geometry ID");
+//}
+//
+//bool DemCoProcessor::isSpheresIntersection(double centerX1, double centerX2, double centerX3, double d)
+//{
+//    bool result = false;
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            SPtr<GbObject3D> sphere = interactors[i]->getGbObject3D();
+//            result                  = result ||
+//                     (sqrt(pow(sphere->getX1Centroid() - centerX1, 2.0) + pow(sphere->getX2Centroid() - centerX2, 2.0) +
+//                           pow(sphere->getX3Centroid() - centerX3, 2.0)) <= d);
+//        }
+//    }
+//    std::vector<int> values;
+//    values.push_back((int)result);
+//    std::vector<int> rvalues = comm->gather(values);
+//
+//    if (comm->isRoot()) {
+//        for (int i = 0; i < (int)rvalues.size(); i++) {
+//            result = result || (bool)rvalues[i];
+//        }
+//    }
+//    int iresult = (int)result;
+//    comm->broadcast(iresult);
+//    result = (bool)iresult;
+//
+//    return result;
+//}
+//
+//void DemCoProcessor::distributeIDs()
+//{
+//    std::vector<unsigned long long> peIDsSend;
+//    std::vector<int> vfIDsSend;
+//
+//    for (int i = 0; i < interactors.size(); i++) {
+//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
+//            peIDsSend.push_back(
+//                std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//                    ->getSystemID());
+//            vfIDsSend.push_back(interactors[i]->getID());
+//        }
+//    }
+//
+//    std::vector<unsigned long long> peIDsRecv;
+//    std::vector<int> vfIDsRecv;
+//
+//    comm->allGather(peIDsSend, peIDsRecv);
+//    comm->allGather(vfIDsSend, vfIDsRecv);
+//
+//    std::map<int, unsigned long long> idMap;
+//
+//    for (int i = 0; i < peIDsRecv.size(); i++) {
+//        idMap.insert(std::make_pair(vfIDsRecv[i], peIDsRecv[i]));
+//    }
+//
+//    for (int i = 0; i < interactors.size(); i++) {
+//        std::map<int, unsigned long long>::const_iterator it;
+//        if ((it = idMap.find(interactors[i]->getID())) == idMap.end()) {
+//            throw UbException(UB_EXARGS, "Interactor ID = " + UbSystem::toString(interactors[i]->getID()) +
+//                                             " is invalid! The DEM object may be not in PE domain!");
+//        }
+//
+//        std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
+//            ->setSystemID(it->second);
+//
+//        geoIdMap.insert(std::make_pair(
+//            it->second, std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])));
+//    }
+//}
+////////////////////////////////////////////////////////////////////////////
+//void DemCoProcessor::setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor)
+//{
+//    this->boundaryConditionsBlockVisitor = boundaryConditionsBlockVisitor;
+//}
+////////////////////////////////////////////////////////////////////////////
+//walberla::pe::RigidBody *DemCoProcessor::getPeGeoObject(walberla::id_t id)
+//{
+//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
+//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
+//    std::shared_ptr<walberla::pe::BodyStorage> globalBodyStorage =
+//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getGlobalBodyStorage();
+//
+//    return walberla::pe::getBody(*globalBodyStorage, *forest, *storageId, id,
+//                                 walberla::pe::StorageSelect::LOCAL | walberla::pe::StorageSelect::SHADOW);
+//}
+//////////////////////////////////////////////////////////////////////////////
+//std::shared_ptr<PePhysicsEngineGeometryAdapter> DemCoProcessor::getPeGeoAdapter(unsigned long long systemId)
+//{
+//    std::map<unsigned long long, std::shared_ptr<PePhysicsEngineGeometryAdapter>>::const_iterator it;
+//    if ((it = geoIdMap.find(systemId)) == geoIdMap.end()) {
+//        return nullptr;
+//    } else
+//        return it->second;
+//}
+
+LiggghtsCoProcessor::LiggghtsCoProcessor()
+{
+}
+
+LiggghtsCoProcessor::~LiggghtsCoProcessor()
+{
+}
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h
new file mode 100644
index 000000000..380451103
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h
@@ -0,0 +1,149 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file LiggghtsCoProcessor.h
+//! \ingroup LiggghtsCoupling
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef LIGGGHTS_CO_PROCESSOR_H
+#define LIGGGHTS_CO_PROCESSOR_H
+
+#include "CoProcessor.h"
+
+#include "lammps.h"
+#include "input.h"
+#include "atom.h"
+#include "modify.h"
+#include "fix_lb_coupling_onetoone.h"
+
+class LiggghtsCoProcessor : public CoProcessor
+{
+public:
+    LiggghtsCoProcessor();
+    virtual ~LiggghtsCoProcessor();
+
+};
+
+#endif
+
+///*
+// *  Author: S. Peters
+// *  mail: peters@irmb.tu-bs.de
+// */
+//#ifndef DEM_CO_PROCESSOR_H
+//#define DEM_CO_PROCESSOR_H
+//
+//#include <map>
+//#include <memory>
+//#include <vector>
+//
+//#include "Vector3D.h"
+//
+//#include "CoProcessor.h"
+//#include "UbTuple.h"
+//
+//#include <pe/basic.h>
+//
+////#define TIMING
+//
+//#ifdef TIMING
+//#include "UbTiming.h"
+//#endif
+//
+//class PhysicsEngineGeometryAdapter;
+//class PhysicsEngineSolverAdapter;
+//class PePhysicsEngineSolverAdapter;
+//class PhysicsEngineMaterialAdapter;
+//class PePhysicsEngineGeometryAdapter;
+//
+//class UbScheduler;
+//class Grid3D;
+//class ForceCalculator;
+//class Communicator;
+//class MovableObjectInteractor;
+//class Communicator;
+//class BoundaryConditionsBlockVisitor;
+//
+//class DemCoProcessor : public CoProcessor
+//{
+//public:
+//    DemCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm,
+//                   std::shared_ptr<ForceCalculator> forceCalculator,
+//                   std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver, double intermediatePeSteps = 1.0);
+//    virtual ~DemCoProcessor();
+//
+//    void addInteractor(std::shared_ptr<MovableObjectInteractor> interactor,
+//                       std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial,
+//                       Vector3D initalVelocity = Vector3D(0.0, 0.0, 0.0));
+//    void process(double step) override;
+//    std::shared_ptr<PhysicsEngineSolverAdapter> getPhysicsEngineSolver();
+//    void distributeIDs();
+//    void setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> blockVisitor);
+//    bool isDemObjectInAABB(std::array<double, 6> AABB);
+//    int addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles);
+//    void getObjectsPropertiesVector(std::vector<double> &p);
+//    void addPeGeo(walberla::pe::RigidBody *peGeo);
+//    void removePeGeo(walberla::pe::RigidBody *peGeo);
+//    void addPeShadowGeo(walberla::pe::RigidBody *peGeo);
+//    void removePeShadowGeo(walberla::pe::RigidBody *peGeo);
+//    bool isSpheresIntersection(double centerX1, double centerX2, double centerX3, double d);
+//
+//private:
+//    std::shared_ptr<PhysicsEngineGeometryAdapter>
+//    createPhysicsEngineGeometryAdapter(std::shared_ptr<MovableObjectInteractor> interactor,
+//                                       std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const;
+//    void applyForcesOnGeometries();
+//    void setForcesToObject(SPtr<Grid3D> grid, std::shared_ptr<MovableObjectInteractor> interactor,
+//                           std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry);
+//    void scaleForcesAndTorques(double scalingFactor);
+//    void calculateDemTimeStep(double step);
+//    void moveVfGeoObjects();
+//    walberla::pe::RigidBody *getPeGeoObject(walberla::id_t id);
+//    std::shared_ptr<PePhysicsEngineGeometryAdapter> getPeGeoAdapter(unsigned long long systemId);
+//
+//private:
+//    std::shared_ptr<Communicator> comm;
+//    std::vector<std::shared_ptr<MovableObjectInteractor>> interactors;
+//    std::shared_ptr<ForceCalculator> forceCalculator;
+//    std::shared_ptr<PePhysicsEngineSolverAdapter> physicsEngineSolver;
+//    std::vector<std::shared_ptr<PhysicsEngineGeometryAdapter>> physicsEngineGeometrieAdapters;
+//    double intermediateDemSteps;
+//    SPtr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor;
+//    // walberla::pe::BodyStorage* bodyStorage;    //!< Reference to the central body storage.
+//    // walberla::pe::BodyStorage* bodyStorageShadowCopies;    //!< Reference to the body storage containing body shadow
+//    // copies.
+//
+//    std::map<unsigned long long, std::shared_ptr<PePhysicsEngineGeometryAdapter>> geoIdMap;
+//
+//#ifdef TIMING
+//    UbTimer timer;
+//#endif
+//};
+//
+//#endif
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index 7dce1da44..ac6302dba 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -42,6 +42,8 @@ target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Gr
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LiggghtsCoupling)
+target_include_directories(${library_name} PUBLIC src/LiggghtsCoupling/Rconstructor)
 
 
 IF(${USE_METIS} AND METIS_INCLUDEDIR)
-- 
GitLab


From bb81981d9af7a81270e06285130cf9c9de3d5f63 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 26 Oct 2021 15:13:38 +0200
Subject: [PATCH 040/179] fix viscosity correction  and optimize muParser
 variable definition in MultiphaseTwoPhaseFieldsPressureFilterLBMKernel

---
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |   4 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |  41 +++----
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 107 ++++++++++++------
 ...aseTwoPhaseFieldsPressureFilterLBMKernel.h |  17 ++-
 4 files changed, 109 insertions(+), 60 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index 174066574..a93c46436 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,5 +1,5 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTestImpVel-Hesam2
+pathname = E:/Multiphase/DropletTest_new_corr5
 
 numOfThreads = 4
 availMem = 10e9
@@ -13,7 +13,7 @@ dx = 1
 refineLevel = 0
 
 #Simulation
-uLB = 0.01#0.005#0.005 
+uLB = 0 #0.001#0.005#0.005 
 Re = 10
 nuL = 1e-2 #1e-5# 1.0e-5 #!1e-2
 nuG = 0.015811388300841892 #5e-2 #1e-4 # 1e-8 # 1.16e-4 #!1e-2
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 269544600..451133022 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -109,11 +109,11 @@ void run(string configname)
         LBMReal mu_h = rho_h * nu_h;
         
         //gravity
-        LBMReal g_y = Re*Re*mu_h*mu_h/(rho_h*(rho_h-rho_l)*D*D*D);
+        LBMReal g_y = Re* Re* mu_h* mu_h / (rho_h * (rho_h - rho_l) * D * D * D);
         //Eotvos number
         LBMReal Eo = 100;
         //surface tension
-        sigma = rho_h*g_y*D*D/Eo;
+        sigma = rho_h* g_y* D* D / Eo;
 
         //g_y = 0;
 
@@ -125,7 +125,7 @@ void run(string configname)
                 //UBLOG(logINFO, "rho = " << rhoLB);
                 UBLOG(logINFO, "D = " << D);
                 UBLOG(logINFO, "nuL = " << nuL);
-                UBLOG(logINFO, "nuL = " << nuG);
+                UBLOG(logINFO, "nuG = " << nuG);
                 UBLOG(logINFO, "Re = " << Re);
                 UBLOG(logINFO, "Eo = " << Eo);
                 UBLOG(logINFO, "g_y = " << g_y);
@@ -141,18 +141,18 @@ void run(string configname)
         SPtr<LBMKernel> kernel;
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+       // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
 
-        //mu::Parser fgr;
-        //fgr.SetExpr("-(rho-rho_l)*g_y");
-        //fgr.DefineConst("rho_l", rho_l);
-        //fgr.DefineConst("g_y", g_y);
+        mu::Parser fgr;
+        fgr.SetExpr("-(rho-rho_l)*g_y");
+        fgr.DefineConst("rho_l", rho_l);
+        fgr.DefineConst("g_y", g_y);
 
-        //kernel->setWithForcing(true);
-        //kernel->setForcingX1(0.0);
-        //kernel->setForcingX2(fgr);
-        //kernel->setForcingX3(0.0);
+        kernel->setWithForcing(true);
+        kernel->setForcingX1(0.0);
+        kernel->setForcingX2(fgr);
+        kernel->setForcingX3(0.0);
 
         kernel->setPhiL(phiL);
         kernel->setPhiH(phiH);
@@ -184,7 +184,7 @@ void run(string configname)
         grid->setPeriodicX1(true);
         grid->setPeriodicX2(true);
         grid->setPeriodicX3(true);
-        grid->setGhostLayerWidth(1);
+        grid->setGhostLayerWidth(2);
 
         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
 
@@ -298,6 +298,7 @@ void run(string configname)
 
             mu::Parser fct2;
             fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+            //fct2.SetExpr("uLB");
             fct2.DefineConst("uLB", uLB);
             fct2.DefineConst("x1c", x1c);
             fct2.DefineConst("x2c", x2c);
@@ -305,8 +306,8 @@ void run(string configname)
             fct2.DefineConst("radius", radius);
             fct2.DefineConst("interfaceThickness", interfaceThickness);
 
-            MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
-            //MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
+            //MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
+            MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
             initVisitor.setPhi(fct1);
             initVisitor.setVx1(fct2);
             grid->accept(initVisitor);
@@ -344,12 +345,12 @@ void run(string configname)
 
         grid->accept(bcVisitor);
 
-        TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
-        grid->accept(setConnsVisitor);
-
-        //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
+        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
+
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 846dd8272..e72f69d04 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -50,14 +50,21 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::initDataSet()
     SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
     SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
     SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
-    SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+    //SPtr<PhaseFieldArray3D> divU(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
     dataSet->setFdistributions(f);
     dataSet->setHdistributions(h); // For phase-field
     dataSet->setH2distributions(h2); // For phase-field
-    dataSet->setPhaseField(divU);
+    //dataSet->setPhaseField(divU);
+	dataSet->setPhaseField(divU1);
 	dataSet->setPressureField(pressure);
+
+	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+	phaseField2 = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+
 }
 //////////////////////////////////////////////////////////////////////////
 SPtr<LBMKernel> MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::clone()
@@ -83,6 +90,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::clone()
     kernel->setIndex(ix1, ix2, ix3);
     kernel->setDeltaT(deltaT);
 	kernel->setGhostLayerWidth(2);
+	dynamicPointerCast<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(kernel)->initForcing();
 
     return kernel;
 }
@@ -170,14 +178,16 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
     int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
     int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
 
+
+
     //TODO
 	//very expensive !!!!!
-	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField(
-            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
-    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2(
-        new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
-        CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU(
-            new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
+	//CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField(
+ //           new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+ //   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2(
+ //       new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0));
+ //       CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU(
+ //           new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0));
 
 //#pragma omp parallel for
 	  for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
@@ -713,7 +723,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   //+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
 			   //+WEIGTH[N] * (phi2[T] - phi2[B]));
 
-			   if (withForcing) {
+			   //if (withForcing) {
 				   // muX1 = static_cast<double>(x1-1+ix1*maxX1);
 				   // muX2 = static_cast<double>(x2-1+ix2*maxX2);
 				   // muX3 = static_cast<double>(x3-1+ix3*maxX3);
@@ -722,11 +732,13 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				  // forcingX2 = muForcingX2.Eval() + c1o3*drho*dX2_phi * rhoToPhi / rho;//-gradPy/rho;
 				   //forcingX3 = muForcingX3.Eval() + c1o3*drho*dX3_phi * rhoToPhi / rho;//-gradPz/rho;
 
-				   muForcingX1.DefineVar("rho",&muRho); 
-				   muForcingX2.DefineVar("rho",&muRho); 
-				   muForcingX3.DefineVar("rho",&muRho); 
 
 				   muRho = rho;
+				   
+			       //muForcingX1.DefineConst("rho", rho);
+			       //muForcingX2.DefineConst("rho", rho);
+			       //muForcingX3.DefineConst("rho", rho);
+				   			   
 
 				   forcingX1 = muForcingX1.Eval()/rho - gradPx/rho;
 				   forcingX2 = muForcingX2.Eval()/rho - gradPy/rho;
@@ -740,7 +752,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				   vvy += forcingX2 * deltaT * 0.5; // Y
 				   vvz += forcingX3 * deltaT * 0.5; // Z
 
-			   }
+			   //}
 
 
 			   ///surface tension force
@@ -958,20 +970,20 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   //forcing 
 			   ///////////////////////////////////////////////////////////////////////////////////////////
-			   if (withForcing)
-			   {
-				   muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
-				   muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
-				   muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
-
-				   //forcingX1 = muForcingX1.Eval();
-				   //forcingX2 = muForcingX2.Eval();
-				   //forcingX3 = muForcingX3.Eval();
-
-				   //vvx += forcingX1 * deltaT * 0.5; // X
-				   //vvy += forcingX2 * deltaT * 0.5; // Y
-				   //vvz += forcingX3 * deltaT * 0.5; // Z
-			   }
+			   //if (withForcing)
+			   //{
+				  // muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
+				  // muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
+				  // muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
+
+				  // //forcingX1 = muForcingX1.Eval();
+				  // //forcingX2 = muForcingX2.Eval();
+				  // //forcingX3 = muForcingX3.Eval();
+
+				  // //vvx += forcingX1 * deltaT * 0.5; // X
+				  // //vvy += forcingX2 * deltaT * 0.5; // Y
+				  // //vvz += forcingX3 * deltaT * 0.5; // Z
+			   //}
 
 			   LBMReal vx2;
                LBMReal vy2;
@@ -1296,9 +1308,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
 
 				///storing pre collision second moments
-				LBMReal mbxx = mfcaa;
-				LBMReal mbyy = mfaca;
-				LBMReal mbzz = mfaac;
+				LBMReal mbxx = mfcaa - c1o3 * mfaaa;
+				LBMReal mbyy = mfaca - c1o3 * mfaaa;
+				LBMReal mbzz = mfaac - c1o3 * mfaaa;
 				LBMReal mbxy = mfbba;
 				LBMReal mbxz = mfbab;
 				LBMReal mbyz = mfabb;
@@ -1468,9 +1480,12 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   mfaba = -mfaba;
 			   mfaab = -mfaab;
 			   //////////////////////////////////////////////////////////////////////////////////////
-			   mfbaa += -rho * rhoToPhi * c1o2 * ((mbxx + mfcaa) * dX1_phi + (mbxy + mfbba) * dX2_phi + (mbxz + mfbab) * dX3_phi);
-			   mfaba += -rho * rhoToPhi * c1o2 * ((mbxy + mfbba) * dX1_phi + (mbyy + mfaca) * dX2_phi + (mbyz + mfabb) * dX3_phi);
-			   mfaab += -rho * rhoToPhi * c1o2 * ((mbxz + mfbab) * dX1_phi + (mbyz + mfabb) * dX2_phi + (mbzz + mfaac) * dX3_phi);
+			   //mfbaa += -rho * rhoToPhi * c1o2 * ((mbxx + mfcaa) * dX1_phi + (mbxy + mfbba) * dX2_phi + (mbxz + mfbab) * dX3_phi);
+			   //mfaba += -rho * rhoToPhi * c1o2 * ((mbxy + mfbba) * dX1_phi + (mbyy + mfaca) * dX2_phi + (mbyz + mfabb) * dX3_phi);
+			   //mfaab += -rho * rhoToPhi * c1o2 * ((mbxz + mfbab) * dX1_phi + (mbyz + mfabb) * dX2_phi + (mbzz + mfaac) * dX3_phi);
+			   mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+			   mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+			   mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
 			   ////////////////////////////////////////////////////////////////////////////////////
 			   //back
 			   ////////////////////////////////////////////////////////////////////////////////////
@@ -3538,4 +3553,28 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::swapDistributions()
     LBMKernel::swapDistributions();
     dataSet->getHdistributions()->swap();
 	dataSet->getH2distributions()->swap();
-}
\ No newline at end of file
+}
+
+void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::initForcing()
+{
+	muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+	muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+	muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+
+	muDeltaT = deltaT;
+
+	muForcingX1.DefineVar("dt", &muDeltaT);
+	muForcingX2.DefineVar("dt", &muDeltaT);
+	muForcingX3.DefineVar("dt", &muDeltaT);
+
+	muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+
+	muForcingX1.DefineVar("nu", &muNu);
+	muForcingX2.DefineVar("nu", &muNu);
+	muForcingX3.DefineVar("nu", &muNu);
+
+	muForcingX1.DefineVar("rho",&muRho); 
+	muForcingX2.DefineVar("rho",&muRho); 
+	muForcingX3.DefineVar("rho",&muRho); 
+
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
index 302aaf508..7d20f8210 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h
@@ -51,10 +51,7 @@ public:
    virtual ~MultiphaseTwoPhaseFieldsPressureFilterLBMKernel(void) = default;
    void calculate(int step) override;
    SPtr<LBMKernel> clone() override;
-   void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
-   void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
-   void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
-   void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
 
    ///refactor
    //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
@@ -64,6 +61,14 @@ public:
 protected:
    virtual void initDataSet();
    void swapDistributions() override;
+
+   void initForcing();
+
+   void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+   void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+   void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
    LBMReal f1[D3Q27System::ENDF+1];
 
    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
@@ -82,6 +87,10 @@ protected:
 
    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
 
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField;
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField2; 
+   CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU; 
+
    LBMReal h  [D3Q27System::ENDF+1];
    LBMReal h2[D3Q27System::ENDF + 1];
    LBMReal g  [D3Q27System::ENDF+1];
-- 
GitLab


From 33bcc8aa0ea0631c0dd075f6d6e944f2c7a71f38 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin2.usr.hlrn.de>
Date: Tue, 26 Oct 2021 15:17:01 +0200
Subject: [PATCH 041/179] fix ViskomatXL simulation

---
 apps/cpu/ViskomatXL/viskomat.cpp                       | 10 +++++-----
 .../CoProcessors/CalculateTorqueCoProcessor.cpp        |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index fced035e3..8bbcf6e19 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -394,7 +394,7 @@ void bflow(string configname)
       SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
       //writeMQCoProcessor->process(100);
 
-      SPtr<UbScheduler> forceSch(new UbScheduler(10));
+      SPtr<UbScheduler> forceSch(new UbScheduler(1000));
       SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
       fp->addInteractor(rotorInt);
       SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
@@ -404,12 +404,12 @@ void bflow(string configname)
 
       SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
       SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      //calculator->addCoProcessor(npr);
-      //calculator->addCoProcessor(fp);
+      calculator->addCoProcessor(npr);
+      calculator->addCoProcessor(fp);
       calculator->addCoProcessor(fp2);
-      //calculator->addCoProcessor(writeMQCoProcessor);
+      calculator->addCoProcessor(writeMQCoProcessor);
       //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
-      //calculator->addCoProcessor(restartCoProcessor);
+      calculator->addCoProcessor(restartCoProcessor);
 
       if (myid == 0) UBLOG(logINFO, "Simulation-start");
       calculator->calculate();
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index 1daa28cba..34df7bd4b 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -171,9 +171,9 @@ void CalculateTorqueCoProcessor::calculateForces()
          torqueX2global += torqueX2;
          torqueX3global += torqueX3;
 
-         UBLOG(logINFO, "torqueX1global = " << torqueX1global);
+         //UBLOG(logINFO, "torqueX1global = " << torqueX1global);
 
-         UBLOG(logINFO, "counter = " << counter);
+         //UBLOG(logINFO, "counter = " << counter);
       }
    }
    std::vector<double> values;
-- 
GitLab


From a65f39d341c039c04264977e06c5ff59d50c9992 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin2.usr.hlrn.de>
Date: Tue, 26 Oct 2021 16:10:28 +0200
Subject: [PATCH 042/179] fix warnings

---
 ...ltiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index e72f69d04..033673504 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -1308,12 +1308,12 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 					   + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
 
 				///storing pre collision second moments
-				LBMReal mbxx = mfcaa - c1o3 * mfaaa;
-				LBMReal mbyy = mfaca - c1o3 * mfaaa;
-				LBMReal mbzz = mfaac - c1o3 * mfaaa;
-				LBMReal mbxy = mfbba;
-				LBMReal mbxz = mfbab;
-				LBMReal mbyz = mfabb;
+				// LBMReal mbxx = mfcaa - c1o3 * mfaaa;
+				// LBMReal mbyy = mfaca - c1o3 * mfaaa;
+				// LBMReal mbzz = mfaac - c1o3 * mfaaa;
+				// LBMReal mbxy = mfbba;
+				// LBMReal mbxz = mfbab;
+				// LBMReal mbyz = mfabb;
 
 			   //2.
 			   // linear combinations
-- 
GitLab


From b13be33974feb774c51fa270a6f80d2c1beb3463 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin2.usr.hlrn.de>
Date: Tue, 26 Oct 2021 16:16:29 +0200
Subject: [PATCH 043/179] fix warnings 2

---
 .../Visitors/MultiphaseInitDistributionsBlockVisitor.cpp    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index 3df7fbcc9..484972355 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -162,7 +162,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 	this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3);
 	this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3);
 
-	LBMReal vx1, vx2, vx3, rho, p1, phi;
+	LBMReal vx1, vx2, vx3, rho, /*p1,*/ phi;
 
 	int gridRank = grid->getRank();
 	int blockRank = block->getRank();
@@ -193,8 +193,8 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
                     x3              = coords[2];
 
 					
-					p1  = 0.0;
-					p1 = muRho.Eval();
+					//p1  = 0.0;
+					//p1 = muRho.Eval();
 					vx1 = muVx1.Eval();
 					vx2 = muVx2.Eval();
 					vx3 = muVx3.Eval();
-- 
GitLab


From 9265fa94b5a8966c82e4cb8d0f138fef264d94be Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin7.usr.hlrn.de>
Date: Thu, 11 Nov 2021 11:05:30 +0100
Subject: [PATCH 044/179] remove  update loop for pressure filter

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp    | 32 ++++++++++++++++---
 apps/cpu/ViskomatXL/viskomat.cpp              |  4 +--
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 30 ++++++++---------
 3 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 451133022..a7bc9859f 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -182,7 +182,7 @@ void run(string configname)
         grid->setDeltaX(dx);
         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
         grid->setPeriodicX1(true);
-        grid->setPeriodicX2(true);
+        grid->setPeriodicX2(false);
         grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
@@ -352,6 +352,29 @@ void run(string configname)
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+        double t_ast, t;
+        t_ast = 2;
+        t = (int)(t_ast/std::sqrt(g_y/D));
+        visSch->addSchedule(t,t,t); //t=2
+        t_ast = 3;
+        t = (int)(t_ast/std::sqrt(g_y/D));        
+        visSch->addSchedule(t,t,t); //t=3
+        t_ast = 4;
+        t = (int)(t_ast/std::sqrt(g_y/D));        
+        visSch->addSchedule(t,t,t); //t=4
+        t_ast = 5;
+        t = (int)(t_ast/std::sqrt(g_y/D));        
+        visSch->addSchedule(t,t,t); //t=5
+        t_ast = 6;
+        t = (int)(t_ast/std::sqrt(g_y/D)); 
+        visSch->addSchedule(t,t,t); //t=6
+        t_ast = 7;
+        t = (int)(t_ast/std::sqrt(g_y/D));         
+        visSch->addSchedule(t,t,t); //t=7
+        t_ast = 9;
+        t = (int)(t_ast/std::sqrt(g_y/D));         
+        visSch->addSchedule(t,t,t); //t=9
+
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
         if(grid->getTimeStep() == 0) 
@@ -369,7 +392,6 @@ void run(string configname)
         calculator->addCoProcessor(rcp);
 
 
-
         if (myid == 0)
             UBLOG(logINFO, "Simulation-start");
         calculator->calculate();
@@ -377,8 +399,8 @@ void run(string configname)
             UBLOG(logINFO, "Simulation-end");
             
 #if defined(__unix__)
-         if (!newStart) 
-         {
+         //if (!newStart) 
+         //{
             if (myid == 0) 
             {
                 std::ofstream ostr(fileName);
@@ -391,7 +413,7 @@ void run(string configname)
                 system(str.c_str());
             }   
             //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
-         }
+         //}
 #endif
 
     } catch (std::exception &e) {
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 8bbcf6e19..1bfa54270 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -405,9 +405,9 @@ void bflow(string configname)
       SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
       SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
       calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(fp);
+      //calculator->addCoProcessor(fp);
       calculator->addCoProcessor(fp2);
-      calculator->addCoProcessor(writeMQCoProcessor);
+      //calculator->addCoProcessor(writeMQCoProcessor);
       //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
       calculator->addCoProcessor(restartCoProcessor);
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 033673504..92df11d00 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -314,7 +314,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 						//! variable density -> TRANSFER!
 						//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
-						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
+						(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
 						//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
 						////!!!!!! relplace by pointer swap!
@@ -444,16 +444,16 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 									int zzz = zz + x3;
 									
 									if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
-										sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressure)(xxx, yyy, zzz);
+										sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressureOld)(xxx, yyy, zzz);
 									}
-									else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressure)(x1, x2, x3);
+									else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressureOld)(x1, x2, x3);
 									}
 
 
 								}
 							}
 						}
-						(*pressureOld)(x1, x2, x3) = sum;
+						(*pressure)(x1, x2, x3) = sum;
 
 
 
@@ -463,17 +463,17 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 		}
 
 //#pragma omp parallel for
-		for (int x3 = minX3-1; x3 <= maxX3; x3++) {
-			for (int x2 = minX2-1; x2 <= maxX2; x2++) {
-				for (int x1 = minX1-1; x1 <= maxX1; x1++) {
-					if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
-						///filter!
-
-						(*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3);
-					}
-				}
-			}
-		}
+		// for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+		// 	for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+		// 		for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+		// 			if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+		// 				///filter!
+
+		// 				(*pressure)(x1, x2, x3) = (*pressureOld)(x1, x2, x3);
+		// 			}
+		// 		}
+		// 	}
+		// }
 		////!filter
 
 
-- 
GitLab


From 8c0e07f93766f01e0fd1686e8a76054c403f3798 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 12 Nov 2021 20:07:32 +0100
Subject: [PATCH 045/179] add pressure filter kernel with one phase field / add
 double ghost layer connectors for two distributions and pressure

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |    8 +-
 src/cpu/VirtualFluids.h                       |    1 +
 ...onsDoubleGhostLayerFullDirectConnector.cpp |  315 ++++
 ...tionsDoubleGhostLayerFullDirectConnector.h |  167 ++
 ...onsDoubleGhostLayerFullVectorConnector.cpp |  615 ++++++
 ...tionsDoubleGhostLayerFullVectorConnector.h |  232 +++
 .../LBM/MultiphasePressureFilterLBMKernel.cpp | 1667 +++++++++++++++++
 .../LBM/MultiphasePressureFilterLBMKernel.h   |  116 ++
 .../Visitors/SetConnectorsBlockVisitor.h      |    5 +-
 9 files changed, 3123 insertions(+), 3 deletions(-)
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index a7bc9859f..96ee82691 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -142,7 +142,8 @@ void run(string configname)
 
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
        // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
 
         mu::Parser fgr;
         fgr.SetExpr("-(rho-rho_l)*g_y");
@@ -348,7 +349,10 @@ void run(string configname)
         //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //grid->accept(setConnsVisitor);
 
-        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //grid->accept(setConnsVisitor);
+
+        TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 7edd56779..de43d4eca 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -247,6 +247,7 @@
 #include <LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h>
+#include <LBM/MultiphasePressureFilterLBMKernel.h>
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
new file mode 100644
index 000000000..3d0ca3f04
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
@@ -0,0 +1,315 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "TwoDistributionsDoubleGhostLayerFullDirectConnector.h"
+#include "LBMKernel.h"
+#include "DataSet3D.h"
+
+TwoDistributionsDoubleGhostLayerFullDirectConnector::TwoDistributionsDoubleGhostLayerFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+    : FullDirectConnector(from, to, sendDir)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullDirectConnector::init()
+{
+    FullDirectConnector::init();
+
+	fFrom =dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions());
+	fTo = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions());
+	hFrom = dynamicPointerCast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getHdistributions());
+	hTo = dynamicPointerCast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getHdistributions());
+    pressureFrom = from.lock()->getKernel()->getDataSet()->getPressureField();
+    pressureTo   = to.lock()->getKernel()->getDataSet()->getPressureField();
+}
+//////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullDirectConnector::sendVectors()
+{
+    updatePointers();
+    exchangeData();
+}
+//////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
+{
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    int minX1p3 = minX1 + 3;
+    int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    int minX2p3 = minX2 + 3;
+    int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    int minX3p3 = minX3 + 3;
+    int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    int maxX3m3 = maxX3 - 3;
+
+    // EAST
+    if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                exchangeData(maxX1m3, x2, x3, minX1, x2, x3);
+                exchangeData(maxX1m2, x2, x3, minX1p1, x2, x3);
+            }
+        }
+    }
+    // WEST
+    else if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                exchangeData(minX1p3, x2, x3, maxX1, x2, x3);
+                exchangeData(minX1p2, x2, x3, maxX1m1, x2, x3);
+            }
+        }
+    }
+    // NORTH
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, maxX2m3, x3, x1, minX2, x3);
+                exchangeData(x1, maxX2m2, x3, x1, minX2p1, x3);
+            }
+        }
+    }
+    // SOUTH
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, minX2p3, x3, x1, maxX2, x3);
+                exchangeData(x1, minX2p2, x3, x1, maxX2m1, x3);
+            }
+        }
+    }
+
+    // TOP
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, x2, maxX3m3, x1, x2, minX3);
+                exchangeData(x1, x2, maxX3m2, x1, x2, minX3p1);
+            }
+        }
+    }
+    // BOTTOM
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                exchangeData(x1, x2, minX3p3, x1, x2, maxX3);
+                exchangeData(x1, x2, minX3p2, x1, x2, maxX3m1);
+            }
+        }
+    }
+    // NORTHEAST
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(maxX1m3, maxX2m3, x3, minX1, minX2, x3);
+            exchangeData(maxX1m2, maxX2m2, x3, minX1p1, minX2p1, x3);
+            exchangeData(maxX1m3, maxX2m2, x3, minX1, minX2p1, x3);
+            exchangeData(maxX1m2, maxX2m3, x3, minX1p1, minX2, x3);
+        }
+    }
+    // NORTHWEST
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(minX1p3, maxX2m3, x3, maxX1, minX2, x3);
+            exchangeData(minX1p2, maxX2m2, x3, maxX1m1, minX2p1, x3);
+            exchangeData(minX1p3, maxX2m2, x3, maxX1, minX2p1, x3);
+            exchangeData(minX1p2, maxX2m3, x3, maxX1m1, minX2, x3);
+        }
+    }
+    // SOUTHWEST
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(minX1p3, minX2p3, x3, maxX1, maxX2, x3);
+            exchangeData(minX1p2, minX2p2, x3, maxX1m1, maxX2m1, x3);
+            exchangeData(minX1p3, minX2p2, x3, maxX1, maxX2m1, x3);
+            exchangeData(minX1p2, minX2p3, x3, maxX1m1, maxX2, x3);
+        }
+    }
+    // SOUTHEAST
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            exchangeData(maxX1m3, minX2p3, x3, minX1, maxX2, x3);
+            exchangeData(maxX1m2, minX2p2, x3, minX1p1, maxX2m1, x3);
+            exchangeData(maxX1m3, minX2p2, x3, minX1, maxX2m1, x3);
+            exchangeData(maxX1m2, minX2p3, x3, minX1p1, maxX2, x3);
+        }
+    } else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(maxX1m3, x2, maxX3m3, minX1, x2, minX3);
+            exchangeData(maxX1m2, x2, maxX3m2, minX1p1, x2, minX3p1);
+            exchangeData(maxX1m3, x2, maxX3m2, minX1, x2, minX3p1);
+            exchangeData(maxX1m2, x2, maxX3m3, minX1p1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(minX1p3, x2, minX3p3, maxX1, x2, maxX3);
+            exchangeData(minX1p2, x2, minX3p2, maxX1m1, x2, maxX3m1);
+            exchangeData(minX1p3, x2, minX3p2, maxX1, x2, maxX3m1);
+            exchangeData(minX1p2, x2, minX3p3, maxX1m1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(maxX1m3, x2, minX3p3, minX1, x2, maxX3);
+            exchangeData(maxX1m2, x2, minX3p2, minX1p1, x2, maxX3m1);
+            exchangeData(maxX1m3, x2, minX3p2, minX1, x2, maxX3m1);
+            exchangeData(maxX1m2, x2, minX3p3, minX1p1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            exchangeData(minX1p3, x2, maxX3m3, maxX1, x2, minX3);
+            exchangeData(minX1p2, x2, maxX3m2, maxX1m1, x2, minX3p1);
+            exchangeData(minX1p3, x2, maxX3m2, maxX1, x2, minX3p1);
+            exchangeData(minX1p2, x2, maxX3m3, maxX1m1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, maxX2m3, maxX3m3, x1, minX2, minX3);
+            exchangeData(x1, maxX2m2, maxX3m2, x1, minX2p1, minX3p1);
+            exchangeData(x1, maxX2m3, maxX3m2, x1, minX2, minX3p1);
+            exchangeData(x1, maxX2m2, maxX3m3, x1, minX2p1, minX3);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, minX2p3, minX3p3, x1, maxX2, maxX3);
+            exchangeData(x1, minX2p2, minX3p2, x1, maxX2m1, maxX3m1);
+            exchangeData(x1, minX2p3, minX3p2, x1, maxX2, maxX3m1);
+            exchangeData(x1, minX2p2, minX3p3, x1, maxX2m1, maxX3);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, maxX2m3, minX3p3, x1, minX2, maxX3);
+            exchangeData(x1, maxX2m2, minX3p2, x1, minX2p1, maxX3m1);
+            exchangeData(x1, maxX2m3, minX3p2, x1, minX2, maxX3m1);
+            exchangeData(x1, maxX2m2, minX3p3, x1, minX2p1, maxX3);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            exchangeData(x1, minX2p3, maxX3m3, x1, maxX2, minX3);
+            exchangeData(x1, minX2p2, maxX3m2, x1, maxX2m1, minX3p1);
+            exchangeData(x1, minX2p3, maxX3m2, x1, maxX2, minX3p1);
+            exchangeData(x1, minX2p2, maxX3m3, x1, maxX2m1, minX3);
+        }
+    else if (sendDir == D3Q27System::TSW) {
+        exchangeData(minX1p3, minX2p3, maxX3m3, maxX1, maxX2, minX3);
+        exchangeData(minX1p2, minX2p2, maxX3m2, maxX1m1, maxX2m1, minX3p1);
+        exchangeData(minX1p3, minX2p2, maxX3m2, maxX1, maxX2m1, minX3p1);
+        exchangeData(minX1p2, minX2p3, maxX3m2, maxX1m1, maxX2, minX3p1);
+        exchangeData(minX1p2, minX2p2, maxX3m3, maxX1m1, maxX2m1, minX3);
+        exchangeData(minX1p3, minX2p3, maxX3m2, maxX1, maxX2, minX3p1);
+        exchangeData(minX1p3, minX2p2, maxX3m3, maxX1, maxX2m1, minX3);
+        exchangeData(minX1p2, minX2p3, maxX3m3, maxX1m1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::TSE) {
+        exchangeData(maxX1m3, minX1p3, maxX3m3, minX1, maxX2, minX3);
+        exchangeData(maxX1m2, minX1p2, maxX3m2, minX1p1, maxX2m1, minX3p1);
+        exchangeData(maxX1m3, minX1p2, maxX3m2, minX1, maxX2m1, minX3p1);
+        exchangeData(maxX1m2, minX1p3, maxX3m2, minX1p1, maxX2, minX3p1);
+        exchangeData(maxX1m2, minX1p2, maxX3m3, minX1p1, maxX2m1, minX3);
+        exchangeData(maxX1m3, minX1p3, maxX3m2, minX1, maxX2, minX3p1);
+        exchangeData(maxX1m3, minX1p2, maxX3m3, minX1, maxX2m1, minX3);
+        exchangeData(maxX1m2, minX1p3, maxX3m3, minX1p1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::TNW) {
+        exchangeData(minX1p3, maxX2m3, maxX3m3, maxX1, minX2, minX3);
+        exchangeData(minX1p2, maxX2m2, maxX3m2, maxX1m1, minX2p1, minX3p1);
+        exchangeData(minX1p3, maxX2m2, maxX3m2, maxX1, minX2p1, minX3p1);
+        exchangeData(minX1p2, maxX2m3, maxX3m2, maxX1m1, minX2, minX3p1);
+        exchangeData(minX1p2, maxX2m2, maxX3m3, maxX1m1, minX2p1, minX3);
+        exchangeData(minX1p3, maxX2m3, maxX3m2, maxX1, minX2, minX3p1);
+        exchangeData(minX1p3, maxX2m2, maxX3m3, maxX1, minX2p1, minX3);
+        exchangeData(minX1p2, maxX2m3, maxX3m3, maxX1m1, minX2, minX3);
+    } else if (sendDir == D3Q27System::TNE) {
+        exchangeData(maxX1m3, maxX2m3, maxX3m3, minX1, minX2, minX3);
+        exchangeData(maxX1m2, maxX2m2, maxX3m2, minX1p1, minX2p1, minX3p1);
+        exchangeData(maxX1m3, maxX2m2, maxX3m2, minX1, minX2p1, minX3p1);
+        exchangeData(maxX1m2, maxX2m3, maxX3m2, minX1p1, minX2, minX3p1);
+        exchangeData(maxX1m2, maxX2m2, maxX3m3, minX1p1, minX2p1, minX3);
+        exchangeData(maxX1m3, maxX2m3, maxX3m2, minX1, minX2, minX3p1);
+        exchangeData(maxX1m3, maxX2m2, maxX3m3, minX1, minX2p1, minX3);
+        exchangeData(maxX1m2, maxX2m3, maxX3m3, minX1p1, minX2, minX3);
+    } else if (sendDir == D3Q27System::BSW) {
+        exchangeData(minX1p3, minX2p3, minX3p3, maxX1, maxX2, maxX3);
+        exchangeData(minX1p2, minX2p2, minX3p2, maxX1m1, maxX2m1, maxX3m1);
+        exchangeData(minX1p3, minX2p2, minX3p2, maxX1, maxX2m1, maxX3m1);
+        exchangeData(minX1p2, minX2p3, minX3p2, maxX1m1, maxX2, maxX3m1);
+        exchangeData(minX1p2, minX2p2, minX3p3, maxX1m1, maxX2m1, maxX3);
+        exchangeData(minX1p3, minX2p3, minX3p2, maxX1, maxX2, maxX3m1);
+        exchangeData(minX1p3, minX2p2, minX3p3, maxX1, maxX2m1, maxX3);
+        exchangeData(minX1p2, minX2p3, minX3p3, maxX1m1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::BSE) {
+        exchangeData(maxX1m3, minX2p3, minX3p3, minX1, maxX2, maxX3);
+        exchangeData(maxX1m2, minX2p2, minX3p2, minX1p1, maxX2m1, maxX3m1);
+        exchangeData(maxX1m3, minX2p2, minX3p2, minX1, maxX2m1, maxX3m1);
+        exchangeData(maxX1m2, minX2p3, minX3p2, minX1p1, maxX2, maxX3m1);
+        exchangeData(maxX1m2, minX2p2, minX3p3, minX1p1, maxX2m1, maxX3);
+        exchangeData(maxX1m3, minX2p3, minX3p2, minX1, maxX2, maxX3m1);
+        exchangeData(maxX1m3, minX2p2, minX3p3, minX1, maxX2m1, maxX3);
+        exchangeData(maxX1m2, minX2p3, minX3p3, minX1p1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::BNW) {
+        exchangeData(minX1p3, maxX2m3, minX3p3, maxX1, minX2, maxX3);
+        exchangeData(minX1p2, maxX2m2, minX3p2, maxX1m1, minX2p1, maxX3m1);
+        exchangeData(minX1p3, maxX2m2, minX3p2, maxX1, minX2p1, maxX3m1);
+        exchangeData(minX1p2, maxX2m3, minX3p2, maxX1m1, minX2, maxX3m1);
+        exchangeData(minX1p2, maxX2m2, minX3p3, maxX1m1, minX2p1, maxX3);
+        exchangeData(minX1p3, maxX2m3, minX3p2, maxX1, minX2, maxX3m1);
+        exchangeData(minX1p3, maxX2m2, minX3p3, maxX1, minX2p1, maxX3);
+        exchangeData(minX1p2, maxX2m3, minX3p3, maxX1m1, minX2, maxX3);
+    } else if (sendDir == D3Q27System::BNE) {
+        exchangeData(maxX1m3, maxX2m3, minX3p3, minX1, minX2, maxX3);
+        exchangeData(maxX1m2, maxX2m2, minX3p2, minX1p1, minX2p1, maxX3m1);
+        exchangeData(maxX1m3, maxX2m2, minX3p2, minX1, minX2p1, maxX3m1);
+        exchangeData(maxX1m2, maxX2m3, minX3p2, minX1p1, minX2, maxX3m1);
+        exchangeData(maxX1m2, maxX2m2, minX3p3, minX1p1, minX2p1, maxX3);
+        exchangeData(maxX1m3, maxX2m3, minX3p2, minX1, minX2, maxX3m1);
+        exchangeData(maxX1m3, maxX2m2, minX3p3, minX1, minX2p1, maxX3);
+        exchangeData(maxX1m2, maxX2m3, minX3p3, minX1p1, minX2, maxX3);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+
+}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h
new file mode 100644
index 000000000..bc431f9f3
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h
@@ -0,0 +1,167 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file TwoDistributionsDoubleGhostLayerFullDirectConnector.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef TwoDistributionsDoubleGhostLayerFullDirectConnector_H
+#define TwoDistributionsDoubleGhostLayerFullDirectConnector_H
+
+#include "FullDirectConnector.h"
+#include "Block3D.h"
+#include "D3Q27System.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+#include "DataSet3D.h"
+
+//! \brief   Exchange data between blocks. 
+//! \details Connector send and receive full distributions between two blocks in shared memory.
+
+class TwoDistributionsDoubleGhostLayerFullDirectConnector : public FullDirectConnector
+{
+public:
+	TwoDistributionsDoubleGhostLayerFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
+    void init() override;
+    void sendVectors() override;
+
+protected:
+    inline void updatePointers() override;
+    void exchangeData() override;
+    inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To) override;
+
+private:
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFromf;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFromf;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFromf;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTof;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTof;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsTof;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFromh;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFromh;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFromh;
+
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsToh;
+	CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsToh;
+	CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsToh;
+
+	SPtr<EsoTwist3D> fFrom, hFrom;
+    SPtr<EsoTwist3D> fTo, hTo;
+
+    SPtr<PressureFieldArray3D> pressureFrom, pressureTo;
+};
+//////////////////////////////////////////////////////////////////////////
+inline void TwoDistributionsDoubleGhostLayerFullDirectConnector::updatePointers()
+{
+    localDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions();
+    nonLocalDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions();
+    zeroDistributionsFromf = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions();
+
+    localDistributionsTof    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions();
+    nonLocalDistributionsTof = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions();
+    zeroDistributionsTof     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions();
+
+    localDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getLocalDistributions();
+    nonLocalDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getNonLocalDistributions();
+    zeroDistributionsFromh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hFrom)->getZeroDistributions();
+
+    localDistributionsToh    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getLocalDistributions();
+    nonLocalDistributionsToh = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getNonLocalDistributions();
+    zeroDistributionsToh     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hTo)->getZeroDistributions();
+}
+//////////////////////////////////////////////////////////////////////////
+inline void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
+{
+	(*this->localDistributionsTof)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_E, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_N, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_T, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_NE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TN, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+	(*this->localDistributionsTof)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFromf)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsTof)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromf)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+	(*this->zeroDistributionsTof)(x1To, x2To, x3To) = (*this->zeroDistributionsFromf)(x1From, x2From, x3From);
+
+
+	(*this->localDistributionsToh)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_E, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_N, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_T, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_NE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TN, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+	(*this->localDistributionsToh)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFromh)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+	(*this->nonLocalDistributionsToh)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFromh)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+	(*this->zeroDistributionsToh)(x1To, x2To, x3To) = (*this->zeroDistributionsFromh)(x1From, x2From, x3From);
+
+    (*this->pressureTo)(x1To, x2To, x3To) = (*this->pressureFrom)(x1From, x2From, x3From);
+}
+#endif
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
new file mode 100644
index 000000000..b831cb840
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -0,0 +1,615 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "TwoDistributionsDoubleGhostLayerFullVectorConnector.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "EsoTwist3D.h"
+#include "DataSet3D.h"
+
+//////////////////////////////////////////////////////////////////////////
+TwoDistributionsDoubleGhostLayerFullVectorConnector::TwoDistributionsDoubleGhostLayerFullVectorConnector(SPtr<Block3D> block,
+                                                                         VectorTransmitterPtr sender,
+                                                                         VectorTransmitterPtr receiver, int sendDir)
+    : FullVectorConnector(block, sender, receiver, sendDir)
+{
+   if (!block || !sender || !receiver)
+      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
+
+}
+//////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullVectorConnector::init()
+{
+   FullVectorConnector::init();
+
+   fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions());
+   hDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getHdistributions());
+   pressure   = block.lock()->getKernel()->getDataSet()->getPressureField();
+
+   int anz = 2*27+1;
+   switch (sendDir)
+   {
+   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::E:
+   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::N:
+   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::T:
+   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
+
+   case D3Q27System::NE:
+   case D3Q27System::SW:
+   case D3Q27System::SE:
+   case D3Q27System::NW:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
+
+   case D3Q27System::TE:
+   case D3Q27System::BW:
+   case D3Q27System::BE:
+   case D3Q27System::TW:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
+
+   case D3Q27System::TN:
+   case D3Q27System::BS:
+   case D3Q27System::BN:
+   case D3Q27System::TS:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
+
+   case D3Q27System::TNE:
+   case D3Q27System::BSW:
+   case D3Q27System::BNE:
+   case D3Q27System::TSW:
+   case D3Q27System::TSE:
+   case D3Q27System::BNW:
+   case D3Q27System::BSE:
+   case D3Q27System::TNW:  sender->getData().resize(anz*8, 0.0);   break;
+
+   default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillSendVectors() 
+{ 
+    updatePointers();
+    fillData();
+}
+////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
+{
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    //int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    int minX1p3 = minX1 + 3;
+    //int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    //int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    int minX2p3 = minX2 + 3;
+    //int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    //int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    int minX3p3 = minX3 + 3;
+    //int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    int maxX3m3 = maxX3 - 3;
+
+    vector_type &sdata = sender->getData();
+
+    int index = 0;
+    // EAST
+    if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                fillData(sdata, index, maxX1m3, x2, x3);
+                fillData(sdata, index, maxX1m2, x2, x3);
+            }
+        }
+    }
+    // WEST
+    else if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                fillData(sdata, index, minX1p3, x2, x3);
+                fillData(sdata, index, minX1p2, x2, x3);
+            }
+        }
+    }
+    // NORTH
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, maxX2m3, x3);
+                fillData(sdata, index, x1, maxX2m2, x3);
+            }
+        }
+    }
+    // SOUTH
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, minX2p3, x3);
+                fillData(sdata, index, x1, minX2p2, x3);
+            }
+        }
+    }
+
+    // TOP
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, x2, maxX3m3);
+                fillData(sdata, index, x1, x2, maxX3m2);
+            }
+        }
+    }
+    // BOTTOM
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                fillData(sdata, index, x1, x2, minX3p3);
+                fillData(sdata, index, x1, x2, minX3p2);
+            }
+        }
+    }
+    // NORTHEAST
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, maxX1m3, maxX2m3, x3);
+            fillData(sdata, index, maxX1m2, maxX2m2, x3);
+            fillData(sdata, index, maxX1m3, maxX2m2, x3);
+            fillData(sdata, index, maxX1m2, maxX2m3, x3);
+        }
+    }
+    // NORTHWEST
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, minX1p3, maxX2m3, x3);
+            fillData(sdata, index, minX1p2, maxX2m2, x3);
+            fillData(sdata, index, minX1p3, maxX2m2, x3);
+            fillData(sdata, index, minX1p2, maxX2m3, x3);
+        }
+    }
+    // SOUTHWEST
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, minX1p3, minX2p3, x3);
+            fillData(sdata, index, minX1p2, minX2p2, x3);
+            fillData(sdata, index, minX1p3, minX2p2, x3);
+            fillData(sdata, index, minX1p2, minX2p3, x3);
+        }
+    }
+    // SOUTHEAST
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            fillData(sdata, index, maxX1m3, minX2p3, x3);
+            fillData(sdata, index, maxX1m2, minX2p2, x3);
+            fillData(sdata, index, maxX1m3, minX2p2, x3);
+            fillData(sdata, index, maxX1m2, minX2p3, x3);
+        }
+    } else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, maxX1m3, x2, maxX3m3);
+            fillData(sdata, index, maxX1m2, x2, maxX3m2);
+            fillData(sdata, index, maxX1m3, x2, maxX3m2);
+            fillData(sdata, index, maxX1m2, x2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, minX1p3, x2, minX3p3);
+            fillData(sdata, index, minX1p2, x2, minX3p2);
+            fillData(sdata, index, minX1p3, x2, minX3p2);
+            fillData(sdata, index, minX1p2, x2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, maxX1m3, x2, minX3p3);
+            fillData(sdata, index, maxX1m2, x2, minX3p2);
+            fillData(sdata, index, maxX1m3, x2, minX3p2);
+            fillData(sdata, index, maxX1m2, x2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            fillData(sdata, index, minX1p3, x2, maxX3m3);
+            fillData(sdata, index, minX1p2, x2, maxX3m2);
+            fillData(sdata, index, minX1p3, x2, maxX3m2);
+            fillData(sdata, index, minX1p2, x2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, maxX2m3, maxX3m3);
+            fillData(sdata, index, x1, maxX2m2, maxX3m2);
+            fillData(sdata, index, x1, maxX2m3, maxX3m2);
+            fillData(sdata, index, x1, maxX2m2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, minX2p3, minX3p3);
+            fillData(sdata, index, x1, minX2p2, minX3p2);
+            fillData(sdata, index, x1, minX2p3, minX3p2);
+            fillData(sdata, index, x1, minX2p2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, maxX2m3, minX3p3);
+            fillData(sdata, index, x1, maxX2m2, minX3p2);
+            fillData(sdata, index, x1, maxX2m3, minX3p2);
+            fillData(sdata, index, x1, maxX2m2, minX3p3);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            fillData(sdata, index, x1, minX2p3, maxX3m3);
+            fillData(sdata, index, x1, minX2p2, maxX3m2);
+            fillData(sdata, index, x1, minX2p3, maxX3m2);
+            fillData(sdata, index, x1, minX2p2, maxX3m3);
+        }
+    else if (sendDir == D3Q27System::TSW) {
+        fillData(sdata, index, minX1p3, minX2p3, maxX3m3);
+        fillData(sdata, index, minX1p2, minX2p2, maxX3m2);
+        fillData(sdata, index, minX1p3, minX2p2, maxX3m2);
+        fillData(sdata, index, minX1p2, minX2p3, maxX3m2);
+        fillData(sdata, index, minX1p2, minX2p2, maxX3m3);
+        fillData(sdata, index, minX1p3, minX2p3, maxX3m2);
+        fillData(sdata, index, minX1p3, minX2p2, maxX3m3);
+        fillData(sdata, index, minX1p2, minX2p3, maxX3m3);
+    } else if (sendDir == D3Q27System::TSE) {
+        fillData(sdata, index, maxX1m3, minX1p3, maxX3m3);
+        fillData(sdata, index, maxX1m2, minX1p2, maxX3m2);
+        fillData(sdata, index, maxX1m3, minX1p2, maxX3m2);
+        fillData(sdata, index, maxX1m2, minX1p3, maxX3m2);
+        fillData(sdata, index, maxX1m2, minX1p2, maxX3m3);
+        fillData(sdata, index, maxX1m3, minX1p3, maxX3m2);
+        fillData(sdata, index, maxX1m3, minX1p2, maxX3m3);
+        fillData(sdata, index, maxX1m2, minX1p3, maxX3m3);
+    } else if (sendDir == D3Q27System::TNW) {
+        fillData(sdata, index, minX1p3, maxX2m3, maxX3m3);
+        fillData(sdata, index, minX1p2, maxX2m2, maxX3m2);
+        fillData(sdata, index, minX1p3, maxX2m2, maxX3m2);
+        fillData(sdata, index, minX1p2, maxX2m3, maxX3m2);
+        fillData(sdata, index, minX1p2, maxX2m2, maxX3m3);
+        fillData(sdata, index, minX1p3, maxX2m3, maxX3m2);
+        fillData(sdata, index, minX1p3, maxX2m2, maxX3m3);
+        fillData(sdata, index, minX1p2, maxX2m3, maxX3m3);
+    } else if (sendDir == D3Q27System::TNE) {
+        fillData(sdata, index, maxX1m3, maxX2m3, maxX3m3);
+        fillData(sdata, index, maxX1m2, maxX2m2, maxX3m2);
+        fillData(sdata, index, maxX1m3, maxX2m2, maxX3m2);
+        fillData(sdata, index, maxX1m2, maxX2m3, maxX3m2);
+        fillData(sdata, index, maxX1m2, maxX2m2, maxX3m3);
+        fillData(sdata, index, maxX1m3, maxX2m3, maxX3m2);
+        fillData(sdata, index, maxX1m3, maxX2m2, maxX3m3);
+        fillData(sdata, index, maxX1m2, maxX2m3, maxX3m3);
+    } else if (sendDir == D3Q27System::BSW) {
+        fillData(sdata, index, minX1p3, minX2p3, minX3p3);
+        fillData(sdata, index, minX1p2, minX2p2, minX3p2);
+        fillData(sdata, index, minX1p3, minX2p2, minX3p2);
+        fillData(sdata, index, minX1p2, minX2p3, minX3p2);
+        fillData(sdata, index, minX1p2, minX2p2, minX3p3);
+        fillData(sdata, index, minX1p3, minX2p3, minX3p2);
+        fillData(sdata, index, minX1p3, minX2p2, minX3p3);
+        fillData(sdata, index, minX1p2, minX2p3, minX3p3);
+    } else if (sendDir == D3Q27System::BSE) {
+        fillData(sdata, index, maxX1m3, minX2p3, minX3p3);
+        fillData(sdata, index, maxX1m2, minX2p2, minX3p2);
+        fillData(sdata, index, maxX1m3, minX2p2, minX3p2);
+        fillData(sdata, index, maxX1m2, minX2p3, minX3p2);
+        fillData(sdata, index, maxX1m2, minX2p2, minX3p3);
+        fillData(sdata, index, maxX1m3, minX2p3, minX3p2);
+        fillData(sdata, index, maxX1m3, minX2p2, minX3p3);
+        fillData(sdata, index, maxX1m2, minX2p3, minX3p3);
+    } else if (sendDir == D3Q27System::BNW) {
+        fillData(sdata, index, minX1p3, maxX2m3, minX3p3);
+        fillData(sdata, index, minX1p2, maxX2m2, minX3p2);
+        fillData(sdata, index, minX1p3, maxX2m2, minX3p2);
+        fillData(sdata, index, minX1p2, maxX2m3, minX3p2);
+        fillData(sdata, index, minX1p2, maxX2m2, minX3p3);
+        fillData(sdata, index, minX1p3, maxX2m3, minX3p2);
+        fillData(sdata, index, minX1p3, maxX2m2, minX3p3);
+        fillData(sdata, index, minX1p2, maxX2m3, minX3p3);
+    } else if (sendDir == D3Q27System::BNE) {
+        fillData(sdata, index, maxX1m3, maxX2m3, minX3p3);
+        fillData(sdata, index, maxX1m2, maxX2m2, minX3p2);
+        fillData(sdata, index, maxX1m3, maxX2m2, minX3p2);
+        fillData(sdata, index, maxX1m2, maxX2m3, minX3p2);
+        fillData(sdata, index, maxX1m2, maxX2m2, minX3p3);
+        fillData(sdata, index, maxX1m3, maxX2m3, minX3p2);
+        fillData(sdata, index, maxX1m3, maxX2m2, minX3p3);
+        fillData(sdata, index, maxX1m2, maxX2m3, minX3p3);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+}
+////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeReceiveVectors() 
+{
+    updatePointers();
+    distributeData();
+}
+////////////////////////////////////////////////////////////////////////
+void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
+{
+    vector_type &rdata = receiver->getData();
+
+    int index = 0;
+    ////////////////////////////////////////////////////////////
+    // relation between ghost layer and regular nodes
+    // maxX1m3 maxX1m2 ... minX1p2 minX1p3 - regular nodes
+    // minX1   minX1p1 ... maxX1m1 maxX1   - ghost layer
+    ////////////////////////////////////////////////////////////
+
+    int minX1   = 0;
+    int minX1p1 = minX1 + 1;
+    int minX1p2 = minX1 + 2;
+    //int minX1p3 = minX1 + 3;
+    int maxX1m1 = maxX1 - 1;
+    int maxX1m2 = maxX1 - 2;
+    //int maxX1m3 = maxX1 - 3;
+
+    int minX2   = 0;
+    int minX2p1 = minX2 + 1;
+    int minX2p2 = minX2 + 2;
+    //int minX2p3 = minX2 + 3;
+    int maxX2m1 = maxX2 - 1;
+    int maxX2m2 = maxX2 - 2;
+    //int maxX2m3 = maxX2 - 3;
+
+    int minX3   = 0;
+    int minX3p1 = minX3 + 1;
+    int minX3p2 = minX3 + 2;
+    //int minX3p3 = minX3 + 3;
+    int maxX3m1 = maxX3 - 1;
+    int maxX3m2 = maxX3 - 2;
+    //int maxX3m3 = maxX3 - 3;
+
+    if (sendDir == D3Q27System::W) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                distributeData(rdata, index, minX1, x2, x3);
+                distributeData(rdata, index, minX1p1, x2, x3);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::E) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+                distributeData(rdata, index, maxX1, x2, x3);
+                distributeData(rdata, index, maxX1m1, x2, x3);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::S) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, minX2, x3);
+                distributeData(rdata, index, x1, minX2p1, x3);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::N) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, maxX2, x3);
+                distributeData(rdata, index, x1, maxX2m1, x3);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::B) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, x2, minX3);
+                distributeData(rdata, index, x1, x2, minX3p1);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::T) {
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+                distributeData(rdata, index, x1, x2, maxX3);
+                distributeData(rdata, index, x1, x2, maxX3m1);
+            }
+        }
+    }
+    else if (sendDir == D3Q27System::SW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, minX1, minX2, x3);
+            distributeData(rdata, index, minX1p1, minX2p1, x3);
+            distributeData(rdata, index, minX1, minX2p1, x3);
+            distributeData(rdata, index, minX1p1, minX2, x3);
+        }
+    }
+    else if (sendDir == D3Q27System::SE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, maxX1, minX2, x3);
+            distributeData(rdata, index, maxX1m1, minX2p1, x3);
+            distributeData(rdata, index, maxX1, minX2p1, x3);
+            distributeData(rdata, index, maxX1m1, minX2, x3);
+        }
+    }
+    else if (sendDir == D3Q27System::NE) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, maxX1, maxX2, x3);
+            distributeData(rdata, index, maxX1m1, maxX2m1, x3);
+            distributeData(rdata, index, maxX1, maxX2m1, x3);
+            distributeData(rdata, index, maxX1m1, maxX2, x3);
+        }
+    }
+    else if (sendDir == D3Q27System::NW) {
+        for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
+            distributeData(rdata, index, minX1, maxX2, x3);
+            distributeData(rdata, index, minX1p1, maxX2m1, x3);
+            distributeData(rdata, index, minX1, maxX2m1, x3);
+            distributeData(rdata, index, minX1p1, maxX2, x3);
+        }
+    } else if (sendDir == D3Q27System::BW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, minX1, x2, minX3);
+            distributeData(rdata, index, minX1p1, x2, minX3p1);
+            distributeData(rdata, index, minX1, x2, minX3p1);
+            distributeData(rdata, index, minX1p1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::TE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, maxX1, x2, maxX3);
+            distributeData(rdata, index, maxX1m1, x2, maxX3m1);
+            distributeData(rdata, index, maxX1, x2, maxX3m1);
+            distributeData(rdata, index, maxX1m1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::TW)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, minX1, x2, maxX3);
+            distributeData(rdata, index, minX1p1, x2, maxX3m1);
+            distributeData(rdata, index, minX1, x2, maxX3m1);
+            distributeData(rdata, index, minX1p1, x2, maxX3);
+        }
+    else if (sendDir == D3Q27System::BE)
+        for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
+            distributeData(rdata, index, maxX1, x2, minX3);
+            distributeData(rdata, index, maxX1m1, x2, minX3p1);
+            distributeData(rdata, index, maxX1, x2, minX3p1);
+            distributeData(rdata, index, maxX1m1, x2, minX3);
+        }
+    else if (sendDir == D3Q27System::BS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, minX2, minX3);
+            distributeData(rdata, index, x1, minX2p1, minX3p1);
+            distributeData(rdata, index, x1, minX2, minX3p1);
+            distributeData(rdata, index, x1, minX2p1, minX3);
+        }
+    else if (sendDir == D3Q27System::TN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, maxX2, maxX3);
+            distributeData(rdata, index, x1, maxX2m1, maxX3m1);
+            distributeData(rdata, index, x1, maxX2, maxX3m1);
+            distributeData(rdata, index, x1, maxX2m1, maxX3);
+        }
+    else if (sendDir == D3Q27System::TS)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, minX2, maxX3);
+            distributeData(rdata, index, x1, minX2p1, maxX3m1);
+            distributeData(rdata, index, x1, minX2, maxX3m1);
+            distributeData(rdata, index, x1, minX2p1, maxX3);
+        }
+    else if (sendDir == D3Q27System::BN)
+        for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
+            distributeData(rdata, index, x1, maxX2, minX3);
+            distributeData(rdata, index, x1, maxX2m1, minX3p1);
+            distributeData(rdata, index, x1, maxX2, minX3p1);
+            distributeData(rdata, index, x1, maxX2m1, minX3);
+        }
+    else if (sendDir == D3Q27System::BNE) {
+        distributeData(rdata, index, maxX1, maxX2, minX3);
+        distributeData(rdata, index, maxX1m1, maxX2m1, minX3p1);
+        distributeData(rdata, index, maxX1, maxX2m1, minX3p1);
+        distributeData(rdata, index, maxX1m1, maxX2, minX3p1);
+        distributeData(rdata, index, maxX1m1, maxX2m1, minX3);
+        distributeData(rdata, index, maxX1, maxX2, minX3p1);
+        distributeData(rdata, index, maxX1, maxX2m1, minX3);
+        distributeData(rdata, index, maxX1m1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::BNW) {
+        distributeData(rdata, index, minX1, maxX2, minX3);
+        distributeData(rdata, index, minX1p1, maxX2m1, minX3p1);
+        distributeData(rdata, index, minX1, maxX2m1, minX3p1);
+        distributeData(rdata, index, minX1p1, maxX2, minX3p1);
+        distributeData(rdata, index, minX1p1, maxX2m1, minX3);
+        distributeData(rdata, index, minX1, maxX2, minX3p1);
+        distributeData(rdata, index, minX1, maxX2m1, minX3);
+        distributeData(rdata, index, minX1p1, maxX2, minX3);
+    } else if (sendDir == D3Q27System::BSE) {
+        distributeData(rdata, index, maxX1, minX2, minX3);
+        distributeData(rdata, index, maxX1m1, minX2p1, minX3p1);
+        distributeData(rdata, index, maxX1, minX2p1, minX3p1);
+        distributeData(rdata, index, maxX1m1, minX2, minX3p1);
+        distributeData(rdata, index, maxX1m1, minX2p1, minX3);
+        distributeData(rdata, index, maxX1, minX2, minX3p1);
+        distributeData(rdata, index, maxX1, minX2p1, minX3);
+        distributeData(rdata, index, maxX1m1, minX2, minX3);
+    } else if (sendDir == D3Q27System::BSW) {
+        distributeData(rdata, index, minX1, minX2, minX3);
+        distributeData(rdata, index, minX1p1, minX2p1, minX3p1);
+        distributeData(rdata, index, minX1, minX2p1, minX3p1);
+        distributeData(rdata, index, minX1p1, minX2, minX3p1);
+        distributeData(rdata, index, minX1p1, minX2p1, minX3);
+        distributeData(rdata, index, minX1, minX2, minX3p1);
+        distributeData(rdata, index, minX1, minX2p1, minX3);
+        distributeData(rdata, index, minX1p1, minX2, minX3);
+    } else if (sendDir == D3Q27System::TNE) {
+        distributeData(rdata, index, maxX1, maxX2, maxX3);
+        distributeData(rdata, index, maxX1m1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, maxX1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, maxX1m1, maxX2, maxX3m1);
+        distributeData(rdata, index, maxX1m1, maxX2m1, maxX3);
+        distributeData(rdata, index, maxX1, maxX2, maxX3m1);
+        distributeData(rdata, index, maxX1, maxX2m1, maxX3);
+        distributeData(rdata, index, maxX1m1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::TNW) {
+        distributeData(rdata, index, minX1, maxX2, maxX3);
+        distributeData(rdata, index, minX1p1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, minX1, maxX2m1, maxX3m1);
+        distributeData(rdata, index, minX1p1, maxX2, maxX3m1);
+        distributeData(rdata, index, minX1p1, maxX2m1, maxX3);
+        distributeData(rdata, index, minX1, maxX2, maxX3m1);
+        distributeData(rdata, index, minX1, maxX2m1, maxX3);
+        distributeData(rdata, index, minX1p1, maxX2, maxX3);
+    } else if (sendDir == D3Q27System::TSE) {
+        distributeData(rdata, index, maxX1, minX2, maxX3);
+        distributeData(rdata, index, maxX1m1, minX2p1, maxX3m1);
+        distributeData(rdata, index, maxX1, minX2p1, maxX3m1);
+        distributeData(rdata, index, maxX1m1, minX2, maxX3m1);
+        distributeData(rdata, index, maxX1m1, minX2p1, maxX3);
+        distributeData(rdata, index, maxX1, minX2, maxX3m1);
+        distributeData(rdata, index, maxX1, minX2p1, maxX3);
+        distributeData(rdata, index, maxX1m1, minX2, maxX3);
+    } else if (sendDir == D3Q27System::TSW) {
+        distributeData(rdata, index, minX1, minX2, maxX3);
+        distributeData(rdata, index, minX1p1, minX2p1, maxX3m1);
+        distributeData(rdata, index, minX1, minX2p1, maxX3m1);
+        distributeData(rdata, index, minX1p1, minX2, maxX3m1);
+        distributeData(rdata, index, minX1p1, minX2p1, maxX3);
+        distributeData(rdata, index, minX1, minX2, maxX3m1);
+        distributeData(rdata, index, minX1, minX2p1, maxX3);
+        distributeData(rdata, index, minX1p1, minX2, maxX3);
+    } else
+        UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+
+}
+//////////////////////////////////////////////////////////////////////////
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h
new file mode 100644
index 000000000..508c9e90a
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h
@@ -0,0 +1,232 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file TwoDistributionsDoubleGhostLayerFullVectorConnector.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef TwoDistributionsDoubleGhostLayerFullVectorConnector_H
+#define TwoDistributionsDoubleGhostLayerFullVectorConnector_H
+
+#include <vector>
+
+#include "FullVectorConnector.h"
+#include "D3Q27System.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+#include "DataSet3D.h"
+
+class EsoTwist3D;
+class Block3D;
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+class TwoDistributionsDoubleGhostLayerFullVectorConnector : public FullVectorConnector
+{
+public:
+   TwoDistributionsDoubleGhostLayerFullVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir);
+
+   void init() override;
+
+   void fillSendVectors() override;
+   void distributeReceiveVectors() override;
+
+protected:
+   inline void updatePointers() override;
+   void fillData() override;
+   void distributeData() override;
+   inline void fillData(vector_type &sdata, int &index, int x1, int x2, int x3) override;
+   inline void distributeData(vector_type &rdata, int &index, int x1, int x2, int x3) override;
+
+private:
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
+
+   SPtr<EsoTwist3D>  fDis;
+
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localHdistributions;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalHdistributions;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroHdistributions;
+
+   SPtr<EsoTwist3D>  hDis;
+
+   SPtr<PressureFieldArray3D> pressure;
+
+};
+//////////////////////////////////////////////////////////////////////////
+inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::updatePointers()
+{
+    localDistributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
+    nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
+    zeroDistributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
+
+    localHdistributions    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getLocalDistributions();
+    nonLocalHdistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getNonLocalDistributions();
+    zeroHdistributions     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->hDis)->getZeroDistributions();
+}
+//////////////////////////////////////////////////////////////////////////
+inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
+{
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroDistributions)(x1, x2, x3);
+
+
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localHdistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalHdistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroHdistributions)(x1, x2, x3);
+
+   sdata[index++] = (*this->pressure)(x1, x2, x3);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
+{
+   (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
+
+   (*this->zeroDistributions)(x1, x2, x3) = rdata[index++];
+
+   
+   (*this->localHdistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localHdistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalHdistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalHdistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
+
+   (*this->zeroHdistributions)(x1, x2, x3) = rdata[index++];
+
+   (*this->pressure)(x1, x2, x3) = rdata[index++];
+}
+
+
+#endif 
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
new file mode 100644
index 000000000..e2316f383
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -0,0 +1,1667 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphasePressureFilterLBMKernel.cpp
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphasePressureFilterLBMKernel.h"
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "D3Q27System.h"
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include <cmath>
+
+#define PROOF_CORRECTNESS
+
+//////////////////////////////////////////////////////////////////////////
+MultiphasePressureFilterLBMKernel::MultiphasePressureFilterLBMKernel() { this->compressible = false; }
+//////////////////////////////////////////////////////////////////////////
+void MultiphasePressureFilterLBMKernel::initDataSet()
+{
+	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+
+	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	dataSet->setFdistributions(f);
+	dataSet->setHdistributions(h); // For phase-field
+	dataSet->setPhaseField(divU1);
+	dataSet->setPressureField(pressure);
+
+	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+
+	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> MultiphasePressureFilterLBMKernel::clone()
+{
+	SPtr<LBMKernel> kernel(new MultiphasePressureFilterLBMKernel());
+	kernel->setNX(nx);
+	dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->initDataSet();
+	kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+	kernel->setDensityRatio(this->densityRatio);
+	kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+	kernel->setContactAngle(this->contactAngle);
+	kernel->setPhiL(this->phiL);
+	kernel->setPhiH(this->phiH);
+	kernel->setPhaseFieldRelaxation(this->tauH);
+	kernel->setMobility(this->mob);
+	kernel->setInterfaceWidth(this->interfaceWidth);
+
+	kernel->setBCProcessor(bcProcessor->clone(kernel));
+	kernel->setWithForcing(withForcing);
+	kernel->setForcingX1(muForcingX1);
+	kernel->setForcingX2(muForcingX2);
+	kernel->setForcingX3(muForcingX3);
+	kernel->setIndex(ix1, ix2, ix3);
+	kernel->setDeltaT(deltaT);
+	kernel->setGhostLayerWidth(2);
+	dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->initForcing();
+
+	return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m2 = mfa + mfc;
+	LBMReal m1 = mfc - mfa;
+	LBMReal m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += oneMinusRho;
+	mfb = (m1 * Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal m1 = (mfa + mfc) + mfb;
+	LBMReal m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+	mfb = m2 - vv * m1;
+	mfa = m1;
+}
+
+
+void  MultiphasePressureFilterLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+
+void MultiphasePressureFilterLBMKernel::calculate(int step)
+{
+	using namespace D3Q27System;
+	using namespace UbMath;
+
+	forcingX1 = 0.0;
+	forcingX2 = 0.0;
+	forcingX3 = 0.0;
+
+	LBMReal oneOverInterfaceScale = c4 / interfaceWidth; //1.0;//1.5;
+														 /////////////////////////////////////
+
+	localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+	nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+	zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+	localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	const int bcArrayMaxX1 = (int)bcArray->getNX1();
+	const int bcArrayMaxX2 = (int)bcArray->getNX2();
+	const int bcArrayMaxX3 = (int)bcArray->getNX3();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+
+	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
+		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
+			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+					(*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+						(((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+							((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+								(mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+
+					////// read F-distributions for velocity formalism
+
+					mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+
+					LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+					//! variable density -> TRANSFER!
+					//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+
+					(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
+
+					//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
+					////!!!!!! relplace by pointer swap!
+					//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+				}
+			}
+		}
+	}
+
+	LBMReal collFactorM;
+
+	////Periodic Filter
+	for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+		for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+			for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+					LBMReal sum = 0.;
+
+					///Version for boundaries
+					for (int xx = -1; xx <= 1; xx++) {
+						//int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+						int xxx = xx + x1;
+
+						for (int yy = -1; yy <= 1; yy++) {
+							//int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+							int yyy = yy + x2;
+
+							for (int zz = -1; zz <= 1; zz++) {
+								//int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+								int zzz = zz + x3;
+
+								if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+									sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressureOld)(xxx, yyy, zzz);
+								}
+								else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressureOld)(x1, x2, x3);
+								}
+
+
+							}
+						}
+					}
+					(*pressure)(x1, x2, x3) = sum;
+				}
+			}
+		}
+	}
+
+	////!filter
+
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					//////////////////////////////////////////////////////////////////////////
+					// Read distributions and phase field
+					////////////////////////////////////////////////////////////////////////////
+					//////////////////////////////////////////////////////////////////////////
+
+					// E   N  T
+					// c   c  c
+					//////////
+					// W   S  B
+					// a   a  a
+
+					// Rest ist b
+
+					// mfxyz
+					// a - negative
+					// b - null
+					// c - positive
+
+					// a b c
+					//-1 0 1
+
+					findNeighbors(phaseField, x1, x2, x3);
+
+					LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal dX1_phi = gradX1_phi();
+					LBMReal dX2_phi = gradX2_phi();
+					LBMReal dX3_phi = gradX3_phi();
+
+					LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
+					LBMReal normX1 = dX1_phi / denom;
+					LBMReal normX2 = dX2_phi / denom;
+					LBMReal normX3 = dX3_phi / denom;
+
+
+
+					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+
+
+					LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+
+					//----------- Calculating Macroscopic Values -------------
+					LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+
+					LBMReal m0, m1, m2;
+					LBMReal rhoRef=c1;
+
+					LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+						(mfcbb - mfabb))/rhoRef;
+					LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+						(mfbcb - mfbab))/rhoRef;
+					LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+						(mfbbc - mfbba))/rhoRef;
+
+					LBMReal gradPx = 0.0;
+					LBMReal gradPy = 0.0;
+					LBMReal gradPz = 0.0;
+					for (int dir1 = -1; dir1 <= 1; dir1++) {
+						for (int dir2 = -1; dir2 <= 1; dir2++) {
+							int yyy = x2 + dir1;
+							int zzz = x3 + dir2;
+							if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+								gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) {
+								gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+							int xxx = x1 + dir1;
+							if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+								gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) {
+								gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+							yyy = x2 + dir2;
+							if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+								gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+								gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+						}
+					}
+
+					//Viscosity increase by pressure gradient
+					LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+					//LBMReal limVis = 0.0000001*10;//0.01;
+					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
+					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
+					errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
+					//collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+
+					//3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+					//+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+					//+WEIGTH[N] * (phi2[T] - phi2[B]));
+
+					muRho = rho;
+
+					forcingX1 = muForcingX1.Eval()/rho - gradPx/rho;
+					forcingX2 = muForcingX2.Eval()/rho - gradPy/rho;
+					forcingX3 = muForcingX3.Eval()/rho - gradPz/rho;
+
+					vvx += forcingX1 * deltaT * 0.5; // X
+					vvy += forcingX2 * deltaT * 0.5; // Y
+					vvz += forcingX3 * deltaT * 0.5; // Z
+
+                    ///surface tension force
+					vvx += mu * dX1_phi * c1o2 / rho;
+					vvy += mu * dX2_phi * c1o2 / rho ;
+					vvz += mu * dX3_phi * c1o2 / rho;
+
+					LBMReal vx2;
+					LBMReal vy2;
+					LBMReal vz2;
+					vx2 = vvx * vvx;
+					vy2 = vvy * vvy;
+					vz2 = vvz * vvz;
+					///////////////////////////////////////////////////////////////////////////////////////////               
+					LBMReal oMdrho;
+
+
+					oMdrho = mfccc + mfaaa;
+					m0 = mfaca + mfcac;
+					m1 = mfacc + mfcaa;
+					m2 = mfaac + mfcca;
+					oMdrho += m0;
+					m1 += m2;
+					oMdrho += m1;
+					m0 = mfbac + mfbca;
+					m1 = mfbaa + mfbcc;
+					m0 += m1;
+					m1 = mfabc + mfcba;
+					m2 = mfaba + mfcbc;
+					m1 += m2;
+					m0 += m1;
+					m1 = mfacb + mfcab;
+					m2 = mfaab + mfccb;
+					m1 += m2;
+					m0 += m1;
+					oMdrho += m0;
+					m0 = mfabb + mfcbb;
+					m1 = mfbab + mfbcb;
+					m2 = mfbba + mfbbc;
+					m0 += m1 + m2;
+					m0 += mfbbb; //hat gefehlt
+					oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+
+															 ////////////////////////////////////////////////////////////////////////////////////
+					LBMReal wadjust;
+					LBMReal qudricLimit = 0.01;
+					////////////////////////////////////////////////////////////////////////////////////
+					//Hin
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m2 = mfaaa + mfaac;
+					m1 = mfaac - mfaaa;
+					m0 = m2 + mfaab;
+					mfaaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfaab = m1 - m0 * vvz;
+					mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfabc;
+					m1 = mfabc - mfaba;
+					m0 = m2 + mfabb;
+					mfaba = m0;
+					m0 += c1o9 * oMdrho;
+					mfabb = m1 - m0 * vvz;
+					mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfacc;
+					m1 = mfacc - mfaca;
+					m0 = m2 + mfacb;
+					mfaca = m0;
+					m0 += c1o36 * oMdrho;
+					mfacb = m1 - m0 * vvz;
+					mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbac;
+					m1 = mfbac - mfbaa;
+					m0 = m2 + mfbab;
+					mfbaa = m0;
+					m0 += c1o9 * oMdrho;
+					mfbab = m1 - m0 * vvz;
+					mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbba + mfbbc;
+					m1 = mfbbc - mfbba;
+					m0 = m2 + mfbbb;
+					mfbba = m0;
+					m0 += c4o9 * oMdrho;
+					mfbbb = m1 - m0 * vvz;
+					mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbca + mfbcc;
+					m1 = mfbcc - mfbca;
+					m0 = m2 + mfbcb;
+					mfbca = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcb = m1 - m0 * vvz;
+					mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcac;
+					m1 = mfcac - mfcaa;
+					m0 = m2 + mfcab;
+					mfcaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfcab = m1 - m0 * vvz;
+					mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcba + mfcbc;
+					m1 = mfcbc - mfcba;
+					m0 = m2 + mfcbb;
+					mfcba = m0;
+					m0 += c1o9 * oMdrho;
+					mfcbb = m1 - m0 * vvz;
+					mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcca + mfccc;
+					m1 = mfccc - mfcca;
+					m0 = m2 + mfccb;
+					mfcca = m0;
+					m0 += c1o36 * oMdrho;
+					mfccb = m1 - m0 * vvz;
+					mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m2 = mfaaa + mfaca;
+					m1 = mfaca - mfaaa;
+					m0 = m2 + mfaba;
+					mfaaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfaba = m1 - m0 * vvy;
+					mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfacb;
+					m1 = mfacb - mfaab;
+					m0 = m2 + mfabb;
+					mfaab = m0;
+					mfabb = m1 - m0 * vvy;
+					mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfacc;
+					m1 = mfacc - mfaac;
+					m0 = m2 + mfabc;
+					mfaac = m0;
+					m0 += c1o18 * oMdrho;
+					mfabc = m1 - m0 * vvy;
+					mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbca;
+					m1 = mfbca - mfbaa;
+					m0 = m2 + mfbba;
+					mfbaa = m0;
+					m0 += c2o3 * oMdrho;
+					mfbba = m1 - m0 * vvy;
+					mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbab + mfbcb;
+					m1 = mfbcb - mfbab;
+					m0 = m2 + mfbbb;
+					mfbab = m0;
+					mfbbb = m1 - m0 * vvy;
+					mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbac + mfbcc;
+					m1 = mfbcc - mfbac;
+					m0 = m2 + mfbbc;
+					mfbac = m0;
+					m0 += c2o9 * oMdrho;
+					mfbbc = m1 - m0 * vvy;
+					mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcca;
+					m1 = mfcca - mfcaa;
+					m0 = m2 + mfcba;
+					mfcaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfcba = m1 - m0 * vvy;
+					mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcab + mfccb;
+					m1 = mfccb - mfcab;
+					m0 = m2 + mfcbb;
+					mfcab = m0;
+					mfcbb = m1 - m0 * vvy;
+					mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcac + mfccc;
+					m1 = mfccc - mfcac;
+					m0 = m2 + mfcbc;
+					mfcac = m0;
+					m0 += c1o18 * oMdrho;
+					mfcbc = m1 - m0 * vvy;
+					mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m2 = mfaaa + mfcaa;
+					m1 = mfcaa - mfaaa;
+					m0 = m2 + mfbaa;
+					mfaaa = m0;
+					m0 += 1. * oMdrho;
+					mfbaa = m1 - m0 * vvx;
+					mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfcba;
+					m1 = mfcba - mfaba;
+					m0 = m2 + mfbba;
+					mfaba = m0;
+					mfbba = m1 - m0 * vvx;
+					mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfcca;
+					m1 = mfcca - mfaca;
+					m0 = m2 + mfbca;
+					mfaca = m0;
+					m0 += c1o3 * oMdrho;
+					mfbca = m1 - m0 * vvx;
+					mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfcab;
+					m1 = mfcab - mfaab;
+					m0 = m2 + mfbab;
+					mfaab = m0;
+					mfbab = m1 - m0 * vvx;
+					mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabb + mfcbb;
+					m1 = mfcbb - mfabb;
+					m0 = m2 + mfbbb;
+					mfabb = m0;
+					mfbbb = m1 - m0 * vvx;
+					mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacb + mfccb;
+					m1 = mfccb - mfacb;
+					m0 = m2 + mfbcb;
+					mfacb = m0;
+					mfbcb = m1 - m0 * vvx;
+					mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfcac;
+					m1 = mfcac - mfaac;
+					m0 = m2 + mfbac;
+					mfaac = m0;
+					m0 += c1o3 * oMdrho;
+					mfbac = m1 - m0 * vvx;
+					mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabc + mfcbc;
+					m1 = mfcbc - mfabc;
+					m0 = m2 + mfbbc;
+					mfabc = m0;
+					mfbbc = m1 - m0 * vvx;
+					mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacc + mfccc;
+					m1 = mfccc - mfacc;
+					m0 = m2 + mfbcc;
+					mfacc = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcc = m1 - m0 * vvx;
+					mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					// Cumulants
+					////////////////////////////////////////////////////////////////////////////////////
+
+					// mfaaa = 0.0;
+					LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity
+											//  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+											//  LBMReal OxyyMxzz  = 1.;//2+s9;//
+					LBMReal O4 = 1.;
+					LBMReal O5 = 1.;
+					LBMReal O6 = 1.;
+
+					/////fourth order parameters; here only for test. Move out of loop!
+
+					LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+					//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+
+
+					//Cum 4.
+					//LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+
+					//Cum 5.
+					LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+					LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+					LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//Cum 6.
+					LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+
+					//2.
+					// linear combinations
+					LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+
+					//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+					mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+										//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
+					LBMReal mxxMyy = mfcaa - mfaca;
+					LBMReal mxxMzz = mfcaa - mfaac;
+
+					LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+					LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+					LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+
+					LBMReal Dxy = -three * collFactorM * mfbba;
+					LBMReal Dxz = -three * collFactorM * mfbab;
+					LBMReal Dyz = -three * collFactorM * mfabb;
+
+					//relax
+					mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+					mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+					mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+
+					mfabb += collFactorM * (-mfabb);
+					mfbab += collFactorM * (-mfbab);
+					mfbba += collFactorM * (-mfbba);
+
+					////updated pressure
+					//mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+					mfaaa = 0.0; // Pressure elimination as in standard velocity model
+								 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
+
+					mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+
+										// mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+										//mfaaa = mfaaaS;
+										// linear combinations back
+					mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+
+					//3.
+					// linear combinations
+					LBMReal mxxyPyzz = mfcba + mfabc;
+					LBMReal mxxyMyzz = mfcba - mfabc;
+
+					LBMReal mxxzPyyz = mfcab + mfacb;
+					LBMReal mxxzMyyz = mfcab - mfacb;
+
+					LBMReal mxyyPxzz = mfbca + mfbac;
+					LBMReal mxyyMxzz = mfbca - mfbac;
+
+					//relax
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+					mfbbb += wadjust * (-mfbbb);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+					mxxyPyzz += wadjust * (-mxxyPyzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+					mxxyMyzz += wadjust * (-mxxyMyzz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+					mxxzPyyz += wadjust * (-mxxzPyyz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+					mxxzMyyz += wadjust * (-mxxzMyyz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+					mxyyPxzz += wadjust * (-mxyyPxzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+					mxyyMxzz += wadjust * (-mxyyMxzz);
+
+					// linear combinations back
+					mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+					mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+					mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+					mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+					mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+					mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+					//4.
+					CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+					CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+					CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+					CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+					CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+					CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+
+					//5.
+					CUMbcc += O5 * (-CUMbcc);
+					CUMcbc += O5 * (-CUMcbc);
+					CUMccb += O5 * (-CUMccb);
+
+					//6.
+					CUMccc += O6 * (-CUMccc);
+
+					//back cumulants to central moments
+					//4.
+					//mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+
+					//5.
+					mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+					mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+					mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//6.
+					mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+
+
+					////////
+
+
+					////////////////////////////////////////////////////////////////////////////////////
+					//forcing
+					mfbaa = -mfbaa;
+					mfaba = -mfaba;
+					mfaab = -mfaab;
+					//////////////////////////////////////////////////////////////////////////////////////
+					mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+					mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+					mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
+					////////////////////////////////////////////////////////////////////////////////////
+					//back
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+					m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaaa = m0;
+					mfaab = m1;
+					mfaac = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+					m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+					m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+					mfaba = m0;
+					mfabb = m1;
+					mfabc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaca = m0;
+					mfacb = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+					m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+					m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+					mfbaa = m0;
+					mfbab = m1;
+					mfbac = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+					m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+					m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+					mfbba = m0;
+					mfbbb = m1;
+					mfbbc = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+					m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+					m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+					mfbca = m0;
+					mfbcb = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcaa = m0;
+					mfcab = m1;
+					mfcac = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+					m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+					m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+					mfcba = m0;
+					mfcbb = m1;
+					mfcbc = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+					m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcca = m0;
+					mfccb = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaaa = m0;
+					mfaba = m1;
+					mfaca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+					m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaab = m0;
+					mfabb = m1;
+					mfacb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaac = m0;
+					mfabc = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+					m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+					m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+					mfbaa = m0;
+					mfbba = m1;
+					mfbca = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+					m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+					m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+					mfbab = m0;
+					mfbbb = m1;
+					mfbcb = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+					m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+					m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+					mfbac = m0;
+					mfbbc = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcaa = m0;
+					mfcba = m1;
+					mfcca = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+					m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcab = m0;
+					mfcbb = m1;
+					mfccb = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcac = m0;
+					mfcbc = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaaa = m0;
+					mfbaa = m1;
+					mfcaa = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaba = m0;
+					mfbba = m1;
+					mfcba = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaca = m0;
+					mfbca = m1;
+					mfcca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaab = m0;
+					mfbab = m1;
+					mfcab = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+					m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabb = m0;
+					mfbbb = m1;
+					mfcbb = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacb = m0;
+					mfbcb = m1;
+					mfccb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaac = m0;
+					mfbac = m1;
+					mfcac = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabc = m0;
+					mfbbc = m1;
+					mfcbc = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacc = m0;
+					mfbcc = m1;
+					mfccc = m2;
+
+					//////////////////////////////////////////////////////////////////////////
+					//proof correctness
+					//////////////////////////////////////////////////////////////////////////
+					//#ifdef  PROOF_CORRECTNESS
+					LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+					//			   //LBMReal dif = fabs(drho - rho_post);
+					//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+					//#ifdef SINGLEPRECISION
+					//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+					//#else
+					//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+					//#endif
+					//			   {
+					//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+					//					   + " dif=" + UbSystem::toString(dif)
+					//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+					//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+					//				   //exit(EXIT_FAILURE);
+					//			   }
+					//#endif
+
+					if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post))
+						UB_THROW(UbException(
+							UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," +
+							UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+
+					//////////////////////////////////////////////////////////////////////////
+					//write distribution
+					//////////////////////////////////////////////////////////////////////////
+					(*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
+
+					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+																																		// !Old Kernel
+/////////////////////  P H A S E - F I E L D   S O L V E R
+////////////////////////////////////////////
+/////CUMULANT PHASE-FIELD
+					LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+					{
+						mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+						mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+						mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+						mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+						mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+						mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+						mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+						mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+						mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+						mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+						mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+						mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+						mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+						mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+						mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+						mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+						mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+						mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+						mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+						mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+						mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+						mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+						mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+						mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+						mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+						mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+						mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// second component
+						LBMReal concentration =
+							((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+								(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+								((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+						////////////////////////////////////////////////////////////////////////////////////
+						LBMReal oneMinusRho = c1- concentration;
+
+						LBMReal cx =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+								(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+								(mfcbb - mfabb));
+						LBMReal cy =
+							((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+								(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+								(mfbcb - mfbab));
+						LBMReal cz =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+								(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+								(mfbbc - mfbba));
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// calculate the square of velocities for this lattice node
+						LBMReal cx2 = cx * cx;
+						LBMReal cy2 = cy * cy;
+						LBMReal cz2 = cz * cz;
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (6)-(14) in \ref
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - experimental Cumulant ... to be published ... hopefully
+						//!
+
+						// linearized orthogonalization of 3rd order central moments
+						LBMReal Mabc = mfabc - mfaba * c1o3;
+						LBMReal Mbca = mfbca - mfbaa * c1o3;
+						LBMReal Macb = mfacb - mfaab * c1o3;
+						LBMReal Mcba = mfcba - mfaba * c1o3;
+						LBMReal Mcab = mfcab - mfaab * c1o3;
+						LBMReal Mbac = mfbac - mfbaa * c1o3;
+						// linearized orthogonalization of 5th order central moments
+						LBMReal Mcbc = mfcbc - mfaba * c1o9;
+						LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+						LBMReal Mccb = mfccb - mfaab * c1o9;
+
+						// collision of 1st order moments
+						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+
+						cx2 = cx * cx;
+						cy2 = cy * cy;
+						cz2 = cz * cz;
+
+						// equilibration of 2nd order moments
+						mfbba = zeroReal;
+						mfbab = zeroReal;
+						mfabb = zeroReal;
+
+						mfcaa = c1o3 * concentration;
+						mfaca = c1o3 * concentration;
+						mfaac = c1o3 * concentration;
+
+						// equilibration of 3rd order moments
+						Mabc = zeroReal;
+						Mbca = zeroReal;
+						Macb = zeroReal;
+						Mcba = zeroReal;
+						Mcab = zeroReal;
+						Mbac = zeroReal;
+						mfbbb = zeroReal;
+
+						// from linearized orthogonalization 3rd order central moments to central moments
+						mfabc = Mabc + mfaba * c1o3;
+						mfbca = Mbca + mfbaa * c1o3;
+						mfacb = Macb + mfaab * c1o3;
+						mfcba = Mcba + mfaba * c1o3;
+						mfcab = Mcab + mfaab * c1o3;
+						mfbac = Mbac + mfbaa * c1o3;
+
+						// equilibration of 4th order moments
+						mfacc = c1o9 * concentration;
+						mfcac = c1o9 * concentration;
+						mfcca = c1o9 * concentration;
+
+						mfcbb = zeroReal;
+						mfbcb = zeroReal;
+						mfbbc = zeroReal;
+
+						// equilibration of 5th order moments
+						Mcbc = zeroReal;
+						Mbcc = zeroReal;
+						Mccb = zeroReal;
+
+						// from linearized orthogonalization 5th order central moments to central moments
+						mfcbc = Mcbc + mfaba * c1o9;
+						mfbcc = Mbcc + mfbaa * c1o9;
+						mfccb = Mccb + mfaab * c1o9;
+
+						// equilibration of 6th order moment
+						mfccc = c1o27 * concentration;
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (88)-(96) in
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+						(*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+						(*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+						(*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+						(*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+						(*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+						(*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+
+						(*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+					}
+				}
+			}
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX1_phi()
+{
+	using namespace D3Q27System;
+	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
+		+WEIGTH[N] * (phi[E] - phi[W]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX2_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
+		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+		+WEIGTH[N] * (phi[N] - phi[S]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+		+WEIGTH[N] * (phi[T] - phi[B]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+		+WEIGTH[N] * (phi2[E] - phi2[W]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+		+WEIGTH[N] * (phi2[N] - phi2[S]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+		+WEIGTH[N] * (phi2[T] - phi2[B]));
+}
+
+LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
+{
+	using namespace D3Q27System;
+	LBMReal sum = 0.0;
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
+		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TN] * (
+		(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
+		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
+		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		);
+	sum += WEIGTH[T] * (
+		((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
+		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
+		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		);
+
+	return 6.0 * sum;
+}
+
+void MultiphasePressureFilterLBMKernel::computePhasefield()
+{
+	using namespace D3Q27System;
+	SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+	int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+	int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+
+	//------------- Computing the phase-field ------------------
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				// if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+				{
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+				}
+			}
+		}
+	}
+}
+
+void MultiphasePressureFilterLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		} else {
+			phi[k] = 0.0;
+		}
+	}
+}
+
+void MultiphasePressureFilterLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.0;
+		}
+	}
+}
+
+void MultiphasePressureFilterLBMKernel::swapDistributions()
+{
+	LBMKernel::swapDistributions();
+	dataSet->getHdistributions()->swap();
+}
+
+void MultiphasePressureFilterLBMKernel::initForcing()
+{
+	muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+	muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+	muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+
+	muDeltaT = deltaT;
+
+	muForcingX1.DefineVar("dt", &muDeltaT);
+	muForcingX2.DefineVar("dt", &muDeltaT);
+	muForcingX3.DefineVar("dt", &muDeltaT);
+
+	muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+
+	muForcingX1.DefineVar("nu", &muNu);
+	muForcingX2.DefineVar("nu", &muNu);
+	muForcingX3.DefineVar("nu", &muNu);
+
+	muForcingX1.DefineVar("rho",&muRho); 
+	muForcingX2.DefineVar("rho",&muRho); 
+	muForcingX3.DefineVar("rho",&muRho); 
+
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
new file mode 100644
index 000000000..84984ec9e
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
@@ -0,0 +1,116 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphasePressureFilterLBMKernel.h
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphasePressureFilterLBMKernel_H
+#define MultiphasePressureFilterLBMKernel_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief  Multiphase Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  M. Geier, K. Kutscher, Hesameddin Safari
+class MultiphasePressureFilterLBMKernel : public LBMKernel
+{
+public:
+    MultiphasePressureFilterLBMKernel();
+    virtual ~MultiphasePressureFilterLBMKernel(void) = default;
+    void calculate(int step) override;
+    SPtr<LBMKernel> clone() override;
+
+
+    ///refactor
+    //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+
+
+    double getCalculationTime() override { return .0; }
+protected:
+    virtual void initDataSet();
+    void swapDistributions() override;
+
+    void initForcing();
+
+    void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+    void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+    LBMReal f1[D3Q27System::ENDF+1];
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH1;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU; 
+
+    LBMReal h  [D3Q27System::ENDF+1];
+    LBMReal h2[D3Q27System::ENDF + 1];
+    LBMReal g  [D3Q27System::ENDF+1];
+    LBMReal phi[D3Q27System::ENDF+1];
+    LBMReal phi2[D3Q27System::ENDF + 1];
+    LBMReal pr1[D3Q27System::ENDF+1];
+    LBMReal phi_cutoff[D3Q27System::ENDF+1];
+
+    LBMReal gradX1_phi();
+    LBMReal gradX2_phi();
+    LBMReal gradX3_phi();
+    LBMReal gradX1_phi2();
+    LBMReal gradX2_phi2();
+    LBMReal gradX3_phi2();
+    void computePhasefield();
+    void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+    void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
+
+    LBMReal nabla2_phi();
+
+    mu::value_type muX1,muX2,muX3;
+    mu::value_type muDeltaT;
+    mu::value_type muNu;
+    mu::value_type muRho;
+    LBMReal forcingX1;
+    LBMReal forcingX2;
+    LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index c9fa88791..a24c0a022 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -46,9 +46,11 @@
 #include "OneDistributionFullVectorConnector.h"
 #include "TwoDistributionsFullDirectConnector.h"
 #include "TwoDistributionsFullVectorConnector.h"
+#include "TwoDistributionsDoubleGhostLayerFullDirectConnector.h"
+#include "TwoDistributionsDoubleGhostLayerFullVectorConnector.h"
 #include "ThreeDistributionsFullDirectConnector.h"
-#include "ThreeDistributionsDoubleGhostLayerFullDirectConnector.h"
 #include "ThreeDistributionsFullVectorConnector.h"
+#include "ThreeDistributionsDoubleGhostLayerFullDirectConnector.h"
 #include "ThreeDistributionsDoubleGhostLayerFullVectorConnector.h"
 #include <basics/transmitter/TbTransmitterLocal.h>
 
@@ -159,6 +161,7 @@ void SetConnectorsBlockVisitor<T1, T2>::setRemoteConnectors(SPtr<Block3D> sblock
 
 using OneDistributionSetConnectorsBlockVisitor  = SetConnectorsBlockVisitor<OneDistributionFullDirectConnector, OneDistributionFullVectorConnector>;
 using TwoDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsFullDirectConnector, TwoDistributionsFullVectorConnector>;
+using TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsDoubleGhostLayerFullDirectConnector, TwoDistributionsDoubleGhostLayerFullVectorConnector>;
 using ThreeDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsFullDirectConnector, ThreeDistributionsFullVectorConnector>;
 using ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<ThreeDistributionsDoubleGhostLayerFullDirectConnector, ThreeDistributionsDoubleGhostLayerFullVectorConnector>;
 
-- 
GitLab


From 3a483627cc6044aa632f54a55080b9c1a8c7a5ac Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 18 Nov 2021 10:09:43 +0100
Subject: [PATCH 046/179] add 2D rising bubble test case

---
 apps/cpu/Applications.cmake                |   2 +-
 apps/cpu/RisingBubble2D/CMakeLists.txt     |   3 +
 apps/cpu/RisingBubble2D/RisingBubble2D.cfg |  43 ++
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 452 +++++++++++++++++++++
 src/cpu/VirtualFluids.h                    |   1 +
 5 files changed, 500 insertions(+), 1 deletion(-)
 create mode 100644 apps/cpu/RisingBubble2D/CMakeLists.txt
 create mode 100644 apps/cpu/RisingBubble2D/RisingBubble2D.cfg
 create mode 100644 apps/cpu/RisingBubble2D/RisingBubble2D.cpp

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index e8902e5ff..210268968 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -9,7 +9,7 @@ add_subdirectory(${APPS_ROOT_CPU}/sphere)
 add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
 add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
-
+add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D)
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
 #add_subdirectory(Applications/greenvortex)
diff --git a/apps/cpu/RisingBubble2D/CMakeLists.txt b/apps/cpu/RisingBubble2D/CMakeLists.txt
new file mode 100644
index 000000000..5741f1441
--- /dev/null
+++ b/apps/cpu/RisingBubble2D/CMakeLists.txt
@@ -0,0 +1,3 @@
+PROJECT(RisingBubble2D)
+
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES RisingBubble2D.cpp )
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cfg b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
new file mode 100644
index 000000000..99d68f3d0
--- /dev/null
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
@@ -0,0 +1,43 @@
+pathname = E:/Multiphase/RisingBubble2D_dr10
+
+numOfThreads = 4
+availMem = 10e9
+
+#Grid
+
+boundingBox = 0 160 0 320 0 3
+blocknx = 16 16 3
+
+dx = 1
+refineLevel = 0
+
+#Simulation
+uLB = 0 #0.001#0.005#0.005 
+Re = 35
+#Eotvos number
+Eo = 10;
+nuL = 1e-3 
+nuG = 1e-3 
+densityRatio = 10
+sigma = 1.0850694444444444e-06 #1e-10 #1e-6  # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+interfaceThickness = 4.096
+radius = 40
+contactAngle = 110.0
+phi_L = 0.0
+phi_H = 1.0
+Phase-field Relaxation = 0.6
+Mobility = 0.056 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
+
+
+logToFile = false
+
+newStart = false
+restartStep = 50000
+
+cpStart = 1000
+cpStep = 1000
+
+outTime = 100
+endTime = 100000
+
+rStep = 159990 #160000
\ No newline at end of file
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
new file mode 100644
index 000000000..f0673cb50
--- /dev/null
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -0,0 +1,452 @@
+#include <iostream>
+#include <string>
+#include <memory>
+
+#if defined(__unix__)
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+void run(string configname)
+{
+    try {
+        ConfigurationFile config;
+        config.load(configname);
+
+        string pathname            = config.getValue<string>("pathname");
+        int numOfThreads           = config.getValue<int>("numOfThreads");
+        vector<int> blocknx        = config.getVector<int>("blocknx");
+        vector<double> boundingBox = config.getVector<double>("boundingBox");
+        double uLB             = config.getValue<double>("uLB");
+        double nuL             = config.getValue<double>("nuL");
+        double nuG             = config.getValue<double>("nuG");
+        double densityRatio    = config.getValue<double>("densityRatio");
+        double sigma           = config.getValue<double>("sigma");
+        int interfaceThickness = config.getValue<int>("interfaceThickness");
+        double radius          = config.getValue<double>("radius");
+        double theta           = config.getValue<double>("contactAngle");
+        double phiL            = config.getValue<double>("phi_L");
+        double phiH            = config.getValue<double>("phi_H");
+        double tauH            = config.getValue<double>("Phase-field Relaxation");
+        double mob             = config.getValue<double>("Mobility");
+
+        double endTime     = config.getValue<double>("endTime");
+        double outTime     = config.getValue<double>("outTime");
+        double availMem    = config.getValue<double>("availMem");
+        int refineLevel    = config.getValue<int>("refineLevel");
+        double Re          = config.getValue<double>("Re");
+        double Eo          = config.getValue<double>("Eo");
+        double dx          = config.getValue<double>("dx");
+        bool logToFile     = config.getValue<bool>("logToFile");
+        double restartStep = config.getValue<double>("restartStep");
+        double cpStart     = config.getValue<double>("cpStart");
+        double cpStep      = config.getValue<double>("cpStep");
+        bool newStart      = config.getValue<bool>("newStart");
+        double rStep = config.getValue<double>("rStep");
+
+        SPtr<Communicator> comm = MPICommunicator::getInstance();
+        int myid                = comm->getProcessID();
+
+        if (myid == 0)
+            UBLOG(logINFO, "2D Rising Bubble: Start!");
+
+        if (logToFile) {
+#if defined(__unix__)
+            if (myid == 0) {
+                const char *str = pathname.c_str();
+                mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+            }
+#endif
+
+            if (myid == 0) {
+                stringstream logFilename;
+                logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+                UbLog::output_policy::setStream(logFilename.str());
+            }
+        }
+        
+        std::string fileName = "./LastTimeStep" + std::to_string((int)boundingBox[1]) + ".txt";
+
+#if defined(__unix__)
+         double lastTimeStep = 0;
+         if (!newStart) 
+         {
+             std::ifstream ifstr(fileName);
+             ifstr >> lastTimeStep;
+             restartStep = lastTimeStep;
+             if(endTime >= lastTimeStep)
+                endTime = lastTimeStep + rStep;
+             else
+                return;
+         }    
+#endif
+
+        //Sleep(30000);
+
+        // LBMReal dLB = 0; // = length[1] / dx;
+        LBMReal rhoLB = 0.0;
+        LBMReal nuLB  = nuL; //(uLB*dLB) / Re;
+
+        //diameter of circular droplet
+        LBMReal D  = 2.0*radius;
+
+        //density retio
+        LBMReal r_rho = densityRatio;
+
+        //density of heavy fluid
+        LBMReal rho_h = 1.0;
+        //density of light fluid
+        LBMReal rho_l = rho_h / r_rho;
+
+        //kinimatic viscosity
+        LBMReal nu_h = nuL;
+        //LBMReal nu_l = nuG;
+        //#dynamic viscosity
+        LBMReal mu_h = rho_h * nu_h;
+        
+        //gravity
+        LBMReal g_y = Re* Re* nu_h* nu_h / D;
+        //Eotvos number
+        //LBMReal Eo = 100;
+        //surface tension
+        sigma = rho_h* g_y* D* D / Eo;
+
+        //g_y = 0;
+
+        double beta  = 12.0 * sigma / interfaceThickness;
+        double kappa = 1.5 * interfaceThickness * sigma;
+
+        if (myid == 0) {
+                //UBLOG(logINFO, "uLb = " << uLB);
+                //UBLOG(logINFO, "rho = " << rhoLB);
+                UBLOG(logINFO, "D = " << D);
+                UBLOG(logINFO, "nuL = " << nuL);
+                UBLOG(logINFO, "nuG = " << nuG);
+                UBLOG(logINFO, "Re = " << Re);
+                UBLOG(logINFO, "Eo = " << Eo);
+                UBLOG(logINFO, "g_y = " << g_y);
+                UBLOG(logINFO, "sigma = " << sigma);
+                UBLOG(logINFO, "dx = " << dx);
+                UBLOG(logINFO, "Preprocess - start");
+        }
+
+        SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
+
+        //const int baseLevel = 0;
+
+        SPtr<LBMKernel> kernel;
+
+        //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
+       // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+
+        mu::Parser fgr;
+        fgr.SetExpr("-rho*g_y");
+        fgr.DefineConst("g_y", g_y);
+
+        kernel->setWithForcing(true);
+        kernel->setForcingX1(0.0);
+        kernel->setForcingX2(fgr);
+        kernel->setForcingX3(0.0);
+
+        kernel->setPhiL(phiL);
+        kernel->setPhiH(phiH);
+        kernel->setPhaseFieldRelaxation(tauH);
+        kernel->setMobility(mob);
+        kernel->setInterfaceWidth(interfaceThickness);
+
+
+        kernel->setCollisionFactorMultiphase(nuL, nuG);
+        kernel->setDensityRatio(densityRatio);
+        kernel->setMultiphaseModelParameters(beta, kappa);
+        kernel->setContactAngle(theta);
+
+        SPtr<BCProcessor> bcProc(new BCProcessor());
+
+        kernel->setBCProcessor(bcProc);
+
+        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+        SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
+        //////////////////////////////////////////////////////////////////////////////////
+        // BC visitor
+        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+        bcVisitor.addBC(noSlipBCAdapter);
+        bcVisitor.addBC(slipBCAdapter);
+
+        SPtr<Grid3D> grid(new Grid3D(comm));
+        grid->setDeltaX(dx);
+        grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+        grid->setPeriodicX1(false);
+        grid->setPeriodicX2(false);
+        grid->setPeriodicX3(true);
+        grid->setGhostLayerWidth(2);
+
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+
+        //////////////////////////////////////////////////////////////////////////
+        // restart
+        SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+        //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
+        // rcp->setNu(nuLB);
+        // rcp->setNuLG(nuL, nuG);
+        // rcp->setDensityRatio(densityRatio);
+
+        rcp->setLBMKernel(kernel);
+        rcp->setBCProcessor(bcProc);
+        //////////////////////////////////////////////////////////////////////////
+
+        if (newStart) {
+
+            // bounding box
+            double g_minX1 = boundingBox[0];
+            double g_minX2 = boundingBox[2];
+            double g_minX3 = boundingBox[4];
+
+            double g_maxX1 = boundingBox[1];
+            double g_maxX2 = boundingBox[3];
+            double g_maxX3 = boundingBox[5];
+
+            // geometry
+            SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
+                    WbWriterVtkXmlBinary::getInstance());
+
+
+
+            GenBlocksGridVisitor genBlocks(gridCube);
+            grid->accept(genBlocks);
+
+            double dx2 = 2.0 * dx;
+            GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_minX1, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+
+            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+            SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+ 
+            SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
+                grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+            InteractorsHelper intHelper(grid, metisVisitor, true);
+            intHelper.addInteractor(wallXminInt);
+            intHelper.addInteractor(wallXmaxInt);
+            intHelper.addInteractor(wallYminInt);
+            intHelper.addInteractor(wallYmaxInt);
+            intHelper.selectBlocks();
+
+            ppblocks->process(0);
+            ppblocks.reset();
+
+            unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+            int ghostLayer                    = 5;
+            unsigned long long numberOfNodesPerBlock =
+                (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
+            unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+            unsigned long long numberOfNodesPerBlockWithGhostLayer =
+                numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+            double needMemAll =
+                double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+            if (myid == 0) {
+                UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+                UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+                int minInitLevel = grid->getCoarsestInitializedLevel();
+                int maxInitLevel = grid->getFinestInitializedLevel();
+                for (int level = minInitLevel; level <= maxInitLevel; level++) {
+                    int nobl = grid->getNumberOfBlocks(level);
+                    UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+                    UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
+                }
+                UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+                UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+                UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+            }
+
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
+                needMem);
+
+            grid->accept(kernelVisitor);
+
+            if (refineLevel > 0) {
+                SetUndefinedNodesBlockVisitor undefNodesVisitor;
+                grid->accept(undefNodesVisitor);
+            }
+
+
+            intHelper.setBC();
+
+            // initialization of distributions
+            LBMReal x1c = D; 
+            LBMReal x2c = D; 
+            LBMReal x3c = 1.5; 
+            //LBMReal x3c = 2.5 * D;
+            mu::Parser fct1;
+            fct1.SetExpr("0.5+0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+            fct1.DefineConst("x1c", x1c);
+            fct1.DefineConst("x2c", x2c);
+            fct1.DefineConst("x3c", x3c);
+            fct1.DefineConst("radius", radius);
+            fct1.DefineConst("interfaceThickness", interfaceThickness);
+
+            mu::Parser fct2;
+            fct2.SetExpr("0.5*uLB+uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+            //fct2.SetExpr("uLB");
+            fct2.DefineConst("uLB", uLB);
+            fct2.DefineConst("x1c", x1c);
+            fct2.DefineConst("x2c", x2c);
+            fct2.DefineConst("x3c", x3c);
+            fct2.DefineConst("radius", radius);
+            fct2.DefineConst("interfaceThickness", interfaceThickness);
+
+            //MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio);
+            MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
+            initVisitor.setPhi(fct1);
+            initVisitor.setVx1(fct2);
+            grid->accept(initVisitor);
+
+            // boundary conditions grid
+            {
+                SPtr<UbScheduler> geoSch(new UbScheduler(1));
+                SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+                    grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+                ppgeo->process(0);
+                ppgeo.reset();
+            }
+
+            if (myid == 0)
+                UBLOG(logINFO, "Preprocess - end");
+        } else {
+            if (myid == 0) {
+                UBLOG(logINFO, "Parameters:");
+                UBLOG(logINFO, "uLb = " << uLB);
+                UBLOG(logINFO, "rho = " << rhoLB);
+                UBLOG(logINFO, "nuLb = " << nuLB);
+                UBLOG(logINFO, "Re = " << Re);
+                UBLOG(logINFO, "dx = " << dx);
+                UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+                UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+                UBLOG(logINFO, "path = " << pathname);
+            }
+
+            rcp->restart((int)restartStep);
+            grid->setTimeStep(restartStep);
+
+            if (myid == 0)
+                UBLOG(logINFO, "Restart - end");
+        }
+
+        grid->accept(bcVisitor);
+
+        //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //grid->accept(setConnsVisitor);
+
+        //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //grid->accept(setConnsVisitor);
+
+        TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
+
+        SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+        //double t_ast, t;
+        //t_ast = 2;
+        //t = (int)(t_ast/std::sqrt(g_y/D));
+        //visSch->addSchedule(t,t,t); //t=2
+        //t_ast = 3;
+        //t = (int)(t_ast/std::sqrt(g_y/D));        
+        //visSch->addSchedule(t,t,t); //t=3
+        //t_ast = 4;
+        //t = (int)(t_ast/std::sqrt(g_y/D));        
+        //visSch->addSchedule(t,t,t); //t=4
+        //t_ast = 5;
+        //t = (int)(t_ast/std::sqrt(g_y/D));        
+        //visSch->addSchedule(t,t,t); //t=5
+        //t_ast = 6;
+        //t = (int)(t_ast/std::sqrt(g_y/D)); 
+        //visSch->addSchedule(t,t,t); //t=6
+        //t_ast = 7;
+        //t = (int)(t_ast/std::sqrt(g_y/D));         
+        //visSch->addSchedule(t,t,t); //t=7
+        //t_ast = 9;
+        //t = (int)(t_ast/std::sqrt(g_y/D));         
+        //visSch->addSchedule(t,t,t); //t=9
+
+        SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
+            grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+        if(grid->getTimeStep() == 0) 
+            pp->process(0);
+
+        SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+        SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+        omp_set_num_threads(numOfThreads);
+
+        SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+        SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+        calculator->addCoProcessor(npr);
+        calculator->addCoProcessor(pp);
+        calculator->addCoProcessor(rcp);
+
+
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-start");
+        calculator->calculate();
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-end");
+            
+#if defined(__unix__)
+         //if (!newStart) 
+         //{
+            if (myid == 0) 
+            {
+                std::ofstream ostr(fileName);
+                ostr << endTime;
+                cout << "start sbatch\n";
+                //system("./start.sh");
+                //system("echo test!");
+                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
+                //system("sbatch startJob512.sh");
+                system(str.c_str());
+            }   
+            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
+         //}
+#endif
+
+    } catch (std::exception &e) {
+        cerr << e.what() << endl << flush;
+    } catch (std::string &s) {
+        cerr << s << endl;
+    } catch (...) {
+        cerr << "unknown exception" << endl;
+    }
+}
+int main(int argc, char *argv[])
+{
+    // Sleep(30000);
+    if (argv != NULL) {
+        if (argv[1] != NULL) {
+            run(string(argv[1]));
+        } else {
+            cout << "Configuration file is missing!" << endl;
+        }
+    }
+}
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index de43d4eca..8a270e968 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -137,6 +137,7 @@
 #include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> 
 #include <BoundaryConditions/MultiphaseVelocityBCAdapter.h>
 #include <BoundaryConditions/MultiphaseVelocityBCAlgorithm.h>
+#include <BoundaryConditions/MultiphaseSlipBCAlgorithm.h> 
 
 #include <Connectors/Block3DConnector.h>
 //#include <Connectors/Block3DConnectorFactory.h>
-- 
GitLab


From 2a214b739c36e754b35673518eb0f7410b0fce1f Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 18 Nov 2021 10:28:06 +0100
Subject: [PATCH 047/179] add coprocessor and wrapper for LIGGGHTS

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          | 162 +++---
 .../LiggghtsCoupling/LiggghtsCoProcessor.cpp  | 523 ------------------
 .../LiggghtsCoupling/LiggghtsCoProcessor.h    | 149 -----
 .../LiggghtsCouplingCoProcessor.cpp           |  13 +
 .../LiggghtsCouplingCoProcessor.h             |  56 ++
 .../LiggghtsCouplingWrapper.cpp               |  85 +++
 .../LiggghtsCouplingWrapper.h                 |  47 ++
 7 files changed, 285 insertions(+), 750 deletions(-)
 delete mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
 delete mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp
 create mode 100644 src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index be4cc2470..2a1578671 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -4,90 +4,96 @@
 
 #include "VirtualFluids.h"
 
-#include "lammps.h"
-#include "input.h"
-#include "atom.h"
-#include "modify.h"
-#include "fix_lb_coupling_onetoone.h"
+//#include "lammps.h"
+//#include "input.h"
+//#include "atom.h"
+//#include "modify.h"
+//#include "fix_lb_coupling_onetoone.h"
+
+#include "LiggghtsCouplingCoProcessor.h"
+
+#include "LiggghtsCouplingWrapper.h"
 
-#include "LiggghtsCoProcessor.h"
 
 using namespace std;
 
 
 int main(int argc, char *argv[])
 {
-	LAMMPS_NS::LAMMPS *lmp;
-    // custom argument vector for LAMMPS library
-    const char *lmpargv[] {"liblammps", "-log", "none"};
-    int lmpargc = sizeof(lmpargv)/sizeof(const char *);
-
-    // explicitly initialize MPI
-    MPI_Init(&argc, &argv);
-
-    // create LAMMPS instance
-    lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD);
-    lmp->input->file("in.lbdem");
-    //lmp->input->one("run 1");
-    
-    //# Try extracting a global value
-    //    print("")
-    //    print("Attempting to get the number of atoms in simulation")
-    //    numAtoms = lmp.extract_global("natoms", 0)
-    //    print("natoms =", numAtoms)
-
-    //    # Try extracting atom's positions
-    //    print("")
-    //    print("Attempting to get the atom's positions")
-    //    pos = lmp.extract_atom("x",3)
-    //    for k in range(0,numAtoms):
-    //        print("Pos[%i] = [%f, %f, %f]" % (k, pos[k][0], pos[k][1], pos[k][2]))
-
-    LAMMPS_NS::FixLbCouplingOnetoone 
-        *couplingFix 
-        = dynamic_cast<LAMMPS_NS::FixLbCouplingOnetoone*>
-        (lmp->modify->find_fix_style("couple/lb/onetoone",0));
-
-    cout << "test1\n";
-    
-    //double **t_liggghts = couplingFix->get_torque_ptr();
-    cout << "test2\n";
-
-    lmp->input->one("run 9 upto");
-
-    for (int step = 0; step < 10; step++)
-    {
-        
-
-        int numAtoms = lmp->atom->natoms;
-
-        //double** pos = (double**)lmp->atom->extract("x");
-        double** pos = lmp->atom->x;
-        
-        //double* forceX = lmp->atom->fx;
-
-        for (int i = 0; i < numAtoms; i++)
-        {
-            double **f_liggghts = couplingFix->get_force_ptr();
-            double** force = lmp->atom->f;
-            cout << "Pos[" << i << "] = [" << pos[i][0] << ", " << pos[i][1] << ", " << pos[i][2] << "]\n";
-            cout << "Force1[" << i << "] = [" << f_liggghts[i][0] << ", " << f_liggghts[i][1] << ", " << f_liggghts[i][2] << "]\n";
-            f_liggghts[i][0] += 0;
-            f_liggghts[i][1] += 0;
-            f_liggghts[i][2] += 500;
-            cout << "Force2[" << i << "] = [" << force[i][0] << ", " << force[i][1] << ", " << force[i][2] << "]\n";
-        }
-
-        couplingFix->comm_force_torque();
-
-        lmp->input->one("run 10000");
-       
-    }
-
-    // delete LAMMPS instance
-    delete lmp;
-
-    // stop MPI environment
-    MPI_Finalize();
+    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    LiggghtsCouplingWrapper wrapper(argv, (MPI_Comm)comm->getNativeCommunicator());
+
+	//LAMMPS_NS::LAMMPS *lmp;
+ //   // custom argument vector for LAMMPS library
+ //   const char *lmpargv[] {"liblammps", "-log", "none"};
+ //   int lmpargc = sizeof(lmpargv)/sizeof(const char *);
+
+ //   // explicitly initialize MPI
+ //   MPI_Init(&argc, &argv);
+
+ //   // create LAMMPS instance
+ //   lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD);
+ //   lmp->input->file("in.lbdem");
+ //   //lmp->input->one("run 1");
+ //   
+ //   //# Try extracting a global value
+ //   //    print("")
+ //   //    print("Attempting to get the number of atoms in simulation")
+ //   //    numAtoms = lmp.extract_global("natoms", 0)
+ //   //    print("natoms =", numAtoms)
+
+ //   //    # Try extracting atom's positions
+ //   //    print("")
+ //   //    print("Attempting to get the atom's positions")
+ //   //    pos = lmp.extract_atom("x",3)
+ //   //    for k in range(0,numAtoms):
+ //   //        print("Pos[%i] = [%f, %f, %f]" % (k, pos[k][0], pos[k][1], pos[k][2]))
+
+ //   LAMMPS_NS::FixLbCouplingOnetoone 
+ //       *couplingFix 
+ //       = dynamic_cast<LAMMPS_NS::FixLbCouplingOnetoone*>
+ //       (lmp->modify->find_fix_style("couple/lb/onetoone",0));
+
+ //   cout << "test1\n";
+ //   
+ //   //double **t_liggghts = couplingFix->get_torque_ptr();
+ //   cout << "test2\n";
+
+ //   lmp->input->one("run 9 upto");
+
+ //   for (int step = 0; step < 10; step++)
+ //   {
+ //       
+
+ //       int numAtoms = lmp->atom->natoms;
+
+ //       //double** pos = (double**)lmp->atom->extract("x");
+ //       double** pos = lmp->atom->x;
+ //       
+ //       //double* forceX = lmp->atom->fx;
+
+ //       for (int i = 0; i < numAtoms; i++)
+ //       {
+ //           double **f_liggghts = couplingFix->get_force_ptr();
+ //           double** force = lmp->atom->f;
+ //           cout << "Pos[" << i << "] = [" << pos[i][0] << ", " << pos[i][1] << ", " << pos[i][2] << "]\n";
+ //           cout << "Force1[" << i << "] = [" << f_liggghts[i][0] << ", " << f_liggghts[i][1] << ", " << f_liggghts[i][2] << "]\n";
+ //           f_liggghts[i][0] += 0;
+ //           f_liggghts[i][1] += 0;
+ //           f_liggghts[i][2] += 500;
+ //           cout << "Force2[" << i << "] = [" << force[i][0] << ", " << force[i][1] << ", " << force[i][2] << "]\n";
+ //       }
+
+ //       couplingFix->comm_force_torque();
+
+ //       lmp->input->one("run 10000");
+ //      
+ //   }
+
+ //   // delete LAMMPS instance
+ //   delete lmp;
+
+ //   // stop MPI environment
+ //   MPI_Finalize();
     return 0;
 }
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
deleted file mode 100644
index 550713f7f..000000000
--- a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.cpp
+++ /dev/null
@@ -1,523 +0,0 @@
-#include "LiggghtsCoProcessor.h"
-//
-//#include "BCProcessor.h"
-//#include "Communicator.h"
-//#include "DataSet3D.h"
-//#include "DistributionArray3D.h"
-//#include "ForceCalculator.h"
-//#include "GbSphere3D.h"
-//#include "Grid3D.h"
-//#include "ILBMKernel.h"
-//#include "MovableObjectInteractor.h"
-//#include "SetBcBlocksBlockVisitor.h"
-//#include "UbScheduler.h"
-//
-//#include "PePhysicsEngineGeometryAdapter.h"
-//#include "PePhysicsEngineSolverAdapter.h"
-//#include "PhysicsEngineGeometryAdapter.h"
-//#include "PhysicsEngineMaterialAdapter.h"
-//#include "PhysicsEngineSolverAdapter.h"
-//
-//#include "BCArray3D.h"
-//#include "Block3D.h"
-//#include "BoundaryConditions.h"
-//#include "BoundaryConditionsBlockVisitor.h"
-//#include "MPICommunicator.h"
-//
-//#include "UbLogger.h"
-//
-//#include <array>
-//#include <functional>
-//
-//DemCoProcessor::DemCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Communicator> comm,
-//                               std::shared_ptr<ForceCalculator> forceCalculator,
-//                               std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver,
-//                               double intermediatePeSteps)
-//    : CoProcessor(grid, s), comm(comm), forceCalculator(forceCalculator),
-//      physicsEngineSolver(std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)),
-//      intermediateDemSteps(intermediatePeSteps)
-//{
-//#ifdef TIMING
-//    timer.resetAndStart();
-//#endif
-//
-//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
-//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
-//
-//    for (auto blockIt = forest->begin(); blockIt != forest->end(); ++blockIt) {
-//        walberla::pe::Storage *storage                     = blockIt->getData<walberla::pe::Storage>(*storageId.get());
-//        walberla::pe::BodyStorage *bodyStorage             = &(*storage)[0];
-//        walberla::pe::BodyStorage *bodyStorageShadowCopies = &(*storage)[1];
-//
-//        bodyStorage->registerAddCallback("DemCoProcessor", std::bind1st(std::mem_fun(&DemCoProcessor::addPeGeo), this));
-//        bodyStorage->registerRemoveCallback("DemCoProcessor",
-//                                            std::bind1st(std::mem_fun(&DemCoProcessor::removePeGeo), this));
-//
-//        bodyStorageShadowCopies->registerAddCallback("DemCoProcessor",
-//                                                     std::bind1st(std::mem_fun(&DemCoProcessor::addPeShadowGeo), this));
-//        bodyStorageShadowCopies->registerRemoveCallback(
-//            "DemCoProcessor", std::bind1st(std::mem_fun(&DemCoProcessor::removePeShadowGeo), this));
-//    }
-//}
-//
-//DemCoProcessor::~DemCoProcessor()
-//{
-//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
-//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
-//
-//    for (auto &currentBlock : *forest) {
-//        walberla::pe::Storage *storage           = currentBlock.getData<walberla::pe::Storage>(*storageId.get());
-//        walberla::pe::BodyStorage &localStorage  = (*storage)[0];
-//        walberla::pe::BodyStorage &shadowStorage = (*storage)[1];
-//
-//        localStorage.clearAddCallbacks();
-//        localStorage.clearRemoveCallbacks();
-//
-//        shadowStorage.clearAddCallbacks();
-//        shadowStorage.clearRemoveCallbacks();
-//    }
-//}
-//
-//void DemCoProcessor::addInteractor(std::shared_ptr<MovableObjectInteractor> interactor,
-//                                   std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial,
-//                                   Vector3D initalVelocity)
-//{
-//    interactors.push_back(interactor);
-//    const int id = static_cast<int>(interactors.size() - 1);
-//    interactor->setID(id);
-//    const auto peGeometryAdapter = this->createPhysicsEngineGeometryAdapter(interactor, physicsEngineMaterial);
-//    if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)->isActive()) {
-//        peGeometryAdapter->setLinearVelolocity(initalVelocity);
-//        geoIdMap.insert(
-//            std::make_pair(std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)->getSystemID(),
-//                           std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(peGeometryAdapter)));
-//    }
-//    SetBcBlocksBlockVisitor setBcVisitor(interactor);
-//    grid->accept(setBcVisitor);
-//
-//    // std::vector< std::shared_ptr<Block3D> > blockVector;
-//    // UbTupleInt3 blockNX=grid->getBlockNX();
-//    // SPtr<GbObject3D> geoObject(interactor->getGbObject3D());
-//    // double ext = 0.0;
-//    // std::array<double, 6> AABB ={
-//    // geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum()
-//    // }; grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext,
-//    // AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext,
-//    // AABB[5]+(double)val<3>(blockNX)*ext, blockVector); for (std::shared_ptr<Block3D> block : blockVector)
-//    //{
-//    //   if (block->getKernel())
-//    //   {
-//    //      interactor->setBCBlock(block);
-//    //      //UBLOG(logINFO, "DemCoProcessor::addInteractor() rank = "<<comm->getProcessID());
-//    //   }
-//    //}
-//
-//    interactor->initInteractor();
-//
-//    physicsEngineGeometrieAdapters.push_back(peGeometryAdapter);
-//}
-//
-//std::shared_ptr<PhysicsEngineGeometryAdapter> DemCoProcessor::createPhysicsEngineGeometryAdapter(
-//    std::shared_ptr<MovableObjectInteractor> interactor,
-//    std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const
-//{
-//    const int id              = static_cast<int>(interactors.size() - 1);
-//    SPtr<GbSphere3D> vfSphere = std::static_pointer_cast<GbSphere3D>(interactor->getGbObject3D());
-//    const Vector3D position(vfSphere->getX1Centroid(), vfSphere->getX2Centroid(), vfSphere->getX3Centroid());
-//    auto peGeometryAdapter = this->physicsEngineSolver->createPhysicsEngineGeometryAdapter(
-//        id, position, vfSphere->getRadius(), physicsEngineMaterial);
-//    interactor->setPhysicsEngineGeometry(peGeometryAdapter);
-//    return peGeometryAdapter;
-//}
-//
-//void DemCoProcessor::process(double actualTimeStep)
-//{
-//#ifdef TIMING
-//    timer.resetAndStart();
-//#endif
-//
-//    this->applyForcesOnGeometries();
-//
-//#ifdef TIMING
-//    if (comm->isRoot())
-//        UBLOG(logINFO, "DemCoProcessor::process start step: " << actualTimeStep);
-//    if (comm->isRoot())
-//        UBLOG(logINFO, "DemCoProcessor::applyForcesOnGeometries() time = " << timer.stop() << " s");
-//#endif
-//
-//    if (scheduler->isDue(actualTimeStep)) {
-//        // UBLOG(logINFO, "DemCoProcessor::update - START - timestep = " << actualTimeStep);
-//        const double demTimeStepsPerIteration = scheduler->getMinStep();
-//
-//        if (demTimeStepsPerIteration != 1)
-//            this->scaleForcesAndTorques(1.0 / demTimeStepsPerIteration);
-//
-//#ifdef TIMING
-//        if (comm->isRoot())
-//            UBLOG(logINFO, "DemCoProcessor::scaleForcesAndTorques() time = " << timer.stop() << " s");
-//        if (comm->isRoot())
-//            UBLOG(logINFO, "DemCoProcessor::calculateDemTimeStep():");
-//#endif
-//
-//        if (this->intermediateDemSteps == 1)
-//            this->calculateDemTimeStep(demTimeStepsPerIteration);
-//
-//        //#ifdef TIMING
-//        //      if (comm->isRoot()) UBLOG(logINFO, "DemCoProcessor::calculateDemTimeStep() time = "<<timer.stop()<<"
-//        //      s");
-//        //#endif
-//        // if ((int)actualTimeStep % 100 == 0)
-//        //{
-//        //    if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometries[0])->isActive())
-//        //    {
-//        //        //UBLOG(logINFO, "v: (x,y,z) " << physicsEngineGeometries[0]->getLinearVelocity() << " actualTimeStep
-//        //        = " << UbSystem::toString(actualTimeStep));
-//        //    }
-//        //}
-//
-//        // during the intermediate time steps of the collision response, the currently acting forces
-//        // (interaction forces, gravitational force, ...) have to remain constant.
-//        // Since they are reset after the call to collision response, they have to be stored explicitly before.
-//        // Then they are set again after each intermediate step.
-//
-//        this->moveVfGeoObjects();
-//
-//#ifdef TIMING
-//        if (comm->isRoot())
-//            UBLOG(logINFO, "DemCoProcessor::moveVfGeoObject() time = " << timer.stop() << " s");
-//#endif
-//
-//        grid->accept(*boundaryConditionsBlockVisitor.get());
-//
-//#ifdef TIMING
-//        if (comm->isRoot())
-//            UBLOG(logINFO, "grid->accept(*boundaryConditionsBlockVisitor.get()) time = " << timer.stop() << " s");
-//#endif
-//
-//        // UBLOG(logINFO, "DemCoProcessor::update - END - timestep = " << actualTimeStep);
-//    }
-//
-//#ifdef TIMING
-//    if (comm->isRoot())
-//        UBLOG(logINFO, "DemCoProcessor::process stop step: " << actualTimeStep);
-//#endif
-//}
-////////////////////////////////////////////////////////////////////////////
-//std::shared_ptr<PhysicsEngineSolverAdapter> DemCoProcessor::getPhysicsEngineSolver() { return physicsEngineSolver; }
-//
-//void DemCoProcessor::applyForcesOnGeometries()
-//{
-//    for (int i = 0; i < physicsEngineGeometrieAdapters.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            this->setForcesToObject(grid, interactors[i], physicsEngineGeometrieAdapters[i]);
-//
-//            // physicsEngineGeometries[i]->setLinearVelolocity(Vector3D(-0.001, 0.0, 0.0));
-//            // physicsEngineGeometries[i]->setAngularVelocity(Vector3D(0.01, 0.01, 0.01));
-//            // UBLOG(logINFO, "v: (x,y,z) " << physicsEngineGeometries[i]->getLinearVelocity());
-//        }
-//    }
-//}
-//
-//void DemCoProcessor::setForcesToObject(SPtr<Grid3D> grid, SPtr<MovableObjectInteractor> interactor,
-//                                       std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry)
-//{
-//    for (BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) {
-//        SPtr<Block3D> block                     = t.first;
-//        SPtr<ILBMKernel> kernel                 = block->getKernel();
-//        SPtr<BCArray3D> bcArray                 = kernel->getBCProcessor()->getBCArray();
-//        SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
-//        distributions->swap();
-//
-//        std::set<std::vector<int>> &transNodeIndicesSet = t.second;
-//        for (std::vector<int> node : transNodeIndicesSet) {
-//            int x1 = node[0];
-//            int x2 = node[1];
-//            int x3 = node[2];
-//
-//            if (kernel->isInsideOfDomain(x1, x2, x3) && bcArray->isFluid(x1, x2, x3)) {
-//                // TODO: calculate assumed boundary position
-//
-//                const Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3);
-//                const auto boundaryVelocity     = physicsEngineGeometry->getVelocityAtPosition(worldCoordinates);
-//
-//                SPtr<BoundaryConditions> bc = bcArray->getBC(x1, x2, x3);
-//                const Vector3D force = forceCalculator->getForces(x1, x2, x3, distributions, bc, boundaryVelocity);
-//                physicsEngineGeometry->addForceAtPosition(force, worldCoordinates);
-//            }
-//        }
-//        distributions->swap();
-//    }
-//}
-//
-//void DemCoProcessor::scaleForcesAndTorques(double scalingFactor)
-//{
-//    for (int i = 0; i < physicsEngineGeometrieAdapters.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            const Vector3D force  = physicsEngineGeometrieAdapters[i]->getForce() * scalingFactor;
-//            const Vector3D torque = physicsEngineGeometrieAdapters[i]->getTorque() * scalingFactor;
-//
-//            physicsEngineGeometrieAdapters[i]->resetForceAndTorque();
-//
-//            physicsEngineGeometrieAdapters[i]->setForce(force);
-//            physicsEngineGeometrieAdapters[i]->setTorque(torque);
-//
-//            // UBLOG(logINFO, "F: (x,y,z) " << force);
-//            // UBLOG(logINFO, "T: (x,y,z) " << torque);
-//        }
-//    }
-//}
-//
-//void DemCoProcessor::calculateDemTimeStep(double step)
-//{
-//    physicsEngineSolver->runTimestep(step);
-//
-//#ifdef TIMING
-//    if (comm->isRoot())
-//        UBLOG(logINFO, "  physicsEngineSolver->runTimestep() time = " << timer.stop() << " s");
-//#endif
-//}
-//
-//void DemCoProcessor::moveVfGeoObjects()
-//{
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                    ->getSemiactive()) {
-//                walberla::pe::RigidBody *peGeoObject = getPeGeoObject(
-//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                        ->getSystemID());
-//                if (peGeoObject != nullptr) {
-//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                        ->setGeometry(peGeoObject);
-//                    interactors[i]->moveGbObjectTo(physicsEngineGeometrieAdapters[i]->getPosition());
-//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                        ->setSemiactive(false);
-//                } else {
-//                    std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                        ->setInactive();
-//                }
-//            } else {
-//                interactors[i]->moveGbObjectTo(physicsEngineGeometrieAdapters[i]->getPosition());
-//            }
-//        }
-//    }
-//}
-//
-//bool DemCoProcessor::isDemObjectInAABB(std::array<double, 6> AABB)
-//{
-//    bool result = false;
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            SPtr<GbObject3D> geoObject = interactors[i]->getGbObject3D();
-//            std::array<double, 2> minMax1;
-//            std::array<double, 2> minMax2;
-//            std::array<double, 2> minMax3;
-//            minMax1[0] = geoObject->getX1Minimum();
-//            minMax2[0] = geoObject->getX2Minimum();
-//            minMax3[0] = geoObject->getX3Minimum();
-//            minMax1[1] = geoObject->getX1Maximum();
-//            minMax2[1] = geoObject->getX2Maximum();
-//            minMax3[1] = geoObject->getX3Maximum();
-//
-//            for (int x3 = 0; x3 < 2; x3++)
-//                for (int x2 = 0; x2 < 2; x2++)
-//                    for (int x1 = 0; x1 < 2; x1++) {
-//                        result =
-//                            result || (minMax1[x1] >= AABB[0] && minMax2[x2] >= AABB[1] && minMax3[x3] >= AABB[2] &&
-//                                       minMax1[x1] <= AABB[3] && minMax2[x2] <= AABB[4] && minMax3[x3] <= AABB[5]);
-//                    }
-//        }
-//    }
-//
-//    std::vector<int> values;
-//    values.push_back((int)result);
-//    std::vector<int> rvalues = comm->gather(values);
-//
-//    if (comm->isRoot()) {
-//        for (int i = 0; i < (int)rvalues.size(); i++) {
-//            result = result || (bool)rvalues[i];
-//        }
-//    }
-//    int iresult = (int)result;
-//    comm->broadcast(iresult);
-//    result = (bool)iresult;
-//
-//    return result;
-//}
-//
-//int DemCoProcessor::addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles)
-//{
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            interactors[i]->getGbObject3D()->addSurfaceTriangleSet(nodes, triangles);
-//        }
-//    }
-//    return (int)interactors.size();
-//}
-//
-//void DemCoProcessor::getObjectsPropertiesVector(std::vector<double> &p)
-//{
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            p.push_back(i);
-//            p.push_back(interactors[i]->getGbObject3D()->getX1Centroid());
-//            p.push_back(interactors[i]->getGbObject3D()->getX2Centroid());
-//            p.push_back(interactors[i]->getGbObject3D()->getX3Centroid());
-//            Vector3D v = physicsEngineGeometrieAdapters[i]->getLinearVelocity();
-//            p.push_back(v[0]);
-//            p.push_back(v[1]);
-//            p.push_back(v[2]);
-//        }
-//    }
-//}
-//
-//void DemCoProcessor::addPeGeo(walberla::pe::RigidBody *peGeo)
-//{
-//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
-//    if (geometry != nullptr) {
-//        geometry->setActive();
-//        geometry->setGeometry(peGeo);
-//        return;
-//    } else
-//        return;
-//}
-//
-//void DemCoProcessor::removePeGeo(walberla::pe::RigidBody *peGeo)
-//{
-//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
-//    if (geometry != nullptr) {
-//        geometry->setSemiactive(true);
-//    } else
-//        throw UbException(UB_EXARGS, "PeGeo SystemId=" + UbSystem::toString(peGeo->getSystemID()) +
-//                                         " is not matching geometry ID");
-//}
-//
-//void DemCoProcessor::addPeShadowGeo(walberla::pe::RigidBody *peGeo)
-//{
-//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
-//    if (geometry != nullptr) {
-//        geometry->setActive();
-//        geometry->setGeometry(peGeo);
-//        return;
-//    } else
-//        throw UbException(UB_EXARGS,
-//                          "PeGeo ID=" + UbSystem::toString(peGeo->getSystemID()) + " is not matching geometry ID");
-//}
-//
-//void DemCoProcessor::removePeShadowGeo(walberla::pe::RigidBody *peGeo)
-//{
-//    auto geometry = getPeGeoAdapter(peGeo->getSystemID());
-//
-//    if (geometry != nullptr) {
-//        geometry->setSemiactive(true);
-//    } else
-//        throw UbException(UB_EXARGS,
-//                          "PeGeo ID=" + UbSystem::toString(peGeo->getSystemID()) + " is not matching geometry ID");
-//}
-//
-//bool DemCoProcessor::isSpheresIntersection(double centerX1, double centerX2, double centerX3, double d)
-//{
-//    bool result = false;
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            SPtr<GbObject3D> sphere = interactors[i]->getGbObject3D();
-//            result                  = result ||
-//                     (sqrt(pow(sphere->getX1Centroid() - centerX1, 2.0) + pow(sphere->getX2Centroid() - centerX2, 2.0) +
-//                           pow(sphere->getX3Centroid() - centerX3, 2.0)) <= d);
-//        }
-//    }
-//    std::vector<int> values;
-//    values.push_back((int)result);
-//    std::vector<int> rvalues = comm->gather(values);
-//
-//    if (comm->isRoot()) {
-//        for (int i = 0; i < (int)rvalues.size(); i++) {
-//            result = result || (bool)rvalues[i];
-//        }
-//    }
-//    int iresult = (int)result;
-//    comm->broadcast(iresult);
-//    result = (bool)iresult;
-//
-//    return result;
-//}
-//
-//void DemCoProcessor::distributeIDs()
-//{
-//    std::vector<unsigned long long> peIDsSend;
-//    std::vector<int> vfIDsSend;
-//
-//    for (int i = 0; i < interactors.size(); i++) {
-//        if (std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])->isActive()) {
-//            peIDsSend.push_back(
-//                std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//                    ->getSystemID());
-//            vfIDsSend.push_back(interactors[i]->getID());
-//        }
-//    }
-//
-//    std::vector<unsigned long long> peIDsRecv;
-//    std::vector<int> vfIDsRecv;
-//
-//    comm->allGather(peIDsSend, peIDsRecv);
-//    comm->allGather(vfIDsSend, vfIDsRecv);
-//
-//    std::map<int, unsigned long long> idMap;
-//
-//    for (int i = 0; i < peIDsRecv.size(); i++) {
-//        idMap.insert(std::make_pair(vfIDsRecv[i], peIDsRecv[i]));
-//    }
-//
-//    for (int i = 0; i < interactors.size(); i++) {
-//        std::map<int, unsigned long long>::const_iterator it;
-//        if ((it = idMap.find(interactors[i]->getID())) == idMap.end()) {
-//            throw UbException(UB_EXARGS, "Interactor ID = " + UbSystem::toString(interactors[i]->getID()) +
-//                                             " is invalid! The DEM object may be not in PE domain!");
-//        }
-//
-//        std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])
-//            ->setSystemID(it->second);
-//
-//        geoIdMap.insert(std::make_pair(
-//            it->second, std::dynamic_pointer_cast<PePhysicsEngineGeometryAdapter>(physicsEngineGeometrieAdapters[i])));
-//    }
-//}
-////////////////////////////////////////////////////////////////////////////
-//void DemCoProcessor::setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor)
-//{
-//    this->boundaryConditionsBlockVisitor = boundaryConditionsBlockVisitor;
-//}
-////////////////////////////////////////////////////////////////////////////
-//walberla::pe::RigidBody *DemCoProcessor::getPeGeoObject(walberla::id_t id)
-//{
-//    std::shared_ptr<walberla::blockforest::BlockForest> forest =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getBlockForest();
-//    std::shared_ptr<walberla::domain_decomposition::BlockDataID> storageId =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getStorageId();
-//    std::shared_ptr<walberla::pe::BodyStorage> globalBodyStorage =
-//        std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(physicsEngineSolver)->getGlobalBodyStorage();
-//
-//    return walberla::pe::getBody(*globalBodyStorage, *forest, *storageId, id,
-//                                 walberla::pe::StorageSelect::LOCAL | walberla::pe::StorageSelect::SHADOW);
-//}
-//////////////////////////////////////////////////////////////////////////////
-//std::shared_ptr<PePhysicsEngineGeometryAdapter> DemCoProcessor::getPeGeoAdapter(unsigned long long systemId)
-//{
-//    std::map<unsigned long long, std::shared_ptr<PePhysicsEngineGeometryAdapter>>::const_iterator it;
-//    if ((it = geoIdMap.find(systemId)) == geoIdMap.end()) {
-//        return nullptr;
-//    } else
-//        return it->second;
-//}
-
-LiggghtsCoProcessor::LiggghtsCoProcessor()
-{
-}
-
-LiggghtsCoProcessor::~LiggghtsCoProcessor()
-{
-}
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h
deleted file mode 100644
index 380451103..000000000
--- a/src/cpu/LiggghtsCoupling/LiggghtsCoProcessor.h
+++ /dev/null
@@ -1,149 +0,0 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
-//      \    \  |    |   ________________________________________________________________
-//       \    \ |    |  |  ______________________________________________________________|
-//        \    \|    |  |  |         __          __     __     __     ______      _______
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
-//
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can
-//  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of
-//  the License, or (at your option) any later version.
-//
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-//  for more details.
-//
-//  You should have received a copy of the GNU General Public License along
-//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
-//
-//! \file LiggghtsCoProcessor.h
-//! \ingroup LiggghtsCoupling
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef LIGGGHTS_CO_PROCESSOR_H
-#define LIGGGHTS_CO_PROCESSOR_H
-
-#include "CoProcessor.h"
-
-#include "lammps.h"
-#include "input.h"
-#include "atom.h"
-#include "modify.h"
-#include "fix_lb_coupling_onetoone.h"
-
-class LiggghtsCoProcessor : public CoProcessor
-{
-public:
-    LiggghtsCoProcessor();
-    virtual ~LiggghtsCoProcessor();
-
-};
-
-#endif
-
-///*
-// *  Author: S. Peters
-// *  mail: peters@irmb.tu-bs.de
-// */
-//#ifndef DEM_CO_PROCESSOR_H
-//#define DEM_CO_PROCESSOR_H
-//
-//#include <map>
-//#include <memory>
-//#include <vector>
-//
-//#include "Vector3D.h"
-//
-//#include "CoProcessor.h"
-//#include "UbTuple.h"
-//
-//#include <pe/basic.h>
-//
-////#define TIMING
-//
-//#ifdef TIMING
-//#include "UbTiming.h"
-//#endif
-//
-//class PhysicsEngineGeometryAdapter;
-//class PhysicsEngineSolverAdapter;
-//class PePhysicsEngineSolverAdapter;
-//class PhysicsEngineMaterialAdapter;
-//class PePhysicsEngineGeometryAdapter;
-//
-//class UbScheduler;
-//class Grid3D;
-//class ForceCalculator;
-//class Communicator;
-//class MovableObjectInteractor;
-//class Communicator;
-//class BoundaryConditionsBlockVisitor;
-//
-//class DemCoProcessor : public CoProcessor
-//{
-//public:
-//    DemCoProcessor(std::shared_ptr<Grid3D> grid, std::shared_ptr<UbScheduler> s, std::shared_ptr<Communicator> comm,
-//                   std::shared_ptr<ForceCalculator> forceCalculator,
-//                   std::shared_ptr<PhysicsEngineSolverAdapter> physicsEngineSolver, double intermediatePeSteps = 1.0);
-//    virtual ~DemCoProcessor();
-//
-//    void addInteractor(std::shared_ptr<MovableObjectInteractor> interactor,
-//                       std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial,
-//                       Vector3D initalVelocity = Vector3D(0.0, 0.0, 0.0));
-//    void process(double step) override;
-//    std::shared_ptr<PhysicsEngineSolverAdapter> getPhysicsEngineSolver();
-//    void distributeIDs();
-//    void setBlockVisitor(std::shared_ptr<BoundaryConditionsBlockVisitor> blockVisitor);
-//    bool isDemObjectInAABB(std::array<double, 6> AABB);
-//    int addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles);
-//    void getObjectsPropertiesVector(std::vector<double> &p);
-//    void addPeGeo(walberla::pe::RigidBody *peGeo);
-//    void removePeGeo(walberla::pe::RigidBody *peGeo);
-//    void addPeShadowGeo(walberla::pe::RigidBody *peGeo);
-//    void removePeShadowGeo(walberla::pe::RigidBody *peGeo);
-//    bool isSpheresIntersection(double centerX1, double centerX2, double centerX3, double d);
-//
-//private:
-//    std::shared_ptr<PhysicsEngineGeometryAdapter>
-//    createPhysicsEngineGeometryAdapter(std::shared_ptr<MovableObjectInteractor> interactor,
-//                                       std::shared_ptr<PhysicsEngineMaterialAdapter> physicsEngineMaterial) const;
-//    void applyForcesOnGeometries();
-//    void setForcesToObject(SPtr<Grid3D> grid, std::shared_ptr<MovableObjectInteractor> interactor,
-//                           std::shared_ptr<PhysicsEngineGeometryAdapter> physicsEngineGeometry);
-//    void scaleForcesAndTorques(double scalingFactor);
-//    void calculateDemTimeStep(double step);
-//    void moveVfGeoObjects();
-//    walberla::pe::RigidBody *getPeGeoObject(walberla::id_t id);
-//    std::shared_ptr<PePhysicsEngineGeometryAdapter> getPeGeoAdapter(unsigned long long systemId);
-//
-//private:
-//    std::shared_ptr<Communicator> comm;
-//    std::vector<std::shared_ptr<MovableObjectInteractor>> interactors;
-//    std::shared_ptr<ForceCalculator> forceCalculator;
-//    std::shared_ptr<PePhysicsEngineSolverAdapter> physicsEngineSolver;
-//    std::vector<std::shared_ptr<PhysicsEngineGeometryAdapter>> physicsEngineGeometrieAdapters;
-//    double intermediateDemSteps;
-//    SPtr<BoundaryConditionsBlockVisitor> boundaryConditionsBlockVisitor;
-//    // walberla::pe::BodyStorage* bodyStorage;    //!< Reference to the central body storage.
-//    // walberla::pe::BodyStorage* bodyStorageShadowCopies;    //!< Reference to the body storage containing body shadow
-//    // copies.
-//
-//    std::map<unsigned long long, std::shared_ptr<PePhysicsEngineGeometryAdapter>> geoIdMap;
-//
-//#ifdef TIMING
-//    UbTimer timer;
-//#endif
-//};
-//
-//#endif
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
new file mode 100644
index 000000000..6dc8539c6
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -0,0 +1,13 @@
+#include "LiggghtsCouplingCoProcessor.h"
+
+LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor()
+{
+}
+
+LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
+{
+}
+
+void LiggghtsCouplingCoProcessor::process(double actualTimeStep)
+{
+}
\ No newline at end of file
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
new file mode 100644
index 000000000..d186aa750
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
@@ -0,0 +1,56 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file LiggghtsCouplingCoProcessor.h
+//! \ingroup LiggghtsCoupling
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef LiggghtsCouplingCoProcessor_h
+#define LiggghtsCouplingCoProcessor_h
+
+#include "CoProcessor.h"
+
+#include "lammps.h"
+#include "input.h"
+#include "atom.h"
+#include "modify.h"
+#include "fix_lb_coupling_onetoone.h"
+
+class LiggghtsCouplingCoProcessor : public CoProcessor
+{
+public:
+    LiggghtsCouplingCoProcessor();
+    virtual ~LiggghtsCouplingCoProcessor();
+
+    void process(double actualTimeStep) override;
+
+};
+
+#endif
+
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp
new file mode 100644
index 000000000..9be87887a
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the LBDEMcoupling software.
+ *
+ * LBDEMcoupling is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2014 Johannes Kepler University Linz
+ *
+ * Author: Philippe Seil (philippe.seil@jku.at)
+ */
+
+#include "LiggghtsCouplingWrapper.h"
+#include "mpi.h"
+#include <iostream>
+#include <sstream>
+
+LiggghtsCouplingWrapper::LiggghtsCouplingWrapper(char **argv, MPI_Comm communicator)
+  : lmp(0)
+{
+  // todo: get LAMMPS to recognize command line options
+  int argc_lmp = 1;
+  char **argv_lmp = 0;
+  argv_lmp = new char*[1];
+  argv_lmp[0] = argv[0];
+
+  lmp = new LAMMPS_NS::LAMMPS(argc_lmp,argv_lmp,communicator);
+
+  //    delete[] argv_lmp[0];
+  delete[] argv_lmp;
+}
+void LiggghtsCouplingWrapper::execFile(char* const fname)
+{
+  lmp->input->file(fname);
+}
+void LiggghtsCouplingWrapper::execCommand(std::stringstream const &cmd)
+{
+  lmp->input->one(cmd.str().c_str());
+}
+void LiggghtsCouplingWrapper::execCommand(char* const cmd)
+{
+  lmp->input->one(cmd);
+}
+int LiggghtsCouplingWrapper::getNumParticles()
+{
+  return lammps_get_natoms(lmp);  
+}
+void LiggghtsCouplingWrapper::setVariable(char const *name, double value)
+{
+  std::stringstream cmd;
+  cmd << "variable " << name << " equal " << value;
+  std::cout << cmd.str() << std::endl;
+  execCommand(cmd);
+}
+void LiggghtsCouplingWrapper::setVariable(char const *name, std::string &value)
+{
+  std::stringstream cmd;
+  cmd << "variable " << name << " string " << value;
+  std::cout << cmd.str() << std::endl;
+  execCommand(cmd);
+}
+void LiggghtsCouplingWrapper::run(int nSteps)
+{
+  std::stringstream cmd;
+  cmd << "run " << nSteps;
+  execCommand(cmd);
+}
+void LiggghtsCouplingWrapper::runUpto(int nSteps)
+{
+  std::stringstream cmd;
+  cmd << "run " << nSteps << " upto";
+  execCommand(cmd);
+}
+
+                              
+                           
+                           
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h
new file mode 100644
index 000000000..a745a7e96
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the LBDEMcoupling software.
+ *
+ * LBDEMcoupling is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2014 Johannes Kepler University Linz
+ *
+ * Author: Philippe Seil (philippe.seil@jku.at)
+ */
+
+#ifndef LIGGGHTSCOUPLINGWRAPPER_H
+#define LIGGGHTSCOUPLINGWRAPPER_H
+
+// necessary LAMMPS/LIGGGHTS includes
+
+#include "lammps.h"
+#include "input.h"
+#include "library.h"
+#include "library_cfd_coupling.h"
+
+class LiggghtsCouplingWrapper {
+public:
+  LiggghtsCouplingWrapper(char **argv, MPI_Comm communicator);
+  void execFile(char* const fname);
+  void execCommand(std::stringstream const &cmd);
+  void execCommand(char* const cmd);
+  void run(int nSteps);
+  void runUpto(int nSteps);
+  int getNumParticles();
+  void setVariable(char const *name, double value);
+  void setVariable(char const *name, std::string &value);
+
+  //private:
+  LAMMPS_NS::LAMMPS *lmp;
+};
+
+#endif /* LIGGGHTSCOUPLINGWRAPPER_H */
-- 
GitLab


From eb21658b8e08edef44674e792cd9a4a030dee105 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 18 Nov 2021 13:51:04 +0100
Subject: [PATCH 048/179] resolve merge conflicts

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp           |  4 ++--
 apps/cpu/ViskomatXL/viskomat.cpp                     |  4 ++--
 .../CoProcessors/CalculateTorqueCoProcessor.cpp      |  2 +-
 .../CoProcessors/MPIIOMigrationBECoProcessor.cpp     |  4 ++--
 .../CoProcessors/MPIIOMigrationBECoProcessor.h       |  8 +++-----
 .../CoProcessors/MPIIOMigrationCoProcessor.cpp       |  7 ++++---
 .../CoProcessors/MPIIOMigrationCoProcessor.h         | 12 +++++-------
 .../CoProcessors/MPIIORestartCoProcessor.h           |  4 ----
 ...WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp |  2 +-
 .../WriteMacroscopicQuantitiesPlusMassCoProcessor.h  |  6 +++---
 10 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index f0673cb50..8d59808f4 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -14,7 +14,7 @@ using namespace std;
 void run(string configname)
 {
     try {
-        ConfigurationFile config;
+        vf::basics::ConfigurationFile  config;
         config.load(configname);
 
         string pathname            = config.getValue<string>("pathname");
@@ -48,7 +48,7 @@ void run(string configname)
         bool newStart      = config.getValue<bool>("newStart");
         double rStep = config.getValue<double>("rStep");
 
-        SPtr<Communicator> comm = MPICommunicator::getInstance();
+        std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
 
         if (myid == 0)
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 30ca26d12..9426aca31 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -35,9 +35,9 @@ void bflow(string configname)
       double          mu = config.getValue<double>("mu");
 
 
-      ConfigurationFile   viscosity;
+      vf::basics::ConfigurationFile   viscosity;
 
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
       int myid = comm->getProcessID();
 
       if (logToFile)
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index 7b8a9bcae..fee4aaf3f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -13,7 +13,7 @@
 #include "EsoTwist3D.h"
 #include "DistributionArray3D.h"
 
-CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : CoProcessor(grid, s), path(path_), comm(comm), forceX1global(0), forceX2global(0), forceX3global(0)
+CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : CoProcessor(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0)
 {
    if (comm->getProcessID() == comm->getRoot())
    {
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 24ac57ffd..384150ed6 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -10,7 +10,7 @@
 #include "DataSet3D.h"
 #include "Grid3D.h"
 #include "LBMKernel.h"
-#include "MetisPartitioningGridVisitor.h"
+#include "Grid3DVisitor.h"
 #include "PointerDefinitions.h"
 #include "RenumberGridVisitor.h"
 #include "UbFileInputASCII.h"
@@ -25,7 +25,7 @@ using namespace MPIIODataStructures;
 #define MESSAGE_TAG 80
 #define SEND_BLOCK_SIZE 100000
 
-MPIIOMigrationBECoProcessor::MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm)
+MPIIOMigrationBECoProcessor::MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm)
     : MPIIOCoProcessor(grid, s, path, comm), nue(-999.999), nuL(-999.999), nuG(-999.999), densityRatio(-999.999)
 {
     memset(&boundCondParamStr, 0, sizeof(boundCondParamStr));
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
index 7c9471246..5fbfea371 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
@@ -13,6 +13,7 @@ class UbScheduler;
 namespace vf::mpi {class Communicator;}
 class BCProcessor;
 class LBMKernel;
+class Grid3DVisitor;
 
 //! \class MPIWriteBlocksBECoProcessor
 //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating
@@ -30,7 +31,7 @@ class MPIIOMigrationBECoProcessor : public MPIIOCoProcessor
     };
 
 public:
-    MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
+    MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path,
                                 std::shared_ptr<vf::mpi::Communicator> comm);
     ~MPIIOMigrationBECoProcessor() override;
     //! Each timestep writes the grid into the files
@@ -78,10 +79,6 @@ public:
     void blocksExchange(int tagN, int ind1, int ind2, int doubleCountInBlock, std::vector<double> &pV,
                         std::vector<double> *rawDataReceive);
 
-protected:
-    // std::string path;
-    // std::shared_ptr<vf::mpi::Communicator> comm;
-
 private:
     // MPI_Datatype gridParamType, block3dType;
     //   MPI_Datatype dataSetType, dataSetSmallType;
@@ -93,6 +90,7 @@ private:
     MPIIODataStructures::boundCondParam boundCondParamStr;
     SPtr<LBMKernel> lbmKernel;
     SPtr<BCProcessor> bcProcessor;
+    SPtr<Grid3DVisitor> metisVisitor;
     double nue;
     double nuL;
     double nuG;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index 6e8371c95..ca64b0e48 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -10,7 +10,7 @@
 #include "DataSet3D.h"
 #include "Grid3D.h"
 #include "LBMKernel.h"
-#include "MetisPartitioningGridVisitor.h"
+#include "Grid3DVisitor.h"
 #include "PointerDefinitions.h"
 #include "RenumberBlockVisitor.h"
 #include "UbFileInputASCII.h"
@@ -22,7 +22,7 @@
 
 using namespace MPIIODataStructures;
 
-MPIIOMigrationCoProcessor::MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, SPtr<Communicator> comm)
+MPIIOMigrationCoProcessor::MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm)
     : MPIIOCoProcessor(grid, s, path, comm)
 {
     memset(&boundCondParamStr, 0, sizeof(boundCondParamStr));
@@ -328,7 +328,8 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    double start, finish;
+    double start {0.};
+    double finish {0.};
     if (comm->isRoot())
         start = MPI_Wtime();
 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
index 1293d38d4..b822b783e 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h
@@ -12,6 +12,7 @@ class UbScheduler;
 namespace vf::mpi {class Communicator;}
 class BCProcessor;
 class LBMKernel;
+class Grid3DVisitor;
 
 //! \class MPIWriteBlocksCoProcessor
 //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating
@@ -26,10 +27,11 @@ public:
         ShearStressVal      = 5,
         RelaxationFactor = 6,
         PhaseField1 = 7,
-        PhaseField2 = 8
+        PhaseField2 = 8,
+        PressureField = 9
     };
 
-    MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm);
+    MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm);
     ~MPIIOMigrationCoProcessor() override;
     //! Each timestep writes the grid into the files
     void process(double step) override;
@@ -71,10 +73,6 @@ public:
     void clearAllFiles(int step);
     // void setNu(double nu);
 
-protected:
-    // std::string path;
-    // std::shared_ptr<vf::mpi::Communicator> comm;
-
 private:
     // MPI_Datatype gridParamType, block3dType;
     MPI_Datatype dataSetType, dataSetSmallType, dataSetDoubleType;
@@ -83,7 +81,7 @@ private:
     MPIIODataStructures::boundCondParam boundCondParamStr;
     SPtr<LBMKernel> lbmKernel;
     SPtr<BCProcessor> bcProcessor;
-    // double nue;
+    SPtr<Grid3DVisitor> metisVisitor;
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
index b50eafb79..beae84af9 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
@@ -60,10 +60,6 @@ public:
     //! The function truncates the data files
     void clearAllFiles(int step);
 
-protected:
-    // std::string path;
-    // std::shared_ptr<vf::mpi::Communicator> comm;
-
 private:
     // MPI_Datatype gridParamType, block3dType;
     MPI_Datatype dataSetType, dataSetSmallType, dataSetDoubleType;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
index f67750dd7..c71a12ee6 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp
@@ -52,7 +52,7 @@ WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMas
                                                                              const std::string &path,
                                                                              WbWriter *const writer,
                                                                              SPtr<LBMUnitConverter> conv,
-                                                                             SPtr<Communicator> comm)
+                                                                             std::shared_ptr<vf::mpi::Communicator> comm)
         : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm)
 {
     gridRank = comm->getProcessID();
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h
index b617c912a..07f1a1267 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h
@@ -42,7 +42,7 @@
 #include "LBMSystem.h"
 #include "UbTuple.h"
 
-class Communicator;
+namespace vf::mpi {class Communicator;}
 class Grid3D;
 class UbScheduler;
 class LBMUnitConverter;
@@ -63,7 +63,7 @@ public:
     //! \param conv is LBMUnitConverter object
     //! \param comm is Communicator object
     WriteMacroscopicQuantitiesPlusMassCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
-                                          WbWriter *const writer, SPtr<LBMUnitConverter> conv, SPtr<Communicator> comm);
+                                          WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm);
     ~WriteMacroscopicQuantitiesPlusMassCoProcessor() override = default;
 
     void process(double step) override;
@@ -90,7 +90,7 @@ private:
     int minInitLevel;
     int maxInitLevel;
     int gridRank;
-    SPtr<Communicator> comm;
+    std::shared_ptr<vf::mpi::Communicator> comm;
 
     using CalcMacrosFct = void (*)(const LBMReal *const &, LBMReal &, LBMReal &, LBMReal &, LBMReal &);
     CalcMacrosFct calcMacros;
-- 
GitLab


From f271592a1012cdac027122877f672e1818128dc5 Mon Sep 17 00:00:00 2001
From: kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 25 Nov 2021 09:56:07 +0100
Subject: [PATCH 049/179] fix gravity for Rising Bubble 2D

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 8d59808f4..939680185 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -109,11 +109,11 @@ void run(string configname)
         LBMReal mu_h = rho_h * nu_h;
         
         //gravity
-        LBMReal g_y = Re* Re* nu_h* nu_h / D;
+        LBMReal g_y = Re * Re * nu_h * nu_h / (D*D*D);
         //Eotvos number
         //LBMReal Eo = 100;
         //surface tension
-        sigma = rho_h* g_y* D* D / Eo;
+        sigma = rho_h * 1000.0 * g_y * D * D / Eo;
 
         //g_y = 0;
 
-- 
GitLab


From 8ab58fb6e6274ef0243fd33296d596f791e4f092 Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Thu, 25 Nov 2021 12:01:08 +0100
Subject: [PATCH 050/179] corrects pressure update in
 MultiphaseTwoPhaseFieldsPressureFilterLBMKernel,
 MultiphasePressureFilterCompressibleAirLBMKernel and
 MultiphasePressureFilterCompressibleAirLBMKernel.
 MultiphasePressureFilterCompressibleAirLBMKernel is not yet different from
 MultiphasePressureFilterCompressibleAirLBMKernel and hence not yet
 compressible.

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |    2 +-
 src/cpu/VirtualFluids.h                       |    1 +
 ...PressureFilterCompressibleAirLBMKernel.cpp | 1669 +++++++++++++++++
 ...sePressureFilterCompressibleAirLBMKernel.h |  116 ++
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp |    2 +-
 5 files changed, 1788 insertions(+), 2 deletions(-)
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index c3fabf97c..a36636f23 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -143,7 +143,7 @@ void run(string configname)
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
        // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterCompressibleAirLBMKernel());
 
         mu::Parser fgr;
         fgr.SetExpr("-(rho-rho_l)*g_y");
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index 067d7f1fb..a7e4e798b 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -256,6 +256,7 @@
 #include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h>
 #include <LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h>
 #include <LBM/MultiphasePressureFilterLBMKernel.h>
+#include <LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h>
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
new file mode 100644
index 000000000..01fb23625
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
@@ -0,0 +1,1669 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphasePressureFilterCompressibleAirLBMKernel.cpp
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphasePressureFilterCompressibleAirLBMKernel.h"
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "D3Q27System.h"
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include <cmath>
+
+#define PROOF_CORRECTNESS
+
+//////////////////////////////////////////////////////////////////////////
+MultiphasePressureFilterCompressibleAirLBMKernel::MultiphasePressureFilterCompressibleAirLBMKernel() { this->compressible = false; }
+//////////////////////////////////////////////////////////////////////////
+void MultiphasePressureFilterCompressibleAirLBMKernel::initDataSet()
+{
+	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+
+	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	dataSet->setFdistributions(f);
+	dataSet->setHdistributions(h); // For phase-field
+	dataSet->setPhaseField(divU1);
+	dataSet->setPressureField(pressure);
+
+	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+
+	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> MultiphasePressureFilterCompressibleAirLBMKernel::clone()
+{
+	SPtr<LBMKernel> kernel(new MultiphasePressureFilterCompressibleAirLBMKernel());
+	kernel->setNX(nx);
+	dynamicPointerCast<MultiphasePressureFilterCompressibleAirLBMKernel>(kernel)->initDataSet();
+	kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+	kernel->setDensityRatio(this->densityRatio);
+	kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+	kernel->setContactAngle(this->contactAngle);
+	kernel->setPhiL(this->phiL);
+	kernel->setPhiH(this->phiH);
+	kernel->setPhaseFieldRelaxation(this->tauH);
+	kernel->setMobility(this->mob);
+	kernel->setInterfaceWidth(this->interfaceWidth);
+
+	kernel->setBCProcessor(bcProcessor->clone(kernel));
+	kernel->setWithForcing(withForcing);
+	kernel->setForcingX1(muForcingX1);
+	kernel->setForcingX2(muForcingX2);
+	kernel->setForcingX3(muForcingX3);
+	kernel->setIndex(ix1, ix2, ix3);
+	kernel->setDeltaT(deltaT);
+	kernel->setGhostLayerWidth(2);
+	dynamicPointerCast<MultiphasePressureFilterCompressibleAirLBMKernel>(kernel)->initForcing();
+
+	return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterCompressibleAirLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m2 = mfa + mfc;
+	LBMReal m1 = mfc - mfa;
+	LBMReal m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += oneMinusRho;
+	mfb = (m1 * Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterCompressibleAirLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphasePressureFilterCompressibleAirLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal m1 = (mfa + mfc) + mfb;
+	LBMReal m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+	mfb = m2 - vv * m1;
+	mfa = m1;
+}
+
+
+void  MultiphasePressureFilterCompressibleAirLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
+{
+	using namespace D3Q27System;
+	using namespace UbMath;
+
+	forcingX1 = 0.0;
+	forcingX2 = 0.0;
+	forcingX3 = 0.0;
+
+	LBMReal oneOverInterfaceScale = c4 / interfaceWidth; //1.0;//1.5;
+														 /////////////////////////////////////
+
+	localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+	nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+	zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+	localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	const int bcArrayMaxX1 = (int)bcArray->getNX1();
+	const int bcArrayMaxX2 = (int)bcArray->getNX2();
+	const int bcArrayMaxX3 = (int)bcArray->getNX3();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+
+	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
+		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
+			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+					(*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+						(((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+							((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+								(mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+
+					////// read F-distributions for velocity formalism
+
+					mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal drho = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+					
+					LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH); //Incompressible
+					//LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH); //wrong?
+					//! variable density -> TRANSFER!
+					//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
+
+					(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
+
+					//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
+					////!!!!!! relplace by pointer swap!
+					//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+				}
+			}
+		}
+	}
+
+	LBMReal collFactorM;
+
+	////Periodic Filter
+	for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+		for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+			for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+					LBMReal sum = 0.;
+
+					///Version for boundaries
+					for (int xx = -1; xx <= 1; xx++) {
+						//int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+						int xxx = xx + x1;
+
+						for (int yy = -1; yy <= 1; yy++) {
+							//int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+							int yyy = yy + x2;
+
+							for (int zz = -1; zz <= 1; zz++) {
+								//int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+								int zzz = zz + x3;
+
+								if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+									sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressureOld)(xxx, yyy, zzz);
+								}
+								else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressureOld)(x1, x2, x3);
+								}
+
+
+							}
+						}
+					}
+					(*pressure)(x1, x2, x3) = sum;
+				}
+			}
+		}
+	}
+
+	////!filter
+
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					//////////////////////////////////////////////////////////////////////////
+					// Read distributions and phase field
+					////////////////////////////////////////////////////////////////////////////
+					//////////////////////////////////////////////////////////////////////////
+
+					// E   N  T
+					// c   c  c
+					//////////
+					// W   S  B
+					// a   a  a
+
+					// Rest ist b
+
+					// mfxyz
+					// a - negative
+					// b - null
+					// c - positive
+
+					// a b c
+					//-1 0 1
+
+					findNeighbors(phaseField, x1, x2, x3);
+
+					LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal dX1_phi = gradX1_phi();
+					LBMReal dX2_phi = gradX2_phi();
+					LBMReal dX3_phi = gradX3_phi();
+
+					LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
+					LBMReal normX1 = dX1_phi / denom;
+					LBMReal normX2 = dX2_phi / denom;
+					LBMReal normX3 = dX3_phi / denom;
+
+
+
+					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+
+
+					LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+
+					//----------- Calculating Macroscopic Values -------------
+					LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH); //Incompressible
+					//LBMReal rho = rhoL + (rhoH - rhoL) * phi[REST] + (one - phi[REST]) * (*pressure)(x1, x2, x3) * three; //compressible
+
+					LBMReal m0, m1, m2;
+					LBMReal rhoRef=c1;
+
+					LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+						(mfcbb - mfabb))/rhoRef;
+					LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+						(mfbcb - mfbab))/rhoRef;
+					LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+						(mfbbc - mfbba))/rhoRef;
+
+					LBMReal gradPx = 0.0;
+					LBMReal gradPy = 0.0;
+					LBMReal gradPz = 0.0;
+					for (int dir1 = -1; dir1 <= 1; dir1++) {
+						for (int dir2 = -1; dir2 <= 1; dir2++) {
+							int yyy = x2 + dir1;
+							int zzz = x3 + dir2;
+							if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+								gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) {
+								gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+							int xxx = x1 + dir1;
+							if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+								gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) {
+								gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+							yyy = x2 + dir2;
+							if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+								gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+								gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+							else {
+								gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+							}
+
+						}
+					}
+
+					//Viscosity increase by pressure gradient
+					LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+					//LBMReal limVis = 0.0000001*10;//0.01;
+					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
+					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
+					errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
+					//collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+
+					//3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+					//+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+					//+WEIGTH[N] * (phi2[T] - phi2[B]));
+
+					muRho = rho;
+
+					forcingX1 = muForcingX1.Eval()/rho - gradPx/rho;
+					forcingX2 = muForcingX2.Eval()/rho - gradPy/rho;
+					forcingX3 = muForcingX3.Eval()/rho - gradPz/rho;
+
+					vvx += forcingX1 * deltaT * 0.5; // X
+					vvy += forcingX2 * deltaT * 0.5; // Y
+					vvz += forcingX3 * deltaT * 0.5; // Z
+
+                    ///surface tension force
+					vvx += mu * dX1_phi * c1o2 / rho;
+					vvy += mu * dX2_phi * c1o2 / rho ;
+					vvz += mu * dX3_phi * c1o2 / rho;
+
+					LBMReal vx2;
+					LBMReal vy2;
+					LBMReal vz2;
+					vx2 = vvx * vvx;
+					vy2 = vvy * vvy;
+					vz2 = vvz * vvz;
+					///////////////////////////////////////////////////////////////////////////////////////////               
+					LBMReal oMdrho;
+
+
+					oMdrho = mfccc + mfaaa;
+					m0 = mfaca + mfcac;
+					m1 = mfacc + mfcaa;
+					m2 = mfaac + mfcca;
+					oMdrho += m0;
+					m1 += m2;
+					oMdrho += m1;
+					m0 = mfbac + mfbca;
+					m1 = mfbaa + mfbcc;
+					m0 += m1;
+					m1 = mfabc + mfcba;
+					m2 = mfaba + mfcbc;
+					m1 += m2;
+					m0 += m1;
+					m1 = mfacb + mfcab;
+					m2 = mfaab + mfccb;
+					m1 += m2;
+					m0 += m1;
+					oMdrho += m0;
+					m0 = mfabb + mfcbb;
+					m1 = mfbab + mfbcb;
+					m2 = mfbba + mfbbc;
+					m0 += m1 + m2;
+					m0 += mfbbb; //hat gefehlt
+					oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+
+															 ////////////////////////////////////////////////////////////////////////////////////
+					LBMReal wadjust;
+					LBMReal qudricLimit = 0.01;
+					////////////////////////////////////////////////////////////////////////////////////
+					//Hin
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m2 = mfaaa + mfaac;
+					m1 = mfaac - mfaaa;
+					m0 = m2 + mfaab;
+					mfaaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfaab = m1 - m0 * vvz;
+					mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfabc;
+					m1 = mfabc - mfaba;
+					m0 = m2 + mfabb;
+					mfaba = m0;
+					m0 += c1o9 * oMdrho;
+					mfabb = m1 - m0 * vvz;
+					mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfacc;
+					m1 = mfacc - mfaca;
+					m0 = m2 + mfacb;
+					mfaca = m0;
+					m0 += c1o36 * oMdrho;
+					mfacb = m1 - m0 * vvz;
+					mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbac;
+					m1 = mfbac - mfbaa;
+					m0 = m2 + mfbab;
+					mfbaa = m0;
+					m0 += c1o9 * oMdrho;
+					mfbab = m1 - m0 * vvz;
+					mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbba + mfbbc;
+					m1 = mfbbc - mfbba;
+					m0 = m2 + mfbbb;
+					mfbba = m0;
+					m0 += c4o9 * oMdrho;
+					mfbbb = m1 - m0 * vvz;
+					mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbca + mfbcc;
+					m1 = mfbcc - mfbca;
+					m0 = m2 + mfbcb;
+					mfbca = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcb = m1 - m0 * vvz;
+					mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcac;
+					m1 = mfcac - mfcaa;
+					m0 = m2 + mfcab;
+					mfcaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfcab = m1 - m0 * vvz;
+					mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcba + mfcbc;
+					m1 = mfcbc - mfcba;
+					m0 = m2 + mfcbb;
+					mfcba = m0;
+					m0 += c1o9 * oMdrho;
+					mfcbb = m1 - m0 * vvz;
+					mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcca + mfccc;
+					m1 = mfccc - mfcca;
+					m0 = m2 + mfccb;
+					mfcca = m0;
+					m0 += c1o36 * oMdrho;
+					mfccb = m1 - m0 * vvz;
+					mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m2 = mfaaa + mfaca;
+					m1 = mfaca - mfaaa;
+					m0 = m2 + mfaba;
+					mfaaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfaba = m1 - m0 * vvy;
+					mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfacb;
+					m1 = mfacb - mfaab;
+					m0 = m2 + mfabb;
+					mfaab = m0;
+					mfabb = m1 - m0 * vvy;
+					mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfacc;
+					m1 = mfacc - mfaac;
+					m0 = m2 + mfabc;
+					mfaac = m0;
+					m0 += c1o18 * oMdrho;
+					mfabc = m1 - m0 * vvy;
+					mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbca;
+					m1 = mfbca - mfbaa;
+					m0 = m2 + mfbba;
+					mfbaa = m0;
+					m0 += c2o3 * oMdrho;
+					mfbba = m1 - m0 * vvy;
+					mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbab + mfbcb;
+					m1 = mfbcb - mfbab;
+					m0 = m2 + mfbbb;
+					mfbab = m0;
+					mfbbb = m1 - m0 * vvy;
+					mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbac + mfbcc;
+					m1 = mfbcc - mfbac;
+					m0 = m2 + mfbbc;
+					mfbac = m0;
+					m0 += c2o9 * oMdrho;
+					mfbbc = m1 - m0 * vvy;
+					mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcca;
+					m1 = mfcca - mfcaa;
+					m0 = m2 + mfcba;
+					mfcaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfcba = m1 - m0 * vvy;
+					mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcab + mfccb;
+					m1 = mfccb - mfcab;
+					m0 = m2 + mfcbb;
+					mfcab = m0;
+					mfcbb = m1 - m0 * vvy;
+					mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcac + mfccc;
+					m1 = mfccc - mfcac;
+					m0 = m2 + mfcbc;
+					mfcac = m0;
+					m0 += c1o18 * oMdrho;
+					mfcbc = m1 - m0 * vvy;
+					mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m2 = mfaaa + mfcaa;
+					m1 = mfcaa - mfaaa;
+					m0 = m2 + mfbaa;
+					mfaaa = m0;
+					m0 += 1. * oMdrho;
+					mfbaa = m1 - m0 * vvx;
+					mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfcba;
+					m1 = mfcba - mfaba;
+					m0 = m2 + mfbba;
+					mfaba = m0;
+					mfbba = m1 - m0 * vvx;
+					mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfcca;
+					m1 = mfcca - mfaca;
+					m0 = m2 + mfbca;
+					mfaca = m0;
+					m0 += c1o3 * oMdrho;
+					mfbca = m1 - m0 * vvx;
+					mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfcab;
+					m1 = mfcab - mfaab;
+					m0 = m2 + mfbab;
+					mfaab = m0;
+					mfbab = m1 - m0 * vvx;
+					mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabb + mfcbb;
+					m1 = mfcbb - mfabb;
+					m0 = m2 + mfbbb;
+					mfabb = m0;
+					mfbbb = m1 - m0 * vvx;
+					mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacb + mfccb;
+					m1 = mfccb - mfacb;
+					m0 = m2 + mfbcb;
+					mfacb = m0;
+					mfbcb = m1 - m0 * vvx;
+					mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfcac;
+					m1 = mfcac - mfaac;
+					m0 = m2 + mfbac;
+					mfaac = m0;
+					m0 += c1o3 * oMdrho;
+					mfbac = m1 - m0 * vvx;
+					mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabc + mfcbc;
+					m1 = mfcbc - mfabc;
+					m0 = m2 + mfbbc;
+					mfabc = m0;
+					mfbbc = m1 - m0 * vvx;
+					mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacc + mfccc;
+					m1 = mfccc - mfacc;
+					m0 = m2 + mfbcc;
+					mfacc = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcc = m1 - m0 * vvx;
+					mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					// Cumulants
+					////////////////////////////////////////////////////////////////////////////////////
+
+					// mfaaa = 0.0;
+					LBMReal OxxPyyPzz = 1.; //omega2 or bulk viscosity
+											//  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+											//  LBMReal OxyyMxzz  = 1.;//2+s9;//
+					LBMReal O4 = 1.;
+					LBMReal O5 = 1.;
+					LBMReal O6 = 1.;
+
+					/////fourth order parameters; here only for test. Move out of loop!
+
+					LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+					//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+
+
+					//Cum 4.
+					//LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+
+					//Cum 5.
+					LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+					LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+					LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//Cum 6.
+					LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+
+					//2.
+					// linear combinations
+					LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+
+					//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+					mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+										//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
+					LBMReal mxxMyy = mfcaa - mfaca;
+					LBMReal mxxMzz = mfcaa - mfaac;
+
+					LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+					LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+					LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+
+					LBMReal Dxy = -three * collFactorM * mfbba;
+					LBMReal Dxz = -three * collFactorM * mfbab;
+					LBMReal Dyz = -three * collFactorM * mfabb;
+
+					//relax
+					mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+					mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+					mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+
+					mfabb += collFactorM * (-mfabb);
+					mfbab += collFactorM * (-mfbab);
+					mfbba += collFactorM * (-mfbba);
+
+					////updated pressure
+					//mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+					mfaaa = 0.0; // Pressure elimination as in standard velocity model
+								 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
+
+					mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+
+										// mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+										//mfaaa = mfaaaS;
+										// linear combinations back
+					mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+
+					//3.
+					// linear combinations
+					LBMReal mxxyPyzz = mfcba + mfabc;
+					LBMReal mxxyMyzz = mfcba - mfabc;
+
+					LBMReal mxxzPyyz = mfcab + mfacb;
+					LBMReal mxxzMyyz = mfcab - mfacb;
+
+					LBMReal mxyyPxzz = mfbca + mfbac;
+					LBMReal mxyyMxzz = mfbca - mfbac;
+
+					//relax
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+					mfbbb += wadjust * (-mfbbb);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+					mxxyPyzz += wadjust * (-mxxyPyzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+					mxxyMyzz += wadjust * (-mxxyMyzz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+					mxxzPyyz += wadjust * (-mxxzPyyz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+					mxxzMyyz += wadjust * (-mxxzMyyz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+					mxyyPxzz += wadjust * (-mxyyPxzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+					mxyyMxzz += wadjust * (-mxyyMxzz);
+
+					// linear combinations back
+					mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+					mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+					mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+					mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+					mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+					mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+					//4.
+					CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+					CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+					CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+					CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+					CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+					CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+
+					//5.
+					CUMbcc += O5 * (-CUMbcc);
+					CUMcbc += O5 * (-CUMcbc);
+					CUMccb += O5 * (-CUMccb);
+
+					//6.
+					CUMccc += O6 * (-CUMccc);
+
+					//back cumulants to central moments
+					//4.
+					//mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+
+					//5.
+					mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+					mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+					mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//6.
+					mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+
+
+					////////
+
+
+					////////////////////////////////////////////////////////////////////////////////////
+					//forcing
+					mfbaa = -mfbaa;
+					mfaba = -mfaba;
+					mfaab = -mfaab;
+					//////////////////////////////////////////////////////////////////////////////////////
+					mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+					mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+					mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
+					////////////////////////////////////////////////////////////////////////////////////
+					//back
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+					m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaaa = m0;
+					mfaab = m1;
+					mfaac = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+					m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+					m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+					mfaba = m0;
+					mfabb = m1;
+					mfabc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaca = m0;
+					mfacb = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+					m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+					m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+					mfbaa = m0;
+					mfbab = m1;
+					mfbac = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+					m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+					m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+					mfbba = m0;
+					mfbbb = m1;
+					mfbbc = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+					m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+					m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+					mfbca = m0;
+					mfbcb = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcaa = m0;
+					mfcab = m1;
+					mfcac = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+					m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+					m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+					mfcba = m0;
+					mfcbb = m1;
+					mfcbc = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+					m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcca = m0;
+					mfccb = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaaa = m0;
+					mfaba = m1;
+					mfaca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+					m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaab = m0;
+					mfabb = m1;
+					mfacb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaac = m0;
+					mfabc = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+					m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+					m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+					mfbaa = m0;
+					mfbba = m1;
+					mfbca = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+					m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+					m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+					mfbab = m0;
+					mfbbb = m1;
+					mfbcb = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+					m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+					m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+					mfbac = m0;
+					mfbbc = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcaa = m0;
+					mfcba = m1;
+					mfcca = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+					m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcab = m0;
+					mfcbb = m1;
+					mfccb = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcac = m0;
+					mfcbc = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaaa = m0;
+					mfbaa = m1;
+					mfcaa = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaba = m0;
+					mfbba = m1;
+					mfcba = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaca = m0;
+					mfbca = m1;
+					mfcca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaab = m0;
+					mfbab = m1;
+					mfcab = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+					m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabb = m0;
+					mfbbb = m1;
+					mfcbb = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacb = m0;
+					mfbcb = m1;
+					mfccb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaac = m0;
+					mfbac = m1;
+					mfcac = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabc = m0;
+					mfbbc = m1;
+					mfcbc = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacc = m0;
+					mfbcc = m1;
+					mfccc = m2;
+
+					//////////////////////////////////////////////////////////////////////////
+					//proof correctness
+					//////////////////////////////////////////////////////////////////////////
+					//#ifdef  PROOF_CORRECTNESS
+					LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+					//			   //LBMReal dif = fabs(drho - rho_post);
+					//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+					//#ifdef SINGLEPRECISION
+					//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+					//#else
+					//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+					//#endif
+					//			   {
+					//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+					//					   + " dif=" + UbSystem::toString(dif)
+					//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+					//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+					//				   //exit(EXIT_FAILURE);
+					//			   }
+					//#endif
+
+					if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post))
+						UB_THROW(UbException(
+							UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," +
+							UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+
+					//////////////////////////////////////////////////////////////////////////
+					//write distribution
+					//////////////////////////////////////////////////////////////////////////
+					(*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
+
+					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+																																		// !Old Kernel
+/////////////////////  P H A S E - F I E L D   S O L V E R
+////////////////////////////////////////////
+/////CUMULANT PHASE-FIELD
+					LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+					{
+						mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+						mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+						mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+						mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+						mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+						mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+						mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+						mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+						mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+						mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+						mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+						mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+						mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+						mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+						mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+						mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+						mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+						mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+						mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+						mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+						mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+						mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+						mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+						mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+						mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+						mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+						mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// second component
+						LBMReal concentration =
+							((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+								(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+								((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+						////////////////////////////////////////////////////////////////////////////////////
+						LBMReal oneMinusRho = c1- concentration;
+
+						LBMReal cx =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+								(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+								(mfcbb - mfabb));
+						LBMReal cy =
+							((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+								(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+								(mfbcb - mfbab));
+						LBMReal cz =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+								(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+								(mfbbc - mfbba));
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// calculate the square of velocities for this lattice node
+						LBMReal cx2 = cx * cx;
+						LBMReal cy2 = cy * cy;
+						LBMReal cz2 = cz * cz;
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (6)-(14) in \ref
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - experimental Cumulant ... to be published ... hopefully
+						//!
+
+						// linearized orthogonalization of 3rd order central moments
+						LBMReal Mabc = mfabc - mfaba * c1o3;
+						LBMReal Mbca = mfbca - mfbaa * c1o3;
+						LBMReal Macb = mfacb - mfaab * c1o3;
+						LBMReal Mcba = mfcba - mfaba * c1o3;
+						LBMReal Mcab = mfcab - mfaab * c1o3;
+						LBMReal Mbac = mfbac - mfbaa * c1o3;
+						// linearized orthogonalization of 5th order central moments
+						LBMReal Mcbc = mfcbc - mfaba * c1o9;
+						LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+						LBMReal Mccb = mfccb - mfaab * c1o9;
+
+						// collision of 1st order moments
+						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+
+						cx2 = cx * cx;
+						cy2 = cy * cy;
+						cz2 = cz * cz;
+
+						// equilibration of 2nd order moments
+						mfbba = zeroReal;
+						mfbab = zeroReal;
+						mfabb = zeroReal;
+
+						mfcaa = c1o3 * concentration;
+						mfaca = c1o3 * concentration;
+						mfaac = c1o3 * concentration;
+
+						// equilibration of 3rd order moments
+						Mabc = zeroReal;
+						Mbca = zeroReal;
+						Macb = zeroReal;
+						Mcba = zeroReal;
+						Mcab = zeroReal;
+						Mbac = zeroReal;
+						mfbbb = zeroReal;
+
+						// from linearized orthogonalization 3rd order central moments to central moments
+						mfabc = Mabc + mfaba * c1o3;
+						mfbca = Mbca + mfbaa * c1o3;
+						mfacb = Macb + mfaab * c1o3;
+						mfcba = Mcba + mfaba * c1o3;
+						mfcab = Mcab + mfaab * c1o3;
+						mfbac = Mbac + mfbaa * c1o3;
+
+						// equilibration of 4th order moments
+						mfacc = c1o9 * concentration;
+						mfcac = c1o9 * concentration;
+						mfcca = c1o9 * concentration;
+
+						mfcbb = zeroReal;
+						mfbcb = zeroReal;
+						mfbbc = zeroReal;
+
+						// equilibration of 5th order moments
+						Mcbc = zeroReal;
+						Mbcc = zeroReal;
+						Mccb = zeroReal;
+
+						// from linearized orthogonalization 5th order central moments to central moments
+						mfcbc = Mcbc + mfaba * c1o9;
+						mfbcc = Mbcc + mfbaa * c1o9;
+						mfccb = Mccb + mfaab * c1o9;
+
+						// equilibration of 6th order moment
+						mfccc = c1o27 * concentration;
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (88)-(96) in
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+						(*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+						(*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+						(*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+						(*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+						(*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+						(*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+
+						(*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+					}
+				}
+			}
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi()
+{
+	using namespace D3Q27System;
+	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
+		+WEIGTH[N] * (phi[E] - phi[W]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
+		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+		+WEIGTH[N] * (phi[N] - phi[S]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
+		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+		+WEIGTH[N] * (phi[T] - phi[B]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+		+WEIGTH[N] * (phi2[E] - phi2[W]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+		+WEIGTH[N] * (phi2[N] - phi2[S]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+		+WEIGTH[N] * (phi2[T] - phi2[B]));
+}
+
+LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::nabla2_phi()
+{
+	using namespace D3Q27System;
+	LBMReal sum = 0.0;
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
+		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TN] * (
+		(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
+		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
+		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		);
+	sum += WEIGTH[T] * (
+		((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
+		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
+		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		);
+
+	return 6.0 * sum;
+}
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::computePhasefield()
+{
+	using namespace D3Q27System;
+	SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+	int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+	int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+
+	//------------- Computing the phase-field ------------------
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				// if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+				{
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+				}
+			}
+		}
+	}
+}
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		} else {
+			phi[k] = 0.0;
+		}
+	}
+}
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[REST] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.0;
+		}
+	}
+}
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::swapDistributions()
+{
+	LBMKernel::swapDistributions();
+	dataSet->getHdistributions()->swap();
+}
+
+void MultiphasePressureFilterCompressibleAirLBMKernel::initForcing()
+{
+	muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+	muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+	muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+
+	muDeltaT = deltaT;
+
+	muForcingX1.DefineVar("dt", &muDeltaT);
+	muForcingX2.DefineVar("dt", &muDeltaT);
+	muForcingX3.DefineVar("dt", &muDeltaT);
+
+	muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+
+	muForcingX1.DefineVar("nu", &muNu);
+	muForcingX2.DefineVar("nu", &muNu);
+	muForcingX3.DefineVar("nu", &muNu);
+
+	muForcingX1.DefineVar("rho",&muRho); 
+	muForcingX2.DefineVar("rho",&muRho); 
+	muForcingX3.DefineVar("rho",&muRho); 
+
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h
new file mode 100644
index 000000000..e15f29e04
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h
@@ -0,0 +1,116 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphasePressureFilterCompressibleAirLBMKernel.h
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphasePressureFilterCompressibleAirLBMKernel_H
+#define MultiphasePressureFilterCompressibleAirLBMKernel_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief  Multiphase Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  M. Geier, K. Kutscher, Hesameddin Safari
+class MultiphasePressureFilterCompressibleAirLBMKernel : public LBMKernel
+{
+public:
+    MultiphasePressureFilterCompressibleAirLBMKernel();
+    virtual ~MultiphasePressureFilterCompressibleAirLBMKernel(void) = default;
+    void calculate(int step) override;
+    SPtr<LBMKernel> clone() override;
+
+
+    ///refactor
+    //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+
+
+    double getCalculationTime() override { return .0; }
+protected:
+    virtual void initDataSet();
+    void swapDistributions() override;
+
+    void initForcing();
+
+    void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+    void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+    LBMReal f1[D3Q27System::ENDF+1];
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH1;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU; 
+
+    LBMReal h  [D3Q27System::ENDF+1];
+    LBMReal h2[D3Q27System::ENDF + 1];
+    LBMReal g  [D3Q27System::ENDF+1];
+    LBMReal phi[D3Q27System::ENDF+1];
+    LBMReal phi2[D3Q27System::ENDF + 1];
+    LBMReal pr1[D3Q27System::ENDF+1];
+    LBMReal phi_cutoff[D3Q27System::ENDF+1];
+
+    LBMReal gradX1_phi();
+    LBMReal gradX2_phi();
+    LBMReal gradX3_phi();
+    LBMReal gradX1_phi2();
+    LBMReal gradX2_phi2();
+    LBMReal gradX3_phi2();
+    void computePhasefield();
+    void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+    void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
+
+    LBMReal nabla2_phi();
+
+    mu::value_type muX1,muX2,muX3;
+    mu::value_type muDeltaT;
+    mu::value_type muNu;
+    mu::value_type muRho;
+    LBMReal forcingX1;
+    LBMReal forcingX2;
+    LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 92df11d00..179fc6f4d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -310,7 +310,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
 							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
-						LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+						LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH);
 						//! variable density -> TRANSFER!
 						//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
-- 
GitLab


From 733a05bd691a4fd4a244fdf1bc7a4a629d0796cd Mon Sep 17 00:00:00 2001
From: "AMATERASU\\geier" <geier@irmb.tu-bs.de>
Date: Thu, 25 Nov 2021 13:23:21 +0100
Subject: [PATCH 051/179] Now MultiphasePressureFilterLBMKernel pressure update
 is also corrected (wrong fiel in previous commit).

---
 .../VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index e2316f383..240027f32 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -251,7 +251,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
 						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
-					LBMReal rho = rhoH + rhoToPhi * ((*pressure)(x1, x2, x3) - phiH);
+					LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH);
 					//! variable density -> TRANSFER!
 					//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
-- 
GitLab


From 91ea5ddd77bb1479de65baf8145157a81d4690cd Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin7.usr.hlrn.de>
Date: Fri, 10 Dec 2021 13:52:13 +0100
Subject: [PATCH 052/179] add acoustic scaling

---
 apps/cpu/ViskomatXL/viskomat.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 8bbcf6e19..c88840742 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -69,9 +69,16 @@ void bflow(string configname)
 
       //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
 
-      double dx = deltax * 1e-3;
+      // double dx = deltax * 1e-3;
+      // double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
+
+      double dx = 1.0 * 1e-3;
       double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
 
+      //acustic scaling
+      OmegaLB /= 2.0;
+      nuLB    *= 2.0;
+
       SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
       //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(1, 1461, 970, 1e3));
       //UBLOG(logINFO, conv->toString());
@@ -405,9 +412,9 @@ void bflow(string configname)
       SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
       SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
       calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(fp);
+      //calculator->addCoProcessor(fp);
       calculator->addCoProcessor(fp2);
-      calculator->addCoProcessor(writeMQCoProcessor);
+      //calculator->addCoProcessor(writeMQCoProcessor);
       //calculator->addCoProcessor(writeThixotropicMQCoProcessor);
       calculator->addCoProcessor(restartCoProcessor);
 
-- 
GitLab


From a8399ee2be1077e7004b4f93d1ed3d8c6ff5628d Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Mon, 3 Jan 2022 13:22:31 +0100
Subject: [PATCH 053/179] Fix restart problem in nx-initialisation; refactor
 MPIIORestartCoProcessor

---
 .../MPIIOMigrationBECoProcessor.cpp           |  23 +-
 .../MPIIOMigrationBECoProcessor.h             |   3 +-
 .../MPIIOMigrationCoProcessor.cpp             |  37 +-
 .../CoProcessors/MPIIORestartCoProcessor.cpp  | 887 +++++++++++++++++-
 .../CoProcessors/MPIIORestartCoProcessor.h    |  51 +-
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |   4 +-
 6 files changed, 916 insertions(+), 89 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
index 384150ed6..34c247345 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp
@@ -245,6 +245,11 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
                 else
                     arrPresence.isPhaseField2Present = false;
 
+                SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> pressureFieldPtr = block->getKernel()->getDataSet()->getPressureField();
+                if (pressureFieldPtr)
+                    arrPresence.isPressureFieldPresent = true;
+                else
+                    arrPresence.isPressureFieldPresent = false;
 
                 firstBlock = false;
             }
@@ -398,6 +403,10 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step)
 
     if (arrPresence.isPhaseField2Present)
         write3DArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
+
+    if (arrPresence.isPressureFieldPresent)
+        write3DArray(step, PressureField, std::string("/cpPressureField.bin"));
+
     }
 
 void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std::string fname)
@@ -565,6 +574,9 @@ void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std::
                 case PhaseField2:
                     ___Array = block->getKernel()->getDataSet()->getPhaseField2();
                     break;
+                case PressureField:
+                    ___Array = block->getKernel()->getDataSet()->getPressureField();
+                    break;
                 default:
                     UB_THROW(UbException(UB_EXARGS,
                     "MPIIOMigrationBECoProcessor::write3DArray : 3D array type does not exist!"));
@@ -1217,6 +1229,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
             // find the nesessary block and fill it
             SPtr<Block3D> block = grid->getBlock(blockID);
             this->lbmKernel->setBlock(block);
+            this->lbmKernel->setNX(std::array<int, 3>{ {dataSetParamStr1.nx1, dataSetParamStr1.nx2, dataSetParamStr1.nx3}});
             SPtr<LBMKernel> kernel = this->lbmKernel->clone();
             LBMReal collFactor = LBMSystem::calcCollisionFactor(this->nue, block->getLevel());
             LBMReal collFactorL = LBMSystem::calcCollisionFactor(this->nuL, block->getLevel());
@@ -1285,9 +1298,12 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step)
     if (arrPresence.isPhaseField2Present)
         readArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
 
+    if (arrPresence.isPressureFieldPresent)
+        readArray(step, PressureField, std::string("/cpPressureField.bin"));
+
     delete[] rawDataReceiveF;
     delete[] rawDataReceiveH1;
-//    delete[] rawDataReceiveH2;
+    delete[] rawDataReceiveH2;
 }
 
 void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::string fname)
@@ -1430,6 +1446,11 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin
                         vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
                     block->getKernel()->getDataSet()->setPhaseField2(___3DArray);
                     break;
+                case PressureField:
+                    ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                        vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+                    block->getKernel()->getDataSet()->setPressureField(___3DArray);
+                    break;
                 default:
                     UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationBECoProcessor::readArray : array type does not exist!"));
                     break;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
index 5fbfea371..c60800ccd 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h
@@ -27,7 +27,8 @@ class MPIIOMigrationBECoProcessor : public MPIIOCoProcessor
         ShearStressVal      = 5,
         RelaxationFactor    = 6,
         PhaseField1         = 7,
-        PhaseField2 = 8
+        PhaseField2         = 8,
+        PressureField = 9
     };
 
 public:
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
index ca64b0e48..285d6c28a 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp
@@ -313,7 +313,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step)
                 if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0))
                     doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end());
             }
-
+            
             ic++;
         }
     }
@@ -476,7 +476,7 @@ void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::st
 
     if (comm->isRoot()) 
     {
-        UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeAverageDensityArray start collect data rank = " << rank);
+        UBLOG(logINFO, "MPIIOMigrationCoProcessor::write4DArray start collect data rank = " << rank);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
@@ -606,7 +606,7 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st
 
     if (comm->isRoot()) 
     {
-        UBLOG(logINFO, "MPIIOMigrationCoProcessor::write3DArray start collect data rank = " << rank);
+        UBLOG(logINFO, "MPIIOMigrationCoProcessor::write3DArray start collect data to file = " << fname);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
@@ -1030,7 +1030,6 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
 
     }
     MPI_File_close(&file_handler);
-
     //----------------------------------------- H2 ----------------------------------------------------
     ic = 0;
     filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpDataSetH2.bin";
@@ -1100,19 +1099,16 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
         if (multiPhase2)
             vectorsOfValuesH23.assign(doubleValuesArrayH2.data() + index, doubleValuesArrayH2.data() + index + vectorSize3);
         index += vectorSize3;
-
+ 
         SPtr<DistributionArray3D> mFdistributions(new D3Q27EsoTwist3DSplittedVector());
         dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesF1, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
+            new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesF1, dataSetParamStr1.nx[0], dataSetParamStr1.nx[1], dataSetParamStr1.nx[2], dataSetParamStr1.nx[3])));
         dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(
-                new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesF2, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
+            new CbArray4D<LBMReal, IndexerX4X3X2X1>(vectorsOfValuesF2, dataSetParamStr2.nx[0], dataSetParamStr2.nx[1], dataSetParamStr2.nx[2], dataSetParamStr2.nx[3])));
         dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
-                    vectorsOfValuesF3, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
-
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(dataSetParamStr1.nx1);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(dataSetParamStr1.nx2);
-        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr1.nx3);
-
+            vectorsOfValuesF3, dataSetParamStr3.nx[0], dataSetParamStr3.nx[1], dataSetParamStr3.nx[2])));
+        
+        //----------------------------------------- H1 ----------------------------------------------------
        SPtr<DistributionArray3D> mH1distributions(new D3Q27EsoTwist3DSplittedVector());
        if (multiPhase1)
         {
@@ -1143,9 +1139,14 @@ void MPIIOMigrationCoProcessor::readDataSet(int step)
             dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mH2distributions)->setNX3(dataSetParamStr1.nx3);
         }
 
+        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX1(dataSetParamStr1.nx1);
+        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX2(dataSetParamStr1.nx2);
+        dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(mFdistributions)->setNX3(dataSetParamStr1.nx3);
+
         // find the nesessary block and fill it
         SPtr<Block3D> block = grid->getBlock(dataSetArray[n].globalID);
         this->lbmKernel->setBlock(block);
+        this->lbmKernel->setNX(std::array<int, 3>{ {dataSetParamStr1.nx1, dataSetParamStr1.nx2, dataSetParamStr1.nx3}});
         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();
@@ -1223,7 +1224,7 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string
 
     if (comm->isRoot()) 
     {
-        UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray start MPI IO rank = " << rank);
+        UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray start fname = " << fname);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
     
@@ -1293,7 +1294,10 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string
     size_t index = 0;
     size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
     std::vector<double> vectorsOfValues;
-    for (std::size_t n = 0; n < blocksCount; n++) 
+    SPtr<CbArray4D<LBMReal, IndexerX4X3X2X1>> ___4DArray;
+    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> ___3DArray;
+
+    for (std::size_t n = 0; n < blocksCount; n++)
     {
         SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].globalID);
 
@@ -1301,9 +1305,6 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string
         index += nextVectorSize;
 
         // fill arrays
-        SPtr<CbArray4D<LBMReal, IndexerX4X3X2X1>> ___4DArray;
-        SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> ___3DArray;
-
         switch (arrType) 
         {
             case AverageDensity:
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 90f393d0f..1798bc68d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -286,6 +286,12 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
                 else
                     arrPresence.isPhaseField2Present = false;
 
+                SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> pressureFieldPtr = block->getKernel()->getDataSet()->getPressureField();
+                if (pressureFieldPtr)
+                    arrPresence.isPressureFieldPresent = true;
+                else
+                    arrPresence.isPressureFieldPresent = false;
+
                 firstBlock = false;
             }
 
@@ -440,6 +446,33 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
     MPI_File_close(&file_handler1);
 
     if (arrPresence.isAverageDensityArrayPresent)
+        write4DArray(step, AverageDensity, std::string("/cpAverageDensityArray.bin"));
+
+    if (arrPresence.isAverageVelocityArrayPresent)
+        write4DArray(step, AverageVelocity, std::string("/cpAverageVelocityArray.bin"));
+
+    if (arrPresence.isAverageFluktuationsArrayPresent)
+        write4DArray(step, AverageFluktuations, std::string("/cpAverageFluktuationsArray.bin"));
+
+    if (arrPresence.isAverageTripleArrayPresent)
+        write4DArray(step, AverageTriple, std::string("/cpAverageTripleArray.bin"));
+
+    if (arrPresence.isShearStressValArrayPresent)
+        write4DArray(step, ShearStressVal, std::string("/cpShearStressValArray.bin"));
+
+    if (arrPresence.isRelaxationFactorPresent)
+        write3DArray(step, RelaxationFactor, std::string("/cpRelaxationFactor.bin"));
+
+    if (arrPresence.isPhaseField1Present)
+        write3DArray(step, PhaseField1, std::string("/cpPhaseField1.bin"));
+
+    if (arrPresence.isPhaseField2Present)
+        write3DArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
+
+    if (arrPresence.isPressureFieldPresent)
+        write3DArray(step, PressureField, std::string("/cpPressureField.bin"));
+
+    /*if (arrPresence.isAverageDensityArrayPresent)
         writeAverageDensityArray(step);
 
     if (arrPresence.isAverageVelocityArrayPresent)
@@ -462,9 +495,327 @@ void MPIIORestartCoProcessor::writeDataSet(int step)
 
     if (arrPresence.isPhaseField2Present)
         writePhaseField(step, 2);
+
+    if (arrPresence.isPressureFieldPresent)
+        writePressureField(step);*/
+
+}
+
+void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::string fname)
+{
+    int rank, size;
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
+
+    std::vector<SPtr<Block3D>> blocksVector[25];
+    int minInitLevel = this->grid->getCoarsestInitializedLevel();
+    int maxInitLevel = this->grid->getFinestInitializedLevel();
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        grid->getBlocks(level, rank, blocksVector[level]);
+        blocksCount += static_cast<int>(blocksVector[level].size());
+    }
+
+    DataSetSmallRestart* dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    std::vector<double> doubleValuesArray; // double-values of the AverageDensityArray in all blocks
+    dataSetParam dataSetParamStr;
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writeAverageDensityArray start collect data to file = " << fname);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    bool firstBlock = true;
+    int doubleCountInBlock = 0;
+    int ic = 0;
+    SPtr<CbArray4D<LBMReal, IndexerX4X3X2X1>> ___Array;
+
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
+        {
+            dataSetSmallArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid
+            dataSetSmallArray[ic].x2 = block->getX2();
+            dataSetSmallArray[ic].x3 = block->getX3();
+            dataSetSmallArray[ic].level = block->getLevel();
+
+            switch (arrayType)
+            {
+            case AverageDensity:
+                ___Array = block->getKernel()->getDataSet()->getAverageDensity();
+                break;
+            case AverageVelocity:
+                ___Array = block->getKernel()->getDataSet()->getAverageVelocity();
+                break;
+            case AverageFluktuations:
+                ___Array = block->getKernel()->getDataSet()->getAverageFluctuations();
+                break;
+            case AverageTriple:
+                ___Array = block->getKernel()->getDataSet()->getAverageTriplecorrelations();
+                break;
+            case ShearStressVal:
+                ___Array = block->getKernel()->getDataSet()->getShearStressValues();
+                break;
+            default:
+                UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::write4DArray : 4D array type does not exist!"));
+                break;
+            }
+
+            if (firstBlock) // when first (any) valid block...
+            {
+                dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
+                dataSetParamStr.nx[0] = static_cast<int>(___Array->getNX1());
+                dataSetParamStr.nx[1] = static_cast<int>(___Array->getNX2());
+                dataSetParamStr.nx[2] = static_cast<int>(___Array->getNX3());
+                dataSetParamStr.nx[3] = static_cast<int>(___Array->getNX4());
+                doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+
+                firstBlock = false;
+            }
+
+            if (___Array && (dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0) && (dataSetParamStr.nx[3] > 0))
+                doubleValuesArray.insert(doubleValuesArray.end(), ___Array->getDataVector().begin(), ___Array->getDataVector().end());
+
+            ic++;
+        }
+    }
+ 
+     // register new MPI-types depending on the block-specific information
+    MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
+    MPI_Type_commit(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::write4DArray start MPI IO rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    // write to the file
+    // all processes calculate their offsets (quantity of bytes that the process is going to write)
+    // and notify the next process (with the rank = rank + 1)
+    MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int));
+    size_t next_write_offset = 0;
+
+    if (size > 1)
+    {
+        if (rank == 0)
+        {
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
+        }
+        else
+        {
+            MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            if (rank < size - 1)
+                MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD);
+        }
+    }
+
+    double start{ 0. };
+    double finish{ 0. };
+    if (comm->isRoot())
+        start = MPI_Wtime();
+
+    MPI_Info info = MPI_INFO_NULL;
+
+#ifdef HLRN_LUSTRE
+    MPI_Info_create(&info);
+    MPI_Info_set(info, "striping_factor", "40");
+    MPI_Info_set(info, "striping_unit", "4M");
+#endif
+
+    MPI_File file_handler;
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + fname;
+    int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+
+    // each process writes the quantity of it's blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
+    // each process writes common parameters of a dataSet
+    MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
+    // each process writes data identifying blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount, dataSetSmallType, MPI_STATUS_IGNORE);
+    // each process writes the dataSet arrays
+    if (doubleValuesArray.size() > 0)
+        MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+
+    MPI_File_sync(file_handler);
+    MPI_File_close(&file_handler);
+    MPI_Type_free(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        finish = MPI_Wtime();
+        UBLOG(logINFO, "MPIIORestartCoProcessor::write4DArray time: " << finish - start << " s");
+    }
+
+    delete[] dataSetSmallArray;
+}
+
+void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::string fname)
+{
+   int rank, size;
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
+
+    std::vector<SPtr<Block3D>> blocksVector[25];
+    int minInitLevel = this->grid->getCoarsestInitializedLevel();
+    int maxInitLevel = this->grid->getFinestInitializedLevel();
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        grid->getBlocks(level, rank, blocksVector[level]);
+        blocksCount += static_cast<int>(blocksVector[level].size());
+    }
+
+    DataSetSmallRestart* dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
+    dataSetParam dataSetParamStr;
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::write3DArray start collect data to file = " << fname);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    bool firstBlock = true;
+    size_t doubleCountInBlock = 0;
+    int ic = 0;
+    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> ___Array;
+
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
+    {
+        for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
+        {
+            dataSetSmallArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid
+            dataSetSmallArray[ic].x2 = block->getX2();
+            dataSetSmallArray[ic].x3 = block->getX3();
+            dataSetSmallArray[ic].level = block->getLevel();
+
+            switch (arrayType)
+            {
+            case RelaxationFactor:
+                ___Array = block->getKernel()->getDataSet()->getRelaxationFactor();
+                break;
+            case PhaseField1:
+                ___Array = block->getKernel()->getDataSet()->getPhaseField();
+                break;
+            case PhaseField2:
+                ___Array = block->getKernel()->getDataSet()->getPhaseField2();
+                break;
+            case PressureField:
+                ___Array = block->getKernel()->getDataSet()->getPressureField();
+                break;
+            default:
+                UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::write3DArray : 3D array type does not exist!"));
+                break;
+            }
+
+            if (firstBlock) // when first (any) valid block...
+            {
+                dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
+                dataSetParamStr.nx[0] = static_cast<int>(___Array->getNX1());
+                dataSetParamStr.nx[1] = static_cast<int>(___Array->getNX2());
+                dataSetParamStr.nx[2] = static_cast<int>(___Array->getNX3());
+                dataSetParamStr.nx[3] = 1;
+                doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+
+                firstBlock = false;
+            }
+
+            if (___Array && (dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0))
+                doubleValuesArray.insert(doubleValuesArray.end(), ___Array->getDataVector().begin(), ___Array->getDataVector().end());
+
+            ic++;
+        }
+    }
+
+     // register new MPI-types depending on the block-specific information
+    MPI_Type_contiguous(int(doubleCountInBlock), MPI_DOUBLE, &dataSetDoubleType);
+    MPI_Type_commit(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::write3DArray start MPI IO rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    // write to the file
+    // all processes calculate their offsets (quantity of bytes that the process is going to write)
+    // and notify the next process (with the rank = rank + 1)
+    MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int));
+    size_t next_write_offset = 0;
+
+    if (size > 1)
+    {
+        if (rank == 0)
+        {
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
+    }
+        else
+        {
+            MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            if (rank < size - 1)
+                MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD);
+        }
+}
+
+
+    double start{ 0. };
+    double finish{ 0. };
+    if (comm->isRoot())
+        start = MPI_Wtime();
+
+    MPI_Info info = MPI_INFO_NULL;
+
+#ifdef HLRN_LUSTRE
+    MPI_Info_create(&info);
+    MPI_Info_set(info, "striping_factor", "40");
+    MPI_Info_set(info, "striping_unit", "4M");
+#endif
+
+    MPI_File file_handler;
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + fname;
+    int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+
+    // each process writes the quantity of it's blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
+    // each process writes common parameters of a dataSet
+    MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
+    // each process writes data identifying blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount,
+        dataSetSmallType, MPI_STATUS_IGNORE);
+    // each process writes the dataSet arrays
+    if (doubleValuesArray.size() > 0)
+        MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+
+
+    MPI_File_sync(file_handler);
+    MPI_File_close(&file_handler);
+    MPI_Type_free(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        finish = MPI_Wtime();
+        UBLOG(logINFO, "MPIIORestartCoProcessor ::write3DArray time: " << finish - start << " s");
+    }
+
+    delete[] dataSetSmallArray;
 }
 
-void MPIIORestartCoProcessor::writeAverageDensityArray(int step)
+/*void MPIIORestartCoProcessor::writeAverageDensityArray(int step)
 {
     int rank, size;
     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -1203,30 +1554,171 @@ void MPIIORestartCoProcessor::writeRelaxationFactor(int step)
             if (firstBlock) // when first (any) valid block...
             {
                 dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-                dataSetParamStr.nx[0] = static_cast<int>(RelaxationFactor3DPtr->getNX1());
-                dataSetParamStr.nx[1] = static_cast<int>(RelaxationFactor3DPtr->getNX2());
-                dataSetParamStr.nx[2] = static_cast<int>(RelaxationFactor3DPtr->getNX3());
+                dataSetParamStr.nx[0] = static_cast<int>(RelaxationFactor3DPtr->getNX1());
+                dataSetParamStr.nx[1] = static_cast<int>(RelaxationFactor3DPtr->getNX2());
+                dataSetParamStr.nx[2] = static_cast<int>(RelaxationFactor3DPtr->getNX3());
+                dataSetParamStr.nx[3] = 1;
+                doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+
+                firstBlock = false;
+            }
+
+            if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0))
+                doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(),
+                                         RelaxationFactor3DPtr->getDataVector().end());
+
+            ic++;
+        }
+    }
+
+    // register new MPI-types depending on the block-specific information
+    MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
+    MPI_Type_commit(&dataSetDoubleType);
+
+    if (comm->isRoot()) 
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writeRelaxationFactor start MPI IO rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    // write to the file
+    // all processes calculate their offsets (quantity of bytes that the process is going to write)
+    // and notify the next process (with the rank = rank + 1)
+    MPI_Offset write_offset  = (MPI_Offset)(size * sizeof(int));
+    size_t next_write_offset = 0;
+
+    if (size > 1) 
+    {
+        if (rank == 0) 
+        {
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
+        } 
+        else 
+        {
+            MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+            next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            if (rank < size - 1)
+                MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD);
+        }
+    }
+
+    
+    double start {0.};
+    double finish {0.};
+    if (comm->isRoot())
+        start = MPI_Wtime();
+
+    MPI_Info info = MPI_INFO_NULL;
+
+#ifdef HLRN_LUSTRE
+    MPI_Info_create(&info);
+    MPI_Info_set(info, "striping_factor", "40");
+    MPI_Info_set(info, "striping_unit", "4M");
+#endif
+
+    MPI_File file_handler;
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpRelaxationFactor.bin";
+    int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+
+    // each process writes the quantity of it's blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
+    // each process writes common parameters of a dataSet
+    MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
+    // each process writes data identifying blocks
+    MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount,
+                      dataSetSmallType, MPI_STATUS_IGNORE);
+    // each process writes the dataSet arrays
+    if (doubleValuesArray.size() > 0)
+        MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+                          &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+
+    MPI_File_sync(file_handler);
+    MPI_File_close(&file_handler);
+    MPI_Type_free(&dataSetDoubleType);
+
+    if (comm->isRoot()) 
+    {
+        finish = MPI_Wtime();
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writeRelaxationFactor time: " << finish - start << " s");
+    }
+
+    delete[] dataSetSmallArray;
+}
+
+void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
+{
+    int rank, size;
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    int blocksCount = 0; // quantity of blocks in the grid, max 2147483648 blocks!
+
+    std::vector<SPtr<Block3D>> blocksVector[25];
+    int minInitLevel = this->grid->getCoarsestInitializedLevel();
+    int maxInitLevel = this->grid->getFinestInitializedLevel();
+    for (int level = minInitLevel; level <= maxInitLevel; level++) 
+    {
+        grid->getBlocks(level, rank, blocksVector[level]);
+        blocksCount += static_cast<int>(blocksVector[level].size());
+    }
+
+    DataSetSmallRestart *dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
+    dataSetParam dataSetParamStr;
+
+    if (comm->isRoot()) 
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField start collect data rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    bool firstBlock        = true;
+    int doubleCountInBlock = 0;
+    int ic                 = 0;
+    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> PhaseField3DPtr;
+
+    for (int level = minInitLevel; level <= maxInitLevel; level++) 
+    {
+        for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
+        {
+            dataSetSmallArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid
+            dataSetSmallArray[ic].x2 = block->getX2();
+            dataSetSmallArray[ic].x3 = block->getX3();
+            dataSetSmallArray[ic].level = block->getLevel();
+
+            if(fieldN == 1)
+                PhaseField3DPtr = block->getKernel()->getDataSet()->getPhaseField();
+            else
+                PhaseField3DPtr = block->getKernel()->getDataSet()->getPhaseField2();
+
+            if (firstBlock) // when first (any) valid block...
+            {
+                dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
+                dataSetParamStr.nx[0] = static_cast<int>(PhaseField3DPtr->getNX1());
+                dataSetParamStr.nx[1] = static_cast<int>(PhaseField3DPtr->getNX2());
+                dataSetParamStr.nx[2] = static_cast<int>(PhaseField3DPtr->getNX3());
                 dataSetParamStr.nx[3] = 1;
                 doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
-
+                std::cout << "writePhaseField"<<fieldN<< " = " << dataSetParamStr.nx[0] << " " << dataSetParamStr.nx[1] << " " << dataSetParamStr.nx[2] << std::endl;
                 firstBlock = false;
             }
-
             if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0))
-                doubleValuesArray.insert(doubleValuesArray.end(), RelaxationFactor3DPtr->getDataVector().begin(),
-                                         RelaxationFactor3DPtr->getDataVector().end());
+                doubleValuesArray.insert(doubleValuesArray.end(), PhaseField3DPtr->getDataVector().begin(), PhaseField3DPtr->getDataVector().end());
 
             ic++;
         }
     }
-
+        
     // register new MPI-types depending on the block-specific information
     MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
     MPI_Type_commit(&dataSetDoubleType);
 
     if (comm->isRoot()) 
     {
-        UBLOG(logINFO, "MPIIORestartCoProcessor::writeRelaxationFactor start MPI IO rank = " << rank);
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField start MPI IO rank = " << rank);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
@@ -1267,7 +1759,9 @@ void MPIIORestartCoProcessor::writeRelaxationFactor(int step)
 #endif
 
     MPI_File file_handler;
-    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpRelaxationFactor.bin";
+    std::string filename;
+    if(fieldN == 1) filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPhaseField1.bin";
+    else filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPhaseField2.bin";
     int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
@@ -1291,13 +1785,13 @@ void MPIIORestartCoProcessor::writeRelaxationFactor(int step)
     if (comm->isRoot()) 
     {
         finish = MPI_Wtime();
-        UBLOG(logINFO, "MPIIORestartCoProcessor::writeRelaxationFactor time: " << finish - start << " s");
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField time: " << finish - start << " s");
     }
 
     delete[] dataSetSmallArray;
 }
 
-void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
+void MPIIORestartCoProcessor::writePressureField(int step)
 {
     int rank, size;
     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -1308,28 +1802,28 @@ void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
     std::vector<SPtr<Block3D>> blocksVector[25];
     int minInitLevel = this->grid->getCoarsestInitializedLevel();
     int maxInitLevel = this->grid->getFinestInitializedLevel();
-    for (int level = minInitLevel; level <= maxInitLevel; level++) 
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
     {
         grid->getBlocks(level, rank, blocksVector[level]);
         blocksCount += static_cast<int>(blocksVector[level].size());
     }
 
-    DataSetSmallRestart *dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    DataSetSmallRestart* dataSetSmallArray = new DataSetSmallRestart[blocksCount];
     std::vector<double> doubleValuesArray; // double-values (arrays of f's) in all blocks
     dataSetParam dataSetParamStr;
 
-    if (comm->isRoot()) 
+    if (comm->isRoot())
     {
-        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField start collect data rank = " << rank);
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePressureField start collect data rank = " << rank);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
-    bool firstBlock        = true;
+    bool firstBlock = true;
     int doubleCountInBlock = 0;
-    int ic                 = 0;
-    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> PhaseField3DPtr;
+    int ic = 0;
+    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> PressureField3DPtr;
 
-    for (int level = minInitLevel; level <= maxInitLevel; level++) 
+    for (int level = minInitLevel; level <= maxInitLevel; level++)
     {
         for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
         {
@@ -1338,53 +1832,53 @@ void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
             dataSetSmallArray[ic].x3 = block->getX3();
             dataSetSmallArray[ic].level = block->getLevel();
 
-            if(fieldN == 1)
-                PhaseField3DPtr = block->getKernel()->getDataSet()->getPhaseField();
-            else
-                PhaseField3DPtr = block->getKernel()->getDataSet()->getPhaseField2();
+            PressureField3DPtr = block->getKernel()->getDataSet()->getPressureField();
 
             if (firstBlock) // when first (any) valid block...
             {
                 dataSetParamStr.nx1 = dataSetParamStr.nx2 = dataSetParamStr.nx3 = 0;
-                dataSetParamStr.nx[0] = static_cast<int>(PhaseField3DPtr->getNX1());
-                dataSetParamStr.nx[1] = static_cast<int>(PhaseField3DPtr->getNX2());
-                dataSetParamStr.nx[2] = static_cast<int>(PhaseField3DPtr->getNX3());
+                dataSetParamStr.nx[0] = static_cast<int>(PressureField3DPtr->getNX1());
+                dataSetParamStr.nx[1] = static_cast<int>(PressureField3DPtr->getNX2());
+                dataSetParamStr.nx[2] = static_cast<int>(PressureField3DPtr->getNX3());
                 dataSetParamStr.nx[3] = 1;
                 doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
 
                 firstBlock = false;
             }
-            if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0))
-                doubleValuesArray.insert(doubleValuesArray.end(), PhaseField3DPtr->getDataVector().begin(), PhaseField3DPtr->getDataVector().end());
 
+            if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0))
+                doubleValuesArray.insert(doubleValuesArray.end(), PressureField3DPtr->getDataVector().begin(),
+                    PressureField3DPtr->getDataVector().end());
+ 
             ic++;
         }
     }
-        
-    // register new MPI-types depending on the block-specific information
+    //doubleValuesArrayRW.assign(doubleValuesArray.begin(), doubleValuesArray.end());
+    //std::cout << "doubleValuesArrayRW = " << doubleValuesArrayRW.size() << std::endl;
+   // register new MPI-types depending on the block-specific information
     MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
     MPI_Type_commit(&dataSetDoubleType);
 
-    if (comm->isRoot()) 
+    if (comm->isRoot())
     {
-        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField start MPI IO rank = " << rank);
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePressureField start MPI IO rank = " << rank);
         UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
     }
 
     // write to the file
     // all processes calculate their offsets (quantity of bytes that the process is going to write)
     // and notify the next process (with the rank = rank + 1)
-    MPI_Offset write_offset  = (MPI_Offset)(size * sizeof(int));
+    MPI_Offset write_offset = (MPI_Offset)(size * sizeof(int));
     size_t next_write_offset = 0;
 
-    if (size > 1) 
+    if (size > 1)
     {
-        if (rank == 0) 
+        if (rank == 0)
         {
             next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
             MPI_Send(&next_write_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
-        } 
-        else 
+        }
+        else
         {
             MPI_Recv(&write_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
             next_write_offset = write_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
@@ -1393,9 +1887,9 @@ void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
         }
     }
 
-    
-    double start {0.};
-    double finish {0.};
+
+    double start{ 0. };
+    double finish{ 0. };
     if (comm->isRoot())
         start = MPI_Wtime();
 
@@ -1408,9 +1902,7 @@ void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
 #endif
 
     MPI_File file_handler;
-    std::string filename;
-    if(fieldN == 1) filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPhaseField1.bin";
-    else filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPhaseField2.bin";
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPressureField.bin";
     int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &file_handler);
     if (rc != MPI_SUCCESS)
         throw UbException(UB_EXARGS, "couldn't open file " + filename);
@@ -1421,24 +1913,24 @@ void MPIIORestartCoProcessor::writePhaseField(int step, int fieldN)
     MPI_File_write_at(file_handler, write_offset, &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
     // each process writes data identifying blocks
     MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount,
-                      dataSetSmallType, MPI_STATUS_IGNORE);
+        dataSetSmallType, MPI_STATUS_IGNORE);
     // each process writes the dataSet arrays
     if (doubleValuesArray.size() > 0)
         MPI_File_write_at(file_handler, (MPI_Offset)(write_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
-                          &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
 
     MPI_File_sync(file_handler);
     MPI_File_close(&file_handler);
     MPI_Type_free(&dataSetDoubleType);
 
-    if (comm->isRoot()) 
+    if (comm->isRoot())
     {
         finish = MPI_Wtime();
-        UBLOG(logINFO, "MPIIORestartCoProcessor::writePhaseField time: " << finish - start << " s");
+        UBLOG(logINFO, "MPIIORestartCoProcessor::writePressureField time: " << finish - start << " s");
     }
 
     delete[] dataSetSmallArray;
-}
+}*/
 
 void MPIIORestartCoProcessor::writeBoundaryConds(int step)
 {
@@ -1854,6 +2346,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
         SPtr<Block3D> block = grid->getBlock(dataSetArray[n].x1, dataSetArray[n].x2, dataSetArray[n].x3, dataSetArray[n].level);
    
         this->lbmKernel->setBlock(block);
+        this->lbmKernel->setNX(std::array<int, 3>{{dataSetParamStr1.nx1, dataSetParamStr1.nx2, dataSetParamStr1.nx3}});
         SPtr<LBMKernel> kernel = this->lbmKernel->clone();
         kernel->setGhostLayerWidth(dataSetArray[n].ghostLayerWidth);
         kernel->setCollisionFactor(dataSetArray[n].collFactor);
@@ -1892,7 +2385,7 @@ void MPIIORestartCoProcessor::readDataSet(int step)
     MPI_File_read_at(file_handler1, (MPI_Offset)0, &arrPresence, 1, arrayPresenceType, MPI_STATUS_IGNORE);
     MPI_File_close(&file_handler1);
 
-    if (arrPresence.isAverageDensityArrayPresent)
+    /*if (arrPresence.isAverageDensityArrayPresent)
         readAverageDensityArray(step);
 
     if (arrPresence.isAverageVelocityArrayPresent)
@@ -1915,9 +2408,192 @@ void MPIIORestartCoProcessor::readDataSet(int step)
 
     if (arrPresence.isPhaseField2Present)
         readPhaseField(step, 2);
+
+    if (arrPresence.isPressureFieldPresent)
+        readPressureField(step);*/
+
+    if (arrPresence.isAverageDensityArrayPresent)
+        readArray(step, AverageDensity, std::string("/cpAverageDensityArray.bin"));
+
+    if (arrPresence.isAverageVelocityArrayPresent)
+        readArray(step, AverageVelocity, std::string("/cpAverageVelocityArray.bin"));
+
+    if (arrPresence.isAverageFluktuationsArrayPresent)
+        readArray(step, AverageFluktuations, std::string("/cpAverageFluktuationsArray.bin"));
+
+    if (arrPresence.isAverageTripleArrayPresent)
+        readArray(step, AverageTriple, std::string("/cpAverageTripleArray.bin"));
+
+    if (arrPresence.isShearStressValArrayPresent)
+        readArray(step, ShearStressVal, std::string("/cpShearStressValArray.bin"));
+
+    if (arrPresence.isRelaxationFactorPresent)
+        readArray(step, RelaxationFactor, std::string("/cpRelaxationFactor.bin"));
+
+    if (arrPresence.isPhaseField1Present)
+        readArray(step, PhaseField1, std::string("/cpPhaseField1.bin"));
+
+    if (arrPresence.isPhaseField2Present)
+        readArray(step, PhaseField2, std::string("/cpPhaseField2.bin"));
+
+    if (arrPresence.isPressureFieldPresent)
+        readArray(step, PressureField, std::string("/cpPressureField.bin"));
+
+}
+
+void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fname)
+{
+    int rank, size;
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readArray start fname = " << fname);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    double start{ 0. };
+    double finish{ 0. };
+    if (comm->isRoot())
+        start = MPI_Wtime();
+
+    MPI_File file_handler;
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + fname;
+    int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+
+    // read count of blocks
+    size_t blocksCount = 0;
+    dataSetParam dataSetParamStr;
+    memset(&dataSetParamStr, 0, sizeof(dataSetParam));
+
+    MPI_File_read_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
+    MPI_File_read_at(file_handler, (MPI_Offset)(size * sizeof(int)), &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
+
+    DataSetSmallRestart* dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    int doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+    std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all blocks
+
+    // define MPI_types depending on the block-specific information
+    MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
+    MPI_Type_commit(&dataSetDoubleType);
+
+    // calculate the read offset
+    MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int));
+    size_t next_read_offset = 0;
+
+    if (size > 1)
+    {
+        if (rank == 0)
+        {
+            next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
+        }
+        else
+        {
+            MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+            next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            if (rank < size - 1)
+                MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD);
+        }
+    }
+
+    MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount, dataSetSmallType, MPI_STATUS_IGNORE);
+    if (doubleCountInBlock > 0)
+        MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+    MPI_File_close(&file_handler);
+    MPI_Type_free(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        finish = MPI_Wtime();
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readArray time: " << finish - start << " s");
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readArray start of restore of data, rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    //----------------------------- restore data ---------------------------------
+    SPtr<CbArray4D<LBMReal, IndexerX4X3X2X1>> ___4DArray;
+    SPtr<CbArray3D<LBMReal, IndexerX3X2X1>> ___3DArray;
+
+    size_t index = 0;
+    size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+    std::vector<double> vectorsOfValues;
+    for (std::size_t n = 0; n < blocksCount; n++)
+    {
+        vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
+        index += nextVectorSize;
+
+        // find the nesessary block and fill it
+        SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].x1, dataSetSmallArray[n].x2, dataSetSmallArray[n].x3, dataSetSmallArray[n].level);
+
+       // fill arrays
+       switch (arrType)
+        {
+        case AverageDensity:
+            ___4DArray = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2], dataSetParamStr.nx[3]));
+            block->getKernel()->getDataSet()->setAverageDensity(___4DArray);
+            break;
+        case AverageVelocity:
+            ___4DArray = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2], dataSetParamStr.nx[3]));
+            block->getKernel()->getDataSet()->setAverageVelocity(___4DArray);
+            break;
+        case AverageFluktuations:
+            ___4DArray = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2], dataSetParamStr.nx[3]));
+            block->getKernel()->getDataSet()->setAverageFluctuations(___4DArray);
+            break;
+        case AverageTriple:
+            ___4DArray = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2], dataSetParamStr.nx[3]));
+            block->getKernel()->getDataSet()->setAverageTriplecorrelations(___4DArray);
+            break;
+        case ShearStressVal:
+            ___4DArray = CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal, IndexerX4X3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2], dataSetParamStr.nx[3]));
+            block->getKernel()->getDataSet()->setShearStressValues(___4DArray);
+            break;
+        case RelaxationFactor:
+            ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+            block->getKernel()->getDataSet()->setRelaxationFactor(___3DArray);
+            break;
+        case PhaseField1:
+            ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+            block->getKernel()->getDataSet()->setPhaseField(___3DArray);
+            break;
+        case PhaseField2:
+            ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+            block->getKernel()->getDataSet()->setPhaseField2(___3DArray);
+            break;
+        case PressureField:
+            ___3DArray = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+                vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+            block->getKernel()->getDataSet()->setPressureField(___3DArray);
+            break;
+        default:
+            UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::readArray : array type does not exist!"));
+            break;
+        }
+    }
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readArray end of restore of data, rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    delete[] dataSetSmallArray;
 }
 
-void MPIIORestartCoProcessor::readAverageDensityArray(int step)
+/*void MPIIORestartCoProcessor::readAverageDensityArray(int step)
 {
     int rank, size;
     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -2592,6 +3268,7 @@ void MPIIORestartCoProcessor::readPhaseField(int step, int fieldN)
     size_t index = 0;
     size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
     std::vector<double> vectorsOfValues;
+    std::cout << "readPhaseField"<< fieldN<<" = " << dataSetParamStr.nx[0] << " " << dataSetParamStr.nx[1] << " " << dataSetParamStr.nx[2] << std::endl;
 
     for (int n = 0; n < blocksCount; n++)
     {
@@ -2609,6 +3286,12 @@ void MPIIORestartCoProcessor::readPhaseField(int step, int fieldN)
             block->getKernel()->getDataSet()->setPhaseField(mPhaseField);
         else
             block->getKernel()->getDataSet()->setPhaseField2(mPhaseField);
+       int nx1 = static_cast<int>(block->getKernel()->getDataSet()->getPhaseField()->getNX1());
+       int nx2 = static_cast<int>(block->getKernel()->getDataSet()->getPhaseField()->getNX2());
+       int nx3 = static_cast<int>(block->getKernel()->getDataSet()->getPhaseField()->getNX3());
+        dataSetParamStr.nx[3] = 1;
+        doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+        std::cout << "writePhaseField" << fieldN << " = " << nx1 << " " << nx2 << " " << nx3 << std::endl;
 
     }
 
@@ -2621,6 +3304,106 @@ void MPIIORestartCoProcessor::readPhaseField(int step, int fieldN)
     delete[] dataSetSmallArray;
 }
 
+void MPIIORestartCoProcessor::readPressureField(int step)
+{
+    int rank, size;
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readPressureField start MPI IO rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    double start{ 0. };
+    double finish{ 0. };
+    if (comm->isRoot())
+        start = MPI_Wtime();
+
+    MPI_File file_handler;
+    std::string filename = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpPressureField.bin";
+    int rc = MPI_File_open(MPI_COMM_WORLD, filename.c_str(), MPI_MODE_RDONLY, MPI_INFO_NULL, &file_handler);
+    if (rc != MPI_SUCCESS)
+        throw UbException(UB_EXARGS, "couldn't open file " + filename);
+
+    // read count of blocks
+    int blocksCount = 0;
+    dataSetParam dataSetParamStr;
+    MPI_File_read_at(file_handler, (MPI_Offset)(rank * sizeof(int)), &blocksCount, 1, MPI_INT, MPI_STATUS_IGNORE);
+    MPI_File_read_at(file_handler, (MPI_Offset)(size * sizeof(int)), &dataSetParamStr, 1, dataSetParamType, MPI_STATUS_IGNORE);
+
+    DataSetSmallRestart* dataSetSmallArray = new DataSetSmallRestart[blocksCount];
+    int doubleCountInBlock = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+    std::vector<double> doubleValuesArray(blocksCount * doubleCountInBlock); // double-values in all blocks
+
+    // define MPI_types depending on the block-specific information
+    MPI_Type_contiguous(doubleCountInBlock, MPI_DOUBLE, &dataSetDoubleType);
+    MPI_Type_commit(&dataSetDoubleType);
+
+    // calculate the read offset
+    MPI_Offset read_offset = (MPI_Offset)(size * sizeof(int));
+    size_t next_read_offset = 0;
+
+    if (size > 1)
+    {
+        if (rank == 0)
+        {
+            next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, 1, 5, MPI_COMM_WORLD);
+        }
+        else
+        {
+            MPI_Recv(&read_offset, 1, MPI_LONG_LONG_INT, rank - 1, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+            next_read_offset = read_offset + sizeof(dataSetParam) + blocksCount * (sizeof(DataSetSmallRestart) + doubleCountInBlock * sizeof(double));
+            if (rank < size - 1)
+                MPI_Send(&next_read_offset, 1, MPI_LONG_LONG_INT, rank + 1, 5, MPI_COMM_WORLD);
+        }
+    }
+
+    MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount, dataSetSmallType, MPI_STATUS_IGNORE);
+    if (doubleCountInBlock > 0)
+        MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+    MPI_File_close(&file_handler);
+    MPI_Type_free(&dataSetDoubleType);
+
+    if (comm->isRoot())
+    {
+        finish = MPI_Wtime();
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readPressureField time: " << finish - start << " s");
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readPressureField start of restore of data, rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    size_t index = 0;
+    size_t nextVectorSize = dataSetParamStr.nx[0] * dataSetParamStr.nx[1] * dataSetParamStr.nx[2] * dataSetParamStr.nx[3];
+    std::vector<double> vectorsOfValues;
+
+    for (int n = 0; n < blocksCount; n++)
+    {
+        vectorsOfValues.assign(doubleValuesArray.data() + index, doubleValuesArray.data() + index + nextVectorSize);
+        index += nextVectorSize;
+    
+        // fill Pressure array
+        SPtr<PressureFieldArray3D> mPressureField;
+        mPressureField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(
+            vectorsOfValues, dataSetParamStr.nx[0], dataSetParamStr.nx[1], dataSetParamStr.nx[2]));
+
+        // find the nesessary block and fill it
+        SPtr<Block3D> block = grid->getBlock(dataSetSmallArray[n].x1, dataSetSmallArray[n].x2, dataSetSmallArray[n].x3, dataSetSmallArray[n].level);
+        block->getKernel()->getDataSet()->setPressureField(mPressureField);
+    }
+
+    if (comm->isRoot())
+    {
+        UBLOG(logINFO, "MPIIORestartCoProcessor::readPressureField end of restore of data, rank = " << rank);
+        UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB");
+    }
+
+    delete[] dataSetSmallArray;
+}*/
+
 void MPIIORestartCoProcessor::readBoundaryConds(int step)
 {
     int rank, size;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
index beae84af9..1a1e1fb4d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h
@@ -20,6 +20,18 @@ class LBMKernel;
 class MPIIORestartCoProcessor : public MPIIOCoProcessor
 {
 public:
+    enum Arrays {
+        AverageDensity = 1,
+        AverageVelocity = 2,
+        AverageFluktuations = 3,
+        AverageTriple = 4,
+        ShearStressVal = 5,
+        RelaxationFactor = 6,
+        PhaseField1 = 7,
+        PhaseField2 = 8,
+        PressureField = 9
+    };
+
     MPIIORestartCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm);
     ~MPIIORestartCoProcessor() override;
     //! Each timestep writes the grid into the files
@@ -30,13 +42,16 @@ public:
     void writeBlocks(int step);
     //! Writes the datasets of the blocks into the file cpDataSet.bin
     void writeDataSet(int step);
-    void writeAverageDensityArray(int step);
-    void writeAverageVelocityArray(int step);
-    void writeAverageFluktuationsArray(int step);
-    void writeAverageTripleArray(int step);
-    void writeShearStressValArray(int step);
-    void writeRelaxationFactor(int step);
-    void writePhaseField(int step, int num);
+    void write4DArray(int step, Arrays arrType, std::string fname);
+    void write3DArray(int step, Arrays arrType, std::string fname);
+    //void writeAverageDensityArray(int step);
+    //void writeAverageVelocityArray(int step);
+    //void writeAverageFluktuationsArray(int step);
+    //void writeAverageTripleArray(int step);
+    //void writeShearStressValArray(int step);
+    //void writeRelaxationFactor(int step);
+    //void writePhaseField(int step, int num);
+    //void writePressureField(int step);
     //! Writes the boundary conditions of the blocks into the file cpBC.bin
     void writeBoundaryConds(int step);
 
@@ -44,14 +59,18 @@ public:
     void readBlocks(int step);
     //! Reads the datasets of the blocks from the file cpDataSet.bin
     void readDataSet(int step);
-    void readAverageDensityArray(int step);
-    void readAverageVelocityArray(int step);
-    void readAverageFluktuationsArray(int step);
-    void readAverageTripleArray(int step);
-    void readShearStressValArray(int step);
-    void readRelaxationFactor(int step);
-    void readPhaseField(int step, int num);
-    //! Reads the boundary conditions of the blocks from the file cpBC.bin
+    void readArray(int step, Arrays arrType, std::string fname);
+
+    //void readAverageDensityArray(int step);
+    //void readAverageVelocityArray(int step);
+    //void readAverageFluktuationsArray(int step);
+    //void readAverageTripleArray(int step);
+    //void readShearStressValArray(int step);
+    //void readRelaxationFactor(int step);
+    //void readPhaseField(int step, int num);
+    //void readPressureField(int step);
+    // 
+   //! Reads the boundary conditions of the blocks from the file cpBC.bin
     void readBoundaryConds(int step);
     //! The function sets LBMKernel
     void setLBMKernel(SPtr<LBMKernel> kernel);
@@ -68,6 +87,8 @@ private:
     MPIIODataStructures::boundCondParam boundCondParamStr;
     SPtr<LBMKernel> lbmKernel;
     SPtr<BCProcessor> bcProcessor;
+
+    //std::vector<double> doubleValuesArrayRW;
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 240027f32..a607745f8 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -241,7 +241,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
 
 					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
-
+					
 					LBMReal rhoH = 1.0;
 					LBMReal rhoL = 1.0 / densityRatio;
 
@@ -305,7 +305,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	}
 
 	////!filter
-
+	//bool firstTime = true;
 	for (int x3 = minX3; x3 < maxX3; x3++) {
 		for (int x2 = minX2; x2 < maxX2; x2++) {
 			for (int x1 = minX1; x1 < maxX1; x1++) {
-- 
GitLab


From 2f143a3507c6837438c345f9ab5dd3e54ab00169 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 7 Jan 2022 11:36:57 +0100
Subject: [PATCH 054/179] refactor MultiphasePressureFilterLBMKernel

---
 apps/cpu/ViskomatXL/viskomat.cfg              | 52 ++++++-------------
 .../LBM/MultiphasePressureFilterLBMKernel.cpp | 49 +----------------
 .../LBM/MultiphasePressureFilterLBMKernel.h   | 17 ------
 3 files changed, 17 insertions(+), 101 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index f46bda31a..75833bef6 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -1,55 +1,33 @@
-outputPath = d:/temp/viskomatCylinderSBB_16_dx_1_stl_2
-#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
-geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
-#geoFile = fishbone.stl
-geoFile = cylinder.stl
+outputPath = d:/temp/viskomatXL
+geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
+#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
+geoFile = fishboneT.stl
+#geoFile = cylinder.stl
 
 numOfThreads = 4
-availMem = 8e9
+availMem = 15e9
 logToFile = false
 
-#blocknx = 8 8 8
-blocknx = 2 32 32
-#blocknx = 1 8 8
-#boundingBox = -4 171 -9.5 155.5 -76.5 82.5
-#boundingBox = -4 166 -9.5 155.5 -76.5 82.5
-
-#boundingBox = -4 166 0 165 0 165
-
-#boundingBox = -4 166 -82.5 82.5 -82.5 82.5
-
-#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
-
-boundingBox = 0 2 -16 16 -16 16
-
-# around X
-#blocknx = 1 16 16
-#boundingBox = 0 1 0 165 0 165
-
-# around Y
-#blocknx = 16 1 16
-#boundingBox =  0 165 0 1 0 165
-
-#zero test
-#blocknx = 8 8 8
-#boundingBox =  0 8 0 8 0 8
+blocknx = 14 14 14
+boundingBox = 0 140 -82.5 82.5 -82.5 82.5
 
 deltax = 1
 refineLevel = 0
 
 #nuLB = 1.5e-4
-OmegaLB = 1e-4
+OmegaLB = 1e-5
 N = 80 #rpm
+mu = 1 # Pa s
 tau0 = 20e-7
 
 resolution = 32
 scaleFactor = 1
 
-newStart = true
-restartStep = 10000
+newStart = false
+restartStep = 50
 
-cpStart = 10000
-cpStep = 10000
+cpStart = 50
+cpStep  = 50
 
 outTime = 10000
-endTime = 20 #0000
\ No newline at end of file
+endTime = 100 #0000
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 240027f32..995dd814d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -50,12 +50,12 @@ void MultiphasePressureFilterLBMKernel::initDataSet()
 	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
 	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
 
-	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	//SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	dataSet->setFdistributions(f);
 	dataSet->setHdistributions(h); // For phase-field
-	dataSet->setPhaseField(divU1);
+	//dataSet->setPhaseField(divU1);
 	dataSet->setPressureField(pressure);
 
 	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
@@ -1494,30 +1494,6 @@ LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi()
 		+WEIGTH[N] * (phi[T] - phi[B]));
 }
 
-LBMReal MultiphasePressureFilterLBMKernel::gradX1_phi2()
-{
-	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
-		+WEIGTH[N] * (phi2[E] - phi2[W]));
-}
-
-LBMReal MultiphasePressureFilterLBMKernel::gradX2_phi2()
-{
-	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
-		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
-		+WEIGTH[N] * (phi2[N] - phi2[S]));
-}
-
-LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi2()
-{
-	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
-		+WEIGTH[N] * (phi2[T] - phi2[B]));
-}
-
 LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
 {
 	using namespace D3Q27System;
@@ -1615,27 +1591,6 @@ void MultiphasePressureFilterLBMKernel::findNeighbors(CbArray3D<LBMReal, Indexer
 	}
 }
 
-void MultiphasePressureFilterLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
-	int x3)
-{
-	using namespace D3Q27System;
-
-	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
-
-	phi2[REST] = (*ph)(x1, x2, x3);
-
-
-	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
-
-		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
-			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
-		}
-		else {
-			phi2[k] = 0.0;
-		}
-	}
-}
-
 void MultiphasePressureFilterLBMKernel::swapDistributions()
 {
 	LBMKernel::swapDistributions();
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
index 84984ec9e..05c4fd192 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
@@ -51,12 +51,6 @@ public:
     virtual ~MultiphasePressureFilterLBMKernel(void) = default;
     void calculate(int step) override;
     SPtr<LBMKernel> clone() override;
-
-
-    ///refactor
-    //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
-
-
     double getCalculationTime() override { return .0; }
 protected:
     virtual void initDataSet();
@@ -69,8 +63,6 @@ protected:
     void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
     void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
 
-    LBMReal f1[D3Q27System::ENDF+1];
-
     CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
     CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
     CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
@@ -85,22 +77,13 @@ protected:
     CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU; 
 
     LBMReal h  [D3Q27System::ENDF+1];
-    LBMReal h2[D3Q27System::ENDF + 1];
-    LBMReal g  [D3Q27System::ENDF+1];
     LBMReal phi[D3Q27System::ENDF+1];
-    LBMReal phi2[D3Q27System::ENDF + 1];
-    LBMReal pr1[D3Q27System::ENDF+1];
-    LBMReal phi_cutoff[D3Q27System::ENDF+1];
 
     LBMReal gradX1_phi();
     LBMReal gradX2_phi();
     LBMReal gradX3_phi();
-    LBMReal gradX1_phi2();
-    LBMReal gradX2_phi2();
-    LBMReal gradX3_phi2();
     void computePhasefield();
     void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
-    void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
 
     LBMReal nabla2_phi();
 
-- 
GitLab


From 4291d9587883498373d5c9b3255ff9f476177301 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 7 Jan 2022 12:07:13 +0100
Subject: [PATCH 055/179] add correct initialization for
 LiggghtsCouplingWrapper

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 2a1578671..61f835128 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -21,7 +21,9 @@ using namespace std;
 int main(int argc, char *argv[])
 {
     SPtr<Communicator> comm = MPICommunicator::getInstance();
-    LiggghtsCouplingWrapper wrapper(argv, (MPI_Comm)comm->getNativeCommunicator());
+    //MPI_Init(&argc, &argv);
+    MPI_Comm mpi_comm       = *(MPI_Comm*)(comm->getNativeCommunicator());
+    LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
 	//LAMMPS_NS::LAMMPS *lmp;
  //   // custom argument vector for LAMMPS library
@@ -94,6 +96,6 @@ int main(int argc, char *argv[])
  //   delete lmp;
 
  //   // stop MPI environment
- //   MPI_Finalize();
+    //MPI_Finalize();
     return 0;
 }
-- 
GitLab


From f19248f8849b253814712ce0a15cb4ddf797a466 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Jan 2022 14:40:44 +0100
Subject: [PATCH 056/179] fix undefine of variable interfaceWidth in LBMKernel,
 add variable phaseFieldBC for BC on the wall

---
 apps/cpu/LaminarTubeFlow/ltf.cfg              |  8 +--
 .../cpu/MultiphaseDropletTest/DropletTest.cfg |  2 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |  4 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cfg    | 12 ++--
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp    | 61 ++++++++++---------
 .../CalculateTorqueCoProcessor.cpp            | 34 ++++++-----
 src/cpu/VirtualFluidsCore/LBM/LBMKernel.h     |  2 +-
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |  9 +--
 .../LBM/MultiphasePressureFilterLBMKernel.h   | 12 ++++
 9 files changed, 77 insertions(+), 67 deletions(-)

diff --git a/apps/cpu/LaminarTubeFlow/ltf.cfg b/apps/cpu/LaminarTubeFlow/ltf.cfg
index 7ee23c7df..110b99d35 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cfg
+++ b/apps/cpu/LaminarTubeFlow/ltf.cfg
@@ -16,11 +16,11 @@ Re = 10
 
 logToFile = false
 
-newStart = false
+newStart = true
 restartStep = 10
 
-cpStart = 10
-cpStep = 10
+cpStart = 1000
+cpStep = 1000
 
 outTime = 10
-endTime = 10
\ No newline at end of file
+endTime = 1000
\ No newline at end of file
diff --git a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
index a93c46436..016e34072 100644
--- a/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
+++ b/apps/cpu/MultiphaseDropletTest/DropletTest.cfg
@@ -1,5 +1,5 @@
 #pathname = d:/temp/MultiphaseDropletTest
-pathname = E:/Multiphase/DropletTest_new_corr5
+pathname = E:/Multiphase/DropletTest_Test
 
 numOfThreads = 4
 availMem = 10e9
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index a36636f23..49a887e98 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -73,7 +73,7 @@ void run(string configname)
 
 #if defined(__unix__)
          double lastTimeStep = 0;
-         if (!newStart) 
+         //if (!newStart) 
          {
              std::ifstream ifstr(fileName);
              ifstr >> lastTimeStep;
@@ -143,7 +143,7 @@ void run(string configname)
         //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
        // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterCompressibleAirLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
 
         mu::Parser fgr;
         fgr.SetExpr("-(rho-rho_l)*g_y");
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cfg b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
index 99d68f3d0..659a3a2d2 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
@@ -1,4 +1,4 @@
-pathname = E:/Multiphase/RisingBubble2D_dr10
+pathname = E:/Multiphase/RisingBubble2D_dr10_test
 
 numOfThreads = 4
 availMem = 10e9
@@ -32,12 +32,12 @@ Mobility = 0.056 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation para
 logToFile = false
 
 newStart = false
-restartStep = 50000
+restartStep = 10
 
-cpStart = 1000
-cpStep = 1000
+cpStart = 10
+cpStep = 10
 
-outTime = 100
-endTime = 100000
+outTime = 10000
+endTime = 20
 
 rStep = 159990 #160000
\ No newline at end of file
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 939680185..e3a7e63ef 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -71,19 +71,19 @@ void run(string configname)
         
         std::string fileName = "./LastTimeStep" + std::to_string((int)boundingBox[1]) + ".txt";
 
-#if defined(__unix__)
-         double lastTimeStep = 0;
-         if (!newStart) 
-         {
-             std::ifstream ifstr(fileName);
-             ifstr >> lastTimeStep;
-             restartStep = lastTimeStep;
-             if(endTime >= lastTimeStep)
-                endTime = lastTimeStep + rStep;
-             else
-                return;
-         }    
-#endif
+//#if defined(__unix__)
+//         double lastTimeStep = 0;
+//         if (!newStart) 
+//         {
+//             std::ifstream ifstr(fileName);
+//             ifstr >> lastTimeStep;
+//             restartStep = lastTimeStep;
+//             if(endTime >= lastTimeStep)
+//                endTime = lastTimeStep + rStep;
+//             else
+//                return;
+//         }    
+//#endif
 
         //Sleep(30000);
 
@@ -165,6 +165,7 @@ void run(string configname)
         kernel->setDensityRatio(densityRatio);
         kernel->setMultiphaseModelParameters(beta, kappa);
         kernel->setContactAngle(theta);
+        dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(1.0);
 
         SPtr<BCProcessor> bcProc(new BCProcessor());
 
@@ -413,23 +414,23 @@ void run(string configname)
         if (myid == 0)
             UBLOG(logINFO, "Simulation-end");
             
-#if defined(__unix__)
-         //if (!newStart) 
-         //{
-            if (myid == 0) 
-            {
-                std::ofstream ostr(fileName);
-                ostr << endTime;
-                cout << "start sbatch\n";
-                //system("./start.sh");
-                //system("echo test!");
-                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
-                //system("sbatch startJob512.sh");
-                system(str.c_str());
-            }   
-            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
-         //}
-#endif
+//#if defined(__unix__)
+//         //if (!newStart) 
+//         //{
+//            if (myid == 0) 
+//            {
+//                std::ofstream ostr(fileName);
+//                ostr << endTime;
+//                cout << "start sbatch\n";
+//                //system("./start.sh");
+//                //system("echo test!");
+//                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
+//                //system("sbatch startJob512.sh");
+//                system(str.c_str());
+//            }   
+//            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
+//         //}
+//#endif
 
     } catch (std::exception &e) {
         cerr << e.what() << endl << flush;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index fee4aaf3f..a3ccfd51f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -103,16 +103,16 @@ void CalculateTorqueCoProcessor::calculateForces()
 
          SPtr<ILBMKernel> kernel = block->getKernel();
 
-         if (kernel->getCompressible())
-         {
-            calcMacrosFct = &D3Q27System::calcCompMacroscopicValues;
-            compressibleFactor = 1.0;
-         }
-         else
-         {
-            calcMacrosFct = &D3Q27System::calcIncompMacroscopicValues;
-            compressibleFactor = 0.0;
-         }
+         //if (kernel->getCompressible())
+         //{
+         //   calcMacrosFct = &D3Q27System::calcCompMacroscopicValues;
+         //   compressibleFactor = 1.0;
+         //}
+         //else
+         //{
+         //   calcMacrosFct = &D3Q27System::calcIncompMacroscopicValues;
+         //   compressibleFactor = 0.0;
+         //}
 
          SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
          SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); 
@@ -160,10 +160,10 @@ void CalculateTorqueCoProcessor::calculateForces()
          //if we have got discretization with more level
          // deltaX is LBM deltaX and equal LBM deltaT 
          //double deltaX = 0.5; // LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
-         double deltaXquadrat = deltaX*deltaX;
-         torqueX1 *= deltaXquadrat;
-         torqueX2 *= deltaXquadrat;
-         torqueX3 *= deltaXquadrat;
+         //double deltaXquadrat = deltaX*deltaX;
+         //torqueX1 *= deltaXquadrat;
+         //torqueX2 *= deltaXquadrat;
+         //torqueX3 *= deltaXquadrat;
 
          distributions->swap();
 
@@ -182,6 +182,8 @@ void CalculateTorqueCoProcessor::calculateForces()
    values.push_back(torqueX2global);
    values.push_back(torqueX3global);
 
+   //UBLOG(logINFO, "counter = " << counter);
+
    rvalues = comm->gather(values);
    if (comm->getProcessID() == comm->getRoot())
    {
@@ -204,8 +206,8 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
 
    LBMReal fs[D3Q27System::ENDF + 1];
    distributions->getDistributionInv(fs, x1, x2, x3);
-   LBMReal /*rho = 0.0,*/ vx1 = 0.0, vx2 = 0.0, vx3 = 0.0, drho = 0.0;
-   calcMacrosFct(fs, drho, vx1, vx2, vx3);
+   //LBMReal /*rho = 0.0,*/ vx1 = 0.0, vx2 = 0.0, vx3 = 0.0, drho = 0.0;
+   //calcMacrosFct(fs, drho, vx1, vx2, vx3);
    //rho = 1.0 + drho * compressibleFactor;
    
    if(bc)
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
index 39205287b..1bdf610fd 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h
@@ -165,7 +165,7 @@ protected:
     LBMReal phiH;
     LBMReal tauH;
     LBMReal mob;
-    LBMReal interfaceWidth;
+    LBMReal interfaceWidth { 4.0 };
 
 private:
     void checkFunction(mu::Parser fct);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index f86e00896..0dc57aaba 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -87,6 +87,7 @@ SPtr<LBMKernel> MultiphasePressureFilterLBMKernel::clone()
 	kernel->setDeltaT(deltaT);
 	kernel->setGhostLayerWidth(2);
 	dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->initForcing();
+    dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(this->phaseFieldBC);
 
 	return kernel;
 }
@@ -252,14 +253,8 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
 					LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH);
-					//! variable density -> TRANSFER!
-					//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
 
 					(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
-
-					//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
-					////!!!!!! relplace by pointer swap!
-					//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
 				}
 			}
 		}
@@ -1586,7 +1581,7 @@ void MultiphasePressureFilterLBMKernel::findNeighbors(CbArray3D<LBMReal, Indexer
 		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
 			phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
 		} else {
-			phi[k] = 0.0;
+            phi[k] = phaseFieldBC;
 		}
 	}
 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
index 05c4fd192..9b2b568b2 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h
@@ -52,6 +52,16 @@ public:
     void calculate(int step) override;
     SPtr<LBMKernel> clone() override;
     double getCalculationTime() override { return .0; }
+
+    void setPhaseFieldBC(LBMReal bc)
+    {
+        phaseFieldBC = bc;
+    }
+    LBMReal getPhaseFieldBC()
+    {
+        return phaseFieldBC;
+    }
+
 protected:
     virtual void initDataSet();
     void swapDistributions() override;
@@ -94,6 +104,8 @@ protected:
     LBMReal forcingX1;
     LBMReal forcingX2;
     LBMReal forcingX3;
+
+    LBMReal phaseFieldBC { 0.0 }; // if 0.0 then light fluid on the wall, else if 1.0 havy fluid
 };
 
 #endif
-- 
GitLab


From ab69a33065858c0e067bc67dc71b55d86590578f Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Jan 2022 14:43:17 +0100
Subject: [PATCH 057/179] fix RisingBubble2D setup

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index e3a7e63ef..3bafc5948 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -113,7 +113,7 @@ void run(string configname)
         //Eotvos number
         //LBMReal Eo = 100;
         //surface tension
-        sigma = rho_h * 1000.0 * g_y * D * D / Eo;
+        sigma = rho_h * g_y * D * D / Eo;
 
         //g_y = 0;
 
-- 
GitLab


From 85e9f9974db5bee8c82190d58732c8b6f8319738 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Jan 2022 14:57:04 +0100
Subject: [PATCH 058/179] fix warnings

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp | 60 +++++++++++-----------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 49a887e98..2376ed4be 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -71,19 +71,19 @@ void run(string configname)
         
         std::string fileName = "./LastTimeStep" + std::to_string((int)boundingBox[1]) + ".txt";
 
-#if defined(__unix__)
-         double lastTimeStep = 0;
-         //if (!newStart) 
-         {
-             std::ifstream ifstr(fileName);
-             ifstr >> lastTimeStep;
-             restartStep = lastTimeStep;
-             if(endTime >= lastTimeStep)
-                endTime = lastTimeStep + rStep;
-             else
-                return;
-         }    
-#endif
+//#if defined(__unix__)
+//         double lastTimeStep = 0;
+//         //if (!newStart) 
+//         {
+//             std::ifstream ifstr(fileName);
+//             ifstr >> lastTimeStep;
+//             restartStep = lastTimeStep;
+//             if(endTime >= lastTimeStep)
+//                endTime = lastTimeStep + rStep;
+//             else
+//                return;
+//         }    
+//#endif
 
         //Sleep(30000);
 
@@ -402,23 +402,23 @@ void run(string configname)
         if (myid == 0)
             UBLOG(logINFO, "Simulation-end");
             
-#if defined(__unix__)
-         //if (!newStart) 
-         //{
-            if (myid == 0) 
-            {
-                std::ofstream ostr(fileName);
-                ostr << endTime;
-                cout << "start sbatch\n";
-                //system("./start.sh");
-                //system("echo test!");
-                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
-                //system("sbatch startJob512.sh");
-                system(str.c_str());
-            }   
-            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
-         //}
-#endif
+//#if defined(__unix__)
+//         //if (!newStart) 
+//         //{
+//            if (myid == 0) 
+//            {
+//                std::ofstream ostr(fileName);
+//                ostr << endTime;
+//                cout << "start sbatch\n";
+//                //system("./start.sh");
+//                //system("echo test!");
+//                std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh";
+//                //system("sbatch startJob512.sh");
+//                system(str.c_str());
+//            }   
+//            //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); 
+//         //}
+//#endif
 
     } catch (std::exception &e) {
         cerr << e.what() << endl << flush;
-- 
GitLab


From 864e6b1cfb27f6fa74c15d3b25ac82b4e5e3e6df Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 11:47:36 +0100
Subject: [PATCH 059/179] fix ViskomatXL and Multiphase setup

---
 apps/cpu/Multiphase/Multiphase.cfg | 20 +++++----
 apps/cpu/Multiphase/Multiphase.cpp | 67 +++++++++++++++++++++++++-----
 apps/cpu/ViskomatXL/viskomat.cfg   | 46 ++++++++++----------
 apps/cpu/ViskomatXL/viskomat.cpp   |  8 +++-
 apps/cpu/rheometer/rheometer.cfg   |  4 +-
 5 files changed, 100 insertions(+), 45 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cfg b/apps/cpu/Multiphase/Multiphase.cfg
index c294ea68c..b2f435db0 100644
--- a/apps/cpu/Multiphase/Multiphase.cfg
+++ b/apps/cpu/Multiphase/Multiphase.cfg
@@ -1,11 +1,11 @@
-pathname = d:/temp/MultiphaseNew5
+pathname = d:/temp/JetBreakup
 #pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup
 pathGeo = d:/Projects/VirtualFluidsCombined/apps/cpu/Multiphase/backup
 #geoFile = JetBreakupR.ASCII.stl
 #geoFile = inlet1.stl
 geoFile = tubeTransformed.stl
 
-numOfThreads = 4
+numOfThreads = 1
 availMem = 10e9
 
 #Grid
@@ -22,21 +22,23 @@ availMem = 10e9
 #boundingBox = -40e-3 40e-3 1.0e-3 11.0e-3 -403-3 40e-3 #(Jet Breakup2) (Original without inlet length)
 #blocknx = 20 20 20
 
-boundingBox = 6.0e-3 46.0e-3 -5e-3 5e-3 -5e-3 5e-3
-blocknx = 20 20 20
+#boundingBox = 6.0e-3 46.0e-3 -5e-3 5e-3 -5e-3 5e-3
+#blocknx = 20 20 20
+boundingBox = 0 9 0 9 0 9
+blocknx = 10 10 10
 
-dx = 1.66666666667e-4
+dx = 1 #1.66666666667e-4
 refineLevel = 0
 
 #Simulation
 uLB = 0.005 #inlet velocity
 #uF2 = 0.0001
 Re = 10
-nuL =1e-2# 1.0e-5 #!1e-2
-nuG =1e-2# 1.16e-4 #!1e-2
+nuL =1e-3# 1.0e-5 #!1e-2
+nuG =1e-6# 1.16e-4 #!1e-2
 densityRatio = 1000
-sigma = 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
-interfaceThickness = 5
+sigma = 0 #1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
+interfaceWidth = 5
 radius = 615.0 (Jet Breakup)
 contactAngle = 110.0
 gravity = 0.0
diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 77eb317e9..407ca2d29 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -28,7 +28,7 @@ void run(string configname)
         double nuG             = config.getValue<double>("nuG");
         double densityRatio    = config.getValue<double>("densityRatio");
         double sigma           = config.getValue<double>("sigma");
-        int interfaceThickness = config.getValue<int>("interfaceThickness");
+        int interfaceWidth = config.getValue<int>("interfaceWidth");
         //double radius          = config.getValue<double>("radius");
         double theta           = config.getValue<double>("contactAngle");
         double gr              = config.getValue<double>("gravity");
@@ -49,8 +49,8 @@ void run(string configname)
         double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
 
-        double beta  = 12 * sigma / interfaceThickness;
-        double kappa = 1.5 * interfaceThickness * sigma;
+        double beta = 12 * sigma / interfaceWidth;
+        double kappa = 1.5 * interfaceWidth * sigma;
 
         SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
@@ -89,7 +89,8 @@ void run(string configname)
         //kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
         //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+       // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(0.0);
@@ -107,6 +108,7 @@ void run(string configname)
         kernel->setDensityRatio(densityRatio);
         kernel->setMultiphaseModelParameters(beta, kappa);
         kernel->setContactAngle(theta);
+        kernel->setInterfaceWidth(interfaceWidth);
 
         SPtr<BCProcessor> bcProc(new BCProcessor());
         // BCProcessorPtr bcProc(new ThinWallBCProcessor());
@@ -114,9 +116,9 @@ void run(string configname)
         kernel->setBCProcessor(bcProc);
 
         SPtr<Grid3D> grid(new Grid3D(comm));
-        // grid->setPeriodicX1(true);
-        // grid->setPeriodicX2(true);
-        // grid->setPeriodicX3(true);
+         //grid->setPeriodicX1(true);
+         //grid->setPeriodicX2(true);
+         //grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
        
@@ -363,10 +365,52 @@ void run(string configname)
             mu::Parser fct1;
             fct1.SetExpr("phiL");
             fct1.DefineConst("phiL", phiL);
-            MultiphaseInitDistributionsBlockVisitor initVisitor(interfaceThickness);
+            //MultiphaseInitDistributionsBlockVisitor initVisitor(interfaceThickness);
+            MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
             initVisitor.setPhi(fct1);
             grid->accept(initVisitor);
-
+///////////////////////////////////////////////////////////////////////////////////////////
+            //{
+                // std::vector<std::vector<SPtr<Block3D>>> blockVector;
+                // int gridRank = comm->getProcessID();
+                // int minInitLevel = grid->getCoarsestInitializedLevel();
+                // int maxInitLevel = grid->getFinestInitializedLevel();
+                // blockVector.resize(maxInitLevel + 1);
+                // for (int level = minInitLevel; level <= maxInitLevel; level++) {
+                //    grid->getBlocks(level, gridRank, true, blockVector[level]);
+                //}
+                //    for (int level = minInitLevel; level <= maxInitLevel; level++) {
+                //    for (SPtr<Block3D> block : blockVector[level]) {
+                //        if (block) {
+                //            int ix1 = block->getX1();
+                //            int ix2 = block->getX2();
+                //            int ix3 = block->getX3();
+                //            int level = block->getLevel();
+
+                //            for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) {
+                //                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+
+                //                if (!neighBlock) {
+
+                //                }
+                //            }
+                //        }
+                //    }
+                //}
+            //    SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0);
+            //    SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+            //    SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+
+            //    for (int ix3 = 0; ix3 <= 13; ix3++) {
+            //        for (int ix2 = 0; ix2 <= 13; ix2++) {
+            //            for (int ix1 = 0; ix1 <= 13; ix1++) {
+            //                if (ix1 == 0 || ix2 == 0 || ix3 == 0 || ix1 == 13 || ix2 == 13 || ix3 == 13)
+            //                    bcArray->setUndefined(ix1, ix2, ix3);
+            //            }
+            //        }
+            //    }
+            //}
+            ////////////////////////////////////////////////////////////////////////////////////////////
             // boundary conditions grid
             {
                 SPtr<UbScheduler> geoSch(new UbScheduler(1));
@@ -403,9 +447,10 @@ void run(string configname)
 
        //ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
 
-       grid->accept(bcVisitor);
+        grid->accept(bcVisitor);
 
-        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index 75833bef6..c46760239 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -1,33 +1,37 @@
-outputPath = d:/temp/viskomatXL
-geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
-#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
-geoFile = fishboneT.stl
-#geoFile = cylinder.stl
+outputPath = d:/temp/viskomatXL_dx_0.5
+#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
+geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
+#geoFile = fishboneT.stl
+geoFile = cylinder.stl
 
-numOfThreads = 4
+numOfThreads = 1
 availMem = 15e9
 logToFile = false
 
-blocknx = 14 14 14
-boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+#blocknx = 14 14 14
+#blocknx = 14 15 15
+#blocknx = 35 83 83
+#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+
+blocknx = 32 12 12
+boundingBox = 0 32 -12 12 -12 12
+#boundingBox = 0 64 -24 24 -24 24
+#boundingBox = 0 64 -24 24 -24 24
+
+deltax = 0.5
 
-deltax = 1
 refineLevel = 0
 
-#nuLB = 1.5e-4
 OmegaLB = 1e-5
-N = 80 #rpm
-mu = 1 # Pa s
+mu = 5 # Pa s
+N = 80 # rpm
 tau0 = 20e-7
 
-resolution = 32
-scaleFactor = 1
-
-newStart = false
-restartStep = 50
+newStart = true
+restartStep = 1.3e6
 
-cpStart = 50
-cpStep  = 50
+cpStart = 100000
+cpStep  = 100000
 
-outTime = 10000
-endTime = 100 #0000
\ No newline at end of file
+outTime = 1
+endTime = 200
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index c29e8699d..bef8fa53a 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -111,16 +111,18 @@ void bflow(string configname)
 
       //// rotation around X-axis
       mu::Parser fctVy;
-      fctVy.SetExpr("-Omega*(x3-z0-r)");
+      fctVy.SetExpr("-Omega*(x3-z0-r)/deltax");
       fctVy.DefineConst("Omega", OmegaLB);
       fctVy.DefineConst("r", 0.5 * (g_maxX3 - g_minX3));
       fctVy.DefineConst("z0", g_minX3);
+      fctVy.DefineConst("deltax", deltax);
 
       mu::Parser fctVz;
-      fctVz.SetExpr("Omega*(x2-y0-r)");
+      fctVz.SetExpr("Omega*(x2-y0-r)/deltax");
       fctVz.DefineConst("Omega", OmegaLB);
       fctVz.DefineConst("r", 0.5 * (g_maxX2 - g_minX2));
       fctVz.DefineConst("y0", g_minX2);
+      fctVz.DefineConst("deltax", deltax);
 
       mu::Parser fctVx;
       fctVx.SetExpr("0.0");
@@ -218,6 +220,8 @@ void bflow(string configname)
       
       SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>();
       stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false);
+      //stator->scale(2.0, 2.0, 2.0);
+      //stator->translate(16.0, 0.0, 0.0);
       //stator->translate(4.0, -73.0, -6.0);
 
       SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>(
diff --git a/apps/cpu/rheometer/rheometer.cfg b/apps/cpu/rheometer/rheometer.cfg
index 9eec8c6de..9b739bc67 100644
--- a/apps/cpu/rheometer/rheometer.cfg
+++ b/apps/cpu/rheometer/rheometer.cfg
@@ -1,4 +1,4 @@
-#outputPath = d:/temp/rheometer/rheometerBinghamqQBB/rheometerBingham_tau_20e-7_nu_1.5e-3_new_lim_test
+#outputPath = d:/temp/rheometerTest
 outputPath = d:/temp/Taylor-CouetteFlowIncompCum
 viscosityPath = d:/Projects/VirtualFluidsCombined/apps/cpu/rheometer
 
@@ -8,7 +8,7 @@ logToFile = false
 
 blocknx = 16 16 1  #8 8 1
 #boundingBox = 32 32 1
-deltax = 1
+deltax = 0.5
 
 #boundingBox = 0.02 0.02 0.00125
 #deltax = 0.000625
-- 
GitLab


From 332b1f3c280ea1f0db8328a428d7a5847ce92e88 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 13:50:04 +0100
Subject: [PATCH 060/179] fix warnings

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp | 2 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 2376ed4be..baf30c112 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -46,7 +46,7 @@ void run(string configname)
         double cpStart     = config.getValue<double>("cpStart");
         double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
-        double rStep = config.getValue<double>("rStep");
+        //double rStep = config.getValue<double>("rStep");
 
         SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 3bafc5948..fd21ce3a3 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -46,7 +46,7 @@ void run(string configname)
         double cpStart     = config.getValue<double>("cpStart");
         double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
-        double rStep = config.getValue<double>("rStep");
+        //double rStep = config.getValue<double>("rStep");
 
         std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
@@ -100,13 +100,13 @@ void run(string configname)
         //density of heavy fluid
         LBMReal rho_h = 1.0;
         //density of light fluid
-        LBMReal rho_l = rho_h / r_rho;
+        //LBMReal rho_l = rho_h / r_rho;
 
         //kinimatic viscosity
         LBMReal nu_h = nuL;
         //LBMReal nu_l = nuG;
         //#dynamic viscosity
-        LBMReal mu_h = rho_h * nu_h;
+        //LBMReal mu_h = rho_h * nu_h;
         
         //gravity
         LBMReal g_y = Re * Re * nu_h * nu_h / (D*D*D);
-- 
GitLab


From 0edd19449b39fa36d9ad400bf92bcb9033471355 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 14:57:31 +0100
Subject: [PATCH 061/179] fix warnings

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp                     | 2 +-
 src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index fd21ce3a3..32dfe53c3 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -95,7 +95,7 @@ void run(string configname)
         LBMReal D  = 2.0*radius;
 
         //density retio
-        LBMReal r_rho = densityRatio;
+        //LBMReal r_rho = densityRatio;
 
         //density of heavy fluid
         LBMReal rho_h = 1.0;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 42ed287c6..f39a95afc 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -70,8 +70,7 @@ protected:
     void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
     void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir);
     std::shared_ptr<vf::mpi::Communicator> comm;
-    int dirs;
-    int gridRank;
+    int gridRank{0};
 };
 
 template <class T1, class T2>
-- 
GitLab


From edb48707e4fa27af38121c01a7d40ed1afb99884 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 15:14:23 +0100
Subject: [PATCH 062/179] fix warnings

---
 .../CalculateTorqueCoProcessor.cpp            | 50 ++-----------------
 .../CoProcessors/CalculateTorqueCoProcessor.h |  4 --
 2 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index a3ccfd51f..eeb0575e5 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -103,17 +103,6 @@ void CalculateTorqueCoProcessor::calculateForces()
 
          SPtr<ILBMKernel> kernel = block->getKernel();
 
-         //if (kernel->getCompressible())
-         //{
-         //   calcMacrosFct = &D3Q27System::calcCompMacroscopicValues;
-         //   compressibleFactor = 1.0;
-         //}
-         //else
-         //{
-         //   calcMacrosFct = &D3Q27System::calcIncompMacroscopicValues;
-         //   compressibleFactor = 0.0;
-         //}
-
          SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
          SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); 
          distributions->swap();
@@ -151,29 +140,14 @@ void CalculateTorqueCoProcessor::calculateForces()
                torqueX1 += ry * Fz - rz * Fy;
                torqueX2 += rz * Fx - rx * Fz;
                torqueX3 += rx * Fy - ry * Fx;
-               
-               
-               counter++;
-               //UBLOG(logINFO, "x1="<<(worldCoordinates[1] - x2Centre)<<",x2=" << (worldCoordinates[2] - x3Centre)<< ",x3=" << (worldCoordinates[0] - x1Centre) <<" forceX3 = " << forceX3);
             }
          }
-         //if we have got discretization with more level
-         // deltaX is LBM deltaX and equal LBM deltaT 
-         //double deltaX = 0.5; // LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
-         //double deltaXquadrat = deltaX*deltaX;
-         //torqueX1 *= deltaXquadrat;
-         //torqueX2 *= deltaXquadrat;
-         //torqueX3 *= deltaXquadrat;
 
          distributions->swap();
 
          torqueX1global += torqueX1;
          torqueX2global += torqueX2;
          torqueX3global += torqueX3;
-
-         //UBLOG(logINFO, "torqueX1global = " << torqueX1global);
-
-         //UBLOG(logINFO, "counter = " << counter);
       }
    }
    std::vector<double> values;
@@ -182,8 +156,6 @@ void CalculateTorqueCoProcessor::calculateForces()
    values.push_back(torqueX2global);
    values.push_back(torqueX3global);
 
-   //UBLOG(logINFO, "counter = " << counter);
-
    rvalues = comm->gather(values);
    if (comm->getProcessID() == comm->getRoot())
    {
@@ -206,9 +178,6 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
 
    LBMReal fs[D3Q27System::ENDF + 1];
    distributions->getDistributionInv(fs, x1, x2, x3);
-   //LBMReal /*rho = 0.0,*/ vx1 = 0.0, vx2 = 0.0, vx3 = 0.0, drho = 0.0;
-   //calcMacrosFct(fs, drho, vx1, vx2, vx3);
-   //rho = 1.0 + drho * compressibleFactor;
    
    if(bc)
    {
@@ -226,22 +195,9 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3,  SP
             f = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1, x2, x3, invDir);
             fnbr = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
 
-            // Vector3D boundaryVelocity;
-            // boundaryVelocity[0] = bc->getBoundaryVelocityX1();
-            // boundaryVelocity[1] = bc->getBoundaryVelocityX2();
-            // boundaryVelocity[2] = bc->getBoundaryVelocityX3();
-            //double correction[3] = { 0.0, 0.0, 0.0 };
-            // if (bc->hasVelocityBoundaryFlag(fdir))
-            // {
-            //    const double forceTerm = f - fnbr;
-            //    correction[0] = forceTerm * boundaryVelocity[0];
-            //    correction[1] = forceTerm * boundaryVelocity[1];
-            //    correction[2] = forceTerm * boundaryVelocity[2];
-            // }
-
-            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[0];
-            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[1];
-            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];// - 2.0 * D3Q27System::WEIGTH[invDir] * rho - correction[2];
+            forceX1 += (f + fnbr) * D3Q27System::DX1[invDir];
+            forceX2 += (f + fnbr) * D3Q27System::DX2[invDir];
+            forceX3 += (f + fnbr) * D3Q27System::DX3[invDir];
          }
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
index 872bccdc4..e488b442b 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h
@@ -43,10 +43,6 @@ private:
    double torqueX1global;
    double torqueX2global;
    double torqueX3global;
-
-   typedef void(*CalcMacrosFct)(const LBMReal* const& /*f[27]*/, LBMReal& /*rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct    calcMacrosFct;
-   LBMReal compressibleFactor;
 };
 
 
-- 
GitLab


From 93b474dc3181058d1dc8621cb53a74ec974d11fb Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 15:23:49 +0100
Subject: [PATCH 063/179] fix warnings

---
 .../CoProcessors/CalculateTorqueCoProcessor.cpp                 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
index eeb0575e5..b2c7466f7 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp
@@ -82,8 +82,6 @@ void CalculateTorqueCoProcessor::calculateForces()
    torqueX2global = 0.0;
    torqueX3global = 0.0;
 
-   int counter = 0;
-
    for(SPtr<D3Q27Interactor> interactor : interactors)
    {
       double x1Centre = interactor->getGbObject3D()->getX1Centroid();
-- 
GitLab


From 473d8672ae76814aedf2b1f521b86598a97a7368 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 15:41:43 +0100
Subject: [PATCH 064/179] fix warnings

---
 src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
index 6d5b3c686..6fe24772d 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
+++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h
@@ -32,7 +32,7 @@ protected:
 private:
     MPI_Datatype gridParamType, block3dType;
     MPI_Datatype dataSetParamType, dataSetTypeRead, dataSetTypeWrite;
-    MPI_Datatype boundCondType, boundCondType1000, dataSetDoubleType;
+    MPI_Datatype boundCondType, boundCondType1000;
 
     MPIIODataStructures::boundCondParam boundCondParamStr;
 };
-- 
GitLab


From 1fbbbf6f0418da773520cbe33f4bcb7bbfa3979b Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 15:54:49 +0100
Subject: [PATCH 065/179] fix warnings

---
 apps/cpu/Multiphase/Multiphase.cpp                       | 2 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp               | 2 +-
 .../Visitors/MultiphaseSetKernelBlockVisitor.cpp         | 9 ++-------
 .../Visitors/MultiphaseSetKernelBlockVisitor.h           | 5 +----
 4 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 407ca2d29..fe1384160 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -349,7 +349,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, availMem,
                 needMem);
 
             grid->accept(kernelVisitor);
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 32dfe53c3..9034251c4 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -283,7 +283,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, availMem,
                 needMem);
 
             grid->accept(kernelVisitor);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
index 11863b691..50b303a60 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
@@ -19,9 +19,8 @@
 //   }
 //}
 //////////////////////////////////////////////////////////////////////////
-MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa,
-	LBMReal contactAngle, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) :
-	Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), densityRatio(densityRatio), beta(beta), kappa(kappa), contactAngle(contactAngle), action(action), dataSetFlag(true)
+MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) :
+	Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), densityRatio(densityRatio), action(action), dataSetFlag(true)
 {
 	if (needMem > availMem)
 	{
@@ -36,10 +35,6 @@ 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->setIndex(block->getX1(), block->getX2(), block->getX3());
 		kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
index 9f952e2dd..7406311a7 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
@@ -46,7 +46,7 @@ public:
 
 	//SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem);
 
-	MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa, LBMReal contactAngle, double availMem, double needMem, 
+	MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, double availMem, double needMem, 
 		MultiphaseSetKernelBlockVisitor::Action action = MultiphaseSetKernelBlockVisitor::NewKernel);
 
 	virtual ~MultiphaseSetKernelBlockVisitor() {}
@@ -60,9 +60,6 @@ private:
 	LBMReal nuL;
 	LBMReal nuG;
 	LBMReal densityRatio;
-	LBMReal beta;
-	LBMReal kappa;
-	LBMReal contactAngle;
 	Action action;
 	bool dataSetFlag;
 };
-- 
GitLab


From 40e1e9d3a36fb1a8ddf03c4eb764ac48b497bc68 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 16:04:31 +0100
Subject: [PATCH 066/179] fix warnings

---
 apps/cpu/Multiphase/Multiphase.cpp                            | 3 +--
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp                    | 3 +--
 .../Visitors/MultiphaseSetKernelBlockVisitor.cpp              | 4 ++--
 .../Visitors/MultiphaseSetKernelBlockVisitor.h                | 3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index fe1384160..9623cd730 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -349,8 +349,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, availMem,
-                needMem);
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem);
 
             grid->accept(kernelVisitor);
 
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 9034251c4..6eb283ae2 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -283,8 +283,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, availMem,
-                needMem);
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem);
 
             grid->accept(kernelVisitor);
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
index 50b303a60..afe288e8c 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
@@ -19,8 +19,8 @@
 //   }
 //}
 //////////////////////////////////////////////////////////////////////////
-MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) :
-	Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), densityRatio(densityRatio), action(action), dataSetFlag(true)
+MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) :
+	Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), action(action), dataSetFlag(true)
 {
 	if (needMem > availMem)
 	{
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
index 7406311a7..c4e03b3b4 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
@@ -46,7 +46,7 @@ public:
 
 	//SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem);
 
-	MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, double availMem, double needMem, 
+	MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, double availMem, double needMem, 
 		MultiphaseSetKernelBlockVisitor::Action action = MultiphaseSetKernelBlockVisitor::NewKernel);
 
 	virtual ~MultiphaseSetKernelBlockVisitor() {}
@@ -59,7 +59,6 @@ private:
 	SPtr<LBMKernel> kernel;
 	LBMReal nuL;
 	LBMReal nuG;
-	LBMReal densityRatio;
 	Action action;
 	bool dataSetFlag;
 };
-- 
GitLab


From d4b463aff641597d71c3bfc9fa9fbc9afcfbbb88 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 21 Jan 2022 16:19:44 +0100
Subject: [PATCH 067/179] fix warnings

---
 apps/cpu/MultiphaseDropletTest/droplet.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index baf30c112..29a2228bb 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -271,8 +271,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem,
-                needMem);
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem);
 
             grid->accept(kernelVisitor);
 
-- 
GitLab


From bc6fd3ded5f06a7b9a6e3ccb7c5e52fad4b80318 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 26 Jan 2022 15:39:47 +0100
Subject: [PATCH 068/179] fix msvc_16 warnings

---
 .../CoProcessors/MPIIORestartCoProcessor.cpp                | 6 ++++--
 .../Visitors/MultiphaseSetKernelBlockVisitor.h              | 4 ----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 1798bc68d..49aa8a896 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -2500,9 +2500,11 @@ void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fn
         }
     }
 
-    MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallArray, blocksCount, dataSetSmallType, MPI_STATUS_IGNORE);
+    MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam)), dataSetSmallArray, (int)blocksCount, dataSetSmallType, MPI_STATUS_IGNORE);
     if (doubleCountInBlock > 0)
-        MPI_File_read_at(file_handler, (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+        MPI_File_read_at(
+            file_handler,
+            (MPI_Offset)(read_offset + sizeof(dataSetParam) + (int)blocksCount * sizeof(DataSetSmallRestart)),
             &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
     MPI_File_close(&file_handler);
     MPI_Type_free(&dataSetDoubleType);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
index c4e03b3b4..24d2b35c3 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h
@@ -42,10 +42,6 @@ class MultiphaseSetKernelBlockVisitor : public Block3DVisitor
 public:
 	enum Action { NewKernel, ChangeKernel, ChangeKernelWithData};
 public:
-	//SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue);
-
-	//SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem);
-
 	MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, double availMem, double needMem, 
 		MultiphaseSetKernelBlockVisitor::Action action = MultiphaseSetKernelBlockVisitor::NewKernel);
 
-- 
GitLab


From da37011ddc19f2ea059f7567a70f795c9fe012f2 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 26 Jan 2022 15:49:16 +0100
Subject: [PATCH 069/179] fix msvc_16 warnings

---
 .../CoProcessors/MPIIORestartCoProcessor.cpp                  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index 49aa8a896..b7e4d4b9a 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -2504,8 +2504,8 @@ void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fn
     if (doubleCountInBlock > 0)
         MPI_File_read_at(
             file_handler,
-            (MPI_Offset)(read_offset + sizeof(dataSetParam) + (int)blocksCount * sizeof(DataSetSmallRestart)),
-            &doubleValuesArray[0], blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
+            (MPI_Offset)(read_offset + sizeof(dataSetParam) + blocksCount * sizeof(DataSetSmallRestart)),
+            &doubleValuesArray[0], (int)blocksCount, dataSetDoubleType, MPI_STATUS_IGNORE);
     MPI_File_close(&file_handler);
     MPI_Type_free(&dataSetDoubleType);
 
-- 
GitLab


From fc01c8b46a1cb101df3c774a3f808a6e25bea364 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 28 Mar 2022 11:33:55 +0200
Subject: [PATCH 070/179] change JetBreakup setup for benchmark paper

---
 apps/cpu/Applications.cmake                   |    1 +
 apps/cpu/JetBreakup/JetBreakup.cfg            |   49 +-
 apps/cpu/JetBreakup/JetBreakup.cpp            | 1056 +++++++++--------
 apps/cpu/RisingBubble2D/RisingBubble2D.cfg    |   14 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp    |   99 +-
 apps/cpu/ViskomatXL/viskomat.cfg              |   32 +-
 apps/cpu/ViskomatXL/viskomat.cpp              |   14 +-
 .../MultiphaseNoSlipBCAlgorithm.cpp           |    4 +
 .../MultiphaseSlipBCAlgorithm.cpp             |    4 +-
 .../MultiphaseVelocityBCAlgorithm.cpp         |    2 +-
 .../CoProcessors/MPIIOCoProcessor.cpp         |    2 +-
 11 files changed, 690 insertions(+), 587 deletions(-)

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index 210268968..436db3c5d 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -10,6 +10,7 @@ add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
 add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
 add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D)
+add_subdirectory(${APPS_ROOT_CPU}/JetBreakup)
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
 #add_subdirectory(Applications/greenvortex)
diff --git a/apps/cpu/JetBreakup/JetBreakup.cfg b/apps/cpu/JetBreakup/JetBreakup.cfg
index 22d20f7d5..426891d2c 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cfg
+++ b/apps/cpu/JetBreakup/JetBreakup.cfg
@@ -1,39 +1,34 @@
-pathname = d:/temp/Multiphase
-pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup
-geoFile = JetBreakup2.ASCII.stl
+pathname = d:/temp/JetBreakupBenchmark_D50
+#pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup
+pathGeo = d:/Projects/VirtualFluidsCombined/apps/cpu/Multiphase/backup
+#geoFile = JetBreakupR.ASCII.stl
+#geoFile = inlet1.stl
+geoFile = tubeTransformed.stl
+
 numOfThreads = 4
 availMem = 10e9
 
 #Grid
-
-#boundingBox = -1.0 121.0 0.5 629.0 -1.0 121.0 #(Jet Breakup) (Original with inlet length)
-#boundingBox = -60.5 60.5 -1.0 -201.0 -60.5 60.5 #(Jet Breakup2) (Original without inlet length)
-#blocknx = 22 20 22
-
-boundingBox = -60.5 60.5 -1.0 -21.0 -60.5 60.5 #(Jet Breakup2) (Original without inlet length)
-blocknx = 22 20 22
-
-
-dx = 0.5
-refineLevel = 0
+blocknx = 10 10 10
 
 #Simulation
-uLB = 0.05 #inlet velocity
-uF2 = 0.0001
+uLB = 0.01 #inlet velocity
+#uF2 = 0.0001
 Re = 10
-nuL = 1.0e-5  #!1e-2
-nuG = 1.16e-4 #!1e-2
-densityRatio = 10 #30
-sigma = 4.66e-3 #surface tension 1e-4 ./. 1e-5
-interfaceThickness = 5
-radius = 615.0   (Jet Breakup)
+nuL =0.00016922169811320757# 1.0e-5 #!1e-2
+nuG =0.00016922169811320757# 1.16e-4 #!1e-2
+densityRatio = 24.579710144927535
+sigma = 1.7688679245283022e-07 
+interfaceWidth = 5
+
+D = 0.0001 # m
+deltaXfactor = 50
+
 contactAngle = 110.0
-gravity = 0.0
-#gravity = -5.04e-6
 phi_L = 0.0
 phi_H = 1.0
 Phase-field Relaxation = 0.6
-Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1 
+Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
 
 
 logToFile = false
@@ -44,5 +39,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1
-endTime = 200000000
\ No newline at end of file
+outTime = 1000
+endTime = 36000
\ No newline at end of file
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index eb7d70553..262eafca9 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -1,516 +1,582 @@
 #include <iostream>
+#include <memory>
 #include <string>
 
 #include "VirtualFluids.h"
 
 using namespace std;
 
+void setInflowBC(double x1, double x2, double x3, double radius, int dir)
+{
+
+}
 
 void run(string configname)
 {
-   try
-   {
-      vf::basics::ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getString("pathname");
-      string		  pathGeo = config.getString("pathGeo");
-      string		  geoFile = config.getString("geoFile");
-      int             numOfThreads = config.getInt("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      //vector<double>  length = config.getVector<double>("length");
-      double          uLB = config.getDouble("uLB");
-      double          uF2 = config.getDouble("uF2");
-      double		  nuL = config.getDouble("nuL");
-      double		  nuG = config.getDouble("nuG");
-      double		  densityRatio = config.getDouble("densityRatio");
-      double		  sigma = config.getDouble("sigma");
-      int		      interfaceThickness = config.getInt("interfaceThickness");
-      double		  radius = config.getDouble("radius");
-      double		  theta = config.getDouble("contactAngle");
-      double		  gr = config.getDouble("gravity");
-      double		  phiL = config.getDouble("phi_L");
-      double		  phiH = config.getDouble("phi_H");
-      double		  tauH = config.getDouble("Phase-field Relaxation");
-      double		  mob = config.getDouble("Mobility");
-
-
-      double          endTime = config.getDouble("endTime");
-      double          outTime = config.getDouble("outTime");
-      double          availMem = config.getDouble("availMem");
-      int             refineLevel = config.getInt("refineLevel");
-      double          Re = config.getDouble("Re");
-      double          dx = config.getDouble("dx");
-      bool            logToFile = config.getBool("logToFile");
-      double          restartStep = config.getDouble("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      bool            newStart = config.getValue<bool>("newStart");
-
-      double beta = 12 * sigma / interfaceThickness;
-      double kappa = 1.5 * interfaceThickness * sigma;
-
-      CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
+    try {
+
+        // Sleep(30000);
+
+        vf::basics::ConfigurationFile config;
+        config.load(configname);
+
+        string pathname = config.getValue<string>("pathname");
+        string pathGeo = config.getValue<string>("pathGeo");
+        string geoFile = config.getValue<string>("geoFile");
+        int numOfThreads = config.getValue<int>("numOfThreads");
+        vector<int> blocknx = config.getVector<int>("blocknx");
+        //vector<double> boundingBox = config.getVector<double>("boundingBox");
+        // vector<double>  length = config.getVector<double>("length");
+        double uLB = config.getValue<double>("uLB");
+        // double uF2                         = config.getValue<double>("uF2");
+        //double nuL = config.getValue<double>("nuL");
+        //double nuG = config.getValue<double>("nuG");
+        //double densityRatio = config.getValue<double>("densityRatio");
+        //double sigma = config.getValue<double>("sigma");
+        int interfaceWidth = config.getValue<int>("interfaceWidth");
+        //double D          = config.getValue<double>("D");
+        double theta = config.getValue<double>("contactAngle");
+        double deltaXfactor = config.getValue<double>("deltaXfactor");
+        double phiL = config.getValue<double>("phi_L");
+        double phiH = config.getValue<double>("phi_H");
+        double tauH = config.getValue<double>("Phase-field Relaxation");
+        double mob = config.getValue<double>("Mobility");
+
+        double endTime = config.getValue<double>("endTime");
+        double outTime = config.getValue<double>("outTime");
+        double availMem = config.getValue<double>("availMem");
+        //int refineLevel = config.getValue<int>("refineLevel");
+        double Re = config.getValue<double>("Re");
+        double dx = D/deltaXfactor;
+        bool logToFile = config.getValue<bool>("logToFile");
+        double restartStep = config.getValue<double>("restartStep");
+        double cpStart = config.getValue<double>("cpStart");
+        double cpStep = config.getValue<double>("cpStep");
+        bool newStart = config.getValue<bool>("newStart");
+
+        double beta = 12 * sigma / interfaceWidth;
+        double kappa = 1.5 * interfaceWidth * sigma;
+
+        int caseN = config.getValue<int>("case");
+
+        SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
+        int myid = comm->getProcessID();
+
+        if (myid == 0)
+            UBLOG(logINFO, "Jet Breakup: Start!");
+
+        if (logToFile) {
 #if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      LBMReal dLB; // = length[1] / dx;
-      LBMReal rhoLB = 0.0;
-      LBMReal nuLB = nuL; //(uLB*dLB) / Re;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-
-
-      Grid3DPtr grid(new Grid3D(comm));
-      //grid->setPeriodicX1(true);
-     //grid->setPeriodicX2(true);
-     //grid->setPeriodicX3(true);
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(cpStep, cpStart));
-      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
-      MPIIORestart1CoProcessor rcp(grid, rSch, pathname, comm);
-      //////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-      mu::Parser fctF1;
-      //fctF1.SetExpr("vy1*(1-((x1-x0)^2+(x3-z0)^2)/(R^2))");
-      //fctF1.SetExpr("vy1*(1-(sqrt((x1-x0)^2+(x3-z0)^2)/R))^0.1");
-      fctF1.SetExpr("vy1");
-      fctF1.DefineConst("vy1", -uLB);
-      fctF1.DefineConst("R", 8.0);
-      fctF1.DefineConst("x0", 0.0);
-      fctF1.DefineConst("z0", 0.0);
-
-
-      if (newStart)
-      {
-
-         //bounding box
-         /*double g_minX1 = 0.0;
-         double g_minX2 = -length[1] / 2.0;
-         double g_minX3 = -length[2] / 2.0;
-
-         double g_maxX1 = length[0];
-         double g_maxX2 = length[1] / 2.0;
-         double g_maxX3 = length[2] / 2.0;*/
-
-         double g_minX1 = boundingBox[0];
-         double g_minX2 = boundingBox[2];
-         double g_minX3 = boundingBox[4];
-
-         double g_maxX1 = boundingBox[1];
-         double g_maxX2 = boundingBox[3];
-         double g_maxX3 = boundingBox[5];
-
-         //geometry
-
-         //GbObject3DPtr innerCube(new GbCuboid3D(g_minX1+2, g_minX2+2, g_minX3+2, g_maxX1-2, g_maxX2-2, g_maxX3-2));
-
-       //GbObject3DPtr cylinder1(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2/2, g_maxX3/2, g_minX1 + 12.0*dx, g_maxX2/2, g_maxX3/2, radius));
-       //GbObject3DPtr cylinder2(new GbCylinder3D(g_minX1 + 12.0*dx, g_maxX2/2, g_maxX3/2, g_maxX1 + 2.0*dx, g_maxX2/2, g_maxX3/2, dLB / 2.0));
-
-       //GbObject3DPtr cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2/2, g_maxX3/2, g_maxX1 + 2.0*dx, g_maxX2/2, g_maxX3/2, dLB / 2.0));
-       //GbObject3DPtr cylinders(new GbObject3DManager());
-       //GbObject3DPtr cylinders1(new GbObjectGroup3D());
-
-
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GbTriFaceMesh3DPtr cylinder;
-         if (myid == 0) UBLOG(logINFO, "Read geoFile:start");
-         //cylinder = GbTriFaceMesh3DPtr(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+geoFile, "geoCylinders", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         cylinder = GbTriFaceMesh3DPtr(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/" + geoFile, "geoCylinders", GbTriFaceMesh3D::KDTREE_SAHPLIT));
-         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance());
-
-
-
-         //inflow
-      //GbCuboid3DPtr geoInflowF1(new GbCuboid3D(40.0, 628.0, 40.0, 80, 631.0, 80.0));  // For JetBreakup (Original)
-         //GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1-2.0*dx, g_minX2-2.0*dx, g_minX3-2.0*dx, g_maxX1+2.0*dx, g_minX2+2.0*dx, g_maxX3+2.0*dx));
-         //if (myid == 0) GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1", WbWriterVtkXmlASCII::getInstance());
-
-
-         ////outflow
-         ////GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original)
-         //GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1-2.0*dx, g_maxX2, g_minX3-2.0*dx, g_maxX1+2.0*dx, g_maxX2+2.0*dx, g_maxX3+2.0*dx));
-         //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2-0.5*dx, g_minX3, g_maxX1, g_minX2 - 1.0*dx, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname+"/geo/geoInflowF1", WbWriterVtkXmlASCII::getInstance());
-
-
-         //outflow
-         //GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original)
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2-1*dx, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         double blockLength = blocknx[0] * dx;
-
-
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "uLb = " << uLB);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nuLb = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "Preprocess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-
-
-         //BC Adapter
-         //////////////////////////////////////////////////////////////////////////////
-         BCAdapterPtr noSlipBCAdapter(new NoSlipBCAdapter());
-         noSlipBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NoSlipBCAlgorithmMultiphase()));
-
-
-         BCAdapterPtr denBCAdapter(new DensityBCAdapter(rhoLB));
-         denBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingOutflowBCAlgorithmMultiphase()));
-
-         double r = 5.0; //boost::dynamic_pointer_cast<GbCylinder3D>(cylinder)->getRadius();
-         double cx1 = g_minX1;
-         double cx2 = 0.0; //cylinder->getX2Centroid();
-         double cx3 = 0.0; //cylinder->getX3Centroid();
-
-
-
-         mu::Parser fctPhi_F1;
-         fctPhi_F1.SetExpr("phiH");
-         fctPhi_F1.DefineConst("phiH", phiH);
-
-         mu::Parser fctPhi_F2;
-         fctPhi_F2.SetExpr("phiL");
-         fctPhi_F2.DefineConst("phiL", phiL);
-
-         mu::Parser fctvel_F2_init;
-         fctvel_F2_init.SetExpr("U");
-         fctvel_F2_init.DefineConst("U", 0);
-
-         //fct.SetExpr("U");
-         //fct.DefineConst("U", uLB);
-         //BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-
-         BCAdapterPtr velBCAdapterF1(new VelocityBCAdapterMultiphase(false, true, false, fctF1, phiH, 0.0, endTime));
-
-         //BCAdapterPtr velBCAdapterF2_1_init(new VelocityBCAdapterMultiphase(false, false, true, fctF2_1, phiH, 0.0, endTime));
-         //BCAdapterPtr velBCAdapterF2_2_init(new VelocityBCAdapterMultiphase(false, false, true, fctF2_2, phiH, 0.0, endTime));
-
-         //BCAdapterPtr velBCAdapterF2_1_init(new VelocityBCAdapterMultiphase(false, false, true, fctvel_F2_init, phiL, 0.0, endTime));
-         //BCAdapterPtr velBCAdapterF2_2_init(new VelocityBCAdapterMultiphase(false, false, true, fctvel_F2_init, phiL, 0.0, endTime));
-
-         velBCAdapterF1->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithmMultiphase()));
-         //velBCAdapterF2_1_init->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithmMultiphase()));
-         //velBCAdapterF2_2_init->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithmMultiphase()));
-
-
-          //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityWithDensityBCAlgorithm()));
-          //mu::Parser fct;
-          //fct.SetExpr("U");
-          //fct.DefineConst("U", uLB);
-          //BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-          //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingVelocityBCAlgorithm()));
-
-
-          //////////////////////////////////////////////////////////////////////////////////
-          //BC visitor
-         BoundaryConditionsBlockVisitorMultiphase bcVisitor;
-         bcVisitor.addBC(noSlipBCAdapter);
-         bcVisitor.addBC(denBCAdapter);
-         bcVisitor.addBC(velBCAdapterF1);
-         //bcVisitor.addBC(velBCAdapterF2_1_init);
-         //bcVisitor.addBC(velBCAdapterF2_2_init);
-
-
-
-         WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         ppblocks->process(0);
-
-         Interactor3DPtr tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         D3Q27InteractorPtr inflowF1Int = D3Q27InteractorPtr(new D3Q27Interactor(geoInflowF1, grid, velBCAdapterF1, Interactor3D::SOLID));
-
-         //D3Q27InteractorPtr inflowF2_1Int_init = D3Q27InteractorPtr(new D3Q27Interactor(geoInflowF2_1, grid, velBCAdapterF2_1_init, Interactor3D::SOLID));
-
-         //D3Q27InteractorPtr inflowF2_2Int_init = D3Q27InteractorPtr(new D3Q27Interactor(geoInflowF2_2, grid, velBCAdapterF2_2_init, Interactor3D::SOLID));
-
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         //SetSolidBlockVisitor visitor1(inflowF2_1Int, SetSolidBlockVisitor::BC);
-         //grid->accept(visitor1);
-         //SetSolidBlockVisitor visitor2(inflowF2_2Int, SetSolidBlockVisitor::BC);
-         //grid->accept(visitor2);
-
-
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(tubes);
-         intHelper.addInteractor(inflowF1Int);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
+            if (myid == 0) {
+                const char *str = pathname.c_str();
+                mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+            }
+#endif
 
-         ppblocks->process(0);
-         ppblocks.reset();
+            if (myid == 0) {
+                stringstream logFilename;
+                logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+                UbLog::output_policy::setStream(logFilename.str());
+            }
+        }
+
+        // Sleep(30000);
+
+        double rho_h, rho_l, r_rho, mu_h, mu_l, Uo, D, sigma;
+
+        switch (caseN) {
+            case 1: 
+                //density of heavy fluid (kg/m^3)
+                rho_h = 848; 
+                //density of light fluid (kg/m^3)
+                rho_l = 34.5;
+                //density retio
+                r_rho = rho_h / rho_l;
+                //dynamic viscosity of heavy fluid (Pa · s)
+                mu_h = 2.87e-3;
+                //dynamic viscosity of light fluid (Pa · s)
+                mu_l = 1.97e-5;
+                //velocity (m/s)
+                Uo = 100;
+                //diameter of jet (m)
+                D = 0.0001;
+                //surface tension (N/m)
+                sigma = 0.03;
+                break;
+            case 2:
+                // density of heavy fluid (kg/m^3)
+                rho_h = 848;
+                // density of light fluid (kg/m^3)
+                rho_l = 1.205;
+                // density retio
+                r_rho = rho_h / rho_l;
+                // dynamic viscosity of heavy fluid (Pa · s)
+                mu_h = 2.87e-3;
+                // dynamic viscosity of light fluid (Pa · s)
+                mu_l = 1.84e-5;
+                // velocity (m/s)
+                Uo = 200;
+                // diameter of jet (m)
+                D = 0.0001;
+                // surface tension (N/m)
+                sigma = 0.03;
+                break;
+        }
+
+        // LBMReal dLB = 0; // = length[1] / dx;
+        LBMReal rhoLB = 0.0;
+        LBMReal nuLB = nuL; //(uLB*dLB) / Re;
+
+        SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
+
+        // const int baseLevel = 0;
+
+        SPtr<LBMKernel> kernel;
+
+        // kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+
+        kernel->setWithForcing(true);
+        kernel->setForcingX1(0.0);
+        kernel->setForcingX2(0.0);
+        kernel->setForcingX3(0.0);
+
+        kernel->setPhiL(phiL);
+        kernel->setPhiH(phiH);
+        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);
+        kernel->setInterfaceWidth(interfaceWidth);
+        dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0);
+
+        SPtr<BCProcessor> bcProc(new BCProcessor());
+        // BCProcessorPtr bcProc(new ThinWallBCProcessor());
+
+        kernel->setBCProcessor(bcProc);
+
+        SPtr<Grid3D> grid(new Grid3D(comm));
+        // grid->setPeriodicX1(true);
+        // grid->setPeriodicX2(true);
+        // grid->setPeriodicX3(true);
+        grid->setGhostLayerWidth(2);
+
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(
+            comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+
+        //////////////////////////////////////////////////////////////////////////
+        // restart
+        SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+        // SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        // SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
+        // rcp->setNu(nuLB);
+        // rcp->setNuLG(nuL, nuG);
+        // rcp->setDensityRatio(densityRatio);
+
+        rcp->setLBMKernel(kernel);
+        rcp->setBCProcessor(bcProc);
+        //////////////////////////////////////////////////////////////////////////
+        // BC Adapter
+        //////////////////////////////////////////////////////////////////////////////
+        mu::Parser fctF1;
+        // fctF1.SetExpr("vy1*(1-((x1-x0)^2+(x3-z0)^2)/(R^2))");
+        // fctF1.SetExpr("vy1*(1-(sqrt((x1-x0)^2+(x3-z0)^2)/R))^0.1");
+        fctF1.SetExpr("vy1");
+        fctF1.DefineConst("vy1", 0.0);
+        fctF1.DefineConst("R", 8.0);
+        fctF1.DefineConst("x0", 0.0);
+        fctF1.DefineConst("z0", 0.0);
+        // SPtr<BCAdapter> velBCAdapterF1(
+        //    new MultiphaseVelocityBCAdapter(false, true, false, fctF1, phiH, 0.0, BCFunction::INFCONST));
+
+        mu::Parser fctF2;
+        fctF2.SetExpr("vy1");
+        fctF2.DefineConst("vy1", uLB);
+
+        double startTime = 30;
+        SPtr<BCAdapter> velBCAdapterF1(
+            new MultiphaseVelocityBCAdapter(true, false, false, fctF1, phiH, 0.0, startTime));
+        SPtr<BCAdapter> velBCAdapterF2(
+            new MultiphaseVelocityBCAdapter(true, false, false, fctF2, phiH, startTime, endTime));
+
+        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+
+        SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+        denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm()));
+
+        mu::Parser fctPhi_F1;
+        fctPhi_F1.SetExpr("phiH");
+        fctPhi_F1.DefineConst("phiH", phiH);
+
+        mu::Parser fctPhi_F2;
+        fctPhi_F2.SetExpr("phiL");
+        fctPhi_F2.DefineConst("phiL", phiL);
+
+        mu::Parser fctvel_F2_init;
+        fctvel_F2_init.SetExpr("U");
+        fctvel_F2_init.DefineConst("U", 0);
+
+        velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
+        //////////////////////////////////////////////////////////////////////////////////
+        // BC visitor
+        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+        bcVisitor.addBC(noSlipBCAdapter);
+        bcVisitor.addBC(denBCAdapter); // Ohne das BB?
+        bcVisitor.addBC(velBCAdapterF1);
+
+        //SPtr<D3Q27Interactor> inflowF1Int;
+        //SPtr<D3Q27Interactor> cylInt;
+
+        SPtr<D3Q27Interactor> inflowInt;
+
+        if (newStart) {
+
+            //  if (newStart) {
+
+            // bounding box
+            double g_minX1 = 0;
+            double g_minX2 = 0;
+            double g_minX3 = 0;
+
+            double g_maxX1 = 8.0*D;
+            double g_maxX2 = 2.5*D;
+            double g_maxX3 = 2.5*D;
+
+            // geometry
+            SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
+                                           WbWriterVtkXmlBinary::getInstance());
+
+            //if (myid == 0)
+            //    UBLOG(logINFO, "Read geoFile:start");
+            //SPtr<GbTriFaceMesh3D> cylinder = make_shared<GbTriFaceMesh3D>();
+            //cylinder->readMeshFromSTLFileBinary(pathGeo + "/" + geoFile, false);
+            //GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance());
+            //if (myid == 0)
+            //    UBLOG(logINFO, "Read geoFile:stop");
+            // inflow
+            // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2 - 0.5 * dx, g_minX3, g_maxX1, g_minX2 - 1.0 *
+            // dx, g_maxX3));
+            //GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1 * 0.5 - dx, g_minX2 - dx, g_minX3 * 0.5 - dx,
+            //                                         g_maxX1 * 0.5 + dx, g_minX2, g_maxX3 * 0.5 + dx));
+            //if (myid == 0)
+            //    GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1",
+            //                               WbWriterVtkXmlASCII::getInstance());
+
+            GbCylinder3DPtr geoInflow(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1,
+                                                       g_maxX2 / 2.0,
+                                                       g_maxX3 / 2.0, D / 2.0));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow",
+                                           WbWriterVtkXmlASCII::getInstance());
+
+            GbCylinder3DPtr geoSolid(new GbCylinder3D(g_minX1 - 2.0 * dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1-dx,
+                                                       g_maxX2 / 2.0, g_maxX3 / 2.0, 1.5*D / 2.0));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(geoSolid.get(), pathname + "/geo/geoSolid",
+                                           WbWriterVtkXmlASCII::getInstance());
+
+
+            // GbCylinder3DPtr cylinder2(
+            //    new GbCylinder3D(0.0, g_minX2 - 2.0 * dx / 2.0, 0.0, 0.0, g_minX2 + 4.0 * dx, 0.0, 8.0+2.0*dx));
+            // if (myid == 0)
+            //    GbSystem3D::writeGeoObject(cylinder2.get(), pathname + "/geo/cylinder2",
+            //                               WbWriterVtkXmlASCII::getInstance());
+            // outflow
+            // GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original)
+            // GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2 - 40 * dx, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+            GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2, g_minX3, g_maxX1, g_maxX2 + dx, g_maxX3));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow",
+                                           WbWriterVtkXmlASCII::getInstance());
+
+            // double blockLength = blocknx[0] * dx;
+
+            if (myid == 0) {
+                UBLOG(logINFO, "uLb = " << uLB);
+                UBLOG(logINFO, "rho = " << rhoLB);
+                UBLOG(logINFO, "nuLb = " << nuLB);
+                UBLOG(logINFO, "Re = " << Re);
+                UBLOG(logINFO, "dx = " << dx);
+                UBLOG(logINFO, "Preprocess - start");
+            }
 
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+            grid->setDeltaX(dx);
+            grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+            grid->setPeriodicX1(false);
+            grid->setPeriodicX2(false);
+            grid->setPeriodicX3(false);
+
+            GenBlocksGridVisitor genBlocks(gridCube);
+            grid->accept(genBlocks);
+
+            SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
+                grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+            //SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBCAdapter,
+            //                                                        Interactor3D::SOLID, Interactor3D::POINTS));
+
+            // inflowF1Int =
+            //    SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            // inflowF1Int->addBCAdapter(velBCAdapterF2);
+
+            SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+            // Create boundary conditions geometry
+            GbCuboid3DPtr wallXmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_minX1, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallXmax(
+                new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallZmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_minX3));
+            GbSystem3D::writeGeoObject(wallZmin.get(), pathname + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallZmax(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_maxX3, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3 + 2.0*dx));
+            GbSystem3D::writeGeoObject(wallZmax.get(), pathname + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_minX2, g_maxX3));
+            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmax(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_maxX2, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+            // Add boundary conditions to grid generator
+            SPtr<D3Q27Interactor> wallXminInt(
+                new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXmaxInt(
+                new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallZminInt(
+                new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallZmaxInt(
+                new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYminInt(
+                new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYmaxInt(
+                new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            //cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCAdapterF1, Interactor3D::SOLID));
+            //cylInt->addBCAdapter(velBCAdapterF2);
+            // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBCAdapter,
+            // Interactor3D::SOLID));
+
+            inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapterF1, Interactor3D::SOLID));
+            inflowInt->addBCAdapter(velBCAdapterF2);
+
+            SPtr<D3Q27Interactor> solidInt =
+                SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            InteractorsHelper intHelper(grid, metisVisitor, true);
+            //intHelper.addInteractor(cylInt);
+            //intHelper.addInteractor(tubes);
+            // intHelper.addInteractor(outflowInt);
+            // intHelper.addInteractor(cyl2Int);
+
+            intHelper.addInteractor(wallXminInt);
+            intHelper.addInteractor(wallXmaxInt);
+            intHelper.addInteractor(wallZminInt);
+            intHelper.addInteractor(wallZmaxInt);
+            intHelper.addInteractor(wallYminInt);
+            intHelper.addInteractor(wallYmaxInt);
+            intHelper.addInteractor(inflowInt);
+            //intHelper.addInteractor(solidInt);
+
+            intHelper.selectBlocks();
+
+            ppblocks->process(0);
+            ppblocks.reset();
+
+            unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+            int ghostLayer = 3;
+            unsigned long long numberOfNodesPerBlock =
+                (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
+            unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+            unsigned long long numberOfNodesPerBlockWithGhostLayer =
+                numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+            double needMemAll =
+                double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+            if (myid == 0) {
+                UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+                UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+                int minInitLevel = grid->getCoarsestInitializedLevel();
+                int maxInitLevel = grid->getFinestInitializedLevel();
+                for (int level = minInitLevel; level <= maxInitLevel; level++) {
+                    int nobl = grid->getNumberOfBlocks(level);
+                    UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+                    UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
+                }
+                UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+                UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+                UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+            }
 
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem);
+
+            grid->accept(kernelVisitor);
+
+            //if (refineLevel > 0) {
+            //    SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            //    grid->accept(undefNodesVisitor);
+            //}
+
+            intHelper.setBC();
+
+            // initialization of distributions
+            mu::Parser fct1;
+            fct1.SetExpr("phiL");
+            fct1.DefineConst("phiL", phiL);
+            // MultiphaseInitDistributionsBlockVisitor initVisitor(interfaceThickness);
+            MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
+            initVisitor.setPhi(fct1);
+            grid->accept(initVisitor);
+            ///////////////////////////////////////////////////////////////////////////////////////////
+            //{
+            // std::vector<std::vector<SPtr<Block3D>>> blockVector;
+            // int gridRank = comm->getProcessID();
+            // int minInitLevel = grid->getCoarsestInitializedLevel();
+            // int maxInitLevel = grid->getFinestInitializedLevel();
+            // blockVector.resize(maxInitLevel + 1);
+            // for (int level = minInitLevel; level <= maxInitLevel; level++) {
+            //    grid->getBlocks(level, gridRank, true, blockVector[level]);
+            //}
+            //    for (int level = minInitLevel; level <= maxInitLevel; level++) {
+            //    for (SPtr<Block3D> block : blockVector[level]) {
+            //        if (block) {
+            //            int ix1 = block->getX1();
+            //            int ix2 = block->getX2();
+            //            int ix3 = block->getX3();
+            //            int level = block->getLevel();
+
+            //            for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) {
+            //                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+
+            //                if (!neighBlock) {
+
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
+            //    SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0);
+            //    SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+            //    SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+
+            //    for (int ix3 = 0; ix3 <= 13; ix3++) {
+            //        for (int ix2 = 0; ix2 <= 13; ix2++) {
+            //            for (int ix1 = 0; ix1 <= 13; ix1++) {
+            //                if (ix1 == 0 || ix2 == 0 || ix3 == 0 || ix1 == 13 || ix2 == 13 || ix3 == 13)
+            //                    bcArray->setUndefined(ix1, ix2, ix3);
+            //            }
+            //        }
+            //    }
+            //}
+            ////////////////////////////////////////////////////////////////////////////////////////////
+            // boundary conditions grid
             {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
+                SPtr<UbScheduler> geoSch(new UbScheduler(1));
+                SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+                    grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+                ppgeo->process(0);
+                ppgeo.reset();
             }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernelPtr kernel;
-
-         kernel = LBMKernelPtr(new MultiphaseCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], MultiphaseCumulantLBMKernel::NORMAL));
-
-         kernel->setWithForcing(true);
-         kernel->setForcingX1(0.0);
-         kernel->setForcingX2(gr);
-         kernel->setForcingX3(0.0);
 
-         kernel->setPhiL(phiL);
-         kernel->setPhiH(phiH);
-         kernel->setPhaseFieldRelaxation(tauH);
-         kernel->setMobility(mob);
-
-         BCProcessorPtr bcProc(new BCProcessor());
-         //BCProcessorPtr bcProc(new ThinWallBCProcessor());
-
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitorMultiphase kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem, needMem);
-
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //inflowF2_1Int->initInteractor();
-         //inflowF2_2Int->initInteractor();
-
-         intHelper.setBC();
-
-
-         grid->accept(bcVisitor);
-
-         //initialization of distributions
-         LBMReal x1c = radius; //g_minX1; //radius; //19; //(g_maxX1+g_minX1)/2;
-         LBMReal x2c = (g_maxX2 + g_minX2) / 2; //g_minX2 + 2;
-         LBMReal x3c = (g_maxX3 + g_minX3) / 2;
-         mu::Parser fct1;
-
-         //fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
-         //fct1.SetExpr("phiM-phiM*tanh((sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/(interfaceThickness*phiM))");
-
-         //fct1.SetExpr("0.5*(phiH + phiL)-0.5*(phiH - phiL)*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
-
-
-         //fct1.SetExpr("0.5*(phiH + phiL) + 0.5*(phiH - phiL)*tanh(2*((x2-radius))/interfaceThickness)");
-         fct1.SetExpr("phiL");
-         fct1.DefineConst("x1c", x1c);
-         fct1.DefineConst("x2c", x2c);
-         fct1.DefineConst("x3c", x3c);
-         fct1.DefineConst("phiL", phiL);
-         fct1.DefineConst("phiH", phiH);
-         fct1.DefineConst("radius", radius);
-         fct1.DefineConst("interfaceThickness", interfaceThickness);
-
-         mu::Parser fct2;
-         //fct2.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))");
-         fct2.SetExpr("vx1");
-         fct2.DefineConst("R", 10.0);
-         fct2.DefineConst("vx1", uLB);
-         fct2.DefineConst("y0", 1.0);
-         fct2.DefineConst("z0", 31.0);
-         /*fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
-         fct2.DefineConst("uLB", uLB);
-         fct2.DefineConst("x1c", x1c);
-         fct2.DefineConst("x2c", x2c);
-         fct2.DefineConst("x3c", x3c);
-         fct2.DefineConst("radius", radius);
-         fct2.DefineConst("interfaceThickness", interfaceThickness);*/
-
-
-         InitDistributionsBlockVisitorMultiphase initVisitor(densityRatio, interfaceThickness, radius);
-         initVisitor.setPhi(fct1);
-         //initVisitor.setVx1(fct2);
-         grid->accept(initVisitor);
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         //ConnectorFactoryPtr factory(new Block3DConnectorFactory());
-         //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         //grid->accept(pqPartVisitor);
-
-
-
-
-         //boundary conditions grid
-         {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessorPtr ppgeo(
-               new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-            ppgeo->process(0);
-            ppgeo.reset();
-         }
-
-         if (myid == 0) UBLOG(logINFO, "Preprocess - end");
-      }
-      else
-      {
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "uLb = " << uLB);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nuLb = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-         }
-
-         rcp.restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-
-         //BCAdapterPtr velBCAdapter(new VelocityBCAdapter());
-         //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithm()));
-         //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityWithDensityBCAlgorithm()));
-         //bcVisitor.addBC(velBCAdapter);
-         //grid->accept(bcVisitor);
-
-         //set connectors
-         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-
-
-
-
-
-      //UbSchedulerPtr bcSch(new UbScheduler(1, 12000, 12000));
-      //TimeDependentBCCoProcessorPtr inflowF2 (new TimeDependentBCCoProcessor(grid,bcSch));
-      //inflowF2->addInteractor(inflowF2_1Int);
-      //inflowF2->addInteractor(inflowF2_2Int);
-
-       //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch,CalculationManager::MPI));
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
+            if (myid == 0)
+                UBLOG(logINFO, "Preprocess - end");
+        } else {
+            if (myid == 0) {
+                UBLOG(logINFO, "Parameters:");
+                UBLOG(logINFO, "uLb = " << uLB);
+                UBLOG(logINFO, "rho = " << rhoLB);
+                UBLOG(logINFO, "nuLb = " << nuLB);
+                UBLOG(logINFO, "Re = " << Re);
+                UBLOG(logINFO, "dx = " << dx);
+                //UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+                UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+                UBLOG(logINFO, "path = " << pathname);
+            }
 
+            rcp->restart((int)restartStep);
+            grid->setTimeStep(restartStep);
+
+            if (myid == 0)
+                UBLOG(logINFO, "Restart - end");
+        }
+
+        //  TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //  grid->accept(setConnsVisitor);
+
+        // ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+
+        grid->accept(bcVisitor);
+
+        // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
+
+        SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+        double t_ast, t;
+        t_ast = 7.19;
+        t = (int)(t_ast/(uLB/(deltaXfactor)));
+        visSch->addSchedule(t,t,t); //t=7.19
+        SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
+            grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+        pp->process(0);
+
+        SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+        SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+        SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime));
+        auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch));
+        timeDepBC->addInteractor(inflowInt);
+
+#ifdef _OPENMP
+        omp_set_num_threads(numOfThreads);
+#endif
+
+        SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+        SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+        calculator->addCoProcessor(npr);
+        calculator->addCoProcessor(pp);
+        calculator->addCoProcessor(timeDepBC);
+        calculator->addCoProcessor(rcp);
+
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-start");
+        calculator->calculate();
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-end");
+    } catch (std::exception &e) {
+        cerr << e.what() << endl << flush;
+    } catch (std::string &s) {
+        cerr << s << endl;
+    } catch (...) {
+        cerr << "unknown exception" << endl;
+    }
 }
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
 {
-   //Sleep(30000);
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
+    // Sleep(30000);
+    if (argv != NULL) {
+        if (argv[1] != NULL) {
+            run(string(argv[1]));
+        } else {
+            cout << "Configuration file is missing!" << endl;
+        }
+    }
 }
-
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cfg b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
index 659a3a2d2..d0635ea27 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cfg
@@ -5,8 +5,12 @@ availMem = 10e9
 
 #Grid
 
-boundingBox = 0 160 0 320 0 3
-blocknx = 16 16 3
+#boundingBox = 0 160 0 320 0 3
+#blocknx = 16 16 3
+#blocknx = 80 80 3
+
+boundingBox = 0 20 0 20 0 3
+blocknx = 20 20 3
 
 dx = 1
 refineLevel = 0
@@ -21,7 +25,7 @@ nuG = 1e-3
 densityRatio = 10
 sigma = 1.0850694444444444e-06 #1e-10 #1e-6  # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5
 interfaceThickness = 4.096
-radius = 40
+radius = 5 #40
 contactAngle = 110.0
 phi_L = 0.0
 phi_H = 1.0
@@ -37,7 +41,7 @@ restartStep = 10
 cpStart = 10
 cpStep = 10
 
-outTime = 10000
-endTime = 20
+outTime = 100000
+endTime = 13
 
 rStep = 159990 #160000
\ No newline at end of file
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 6eb283ae2..0182f569c 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -174,7 +174,7 @@ void run(string configname)
         SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
         SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
+        slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
         //////////////////////////////////////////////////////////////////////////////////
         // BC visitor
         MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
@@ -194,55 +194,58 @@ void run(string configname)
         //////////////////////////////////////////////////////////////////////////
         // restart
         SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-        //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
-        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
-        // rcp->setNu(nuLB);
-        // rcp->setNuLG(nuL, nuG);
-        // rcp->setDensityRatio(densityRatio);
+        SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        //SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        //rcp->setNu(nuLB);
+        //rcp->setNuLG(nuL, nuG);
+        //rcp->setDensityRatio(densityRatio);
 
         rcp->setLBMKernel(kernel);
         rcp->setBCProcessor(bcProc);
         //////////////////////////////////////////////////////////////////////////
+        // bounding box
+        double g_minX1 = boundingBox[0];
+        double g_minX2 = boundingBox[2];
+        double g_minX3 = boundingBox[4];
+
+        double g_maxX1 = boundingBox[1];
+        double g_maxX2 = boundingBox[3];
+        double g_maxX3 = boundingBox[5];
+
+        double dx2 = 2.0 * dx;
+        GbCuboid3DPtr wallXmin(
+            new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_minX1, g_maxX2 + dx2, g_maxX3 + dx2));
+        GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+        GbCuboid3DPtr wallXmax(
+            new GbCuboid3D(g_maxX1, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+        GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+
+        GbCuboid3DPtr wallYmin(
+            new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
+        GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+        GbCuboid3DPtr wallYmax(
+            new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+        GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+        SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
+        SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
+
+        SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+        SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
         if (newStart) {
 
-            // bounding box
-            double g_minX1 = boundingBox[0];
-            double g_minX2 = boundingBox[2];
-            double g_minX3 = boundingBox[4];
-
-            double g_maxX1 = boundingBox[1];
-            double g_maxX2 = boundingBox[3];
-            double g_maxX3 = boundingBox[5];
-
             // geometry
             SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
             if (myid == 0)
                 GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
-                    WbWriterVtkXmlBinary::getInstance());
-
-
+                                           WbWriterVtkXmlBinary::getInstance());
 
             GenBlocksGridVisitor genBlocks(gridCube);
             grid->accept(genBlocks);
 
-            double dx2 = 2.0 * dx;
-            GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_minX1, g_maxX2 + dx2, g_maxX3 + dx2));
-            GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
-            GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
-            GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
-
-            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
-            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
-            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
-            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
-
-            SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
-            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
  
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
@@ -349,7 +352,28 @@ void run(string configname)
             }
 
             rcp->restart((int)restartStep);
-            grid->setTimeStep(restartStep);
+            //grid->setTimeStep(restartStep);
+
+            //rcp->readBlocks((int)restartStep);
+            //rcp->readDataSet((int)restartStep);
+            //rcp->readBoundaryConds((int)restartStep);
+            //grid->setTimeStep((int)restartStep);
+
+            //SetBcBlocksBlockVisitor v2(wallXminInt);
+            //grid->accept(v2);
+            //wallXminInt->initInteractor();
+
+            //SetBcBlocksBlockVisitor v3(wallXmaxInt);
+            //grid->accept(v3);
+            //wallXmaxInt->initInteractor();
+
+            //SetBcBlocksBlockVisitor v4(wallYminInt);
+            //grid->accept(v4);
+            //wallYminInt->initInteractor();
+
+            //SetBcBlocksBlockVisitor v1(wallYmaxInt);
+            //grid->accept(v1);
+            //wallYmaxInt->initInteractor();
 
             if (myid == 0)
                 UBLOG(logINFO, "Restart - end");
@@ -392,8 +416,9 @@ void run(string configname)
 
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-        if(grid->getTimeStep() == 0) 
-            pp->process(0);
+        //if(grid->getTimeStep() == 0) 
+            //pp->process(0);
+        pp->process(grid->getTimeStep());
 
         SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
         SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index c46760239..3e84b68cf 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -1,24 +1,24 @@
-outputPath = d:/temp/viskomatXL_dx_0.5
-#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
-geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
-#geoFile = fishboneT.stl
-geoFile = cylinder.stl
+outputPath = d:/temp/viskomatXL_restart_test
+geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
+#geoPath = d:/Projects/TRR277/Project/WP1/Rheometer
+geoFile = fishboneT.stl
+#geoFile = cylinder.stl
 
 numOfThreads = 1
 availMem = 15e9
 logToFile = false
 
-#blocknx = 14 14 14
+blocknx = 14 14 14
 #blocknx = 14 15 15
 #blocknx = 35 83 83
-#boundingBox = 0 140 -82.5 82.5 -82.5 82.5
+boundingBox = 0 140 -82.5 82.5 -82.5 82.5
 
-blocknx = 32 12 12
-boundingBox = 0 32 -12 12 -12 12
+#blocknx = 32 12 12
+#boundingBox = 0 32 -12 12 -12 12
 #boundingBox = 0 64 -24 24 -24 24
 #boundingBox = 0 64 -24 24 -24 24
 
-deltax = 0.5
+deltax = 1
 
 refineLevel = 0
 
@@ -27,11 +27,11 @@ mu = 5 # Pa s
 N = 80 # rpm
 tau0 = 20e-7
 
-newStart = true
-restartStep = 1.3e6
+newStart = false
+restartStep = 10
 
-cpStart = 100000
-cpStep  = 100000
+cpStart = 10
+cpStep  = 10
 
-outTime = 1
-endTime = 200
\ No newline at end of file
+outTime = 10000
+endTime = 20
\ No newline at end of file
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index bef8fa53a..45694a4e4 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -363,8 +363,12 @@ void bflow(string configname)
       }
       else
       {
-         restartCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
+         //restartCoProcessor->restart((int)restartStep);
+         
+         restartCoProcessor->readBlocks((int)restartStep);
+         restartCoProcessor->readDataSet((int)restartStep);
+         //restartCoProcessor->readBoundaryConds((int)restartStep);
+         grid->setTimeStep((int)restartStep);
          
          SetBcBlocksBlockVisitor v2(wallXmaxInt);
          grid->accept(v2);
@@ -381,6 +385,10 @@ void bflow(string configname)
          SetBcBlocksBlockVisitor v1(wallXminInt);
          grid->accept(v1);
          wallXminInt->initInteractor();
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath,
+                                                               WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->process(1);
       }
       
       omp_set_num_threads(numOfThreads);
@@ -405,7 +413,7 @@ void bflow(string configname)
       SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
       //writeMQCoProcessor->process(100);
 
-      SPtr<UbScheduler> forceSch(new UbScheduler(1000));
+      SPtr<UbScheduler> forceSch(new UbScheduler(100));
       SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
       fp->addInteractor(rotorInt);
       SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
index 51fc2d5ab..76128e0e7 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
@@ -85,8 +85,12 @@ void MultiphaseNoSlipBCAlgorithm::applyBC()
          //quadratic bounce back
          const int invDir = D3Q27System::INVDIR[fdir];
 		 LBMReal fReturn = f[invDir];
+         //if (UbMath::isNaN(fReturn))
+             //UBLOG(logINFO, "fReturn: " << fReturn);
          distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
 		 LBMReal hReturn = h[invDir];
+         //if (UbMath::isNaN(hReturn))
+             //UBLOG(logINFO, "hReturn: " << hReturn);
 		 distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
index beba9a256..483cf3db8 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
@@ -133,8 +133,8 @@ void MultiphaseSlipBCAlgorithm::applyBC()
          LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q));
          distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
 
-		 LBMReal hReturn = ((1.0-q)/(1.0+q))*((h[invDir]-heq[invDir])/(1.0-collFactorPh)+heq[invDir])+((q/(1.0+q))*(h[invDir]+h[fdir]));
-		 //LBMReal hReturn = h[invDir];
+		 //LBMReal hReturn = ((1.0-q)/(1.0+q))*((h[invDir]-heq[invDir])/(1.0-collFactorPh)+heq[invDir])+((q/(1.0+q))*(h[invDir]+h[fdir]));
+		 LBMReal hReturn = h[invDir];
 		 distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
       }
    }
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
index 58c359887..70b0cceff 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
@@ -100,7 +100,7 @@ void MultiphaseVelocityBCAlgorithm::applyBC()
    else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
    else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
    else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
-   else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
+   //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
    
    phiBC = bcPtr->getBoundaryPhaseField();
    
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
index 70bde9e97..a16f32c7d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp
@@ -55,7 +55,7 @@ MPIIOCoProcessor::MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const
     //-----------------------------------------------------------------------
 
     MPI_Datatype typesBC[3] = { MPI_LONG_LONG_INT, MPI_FLOAT, MPI_CHAR };
-    int blocksBC[3]         = { 5, 33, 1 };
+    int blocksBC[3]         = { 5, 34, 1 };
     MPI_Aint offsetsBC[3], lbBC, extentBC;
 
     offsetsBC[0] = 0;
-- 
GitLab


From 9e1c774aebe6d7af165be2bd52d690fa8d506bb7 Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Mon, 28 Mar 2022 12:01:17 +0200
Subject: [PATCH 071/179] fix some problems: deadlock und nan reasons

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp    | 101 +++++++-----------
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |  75 ++++++++++++-
 2 files changed, 109 insertions(+), 67 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 0182f569c..7d8361e00 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -46,7 +46,7 @@ void run(string configname)
         double cpStart     = config.getValue<double>("cpStart");
         double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
-        //double rStep = config.getValue<double>("rStep");
+        double rStep = config.getValue<double>("rStep");
 
         std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
@@ -85,7 +85,7 @@ void run(string configname)
 //         }    
 //#endif
 
-        //Sleep(30000);
+        //Sleep(20000);
 
         // LBMReal dLB = 0; // = length[1] / dx;
         LBMReal rhoLB = 0.0;
@@ -95,18 +95,18 @@ void run(string configname)
         LBMReal D  = 2.0*radius;
 
         //density retio
-        //LBMReal r_rho = densityRatio;
+        LBMReal r_rho = densityRatio;
 
         //density of heavy fluid
         LBMReal rho_h = 1.0;
         //density of light fluid
-        //LBMReal rho_l = rho_h / r_rho;
+        LBMReal rho_l = rho_h / r_rho;
 
         //kinimatic viscosity
         LBMReal nu_h = nuL;
         //LBMReal nu_l = nuG;
         //#dynamic viscosity
-        //LBMReal mu_h = rho_h * nu_h;
+        LBMReal mu_h = rho_h * nu_h;
         
         //gravity
         LBMReal g_y = Re * Re * nu_h * nu_h / (D*D*D);
@@ -174,7 +174,7 @@ void run(string configname)
         SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
         SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-        slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
         //////////////////////////////////////////////////////////////////////////////////
         // BC visitor
         MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
@@ -197,55 +197,52 @@ void run(string configname)
         SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
         //SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
         //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, metisVisitor, pathname, comm));
-        //rcp->setNu(nuLB);
-        //rcp->setNuLG(nuL, nuG);
+        // rcp->setNu(nuLB);
+       //  rcp->setNuLG(nuL, nuG);
         //rcp->setDensityRatio(densityRatio);
 
         rcp->setLBMKernel(kernel);
         rcp->setBCProcessor(bcProc);
         //////////////////////////////////////////////////////////////////////////
-        // bounding box
-        double g_minX1 = boundingBox[0];
-        double g_minX2 = boundingBox[2];
-        double g_minX3 = boundingBox[4];
-
-        double g_maxX1 = boundingBox[1];
-        double g_maxX2 = boundingBox[3];
-        double g_maxX3 = boundingBox[5];
-
-        double dx2 = 2.0 * dx;
-        GbCuboid3DPtr wallXmin(
-            new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_minX1, g_maxX2 + dx2, g_maxX3 + dx2));
-        GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
-        GbCuboid3DPtr wallXmax(
-            new GbCuboid3D(g_maxX1, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
-        GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
-
-        GbCuboid3DPtr wallYmin(
-            new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
-        GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
-        GbCuboid3DPtr wallYmax(
-            new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
-        GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
-
-        SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
-        SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
-
-        SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-        SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
         if (newStart) {
 
+            // bounding box
+            double g_minX1 = boundingBox[0];
+            double g_minX2 = boundingBox[2];
+            double g_minX3 = boundingBox[4];
+
+            double g_maxX1 = boundingBox[1];
+            double g_maxX2 = boundingBox[3];
+            double g_maxX3 = boundingBox[5];
+
             // geometry
             SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
             if (myid == 0)
                 GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
-                                           WbWriterVtkXmlBinary::getInstance());
+                    WbWriterVtkXmlBinary::getInstance());
+
+
 
             GenBlocksGridVisitor genBlocks(gridCube);
             grid->accept(genBlocks);
 
+            double dx2 = 2.0 * dx;
+            GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_minX1, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+
+            GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+            SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
 
+            SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
  
             SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
                 grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
@@ -352,28 +349,7 @@ void run(string configname)
             }
 
             rcp->restart((int)restartStep);
-            //grid->setTimeStep(restartStep);
-
-            //rcp->readBlocks((int)restartStep);
-            //rcp->readDataSet((int)restartStep);
-            //rcp->readBoundaryConds((int)restartStep);
-            //grid->setTimeStep((int)restartStep);
-
-            //SetBcBlocksBlockVisitor v2(wallXminInt);
-            //grid->accept(v2);
-            //wallXminInt->initInteractor();
-
-            //SetBcBlocksBlockVisitor v3(wallXmaxInt);
-            //grid->accept(v3);
-            //wallXmaxInt->initInteractor();
-
-            //SetBcBlocksBlockVisitor v4(wallYminInt);
-            //grid->accept(v4);
-            //wallYminInt->initInteractor();
-
-            //SetBcBlocksBlockVisitor v1(wallYmaxInt);
-            //grid->accept(v1);
-            //wallYmaxInt->initInteractor();
+            grid->setTimeStep(restartStep);
 
             if (myid == 0)
                 UBLOG(logINFO, "Restart - end");
@@ -416,9 +392,8 @@ void run(string configname)
 
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-        //if(grid->getTimeStep() == 0) 
-            //pp->process(0);
-        pp->process(grid->getTimeStep());
+        if(grid->getTimeStep() == 0) 
+            pp->process(0);
 
         SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
         SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 0dc57aaba..df437b553 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -47,8 +47,8 @@ MultiphasePressureFilterLBMKernel::MultiphasePressureFilterLBMKernel() { this->c
 //////////////////////////////////////////////////////////////////////////
 void MultiphasePressureFilterLBMKernel::initDataSet()
 {
-	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
-	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); // For phase-field
 
 	//SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
@@ -58,7 +58,7 @@ void MultiphasePressureFilterLBMKernel::initDataSet()
 	//dataSet->setPhaseField(divU1);
 	dataSet->setPressureField(pressure);
 
-	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 
 	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
 }
@@ -156,6 +156,21 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
 	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
 
+
+	/*std::vector<double> doubleValuesArrayFtemp; // double-values (arrays of f's) in all blocks  Fdistribution
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), localDistributionsF->getDataVector().begin(), localDistributionsF->getDataVector().end());
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), nonLocalDistributionsF->getDataVector().begin(), nonLocalDistributionsF->getDataVector().end());
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), zeroDistributionsF->getDataVector().begin(), zeroDistributionsF->getDataVector().end());
+
+	for (int i = 0; i < doubleValuesArrayFtemp.size(); i++)
+	{
+		if (UbMath::isNaN(doubleValuesArrayFtemp[i]) || UbMath::isInfinity(doubleValuesArrayFtemp[i]))
+			std::cout << "doubleValuesArrayFtemp[i] is NAN  " << i << std::endl;
+	}*/
+	//std::cout << "localDistributionsF=" << localDistributionsF->getNX1() << " " << localDistributionsF->getNX2() << " " << localDistributionsF->getNX3() << " " << localDistributionsF->getNX4() << std::endl;
+	//std::cout << "nonLocalDistributionsF=" << nonLocalDistributionsF->getNX1() << " " << nonLocalDistributionsF->getNX2() << " " << nonLocalDistributionsF->getNX3() << " " << nonLocalDistributionsF->getNX4() << std::endl;
+	//std::cout << "zeroDistributionsF=" << zeroDistributionsF->getNX1() << " " << zeroDistributionsF->getNX2() << " " << zeroDistributionsF->getNX3() << std::endl;
+
 	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
@@ -171,6 +186,12 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
 	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
 
+//	std::cout << "MultiphasePressureFilterLBMKernel::calculate bcArrayMaxX1=" << bcArrayMaxX1 << " , bcArrayMaxX2=" << bcArrayMaxX2 << ", bcArrayMaxX3=" << bcArrayMaxX3 << std::endl;
+//	std::cout << "MultiphasePressureFilterLBMKernel::calculate minX1=" << minX1 << " , minX2=" << minX2 << ", minX3=" << minX3 << std::endl;
+//	std::cout << "MultiphasePressureFilterLBMKernel::calculate maxX1=" << maxX1 << " , maxX2=" << maxX2 << ", maxX3=" << maxX3 << std::endl;
+//	std::cout << "dataSetParamStr1=" << localDistributionsF->getNX1() << " " << localDistributionsF->getNX2() << " " << localDistributionsF->getNX3() << " " << localDistributionsF->getNX4() << std::endl;
+//	std::cout << "nx=" << dataSet->getFdistributions()->getNX1() << " " << dataSet->getFdistributions()->getNX2() << " " << dataSet->getFdistributions()->getNX3() << std::endl;
+
 	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
 		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
 			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
@@ -243,6 +264,34 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 
 					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
 					
+					/*if (UbMath::isNaN(mfcbb) || UbMath::isInfinity(mfcbb)) std::cout << "mfcbb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbcb) || UbMath::isInfinity(mfbcb)) std::cout << "mfbcb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbbc) || UbMath::isInfinity(mfbbc)) std::cout << "mfbbc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfccb) || UbMath::isInfinity(mfccb)) std::cout << "mfccb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfacb) || UbMath::isInfinity(mfacb)) std::cout << "mfacb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcbc) || UbMath::isInfinity(mfcbc)) std::cout << "mfcbc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfabc) || UbMath::isInfinity(mfabc)) std::cout << "mfabc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbcc) || UbMath::isInfinity(mfbcc)) std::cout << "mfbcc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbac) || UbMath::isInfinity(mfbac)) std::cout << "mfbac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfccc) || UbMath::isInfinity(mfccc)) std::cout << "mfccc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfacc) || UbMath::isInfinity(mfacc)) std::cout << "mfacc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcac) || UbMath::isInfinity(mfcac)) std::cout << "mfcac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfaac) || UbMath::isInfinity(mfaac)) std::cout << "mfaac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfabb) || UbMath::isInfinity(mfabb)) std::cout << "mfabb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbab) || UbMath::isInfinity(mfbab)) std::cout << "mfbab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbba) || UbMath::isInfinity(mfbba)) std::cout << "mfbba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfaab) || UbMath::isInfinity(mfaab)) std::cout << "mfaab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcab) || UbMath::isInfinity(mfcab)) std::cout << "mfcab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfaba) || UbMath::isInfinity(mfaba)) std::cout << "mfaba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcba) || UbMath::isInfinity(mfcba)) std::cout << "mfcba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbaa) || UbMath::isInfinity(mfbaa)) std::cout << "mfbaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbca) || UbMath::isInfinity(mfbca)) std::cout << "mfbca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfaaa) || UbMath::isInfinity(mfaaa)) std::cout << "mfaaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcaa) || UbMath::isInfinity(mfcaa)) std::cout << "mfcaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfaca) || UbMath::isInfinity(mfaca)) std::cout << "mfaca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfcca) || UbMath::isInfinity(mfcca)) std::cout << "mfcca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
+					if (UbMath::isNaN(mfbbb) || UbMath::isInfinity(mfbbb)) std::cout << "mfbbb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;*/
+
 					LBMReal rhoH = 1.0;
 					LBMReal rhoL = 1.0 / densityRatio;
 
@@ -1200,7 +1249,8 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
 
 					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
-																																		// !Old Kernel
+									
+																			// !Old Kernel
 /////////////////////  P H A S E - F I E L D   S O L V E R
 ////////////////////////////////////////////
 /////CUMULANT PHASE-FIELD
@@ -1462,6 +1512,23 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 			}
 		}
 	}
+
+	/*std::vector<double> doubleValuesArrayFtemp; // double-values (arrays of f's) in all blocks  Fdistribution
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->localDistributionsF->getDataVector().begin(),
+		*this->localDistributionsF->getDataVector().end());
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->nonLocalDistributionsF->getDataVector().begin(),
+		*this->nonLocalDistributionsF->getDataVector().end());
+	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->zeroDistributionsF->getDataVector().begin(),
+		*this->zeroDistributionsF->getDataVector().end());
+
+	for (int i = 0; i < doubleValuesArrayFtemp.size(); i++)
+	{
+		if (UbMath::isNaN(doubleValuesArrayFtemp[i]) || UbMath::isInfinity(doubleValuesArrayFtemp[i]))
+			std::cout << "doubleValuesArrayFtemp[i] is NAN  " << i << std::endl;
+	}*/
+
+	//std::cout << "MPIIOMigrationCoProcessor::readDataSet posle NAN ni4ego net" << std::endl;*/
+
 }
 //////////////////////////////////////////////////////////////////////////
 
-- 
GitLab


From cb0e2a5274c6fe04e0705440233f139c160f1bf4 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 1 Apr 2022 19:25:50 +0200
Subject: [PATCH 072/179] fix Viskomat setup

---
 apps/cpu/ViskomatXL/viskomat.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 45694a4e4..ad07752ed 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -363,12 +363,12 @@ void bflow(string configname)
       }
       else
       {
-         //restartCoProcessor->restart((int)restartStep);
+         restartCoProcessor->restart((int)restartStep);
          
-         restartCoProcessor->readBlocks((int)restartStep);
-         restartCoProcessor->readDataSet((int)restartStep);
-         //restartCoProcessor->readBoundaryConds((int)restartStep);
-         grid->setTimeStep((int)restartStep);
+         //restartCoProcessor->readBlocks((int)restartStep);
+         //restartCoProcessor->readDataSet((int)restartStep);
+         ////restartCoProcessor->readBoundaryConds((int)restartStep);
+         //grid->setTimeStep((int)restartStep);
          
          SetBcBlocksBlockVisitor v2(wallXmaxInt);
          grid->accept(v2);
@@ -413,7 +413,7 @@ void bflow(string configname)
       SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
       //writeMQCoProcessor->process(100);
 
-      SPtr<UbScheduler> forceSch(new UbScheduler(100));
+      SPtr<UbScheduler> forceSch(new UbScheduler(1000));
       SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm);
       fp->addInteractor(rotorInt);
       SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm);
-- 
GitLab


From 2d5b026e0450341bc450d1ab0085bd1940db01c7 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Sat, 2 Apr 2022 22:28:36 +0200
Subject: [PATCH 073/179] fix jet breakup setup and
 MultiphasePressureFilterLBMKernel

---
 apps/cpu/JetBreakup/JetBreakup.cfg            |  17 +-
 apps/cpu/JetBreakup/JetBreakup.cpp            |  72 +++---
 .../LBM/MultiphasePressureFilterLBMKernel.cpp | 237 ++++++++++++------
 3 files changed, 211 insertions(+), 115 deletions(-)

diff --git a/apps/cpu/JetBreakup/JetBreakup.cfg b/apps/cpu/JetBreakup/JetBreakup.cfg
index 426891d2c..8d39e8a73 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cfg
+++ b/apps/cpu/JetBreakup/JetBreakup.cfg
@@ -1,4 +1,4 @@
-pathname = d:/temp/JetBreakupBenchmark_D50
+pathname = d:/temp/JetBreakupBenchmark_D50_2
 #pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup
 pathGeo = d:/Projects/VirtualFluidsCombined/apps/cpu/Multiphase/backup
 #geoFile = JetBreakupR.ASCII.stl
@@ -12,17 +12,18 @@ availMem = 10e9
 blocknx = 10 10 10
 
 #Simulation
-uLB = 0.01 #inlet velocity
+case = 2
+U_LB = 0.01 #inlet velocity
 #uF2 = 0.0001
-Re = 10
-nuL =0.00016922169811320757# 1.0e-5 #!1e-2
-nuG =0.00016922169811320757# 1.16e-4 #!1e-2
-densityRatio = 24.579710144927535
-sigma = 1.7688679245283022e-07 
+#Re = 10
+#nuL =0.00016922169811320757# 1.0e-5 #!1e-2
+#nuG =0.00016922169811320757# 1.16e-4 #!1e-2
+#densityRatio = 24.579710144927535
+#sigma = 1.7688679245283022e-07 
 interfaceWidth = 5
 
 D = 0.0001 # m
-deltaXfactor = 50
+D_LB = 50
 
 contactAngle = 110.0
 phi_L = 0.0
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index 262eafca9..549748f23 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -27,7 +27,7 @@ void run(string configname)
         vector<int> blocknx = config.getVector<int>("blocknx");
         //vector<double> boundingBox = config.getVector<double>("boundingBox");
         // vector<double>  length = config.getVector<double>("length");
-        double uLB = config.getValue<double>("uLB");
+        double U_LB = config.getValue<double>("U_LB");
         // double uF2                         = config.getValue<double>("uF2");
         //double nuL = config.getValue<double>("nuL");
         //double nuG = config.getValue<double>("nuG");
@@ -36,7 +36,7 @@ void run(string configname)
         int interfaceWidth = config.getValue<int>("interfaceWidth");
         //double D          = config.getValue<double>("D");
         double theta = config.getValue<double>("contactAngle");
-        double deltaXfactor = config.getValue<double>("deltaXfactor");
+        double D_LB = config.getValue<double>("D_LB");
         double phiL = config.getValue<double>("phi_L");
         double phiH = config.getValue<double>("phi_H");
         double tauH = config.getValue<double>("Phase-field Relaxation");
@@ -46,16 +46,15 @@ void run(string configname)
         double outTime = config.getValue<double>("outTime");
         double availMem = config.getValue<double>("availMem");
         //int refineLevel = config.getValue<int>("refineLevel");
-        double Re = config.getValue<double>("Re");
-        double dx = D/deltaXfactor;
+        //double Re = config.getValue<double>("Re");
+        
         bool logToFile = config.getValue<bool>("logToFile");
         double restartStep = config.getValue<double>("restartStep");
         double cpStart = config.getValue<double>("cpStart");
         double cpStep = config.getValue<double>("cpStep");
         bool newStart = config.getValue<bool>("newStart");
 
-        double beta = 12 * sigma / interfaceWidth;
-        double kappa = 1.5 * interfaceWidth * sigma;
+
 
         int caseN = config.getValue<int>("case");
 
@@ -123,9 +122,39 @@ void run(string configname)
                 break;
         }
 
+        double Re = rho_h * Uo * D / mu_h;
+        double We = rho_h * Uo * Uo * D / sigma;
+
+        double dx = D / D_LB;
+        double nu_h = U_LB * D_LB / Re;
+        double nu_l = nu_h;
+
+        double rho_h_LB = 1;
+        //surface tension
+        double sigma_LB = rho_h_LB * U_LB * U_LB * D_LB / We;
+
         // LBMReal dLB = 0; // = length[1] / dx;
         LBMReal rhoLB = 0.0;
-        LBMReal nuLB = nuL; //(uLB*dLB) / Re;
+        LBMReal nuLB = nu_l; //(uLB*dLB) / Re;
+
+        double beta = 12.0 * sigma_LB / interfaceWidth;
+        double kappa = 1.5 * interfaceWidth * sigma_LB;
+
+        if (myid == 0) {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "U_LB = " << U_LB);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nu_l = " << nu_l);
+            UBLOG(logINFO, "nu_h = " << nu_h);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "We = " << We);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "sigma = " << sigma);
+            UBLOG(logINFO, "density ratio = " << r_rho);
+            // UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+        }
 
         SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
 
@@ -152,8 +181,8 @@ void run(string configname)
 
         // nuL, nuG, densityRatio, beta, kappa, theta,
 
-        kernel->setCollisionFactorMultiphase(nuL, nuG);
-        kernel->setDensityRatio(densityRatio);
+        kernel->setCollisionFactorMultiphase(nu_h, nu_l);
+        kernel->setDensityRatio(r_rho);
         kernel->setMultiphaseModelParameters(beta, kappa);
         kernel->setContactAngle(theta);
         kernel->setInterfaceWidth(interfaceWidth);
@@ -201,7 +230,7 @@ void run(string configname)
 
         mu::Parser fctF2;
         fctF2.SetExpr("vy1");
-        fctF2.DefineConst("vy1", uLB);
+        fctF2.DefineConst("vy1", U_LB);
 
         double startTime = 30;
         SPtr<BCAdapter> velBCAdapterF1(
@@ -305,11 +334,6 @@ void run(string configname)
             // double blockLength = blocknx[0] * dx;
 
             if (myid == 0) {
-                UBLOG(logINFO, "uLb = " << uLB);
-                UBLOG(logINFO, "rho = " << rhoLB);
-                UBLOG(logINFO, "nuLb = " << nuLB);
-                UBLOG(logINFO, "Re = " << Re);
-                UBLOG(logINFO, "dx = " << dx);
                 UBLOG(logINFO, "Preprocess - start");
             }
 
@@ -426,7 +450,7 @@ void run(string configname)
                 UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
             }
 
-            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem);
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h, nu_l, availMem, needMem);
 
             grid->accept(kernelVisitor);
 
@@ -499,25 +523,13 @@ void run(string configname)
             if (myid == 0)
                 UBLOG(logINFO, "Preprocess - end");
         } else {
-            if (myid == 0) {
-                UBLOG(logINFO, "Parameters:");
-                UBLOG(logINFO, "uLb = " << uLB);
-                UBLOG(logINFO, "rho = " << rhoLB);
-                UBLOG(logINFO, "nuLb = " << nuLB);
-                UBLOG(logINFO, "Re = " << Re);
-                UBLOG(logINFO, "dx = " << dx);
-                //UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-                UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-                UBLOG(logINFO, "path = " << pathname);
-            }
-
             rcp->restart((int)restartStep);
             grid->setTimeStep(restartStep);
 
             if (myid == 0)
                 UBLOG(logINFO, "Restart - end");
         }
-
+        
         //  TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
         //  grid->accept(setConnsVisitor);
 
@@ -532,7 +544,7 @@ void run(string configname)
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
         double t_ast, t;
         t_ast = 7.19;
-        t = (int)(t_ast/(uLB/(deltaXfactor)));
+        t = (int)(t_ast/(U_LB/(D_LB)));
         visSch->addSchedule(t,t,t); //t=7.19
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index df437b553..7372beed5 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -156,21 +156,6 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
 	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
 
-
-	/*std::vector<double> doubleValuesArrayFtemp; // double-values (arrays of f's) in all blocks  Fdistribution
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), localDistributionsF->getDataVector().begin(), localDistributionsF->getDataVector().end());
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), nonLocalDistributionsF->getDataVector().begin(), nonLocalDistributionsF->getDataVector().end());
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), zeroDistributionsF->getDataVector().begin(), zeroDistributionsF->getDataVector().end());
-
-	for (int i = 0; i < doubleValuesArrayFtemp.size(); i++)
-	{
-		if (UbMath::isNaN(doubleValuesArrayFtemp[i]) || UbMath::isInfinity(doubleValuesArrayFtemp[i]))
-			std::cout << "doubleValuesArrayFtemp[i] is NAN  " << i << std::endl;
-	}*/
-	//std::cout << "localDistributionsF=" << localDistributionsF->getNX1() << " " << localDistributionsF->getNX2() << " " << localDistributionsF->getNX3() << " " << localDistributionsF->getNX4() << std::endl;
-	//std::cout << "nonLocalDistributionsF=" << nonLocalDistributionsF->getNX1() << " " << nonLocalDistributionsF->getNX2() << " " << nonLocalDistributionsF->getNX3() << " " << nonLocalDistributionsF->getNX4() << std::endl;
-	//std::cout << "zeroDistributionsF=" << zeroDistributionsF->getNX1() << " " << zeroDistributionsF->getNX2() << " " << zeroDistributionsF->getNX3() << std::endl;
-
 	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
@@ -186,12 +171,6 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
 	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
 
-//	std::cout << "MultiphasePressureFilterLBMKernel::calculate bcArrayMaxX1=" << bcArrayMaxX1 << " , bcArrayMaxX2=" << bcArrayMaxX2 << ", bcArrayMaxX3=" << bcArrayMaxX3 << std::endl;
-//	std::cout << "MultiphasePressureFilterLBMKernel::calculate minX1=" << minX1 << " , minX2=" << minX2 << ", minX3=" << minX3 << std::endl;
-//	std::cout << "MultiphasePressureFilterLBMKernel::calculate maxX1=" << maxX1 << " , maxX2=" << maxX2 << ", maxX3=" << maxX3 << std::endl;
-//	std::cout << "dataSetParamStr1=" << localDistributionsF->getNX1() << " " << localDistributionsF->getNX2() << " " << localDistributionsF->getNX3() << " " << localDistributionsF->getNX4() << std::endl;
-//	std::cout << "nx=" << dataSet->getFdistributions()->getNX1() << " " << dataSet->getFdistributions()->getNX2() << " " << dataSet->getFdistributions()->getNX3() << std::endl;
-
 	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
 		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
 			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
@@ -263,34 +242,6 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
 
 					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
-					
-					/*if (UbMath::isNaN(mfcbb) || UbMath::isInfinity(mfcbb)) std::cout << "mfcbb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbcb) || UbMath::isInfinity(mfbcb)) std::cout << "mfbcb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbbc) || UbMath::isInfinity(mfbbc)) std::cout << "mfbbc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfccb) || UbMath::isInfinity(mfccb)) std::cout << "mfccb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfacb) || UbMath::isInfinity(mfacb)) std::cout << "mfacb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcbc) || UbMath::isInfinity(mfcbc)) std::cout << "mfcbc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfabc) || UbMath::isInfinity(mfabc)) std::cout << "mfabc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbcc) || UbMath::isInfinity(mfbcc)) std::cout << "mfbcc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbac) || UbMath::isInfinity(mfbac)) std::cout << "mfbac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfccc) || UbMath::isInfinity(mfccc)) std::cout << "mfccc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfacc) || UbMath::isInfinity(mfacc)) std::cout << "mfacc is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcac) || UbMath::isInfinity(mfcac)) std::cout << "mfcac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfaac) || UbMath::isInfinity(mfaac)) std::cout << "mfaac is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfabb) || UbMath::isInfinity(mfabb)) std::cout << "mfabb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbab) || UbMath::isInfinity(mfbab)) std::cout << "mfbab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbba) || UbMath::isInfinity(mfbba)) std::cout << "mfbba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfaab) || UbMath::isInfinity(mfaab)) std::cout << "mfaab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcab) || UbMath::isInfinity(mfcab)) std::cout << "mfcab is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfaba) || UbMath::isInfinity(mfaba)) std::cout << "mfaba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcba) || UbMath::isInfinity(mfcba)) std::cout << "mfcba is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbaa) || UbMath::isInfinity(mfbaa)) std::cout << "mfbaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbca) || UbMath::isInfinity(mfbca)) std::cout << "mfbca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfaaa) || UbMath::isInfinity(mfaaa)) std::cout << "mfaaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcaa) || UbMath::isInfinity(mfcaa)) std::cout << "mfcaa is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfaca) || UbMath::isInfinity(mfaca)) std::cout << "mfaca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfcca) || UbMath::isInfinity(mfcca)) std::cout << "mfcca is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;
-					if (UbMath::isNaN(mfbbb) || UbMath::isInfinity(mfbbb)) std::cout << "mfbbb is NAN  " << x1 << " " << x2 << " " << x3 << std::endl;*/
 
 					LBMReal rhoH = 1.0;
 					LBMReal rhoL = 1.0 / densityRatio;
@@ -349,7 +300,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 	}
 
 	////!filter
-	//bool firstTime = true;
+
 	for (int x3 = minX3; x3 < maxX3; x3++) {
 		for (int x2 = minX2; x2 < maxX2; x2++) {
 			for (int x1 = minX1; x1 < maxX1; x1++) {
@@ -525,6 +476,124 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					vvy += mu * dX2_phi * c1o2 / rho ;
 					vvz += mu * dX3_phi * c1o2 / rho;
 
+					//Abbas
+					LBMReal pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+
+					LBMReal M200 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba))))
+						+ ((mfabb + mfcbb))));
+					LBMReal M020 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ((mfbab + mfbcb))));
+					LBMReal M002 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (+((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ((mfbba + mfbbc))));
+
+					LBMReal M110 = ((((((mfaaa + mfccc) + (-mfcac - mfaca)) + ((mfaac + mfcca) + (-mfcaa - mfacc)))
+						+ (((mfaab + mfccb) + (-mfacb - mfcab))))
+						));
+					LBMReal M101 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcac + mfaca) - (mfcaa + mfacc)))
+						+ (((mfaba + mfcbc) + (-mfabc - mfcba))))
+						));
+					LBMReal M011 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcaa + mfacc) - (mfcac + mfaca)))
+						+ (((mfbaa + mfbcc) + (-mfbac - mfbca))))
+						));
+					LBMReal vvxI = vvx;
+					LBMReal vvyI = vvy;
+					LBMReal vvzI = vvz;
+
+					LBMReal collFactorStore = collFactorM;
+					LBMReal stress;
+					for (int iter = 0; iter < 1; iter++) {
+						LBMReal OxxPyyPzz = 1.0;
+						LBMReal mxxPyyPzz = (M200 - vvxI * vvxI) + (M020 - vvyI * vvyI) + (M002 - vvzI * vvzI);
+						mxxPyyPzz -= c3 * pStar;
+
+						LBMReal mxxMyy = (M200 - vvxI * vvxI) - (M020 - vvyI * vvyI);
+						LBMReal mxxMzz = (M200 - vvxI * vvxI) - (M002 - vvzI * vvzI);
+						LBMReal mxy = M110 - vvxI * vvyI;
+						LBMReal mxz = M101 - vvxI * vvzI;
+						LBMReal myz = M011 - vvyI * vvzI;
+
+						///////Bingham
+						//LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+						//LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy;
+						//LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz;
+						//LBMReal Dxy = -three * collFactorM * mxy;
+						//LBMReal Dxz = -three * collFactorM * mxz;
+						//LBMReal Dyz = -three * collFactorM * myz;
+
+						//LBMReal tau0 = phi[REST] * 1.0e-7;//(phi[REST]>0.01)?1.0e-6: 0;
+						//LBMReal shearRate =fabs(pStar)*0.0e-2+ sqrt(c2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz) / (rho);
+						//collFactorM = collFactorM * (UbMath::one - (collFactorM * tau0) / (shearRate * c1o3 /* *rho*/ + 1.0e-15));
+						//collFactorM = (collFactorM < -1000000) ? -1000000 : collFactorM;
+						////if(collFactorM < 0.1) {
+						////	int test = 1;
+						////}
+						//////!Bingham
+
+
+						mxxMyy *= c1 - collFactorM * c1o2;
+						mxxMzz *= c1 - collFactorM * c1o2;
+						mxy *= c1 - collFactorM * c1o2;
+						mxz *= c1 - collFactorM * c1o2;
+						myz *= c1 - collFactorM * c1o2;
+						mxxPyyPzz *= c1 - OxxPyyPzz * c1o2;
+						//mxxPyyPzz += c3 * pStar;
+						LBMReal mxx = (mxxMyy + mxxMzz + mxxPyyPzz) * c1o3;
+						LBMReal myy = (-c2 * mxxMyy + mxxMzz + mxxPyyPzz) * c1o3;
+						LBMReal mzz = (mxxMyy - c2 * mxxMzz + mxxPyyPzz) * c1o3;
+						vvxI = vvx - (mxx * dX1_phi + mxy * dX2_phi + mxz * dX3_phi) * rhoToPhi / (rho);
+						vvyI = vvy - (mxy * dX1_phi + myy * dX2_phi + myz * dX3_phi) * rhoToPhi / (rho);
+						vvzI = vvz - (mxz * dX1_phi + myz * dX2_phi + mzz * dX3_phi) * rhoToPhi / (rho);
+
+
+
+					}
+
+
+					forcingX1 += c2 * (vvxI - vvx);
+					forcingX2 += c2 * (vvyI - vvy);
+					forcingX3 += c2 * (vvzI - vvz);
+
+					mfabb += c1o2 * (-forcingX1) * c2o9;
+					mfbab += c1o2 * (-forcingX2) * c2o9;
+					mfbba += c1o2 * (-forcingX3) * c2o9;
+					mfaab += c1o2 * (-forcingX1 - forcingX2) * c1o18;
+					mfcab += c1o2 * (forcingX1 - forcingX2) * c1o18;
+					mfaba += c1o2 * (-forcingX1 - forcingX3) * c1o18;
+					mfcba += c1o2 * (forcingX1 - forcingX3) * c1o18;
+					mfbaa += c1o2 * (-forcingX2 - forcingX3) * c1o18;
+					mfbca += c1o2 * (forcingX2 - forcingX3) * c1o18;
+					mfaaa += c1o2 * (-forcingX1 - forcingX2 - forcingX3) * c1o72;
+					mfcaa += c1o2 * (forcingX1 - forcingX2 - forcingX3) * c1o72;
+					mfaca += c1o2 * (-forcingX1 + forcingX2 - forcingX3) * c1o72;
+					mfcca += c1o2 * (forcingX1 + forcingX2 - forcingX3) * c1o72;
+					mfcbb += c1o2 * (forcingX1)*c2o9;
+					mfbcb += c1o2 * (forcingX2)*c2o9;
+					mfbbc += c1o2 * (forcingX3)*c2o9;
+					mfccb += c1o2 * (forcingX1 + forcingX2) * c1o18;
+					mfacb += c1o2 * (-forcingX1 + forcingX2) * c1o18;
+					mfcbc += c1o2 * (forcingX1 + forcingX3) * c1o18;
+					mfabc += c1o2 * (-forcingX1 + forcingX3) * c1o18;
+					mfbcc += c1o2 * (forcingX2 + forcingX3) * c1o18;
+					mfbac += c1o2 * (-forcingX2 + forcingX3) * c1o18;
+					mfccc += c1o2 * (forcingX1 + forcingX2 + forcingX3) * c1o72;
+					mfacc += c1o2 * (-forcingX1 + forcingX2 + forcingX3) * c1o72;
+					mfcac += c1o2 * (forcingX1 - forcingX2 + forcingX3) * c1o72;
+					mfaac += c1o2 * (-forcingX1 - forcingX2 + forcingX3) * c1o72;
+
+
+
+					vvx = vvxI;
+					vvy = vvyI;
+					vvz = vvzI;
+
+					//!Abbas
+
+
 					LBMReal vx2;
 					LBMReal vy2;
 					LBMReal vz2;
@@ -807,7 +876,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 
 					LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
 					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
-					//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+					LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
@@ -897,7 +966,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					LBMReal mxyyMxzz = mfbca - mfbac;
 
 					//relax
-					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+					wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
 					mfbbb += wadjust * (-mfbbb);
 					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
 					mxxyPyzz += wadjust * (-mxxyPyzz);
@@ -974,13 +1043,13 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 
 					////////////////////////////////////////////////////////////////////////////////////
 					//forcing
-					mfbaa = -mfbaa;
-					mfaba = -mfaba;
-					mfaab = -mfaab;
+					//mfbaa = -mfbaa;
+					//mfaba = -mfaba;
+					//mfaab = -mfaab;
 					//////////////////////////////////////////////////////////////////////////////////////
-					mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
-					mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
-					mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
+					//mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+					//mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+					//mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
 					////////////////////////////////////////////////////////////////////////////////////
 					//back
 					////////////////////////////////////////////////////////////////////////////////////
@@ -1190,6 +1259,38 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					mfbcc = m1;
 					mfccc = m2;
 
+					////forcing
+
+					mfabb += c1o2 * (-forcingX1) * c2o9;
+					mfbab += c1o2 * (-forcingX2) * c2o9;
+					mfbba += c1o2 * (-forcingX3) * c2o9;
+					mfaab += c1o2 * (-forcingX1 - forcingX2) * c1o18;
+					mfcab += c1o2 * (forcingX1 - forcingX2) * c1o18;
+					mfaba += c1o2 * (-forcingX1 - forcingX3) * c1o18;
+					mfcba += c1o2 * (forcingX1 - forcingX3) * c1o18;
+					mfbaa += c1o2 * (-forcingX2 - forcingX3) * c1o18;
+					mfbca += c1o2 * (forcingX2 - forcingX3) * c1o18;
+					mfaaa += c1o2 * (-forcingX1 - forcingX2 - forcingX3) * c1o72;
+					mfcaa += c1o2 * (forcingX1 - forcingX2 - forcingX3) * c1o72;
+					mfaca += c1o2 * (-forcingX1 + forcingX2 - forcingX3) * c1o72;
+					mfcca += c1o2 * (forcingX1 + forcingX2 - forcingX3) * c1o72;
+					mfcbb += c1o2 * (forcingX1)*c2o9;
+					mfbcb += c1o2 * (forcingX2)*c2o9;
+					mfbbc += c1o2 * (forcingX3)*c2o9;
+					mfccb += c1o2 * (forcingX1 + forcingX2) * c1o18;
+					mfacb += c1o2 * (-forcingX1 + forcingX2) * c1o18;
+					mfcbc += c1o2 * (forcingX1 + forcingX3) * c1o18;
+					mfabc += c1o2 * (-forcingX1 + forcingX3) * c1o18;
+					mfbcc += c1o2 * (forcingX2 + forcingX3) * c1o18;
+					mfbac += c1o2 * (-forcingX2 + forcingX3) * c1o18;
+					mfccc += c1o2 * (forcingX1 + forcingX2 + forcingX3) * c1o72;
+					mfacc += c1o2 * (-forcingX1 + forcingX2 + forcingX3) * c1o72;
+					mfcac += c1o2 * (forcingX1 - forcingX2 + forcingX3) * c1o72;
+					mfaac += c1o2 * (-forcingX1 - forcingX2 + forcingX3) * c1o72;
+
+
+
+
 					//////////////////////////////////////////////////////////////////////////
 					//proof correctness
 					//////////////////////////////////////////////////////////////////////////
@@ -1249,8 +1350,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac   ;//* rho * c1o3;
 
 					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
-									
-																			// !Old Kernel
+																																		// !Old Kernel
 /////////////////////  P H A S E - F I E L D   S O L V E R
 ////////////////////////////////////////////
 /////CUMULANT PHASE-FIELD
@@ -1512,23 +1612,6 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 			}
 		}
 	}
-
-	/*std::vector<double> doubleValuesArrayFtemp; // double-values (arrays of f's) in all blocks  Fdistribution
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->localDistributionsF->getDataVector().begin(),
-		*this->localDistributionsF->getDataVector().end());
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->nonLocalDistributionsF->getDataVector().begin(),
-		*this->nonLocalDistributionsF->getDataVector().end());
-	doubleValuesArrayFtemp.insert(doubleValuesArrayFtemp.end(), *this->zeroDistributionsF->getDataVector().begin(),
-		*this->zeroDistributionsF->getDataVector().end());
-
-	for (int i = 0; i < doubleValuesArrayFtemp.size(); i++)
-	{
-		if (UbMath::isNaN(doubleValuesArrayFtemp[i]) || UbMath::isInfinity(doubleValuesArrayFtemp[i]))
-			std::cout << "doubleValuesArrayFtemp[i] is NAN  " << i << std::endl;
-	}*/
-
-	//std::cout << "MPIIOMigrationCoProcessor::readDataSet posle NAN ni4ego net" << std::endl;*/
-
 }
 //////////////////////////////////////////////////////////////////////////
 
-- 
GitLab


From 4cafd7efd69a500bed66eaea8a186e6248ef2d1e Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin2.usr.hlrn.de>
Date: Sat, 2 Apr 2022 22:39:10 +0200
Subject: [PATCH 074/179] fix rising bubble

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 3bafc5948..1c2b551ee 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -25,7 +25,7 @@ void run(string configname)
         double nuL             = config.getValue<double>("nuL");
         double nuG             = config.getValue<double>("nuG");
         double densityRatio    = config.getValue<double>("densityRatio");
-        double sigma           = config.getValue<double>("sigma");
+        //double sigma           = config.getValue<double>("sigma");
         int interfaceThickness = config.getValue<int>("interfaceThickness");
         double radius          = config.getValue<double>("radius");
         double theta           = config.getValue<double>("contactAngle");
@@ -113,7 +113,7 @@ void run(string configname)
         //Eotvos number
         //LBMReal Eo = 100;
         //surface tension
-        sigma = rho_h * g_y * D * D / Eo;
+        LBMReal sigma = rho_h * g_y * D * D / Eo;
 
         //g_y = 0;
 
@@ -174,7 +174,7 @@ void run(string configname)
         SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
         SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
+        slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm()));
         //////////////////////////////////////////////////////////////////////////////////
         // BC visitor
         MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
@@ -194,8 +194,8 @@ void run(string configname)
         //////////////////////////////////////////////////////////////////////////
         // restart
         SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-        //SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
-        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        //SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
         //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
         // rcp->setNu(nuLB);
         // rcp->setNuLG(nuL, nuG);
@@ -238,8 +238,8 @@ void run(string configname)
             GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
             GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
 
-            SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID));
 
             SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
             SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
@@ -368,6 +368,8 @@ void run(string configname)
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+        //visSch->addSchedule(307200,307200,307200); //t=2 
+        visSch->addSchedule(1228185,1228185,1228185);
         //double t_ast, t;
         //t_ast = 2;
         //t = (int)(t_ast/std::sqrt(g_y/D));
@@ -391,6 +393,7 @@ void run(string configname)
         //t = (int)(t_ast/std::sqrt(g_y/D));         
         //visSch->addSchedule(t,t,t); //t=9
 
+
         SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
             grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
         if(grid->getTimeStep() == 0) 
@@ -399,7 +402,7 @@ void run(string configname)
         SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
         SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
 
-        omp_set_num_threads(numOfThreads);
+        //omp_set_num_threads(numOfThreads);
 
         SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
         SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-- 
GitLab


From 24fbc7b415ee1b1b88ea08b2d36c0afb3f874a36 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin2.usr.hlrn.de>
Date: Sat, 2 Apr 2022 22:47:40 +0200
Subject: [PATCH 075/179] fix rising bubble sutup

---
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 9001b64f0..536936d66 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -196,11 +196,7 @@ void run(string configname)
         SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
         SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
         //SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
-<<<<<<< HEAD
         //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
-=======
-        //SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, metisVisitor, pathname, comm));
->>>>>>> 2d5b026e0450341bc450d1ab0085bd1940db01c7
         // rcp->setNu(nuLB);
        //  rcp->setNuLG(nuL, nuG);
         //rcp->setDensityRatio(densityRatio);
-- 
GitLab


From 23894b6bcd2db9abb166fd829af0e6ced28f3eb1 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 5 Apr 2022 15:10:09 +0200
Subject: [PATCH 076/179] Corrected stress correction and a different way to
 implement the force externally from the kernel. Initial conditions for jet.

---
 apps/cpu/JetBreakup/JetBreakup.cfg              |  4 ++--
 apps/cpu/JetBreakup/JetBreakup.cpp              | 17 ++++++++++++++---
 .../LBM/MultiphasePressureFilterLBMKernel.cpp   | 16 +++++++++++-----
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/apps/cpu/JetBreakup/JetBreakup.cfg b/apps/cpu/JetBreakup/JetBreakup.cfg
index 8d39e8a73..1b0638fdb 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cfg
+++ b/apps/cpu/JetBreakup/JetBreakup.cfg
@@ -9,7 +9,7 @@ numOfThreads = 4
 availMem = 10e9
 
 #Grid
-blocknx = 10 10 10
+blocknx = 20 25 25
 
 #Simulation
 case = 2
@@ -40,5 +40,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 1000
+outTime = 100
 endTime = 36000
\ No newline at end of file
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index 549748f23..4ebc8e814 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -462,10 +462,21 @@ void run(string configname)
             intHelper.setBC();
 
             // initialization of distributions
+            //mu::Parser fct1;
+            //fct1.SetExpr("phiL");
+            //fct1.DefineConst("phiL", phiL);
+            LBMReal x1c = 0;  // (g_maxX1 - g_minX1-1)/2; //
+            LBMReal x2c = (g_maxX2 - g_minX2)/2;
+            LBMReal x3c = (g_maxX3 - g_minX3)/2;
+            
             mu::Parser fct1;
-            fct1.SetExpr("phiL");
-            fct1.DefineConst("phiL", phiL);
-            // MultiphaseInitDistributionsBlockVisitor initVisitor(interfaceThickness);
+            fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)");
+            fct1.DefineConst("x1c", x1c);
+            fct1.DefineConst("x2c", x2c);
+            fct1.DefineConst("x3c", x3c);
+            fct1.DefineConst("radius", 0.5*D);
+            fct1.DefineConst("interfaceThickness", interfaceWidth*dx);
+
             MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
             initVisitor.setPhi(fct1);
             grid->accept(initVisitor);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 7372beed5..64b3cf168 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -375,7 +375,9 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					LBMReal normX2 = dX2_phi / denom;
 					LBMReal normX3 = dX3_phi / denom;
 
-
+					dX1_phi = normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+                    dX2_phi = normX2 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+                    dX3_phi = normX3 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
 
 					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
 
@@ -467,14 +469,18 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					forcingX2 = muForcingX2.Eval()/rho - gradPy/rho;
 					forcingX3 = muForcingX3.Eval()/rho - gradPz/rho;
 
+					forcingX1 += mu * dX1_phi / rho;
+                    forcingX2 += mu * dX2_phi / rho;
+                    forcingX3 += mu * dX3_phi / rho;
+
 					vvx += forcingX1 * deltaT * 0.5; // X
 					vvy += forcingX2 * deltaT * 0.5; // Y
 					vvz += forcingX3 * deltaT * 0.5; // Z
 
                     ///surface tension force
-					vvx += mu * dX1_phi * c1o2 / rho;
-					vvy += mu * dX2_phi * c1o2 / rho ;
-					vvz += mu * dX3_phi * c1o2 / rho;
+					//vvx += mu * dX1_phi * c1o2 / rho;
+					//vvy += mu * dX2_phi * c1o2 / rho ;
+					//vvz += mu * dX3_phi * c1o2 / rho;
 
 					//Abbas
 					LBMReal pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
@@ -541,7 +547,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 						mxz *= c1 - collFactorM * c1o2;
 						myz *= c1 - collFactorM * c1o2;
 						mxxPyyPzz *= c1 - OxxPyyPzz * c1o2;
-						//mxxPyyPzz += c3 * pStar;
+						//mxxPyyPzz += c3o2 * pStar;
 						LBMReal mxx = (mxxMyy + mxxMzz + mxxPyyPzz) * c1o3;
 						LBMReal myy = (-c2 * mxxMyy + mxxMzz + mxxPyyPzz) * c1o3;
 						LBMReal mzz = (mxxMyy - c2 * mxxMzz + mxxPyyPzz) * c1o3;
-- 
GitLab


From ca34ed6118cd9a6ad21ab121d273e93eb82e1fa3 Mon Sep 17 00:00:00 2001
From: niikonst <niikonst@blogin4.usr.hlrn.de>
Date: Wed, 4 May 2022 10:23:32 +0200
Subject: [PATCH 077/179] fix Viskomat XL setup for Non-Newtonian fluid

---
 apps/cpu/ViskomatXL/viskomat.cpp | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index ad07752ed..983ecb06c 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -69,15 +69,19 @@ void bflow(string configname)
 
       //double nuLB = OmegaLB * R * 1e3 * R * 1e3 / Re;
 
-      // double dx = deltax * 1e-3;
-      // double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
-
-      double dx = 1.0 * 1e-3;
+      double dx = deltax * 1e-3;
       double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
 
+      double Bm = tau0/(mu*Omega);
+      double tau0LB = Bm*nuLB*OmegaLB;
+
+
+      //double dx = 1.0 * 1e-3;
+      //double nuLB = OmegaLB * (R / dx)*(R / dx) / Re;
+
       //acustic scaling
-      OmegaLB /= 2.0;
-      nuLB    *= 2.0;
+      // OmegaLB /= 2.0;
+      // nuLB    *= 2.0;
 
       SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
       //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(1, 1461, 970, 1e3));
@@ -97,13 +101,13 @@ void bflow(string configname)
       SPtr<Rheology> thix = Rheology::getInstance();
       //thix->setPowerIndex(n);
       //thix->setViscosityParameter(k);
-      thix->setYieldStress(tau0);
+      thix->setYieldStress(tau0LB);
       //thix->setOmegaMin(omegaMin);
 
       SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
       noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
       //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm()));
-      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm()));
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm()));
 
       SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
       slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm()));
@@ -167,8 +171,8 @@ void bflow(string configname)
       //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel());
       //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
       //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); 
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); 
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel());
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); 
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel());
       //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel());
       //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BinghamModelLBMKernel());
       kernel->setBCProcessor(bcProc);
@@ -265,11 +269,14 @@ void bflow(string configname)
          UBLOG(logINFO, "N = " << N << " rpm");
          UBLOG(logINFO, "Omega = " << Omega << " rad/s");
          UBLOG(logINFO, "mu = " << mu << " Pa s");
+         UBLOG(logINFO, "tau0 = " << tau0<< " Pa");
+         UBLOG(logINFO, "rho = " << rho<< " kg/m^3");
          UBLOG(logINFO, "Re = " << Re);
-         UBLOG(logINFO, "rho = " << rhoLB);
+         UBLOG(logINFO, "Bm = " << Bm);
+         UBLOG(logINFO, "rhoLB = " << rhoLB);
          UBLOG(logINFO, "uLB = " << OmegaLB);
          UBLOG(logINFO, "nuLB = " << nuLB);
-         UBLOG(logINFO, "tau0 = " << tau0);
+         UBLOG(logINFO, "tau0LB = " << tau0LB);
          UBLOG(logINFO, "deltax = " << deltax << " mm");
          UBLOG(logINFO, "number of levels = " << refineLevel + 1);
          UBLOG(logINFO, "number of threads = " << numOfThreads);
-- 
GitLab


From 7c54ec1c38b64c37bff12b57b00f1cdd6d6b711c Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 12 Jul 2022 10:55:11 +0200
Subject: [PATCH 078/179] doesn't work, first try

---
 apps/cpu/PoiseuilleFlow/pf1.cpp               | 24 ++---
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp | 14 ++-
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.h   | 90 ++++++++++++-------
 .../Visitors/SetConnectorsBlockVisitor.h      |  2 +-
 src/lbm/constants/D3Q27.h                     | 82 +++++++++++++++++
 5 files changed, 164 insertions(+), 48 deletions(-)

diff --git a/apps/cpu/PoiseuilleFlow/pf1.cpp b/apps/cpu/PoiseuilleFlow/pf1.cpp
index 25f86a206..99600ceb9 100644
--- a/apps/cpu/PoiseuilleFlow/pf1.cpp
+++ b/apps/cpu/PoiseuilleFlow/pf1.cpp
@@ -11,7 +11,7 @@ void pf1()
    int myid = comm->getProcessID();
 
    //parameters
-   string          pathOut = "/gfs1/work/niikonst/pflow_pipe_forcing";
+   string          pathOut = "d:/temp/test_dir_naming";  //"/gfs1/work/niikonst/pflow_pipe_forcing";
    int             numOfThreads = 1;
    int             blocknx[3] ={ 10,10,10 };
    double          endTime = 10;
@@ -27,12 +27,12 @@ void pf1()
 
    //simulation bounding box
    double g_minX1 = 0.0;
-   double g_minX2 = -50.0;
-   double g_minX3 = -50.0;
+   double g_minX2 = -10.0;
+   double g_minX3 = -10.0;
 
-   double g_maxX1 = 2000;
-   double g_maxX2 = 50;
-   double g_maxX3 = 50;
+   double g_maxX1 = 50;
+   double g_maxX2 = 10;
+   double g_maxX3 = 10;
 
    //Sleep(15000);
 
@@ -169,11 +169,11 @@ void pf1()
 
    //grid=SPtr<Grid3D>(new Grid3D(comm));
    //restartCoProcessor->restart(200);
-   SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, metisVisitor, pathOut + "/mig", comm));
-   migCoProcessor->setLBMKernel(kernel);
-   migCoProcessor->setBCProcessor(bcProc);
-   migCoProcessor->setNu(nuLB);
-   migCoProcessor->restart(10);
+   //SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, metisVisitor, pathOut + "/mig", comm));
+   //migCoProcessor->setLBMKernel(kernel);
+   //migCoProcessor->setBCProcessor(bcProc);
+   //migCoProcessor->setNu(nuLB);
+   //migCoProcessor->restart(10);
 
    ppblocks->process(1);
 
@@ -192,7 +192,7 @@ void pf1()
    SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
    calculator->addCoProcessor(npr);
    calculator->addCoProcessor(writeMQCoProcessor);
-   calculator->addCoProcessor(migCoProcessor);
+   //calculator->addCoProcessor(migCoProcessor);
    //calculator->addCoProcessor(restartCoProcessor);
 
    if (myid == 0) UBLOG(logINFO, "Simulation-start");
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
index 105603b35..b82616cbc 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
@@ -6,11 +6,17 @@ namespace D3Q27System
 {
 using namespace UbMath;
 
-// index            0   1   2   3   4   5  6   7   8   9   10  11  12  13  14  15  16  17  18  20  21  22  23  24  25  26
+// index            0   1   2   3   4   5  6   7   8   9   10  11  12  13  14  15  16  17   18  19  20  21  22  23  24  25
 // f:               E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
-const int DX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
-const int DX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
-const int DX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
+//const int DX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
+//const int DX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
+//const int DX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
+
+// index            0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18   19  20  21  22  23  24  25  26
+// f:             REST, E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
+const int DX1[] = { 0,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,   1, -1,  1, -1,  1, -1,  1, -1 };
+const int DX2[] = { 0,  0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,   1,  1, -1, -1,  1,  1, -1, -1 };
+const int DX3[] = { 0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,   1,  1,  1,  1, -1, -1, -1, -1 };
 
 const double WEIGTH[] = { c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c1o54,  c1o54,  c1o54,
                           c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
index 04fe8a819..edfb903c1 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
@@ -48,14 +48,14 @@ namespace D3Q27System
 {
 //////////////////////////////////////////////////////////////////////////
 // DIRECTION STUFF
-static const int FSTARTDIR = 0;
-static const int FENDDIR   = 25; // D3Q27
+static const int FSTARTDIR = 1;
+static const int FENDDIR   = 26; // D3Q27
 
 static const int STARTF = 0;
 static const int ENDF   = 26; // D3Q27
 
-static const int STARTDIR = 0;
-static const int ENDDIR   = 26; // all geometric directions
+static const int STARTDIR = 1; //0
+static const int ENDDIR   = 27;//26 // all geometric directions
 
 extern const int DX1[ENDDIR + 1];
 extern const int DX2[ENDDIR + 1];
@@ -64,33 +64,61 @@ extern const double WEIGTH[ENDDIR + 1];
 
 extern const double cNorm[3][ENDDIR];
 
-static const int E    = 0;
-static const int W    = 1;
-static const int N    = 2;
-static const int S    = 3;
-static const int T    = 4;
-static const int B    = 5;
-static const int NE   = 6;
-static const int SW   = 7;
-static const int SE   = 8;
-static const int NW   = 9;
-static const int TE   = 10;
-static const int BW   = 11;
-static const int BE   = 12;
-static const int TW   = 13;
-static const int TN   = 14;
-static const int BS   = 15;
-static const int BN   = 16;
-static const int TS   = 17;
-static const int TNE  = 18;
-static const int TNW  = 19;
-static const int TSE  = 20;
-static const int TSW  = 21;
-static const int BNE  = 22;
-static const int BNW  = 23;
-static const int BSE  = 24;
-static const int BSW  = 25;
-static const int REST = 26;
+//static const int E    = 0;
+//static const int W    = 1;
+//static const int N    = 2;
+//static const int S    = 3;
+//static const int T    = 4;
+//static const int B    = 5;
+//static const int NE   = 6;
+//static const int SW   = 7;
+//static const int SE   = 8;
+//static const int NW   = 9;
+//static const int TE   = 10;
+//static const int BW   = 11;
+//static const int BE   = 12;
+//static const int TW   = 13;
+//static const int TN   = 14;
+//static const int BS   = 15;
+//static const int BN   = 16;
+//static const int TS   = 17;
+//static const int TNE  = 18;
+//static const int TNW  = 19;
+//static const int TSE  = 20;
+//static const int TSW  = 21;
+//static const int BNE  = 22;
+//static const int BNW  = 23;
+//static const int BSE  = 24;
+//static const int BSW  = 25;
+//static const int REST = 26;
+
+static constexpr int REST = 0;
+static constexpr int E = 1;
+static constexpr int W = 2;
+static constexpr int N = 3;
+static constexpr int S = 4;
+static constexpr int T = 5;
+static constexpr int B = 6;
+static constexpr int NE = 7;
+static constexpr int SW = 8;
+static constexpr int SE = 9;
+static constexpr int NW = 10;
+static constexpr int TE = 11;
+static constexpr int BW = 12;
+static constexpr int BE = 13;
+static constexpr int TW = 14;
+static constexpr int TN = 15;
+static constexpr int BS = 16;
+static constexpr int BN = 17;
+static constexpr int TS = 18;
+static constexpr int TNE = 19;
+static constexpr int TNW = 20;
+static constexpr int TSE = 21;
+static constexpr int TSW = 22;
+static constexpr int BNE = 23;
+static constexpr int BNW = 24;
+static constexpr int BSE = 25;
+static constexpr int BSW = 26;
 
 static const int INV_E   = W;
 static const int INV_W   = E;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index f39a95afc..91f18e729 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -114,7 +114,7 @@ void SetConnectorsBlockVisitor<T1, T2>::setSameLevelConnectors(SPtr<Grid3D> grid
         int ix3   = block->getX3();
         int level = block->getLevel();
 
-        for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) {
+        for (int dir = D3Q27System::STARTDIR; dir < D3Q27System::ENDDIR; dir++) {
             SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
 
             if (neighBlock) {
diff --git a/src/lbm/constants/D3Q27.h b/src/lbm/constants/D3Q27.h
index 0b2cbfdd4..418038c35 100644
--- a/src/lbm/constants/D3Q27.h
+++ b/src/lbm/constants/D3Q27.h
@@ -64,6 +64,88 @@ static constexpr int PMM = 24;
 static constexpr int MMM = 25;
 static constexpr int ZZZ = 26;
 
+static constexpr int DIR_000 = 0;
+static constexpr int DIR_P00 = 1;
+static constexpr int DIR_M00 = 2;
+static constexpr int DIR_0P0 = 3;
+static constexpr int DIR_0M0 = 4;
+static constexpr int DIR_00P = 5;
+static constexpr int DIR_00M = 6;
+static constexpr int DIR_PP0 = 7;
+static constexpr int DIR_MM0 = 8;
+static constexpr int DIR_PM0 = 9;
+static constexpr int DIR_MP0 = 10;
+static constexpr int DIR_P0P = 11;
+static constexpr int DIR_M0M = 12;
+static constexpr int DIR_P0M = 13;
+static constexpr int DIR_M0P = 14;
+static constexpr int DIR_0PP = 15;
+static constexpr int DIR_0MM = 16;
+static constexpr int DIR_0PM = 17;
+static constexpr int DIR_0MP = 18;
+static constexpr int DIR_PPP = 19;
+static constexpr int DIR_MPP = 20;
+static constexpr int DIR_PMP = 21;
+static constexpr int DIR_MMP = 22;
+static constexpr int DIR_PPM = 23;
+static constexpr int DIR_MPM = 24;
+static constexpr int DIR_PMM = 25;
+static constexpr int DIR_MMM = 26;
+
+static constexpr int INV_P00 = DIR_M00;
+static constexpr int INV_M00 = DIR_P00;
+static constexpr int INV_0P0 = DIR_0M0;
+static constexpr int INV_0M0 = DIR_0P0;
+static constexpr int INV_00P = DIR_00M;
+static constexpr int INV_00M = DIR_00P;
+static constexpr int INV_PP0 = DIR_MM0;
+static constexpr int INV_MM0 = DIR_PP0;
+static constexpr int INV_PM0 = DIR_MP0;
+static constexpr int INV_MP0 = DIR_PM0;
+static constexpr int INV_P0P = DIR_M0M;
+static constexpr int INV_M0M = DIR_P0P;
+static constexpr int INV_P0M = DIR_M0P;
+static constexpr int INV_M0P = DIR_P0M;
+static constexpr int INV_0PP = DIR_0MM;
+static constexpr int INV_0MM = DIR_0PP;
+static constexpr int INV_0PM = DIR_0MP;
+static constexpr int INV_0MP = DIR_0PM;
+static constexpr int INV_PPP = DIR_MMM;
+static constexpr int INV_MPP = DIR_PMM;
+static constexpr int INV_PMP = DIR_MPM;
+static constexpr int INV_MMP = DIR_PPM;
+static constexpr int INV_PPM = DIR_MMP;
+static constexpr int INV_MPM = DIR_PMP;
+static constexpr int INV_PMM = DIR_MPP;
+static constexpr int INV_MMM = DIR_PPP;
+
+static constexpr int SGD_P00 = 0;
+static constexpr int SGD_M00 = 1;
+static constexpr int SGD_0P0 = 2;
+static constexpr int SGD_0M0 = 3;
+static constexpr int SGD_00P = 4;
+static constexpr int SGD_00M = 5;
+static constexpr int SGD_PP0 = 6;
+static constexpr int SGD_MM0 = 7;
+static constexpr int SGD_PM0 = 8;
+static constexpr int SGD_MP0 = 9;
+static constexpr int SGD_P0P = 10;
+static constexpr int SGD_M0M = 11;
+static constexpr int SGD_P0M = 12;
+static constexpr int SGD_M0P = 13;
+static constexpr int SGD_0PP = 14;
+static constexpr int SGD_0MM = 15;
+static constexpr int SGD_0PM = 16;
+static constexpr int SGD_0MP = 17;
+static constexpr int SGD_PPP = 18;
+static constexpr int SGD_MPP = 19;
+static constexpr int SGD_PMP = 20;
+static constexpr int SGD_MMP = 21;
+static constexpr int SGD_PPM = 22;
+static constexpr int SGD_MPM = 23;
+static constexpr int SGD_PMM = 24;
+static constexpr int SGD_MMM = 25;
+
 }
 }
 }
-- 
GitLab


From 8ee5798f9d99025c059d41e03dc84ce292a89985 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 13 Jul 2022 18:00:01 +0200
Subject: [PATCH 079/179] set REST=0, remove Grid3DSystem, rename REST to
 DIR_000

---
 apps/cpu/FlowAroundCylinder/cylinder.cfg      |   8 +-
 .../CoProcessors/MPIIORestartCoProcessor.cpp  |   2 +-
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |  22 +-
 .../OneDistributionFullVectorConnector.cpp    |   2 +-
 ...onsDoubleGhostLayerFullVectorConnector.cpp |   2 +-
 .../ThreeDistributionsFullVectorConnector.cpp |   2 +-
 ...onsDoubleGhostLayerFullVectorConnector.cpp |   2 +-
 .../TwoDistributionsFullVectorConnector.cpp   |   2 +-
 .../Data/D3Q27EsoTwist3DSoA.cpp               |   6 +-
 .../Data/D3Q27EsoTwist3DSplittedVector.cpp    |  20 +-
 .../Data/EsoTwistD3Q27System.cpp              |   2 +-
 .../Data/EsoTwistD3Q27System.h                |   2 +-
 src/cpu/VirtualFluidsCore/Grid/Block3D.cpp    |  10 +-
 src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp     | 142 +++++------
 .../VirtualFluidsCore/LBM/BGKLBMKernel.cpp    |  14 +-
 ...mpressibleOffsetInterpolationProcessor.cpp |   4 +-
 ...bleOffsetMomentsInterpolationProcessor.cpp |   4 +-
 ...etSquarePressureInterpolationProcessor.cpp |   4 +-
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp |  17 +-
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.h   | 230 +++++++++++++++++-
 ...mpressibleOffsetInterpolationProcessor.cpp |   4 +-
 .../LBM/InitDensityLBMKernel.cpp              |  10 +-
 .../LBM/LBMKernelETD3Q27BGK.cpp               |  12 +-
 .../LBM/MultiphaseCumulantLBMKernel.cpp       |  36 +--
 ...PressureFilterCompressibleAirLBMKernel.cpp |  36 +--
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |  40 +--
 .../MultiphaseScratchCumulantLBMKernel.cpp    |  50 ++--
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp |  56 ++---
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp |  42 ++--
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp |  42 ++--
 .../LBM/RheologyInterpolationProcessor.cpp    |   4 +-
 .../BoundaryConditionsBlockVisitor.cpp        |   6 +-
 .../ChangeBoundaryDensityBlockVisitor.cpp     |   4 +-
 .../Visitors/CheckRatioBlockVisitor.cpp       |   4 +-
 .../Visitors/GenBlocksGridVisitor.cpp         |   2 +-
 .../InitDistributionsBlockVisitor.cpp         |   6 +-
 .../InitDistributionsFromFileBlockVisitor.cpp |   4 +-
 ...tributionsWithInterpolationGridVisitor.cpp |   2 +-
 .../Visitors/InitThixotropyBlockVisitor.cpp   |   6 +-
 ...ltiphaseBoundaryConditionsBlockVisitor.cpp |   4 +-
 ...ultiphaseInitDistributionsBlockVisitor.cpp |  12 +-
 .../MultiphaseSetKernelBlockVisitor.cpp       |   8 +-
 ...ocityFormInitDistributionsBlockVisitor.cpp |  10 +-
 .../Visitors/OverlapBlockVisitor.cpp          |   4 +-
 .../Visitors/RatioBlockVisitor.cpp            |   4 +-
 .../Visitors/RatioSmoothBlockVisitor.cpp      |   4 +-
 .../Visitors/RenumberBlockVisitor.cpp         |   4 +-
 .../Visitors/RenumberGridVisitor.cpp          |   2 +-
 .../Visitors/SetBcBlocksBlockVisitor.cpp      |   4 +-
 .../Visitors/SetConnectorsBlockVisitor.h      |   4 +-
 .../Visitors/SetForcingBlockVisitor.cpp       |   8 +-
 ...SetInterpolationConnectorsBlockVisitor.cpp |   4 +-
 .../SetInterpolationDirsBlockVisitor.cpp      |   4 +-
 .../Visitors/SetKernelBlockVisitor.cpp        |   6 +-
 .../Visitors/SetSolidBlocksBlockVisitor.cpp   |   4 +-
 .../Visitors/SetSpongeLayerBlockVisitor.cpp   |   4 +-
 .../SetUndefinedNodesBlockVisitor.cpp         |   4 +-
 .../Visitors/SpongeLayerBlockVisitor.cpp      |   4 +-
 .../Visitors/ViscosityBlockVisitor.cpp        |   4 +-
 59 files changed, 592 insertions(+), 373 deletions(-)

diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cfg b/apps/cpu/FlowAroundCylinder/cylinder.cfg
index 0a7066ed9..97ece40e6 100644
--- a/apps/cpu/FlowAroundCylinder/cylinder.cfg
+++ b/apps/cpu/FlowAroundCylinder/cylinder.cfg
@@ -1,6 +1,6 @@
-pathOut = d:/temp/cylinder_test
+pathOut = d:/temp/cylinder_test_naming
 
-numOfThreads = 4
+numOfThreads = 8
 availMem = 15e9
 refineLevel = 0
 blockNx = 25 41 41
@@ -16,7 +16,7 @@ restartStep = 1000
 cpStart = 1000
 cpStep = 1000
 
-outTime = 10000
-endTime = 100000
+outTime = 10
+endTime = 100
 
 nupsStep = 100 100 10000000
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
index b7e4d4b9a..ea45bb141 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp
@@ -9,7 +9,7 @@
 #include "D3Q27System.h"
 #include "DataSet3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 #include "UbFileInputASCII.h"
 #include "UbFileOutputASCII.h"
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index fc993d958..c0d88a853 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -228,14 +228,14 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
                         (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
                         ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
                     if (distributionsH2) {
                     distributionsH2->getDistribution(f, ix1, ix2, ix3);
                     (*phaseField2)(ix1, ix2, ix3) =
                         ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
                         (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
                         ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
                 }
                     else { (*phaseField2)(ix1, ix2, ix3) = 999.0; }
                     
@@ -273,8 +273,8 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     nodes.push_back(UbTupleFloat3(float(worldCoordinates[0]), float(worldCoordinates[1]),
                                                   float(worldCoordinates[2])));
 
-                    phi[REST] = (*phaseField)(ix1, ix2, ix3);
-                    phi2[REST] = (*phaseField2)(ix1, ix2, ix3);
+                    phi[DIR_000] = (*phaseField)(ix1, ix2, ix3);
+                    phi2[DIR_000] = (*phaseField2)(ix1, ix2, ix3);
 
                     if ((ix1 == 0) || (ix2 == 0) || (ix3 == 0)) {
                         dX1_phi = 0.0;
@@ -314,7 +314,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         dX1_phi  = 0.0 * gradX1_phi(phi);
                         dX2_phi  = 0.0 * gradX2_phi(phi);
                         dX3_phi  = 0.0 * gradX3_phi(phi);
-                        mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi(phi);
+                        mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(phi);
 
                         //phi2[E] = (*phaseField2)(ix1 + DX1[E], ix2 + DX2[E], ix3 + DX3[E]);
                         //phi2[N] = (*phaseField2)(ix1 + DX1[N], ix2 + DX2[N], ix3 + DX3[N]);
@@ -358,7 +358,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
 
                     // rho = phi[ZERO] + (1.0 - phi[ZERO])*1.0/densityRatio;
-                    rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                    rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
                     if (pressure) {
                         vx1 =
@@ -398,7 +398,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     p1 = (((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
                           (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
                            ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST]) +
+                          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000]) +
                          (vx1 * rhoToPhi * dX1_phi * c1o3 + vx2 * rhoToPhi * dX2_phi * c1o3 +
                           vx3 * rhoToPhi * dX3_phi * c1o3) /
                              2.0;
@@ -426,7 +426,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                                            block->toString() + ", node=" + UbSystem::toString(ix1) + "," +
                                            UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
 
-                    if (UbMath::isNaN(phi[REST]) || UbMath::isInfinity(phi[REST]))
+                    if (UbMath::isNaN(phi[DIR_000]) || UbMath::isInfinity(phi[DIR_000]))
                         UB_THROW(UbException(
                             UB_EXARGS, "phi is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" +
                                            block->toString() + ", node=" + UbSystem::toString(ix1) + "," +
@@ -436,12 +436,12 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         UB_THROW( UbException(UB_EXARGS,"p1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
                         ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
 
-                    data[index++].push_back(phi[REST]);
+                    data[index++].push_back(phi[DIR_000]);
                     data[index++].push_back(vx1);
                     data[index++].push_back(vx2);
                     data[index++].push_back(vx3);
                     data[index++].push_back(p1);
-                    data[index++].push_back(phi2[REST]);
+                    data[index++].push_back(phi2[DIR_000]);
                     if (pressure) data[index++].push_back((*pressure)(ix1, ix2, ix3));
                 }
             }
@@ -502,7 +502,7 @@ LBMReal WriteMultiphaseQuantitiesCoProcessor::nabla2_phi(const LBMReal *const &h
     using namespace D3Q27System;
     LBMReal sum = 0.0;
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
-        sum += WEIGTH[k] * (h[k] - h[REST]);
+        sum += WEIGTH[k] * (h[k] - h[DIR_000]);
     }
     return 6.0 * sum;
 }
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
index 739efcddb..21dbee2f9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
@@ -18,7 +18,7 @@ void OneDistributionFullVectorConnector::init()
 
     int anz = 27;
     switch (sendDir) {
-        case D3Q27System::REST:
+        case D3Q27System::DIR_000:
             UB_THROW(UbException(UB_EXARGS, "ZERO not allowed"));
             break;
         case D3Q27System::E:
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
index 3e314fbce..7d2e5e00a 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -60,7 +60,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init()
    int anz = 3*27+1;
    switch (sendDir)
    {
-   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
    case D3Q27System::E:
    case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
    case D3Q27System::N:
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
index 2e726fc7b..5cd49a163 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
@@ -59,7 +59,7 @@ void ThreeDistributionsFullVectorConnector::init()
    int anz = 3*27;
    switch (sendDir)
    {
-   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
    case D3Q27System::E:
    case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
    case D3Q27System::N:
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
index b831cb840..15d18279c 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -59,7 +59,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::init()
    int anz = 2*27+1;
    switch (sendDir)
    {
-   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
    case D3Q27System::E:
    case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
    case D3Q27System::N:
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
index 7fe8bc364..008b6630d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
@@ -58,7 +58,7 @@ void TwoDistributionsFullVectorConnector::init()
    int anz = 2*27;
    switch (sendDir)
    {
-   case D3Q27System::REST: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
    case D3Q27System::E:
    case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
    case D3Q27System::N:
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
index bd6d46c2b..765461b34 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
@@ -119,7 +119,7 @@ void D3Q27EsoTwist3DSoA::getDistribution(LBMReal *const f, size_t x1, size_t x2,
     f[D3Q27System::BNW] = (*d.BNW)(x1p, x2, x3p);
     f[D3Q27System::BNE] = (*d.BNE)(x1, x2, x3p);
 
-    f[D3Q27System::REST] = (*d.REST)(x1, x2, x3);
+    f[D3Q27System::DIR_000] = (*d.REST)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
@@ -156,7 +156,7 @@ void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal *const f, size_t x1, size
     (*d.BNW)(x1p, x2, x3p)  = f[D3Q27System::INV_BNW];
     (*d.BNE)(x1, x2, x3p)   = f[D3Q27System::INV_BNE];
 
-    (*d.REST)(x1, x2, x3) = f[D3Q27System::REST];
+    (*d.REST)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal *const f, size_t x1, size_t x2, size_t x3)
@@ -189,7 +189,7 @@ void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal *const f, size_t x1, size_t
     f[D3Q27System::INV_BNW] = (*d.BNW)(x1 + 1, x2, x3 + 1);
     f[D3Q27System::INV_BNE] = (*d.BNE)(x1, x2, x3 + 1);
 
-    f[D3Q27System::REST] = (*d.REST)(x1, x2, x3);
+    f[D3Q27System::DIR_000] = (*d.REST)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSoA::setDistributionInv(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
index 5e762c68b..ecb53fda1 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
@@ -84,7 +84,7 @@ void D3Q27EsoTwist3DSplittedVector::getDistribution(LBMReal *const f, size_t x1,
     f[D3Q27System::BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
     f[D3Q27System::BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
 
-    f[D3Q27System::REST] = (*this->zeroDistributions)(x1, x2, x3);
+    f[D3Q27System::DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
@@ -117,7 +117,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal *const f, size
     (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::INV_BNW];
     (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::INV_BNE];
 
-    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal *const f, size_t x1, size_t x2, size_t x3)
@@ -150,7 +150,7 @@ void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal *const f, size_t
     f[D3Q27System::INV_BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
     f[D3Q27System::INV_BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
 
-    f[D3Q27System::REST] = (*this->zeroDistributions)(x1, x2, x3);
+    f[D3Q27System::DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
@@ -183,7 +183,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal *const f, s
     (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::BNW];
     (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::BNE];
 
-    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal *const f, size_t x1, size_t x2, size_t x3,
@@ -242,7 +242,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal *c
     if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
         (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f[D3Q27System::TSW];
     if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
-        (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+        (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3,
@@ -327,7 +327,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_
         case D3Q27System::TSW:
             (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::REST:
+        case D3Q27System::DIR_000:
             (*this->zeroDistributions)(x1, x2, x3) = f;
             break;
         default:
@@ -391,7 +391,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal
     if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
         (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::TSW];
     if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
-        (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+        (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3,
@@ -476,7 +476,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, si
         case D3Q27System::TSW:
             (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::REST:
+        case D3Q27System::DIR_000:
             (*this->zeroDistributions)(x1, x2, x3) = f;
             break;
         default:
@@ -539,7 +539,7 @@ LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, si
             return (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
         case D3Q27System::BNE:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
-        case D3Q27System::REST:
+        case D3Q27System::DIR_000:
             return (*this->zeroDistributions)(x1, x2, x3);
         default:
             UB_THROW(UbException(UB_EXARGS, "Direction didn't find"));
@@ -601,7 +601,7 @@ LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionInvForDirection(size_t x1,
             return (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
         case D3Q27System::TSW:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
-        case D3Q27System::REST:
+        case D3Q27System::DIR_000:
             return (*this->zeroDistributions)(x1, x2, x3);
         default:
             UB_THROW(UbException(UB_EXARGS, "Direction didn't find"));
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
index c456be678..21d1141a1 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
@@ -49,7 +49,7 @@ const int EsoTwistD3Q27System::etINVDIR[EsoTwistD3Q27System::ENDF + 1] = {
     D3Q27System::INV_TE,  D3Q27System::INV_BW,  D3Q27System::INV_BE,  D3Q27System::INV_TW,  D3Q27System::INV_TN,
     D3Q27System::INV_BS,  D3Q27System::INV_BN,  D3Q27System::INV_TS,  D3Q27System::INV_TNE, D3Q27System::INV_TNW,
     D3Q27System::INV_TSE, D3Q27System::INV_TSW, D3Q27System::INV_BNE, D3Q27System::INV_BNW, D3Q27System::INV_BSE,
-    D3Q27System::INV_BSW, D3Q27System::REST
+    D3Q27System::INV_BSW, D3Q27System::DIR_000
 };
 
 const unsigned long int EsoTwistD3Q27System::etDIR[EsoTwistD3Q27System::ENDF + 1] = {
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
index 21752cc48..c2ea5a9dd 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
@@ -47,7 +47,7 @@ struct EsoTwistD3Q27System {
     const static int STARTDIR = D3Q27System::STARTDIR;
     const static int ENDDIR   = D3Q27System::ENDDIR;
 
-    static const int REST = D3Q27System::REST; /*f0 */
+    static const int REST = D3Q27System::DIR_000; /*f0 */
     static const int E    = D3Q27System::E;    /*f1 */
     static const int W    = D3Q27System::W;    /*f2 */
     static const int N    = D3Q27System::N;    /*f3 */
diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
index 79753c144..3a55c6ad7 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
@@ -34,7 +34,7 @@
 #include "Block3D.h"
 
 #include "Block3DConnector.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 
 int Block3D::counter = 0;
@@ -335,13 +335,13 @@ std::string Block3D::toString()
     for (std::size_t i = 0; i < connectors.size(); i++)
         if (connectors[i]) {
             if (connectors[i]->isLocalConnector())
-                ss << "l." << Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+                ss << "l." << D3Q27System::getDirectionString(connectors[i]->getSendDir()) << ", ";
             if (connectors[i]->isRemoteConnector())
-                ss << "r." << Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+                ss << "r." << D3Q27System::getDirectionString(connectors[i]->getSendDir()) << ", ";
             if (connectors[i]->isInterpolationConnectorCF())
-                ss << "cf." << Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+                ss << "cf." << D3Q27System::getDirectionString(connectors[i]->getSendDir()) << ", ";
             if (connectors[i]->isInterpolationConnectorFC())
-                ss << "fc." << Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+                ss << "fc." << D3Q27System::getDirectionString(connectors[i]->getSendDir()) << ", ";
         }
     return ss.str();
 }
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
index 41235087e..b4d3ba655 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
@@ -39,21 +39,21 @@
 #include <geometry3d/CoordinateTransformation3D.h>
 
 #include "Block3DVisitor.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "Grid3DVisitor.h"
 #include "Interactor3D.h"
-#include "LBMSystem.h"
+#include "D3Q27System.h"
 #include <Block3D.h>
 #include <Communicator.h>
 
 using namespace std;
 
-Grid3D::Grid3D() { levelSet.resize(Grid3DSystem::MAXLEVEL + 1); }
+Grid3D::Grid3D() { levelSet.resize(D3Q27System::MAXLEVEL + 1); }
 //////////////////////////////////////////////////////////////////////////
 Grid3D::Grid3D(std::shared_ptr<vf::mpi::Communicator> comm)
 
 {
-    levelSet.resize(Grid3DSystem::MAXLEVEL + 1);
+    levelSet.resize(D3Q27System::MAXLEVEL + 1);
     bundle = comm->getBundleID();
     rank = comm->getProcessID();
 }
@@ -63,7 +63,7 @@ Grid3D::Grid3D(std::shared_ptr<vf::mpi::Communicator> comm, int blockNx1, int bl
 
       blockNx1(blockNx1), blockNx2(blockNx2), blockNx3(blockNx2), nx1(gridNx1), nx2(gridNx2), nx3(gridNx3)
 {
-    levelSet.resize(Grid3DSystem::MAXLEVEL + 1);
+    levelSet.resize(D3Q27System::MAXLEVEL + 1);
     bundle = comm->getBundleID();
     rank  = comm->getProcessID();
     trafo = std::make_shared<CoordinateTransformation3D>(0.0, 0.0, 0.0, (double)blockNx1, (double)blockNx2,
@@ -88,7 +88,7 @@ void Grid3D::accept(Block3DVisitor &blockVisitor)
     int startLevel = blockVisitor.getStartLevel();
     int stopLevel  = blockVisitor.getStopLevel();
 
-    if (startLevel < 0 || stopLevel < 0 || startLevel > Grid3DSystem::MAXLEVEL || stopLevel > Grid3DSystem::MAXLEVEL)
+    if (startLevel < 0 || stopLevel < 0 || startLevel > D3Q27System::MAXLEVEL || stopLevel > D3Q27System::MAXLEVEL)
         throw UbException(UB_EXARGS, "not valid level!");
 
     bool dir = startLevel < stopLevel;
@@ -158,8 +158,8 @@ bool Grid3D::deleteBlock(int ix1, int ix2, int ix3, int level)
 void Grid3D::deleteBlocks()
 {
     std::vector<std::vector<SPtr<Block3D>>> blocksVector(25);
-    int minInitLevel = Grid3DSystem::MINLEVEL;
-    int maxInitLevel = Grid3DSystem::MAXLEVEL;
+    int minInitLevel = D3Q27System::MINLEVEL;
+    int maxInitLevel = D3Q27System::MAXLEVEL;
     for (int level = minInitLevel; level < maxInitLevel; level++) {
         getBlocks(level, blocksVector[level]);
         for (SPtr<Block3D> block : blocksVector[level]) //	blocks of the current level
@@ -265,7 +265,7 @@ void Grid3D::getSubBlocks(int ix1, int ix2, int ix3, int level, int levelDepth,
         return;
     if (level > 0 && !this->getSuperBlock(ix1, ix2, ix3, level))
         return;
-    if (level >= Grid3DSystem::MAXLEVEL)
+    if (level >= D3Q27System::MAXLEVEL)
         throw UbException(UB_EXARGS, "Level bigger then MAXLEVEL");
 
     int x1[] = { ix1 << 1, (ix1 << 1) + 1 };
@@ -300,7 +300,7 @@ bool Grid3D::expandBlock(int ix1, int ix2, int ix3, int level)
     ix3 = block->getX3();
 
     int l = level + 1;
-    if (l > Grid3DSystem::MAXLEVEL)
+    if (l > D3Q27System::MAXLEVEL)
         throw UbException(UB_EXARGS, "level > Grid3D::MAXLEVEL");
 
     int west   = ix1 << 1;
@@ -584,7 +584,7 @@ void Grid3D::checkLevel(int level)
     if (level < 0) {
         throw UbException(UB_EXARGS, "l(" + UbSystem::toString(level) + (string) ")<0");
     }
-    if (level > Grid3DSystem::MAXLEVEL) {
+    if (level > D3Q27System::MAXLEVEL) {
         throw UbException(UB_EXARGS, "l(" + UbSystem::toString(level) + (string) ")>MAXLEVEL");
     }
     if (this->levelSet[level].size() == 0) {
@@ -596,7 +596,7 @@ bool Grid3D::hasLevel(int level) const
 {
     if (level < 0)
         return false;
-    if (level > Grid3DSystem::MAXLEVEL)
+    if (level > D3Q27System::MAXLEVEL)
         return false;
     if (this->levelSet[level].size() == 0)
         return false;
@@ -616,7 +616,7 @@ UbTupleInt3 Grid3D::getBlockNX() const { return makeUbTuple(blockNx1, blockNx2,
 
 SPtr<Block3D> Grid3D::getNeighborBlock(int dir, int ix1, int ix2, int ix3, int level) const
 {
-    return this->getBlock(ix1 + Grid3DSystem::EX1[dir], ix2 + Grid3DSystem::EX2[dir], ix3 + Grid3DSystem::EX3[dir],
+    return this->getBlock(ix1 + D3Q27System::DX1[dir], ix2 + D3Q27System::DX2[dir], ix3 + D3Q27System::DX3[dir],
                           level);
 }
 //////////////////////////////////////////////////////////////////////////
@@ -631,8 +631,8 @@ SPtr<Block3D> Grid3D::getNeighborBlock(int dir, SPtr<Block3D> block) const
 //////////////////////////////////////////////////////////////////////////
 void Grid3D::getAllNeighbors(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks)
 {
-    for (int dir = Grid3DSystem::STARTDIR; dir <= Grid3DSystem::ENDDIR; dir++)
-    // for (int dir = Grid3DSystem::STARTDIR; dir<=Grid3DSystem::TS; dir++)
+    for (int dir = D3Q27System::STARTDIR; dir <= D3Q27System::ENDDIR; dir++)
+    // for (int dir = D3Q27System::STARTDIR; dir<=D3Q27System::TS; dir++)
     {
         this->getNeighborBlocksForDirection(dir, ix1, ix2, ix3, level, levelDepth, blocks);
     }
@@ -1100,82 +1100,82 @@ void Grid3D::getNeighborBlocksForDirection(int dir, int ix1, int ix2, int ix3, i
                                            std::vector<SPtr<Block3D>> &blocks)
 {
     switch (dir) {
-        case Grid3DSystem::E:
+        case D3Q27System::E:
             this->getNeighborsEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::W:
+        case D3Q27System::W:
             this->getNeighborsWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::N:
+        case D3Q27System::N:
             this->getNeighborsNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::S:
+        case D3Q27System::S:
             this->getNeighborsSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::T:
+        case D3Q27System::T:
             this->getNeighborsTop(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::B:
+        case D3Q27System::B:
             this->getNeighborsBottom(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::NE:
+        case D3Q27System::NE:
             this->getNeighborsNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::SW:
+        case D3Q27System::SW:
             this->getNeighborsSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::SE:
+        case D3Q27System::SE:
             this->getNeighborsSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::NW:
+        case D3Q27System::NW:
             this->getNeighborsNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TE:
+        case D3Q27System::TE:
             this->getNeighborsTopEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BW:
+        case D3Q27System::BW:
             this->getNeighborsBottomWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BE:
+        case D3Q27System::BE:
             this->getNeighborsBottomEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TW:
+        case D3Q27System::TW:
             this->getNeighborsTopWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TN:
+        case D3Q27System::TN:
             this->getNeighborsTopNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BS:
+        case D3Q27System::BS:
             this->getNeighborsBottomSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BN:
+        case D3Q27System::BN:
             this->getNeighborsBottomNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TS:
+        case D3Q27System::TS:
             this->getNeighborsTopSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TNE:
+        case D3Q27System::TNE:
             this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TNW:
+        case D3Q27System::TNW:
             this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TSE:
+        case D3Q27System::TSE:
             this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TSW:
+        case D3Q27System::TSW:
             this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BNE:
+        case D3Q27System::BNE:
             this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BNW:
+        case D3Q27System::BNW:
             this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BSE:
+        case D3Q27System::BSE:
             this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BSW:
+        case D3Q27System::BSW:
             this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
         default:
@@ -1263,85 +1263,85 @@ void Grid3D::getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2,
                                                       std::vector<SPtr<Block3D>> &blocks)
 {
     switch (dir) {
-        case Grid3DSystem::E:
+        case D3Q27System::E:
             this->getNeighborsEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::W:
+        case D3Q27System::W:
             this->getNeighborsWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::N:
+        case D3Q27System::N:
             this->getNeighborsNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::S:
+        case D3Q27System::S:
             this->getNeighborsSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::T:
+        case D3Q27System::T:
             this->getNeighborsTop(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::B:
+        case D3Q27System::B:
             this->getNeighborsBottom(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::NE:
+        case D3Q27System::NE:
             this->getNeighborsNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::SW:
+        case D3Q27System::SW:
             this->getNeighborsSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::SE:
+        case D3Q27System::SE:
             this->getNeighborsSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::NW:
+        case D3Q27System::NW:
             this->getNeighborsNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TE:
+        case D3Q27System::TE:
             this->getNeighborsTopEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BW:
+        case D3Q27System::BW:
             this->getNeighborsBottomWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BE:
+        case D3Q27System::BE:
             this->getNeighborsBottomEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TW:
+        case D3Q27System::TW:
             this->getNeighborsTopWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TN:
+        case D3Q27System::TN:
             this->getNeighborsTopNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BS:
+        case D3Q27System::BS:
             this->getNeighborsBottomSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BN:
+        case D3Q27System::BN:
             this->getNeighborsBottomNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TS:
+        case D3Q27System::TS:
             this->getNeighborsTopSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TNE:
+        case D3Q27System::TNE:
             this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TNW:
+        case D3Q27System::TNW:
             this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TSE:
+        case D3Q27System::TSE:
             this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::TSW:
+        case D3Q27System::TSW:
             this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BNE:
+        case D3Q27System::BNE:
             this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BNW:
+        case D3Q27System::BNW:
             this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BSE:
+        case D3Q27System::BSE:
             this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::BSW:
+        case D3Q27System::BSW:
             this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case Grid3DSystem::REST:
+        case D3Q27System::DIR_000:
             this->getNeighborsZero(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
         default:
@@ -1980,7 +1980,7 @@ void Grid3D::getBlocks(int level, int rank, bool active, std::vector<SPtr<Block3
 //////////////////////////////////////////////////////////////////////////
 int Grid3D::getFinestInitializedLevel()
 {
-    for (int i = Grid3DSystem::MAXLEVEL; i >= 0; i--)
+    for (int i = D3Q27System::MAXLEVEL; i >= 0; i--)
         if (this->levelSet[i].size() > 0)
             return (i);
     return (-1);
@@ -1988,7 +1988,7 @@ int Grid3D::getFinestInitializedLevel()
 //////////////////////////////////////////////////////////////////////////
 int Grid3D::getCoarsestInitializedLevel()
 {
-    for (int i = 0; i <= Grid3DSystem::MAXLEVEL; i++)
+    for (int i = 0; i <= D3Q27System::MAXLEVEL; i++)
         if (this->levelSet[i].size() > 0)
             return (i);
     return (-1);
@@ -2343,7 +2343,7 @@ void Grid3D::updateDistributedBlocks(std::shared_ptr<vf::mpi::Communicator> comm
             levelSet[l].clear();
         }
         this->levelSet.clear();
-        levelSet.resize(Grid3DSystem::MAXLEVEL + 1);
+        levelSet.resize(D3Q27System::MAXLEVEL + 1);
 
         int rsize = (int)blocks.size();
         for (int i = 0; i < rsize; i += 5) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
index 20851b019..4d4dff771 100644
--- a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
@@ -91,7 +91,7 @@ void BGKLBMKernel::calculate(int step)
                     //////////////////////////////////////////////////////////////////////////
                     // read distribution
                     ////////////////////////////////////////////////////////////////////////////
-                    f[REST] = (*this->zeroDistributions)(x1, x2, x3);
+                    f[DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 
                     f[E]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
                     f[N]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
@@ -122,7 +122,7 @@ void BGKLBMKernel::calculate(int step)
                     f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
                     //////////////////////////////////////////////////////////////////////////
 
-                    drho = f[REST] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] +
+                    drho = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] +
                            f[BW] + f[BE] + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] +
                            f[BNE] + f[BSW] + f[BSE] + f[BNW];
 
@@ -137,7 +137,7 @@ void BGKLBMKernel::calculate(int step)
 
                     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
-                    feq[REST] = c8o27 * (drho - cu_sq);
+                    feq[DIR_000] = c8o27 * (drho - cu_sq);
                     feq[E]    = c2o27 * (drho + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
                     feq[W]    = c2o27 * (drho + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
                     feq[N]    = c2o27 * (drho + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
@@ -174,7 +174,7 @@ void BGKLBMKernel::calculate(int step)
                                          c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
 
                     // Relaxation
-                    f[REST] += (feq[REST] - f[REST]) * collFactor;
+                    f[DIR_000] += (feq[DIR_000] - f[DIR_000]) * collFactor;
                     f[E] += (feq[E] - f[E]) * collFactor;
                     f[W] += (feq[W] - f[W]) * collFactor;
                     f[N] += (feq[N] - f[N]) * collFactor;
@@ -214,7 +214,7 @@ void BGKLBMKernel::calculate(int step)
                         forcingX2 = muForcingX2.Eval();
                         forcingX3 = muForcingX3.Eval();
 
-                        f[REST] += 0.0;
+                        f[DIR_000] += 0.0;
                         f[E] += 3.0 * c2o27 * (forcingX1);
                         f[W] += 3.0 * c2o27 * (-forcingX1);
                         f[N] += 3.0 * c2o27 * (forcingX2);
@@ -244,7 +244,7 @@ void BGKLBMKernel::calculate(int step)
                     }
                     //////////////////////////////////////////////////////////////////////////
 #ifdef PROOF_CORRECTNESS
-                    LBMReal rho_post = f[REST] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] +
+                    LBMReal rho_post = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] +
                                        f[NW] + f[TE] + f[BW] + f[BE] + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] +
                                        f[TSW] + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW];
                     LBMReal dif = drho - rho_post;
@@ -291,7 +291,7 @@ void BGKLBMKernel::calculate(int step)
                     (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  = f[D3Q27System::INV_BNW];
                     (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   = f[D3Q27System::INV_BNE];
 
-                    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+                    (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
                     //////////////////////////////////////////////////////////////////////////
                 }
             }
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
index 036b35379..21b23b61d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
@@ -497,7 +497,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f
    f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
    f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
    f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
-   f[REST] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[REST];
+   f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -691,7 +691,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f
    f[BNW]  = f_TSE  + feq[BNW];
    f[BSE]  = f_TNW  + feq[BSE];
    f[BSW]  = f_TNE  + feq[BSW];
-   f[REST] = f_ZERO + feq[REST];
+   f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
index 4dec63758..936cf18ab 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
@@ -803,7 +803,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBM
    f[BS]   = mfbaa;
    f[BN]   = mfbca;
    f[TS]   = mfbac;
-   f[REST] = mfbbb;
+   f[DIR_000] = mfbbb;
    f[TNE]  = mfccc;
    f[TSE]  = mfcac;
    f[BNE]  = mfcca;
@@ -1251,7 +1251,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBM
    f[BS]   = mfbaa;
    f[BN]   = mfbca;
    f[TS]   = mfbac;
-   f[REST] = mfbbb;
+   f[DIR_000] = mfbbb;
    f[TNE]  = mfccc;
    f[TSE]  = mfcac;
    f[BNE]  = mfcca;
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
index 7a19f156e..721dc5dad 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
@@ -798,7 +798,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod
    f[BS]   = mfbaa;
    f[BN]   = mfbca;
    f[TS]   = mfbac;
-   f[REST] = mfbbb;
+   f[DIR_000] = mfbbb;
    f[TNE]  = mfccc;
    f[TSE]  = mfcac;
    f[BNE]  = mfcca;
@@ -1251,7 +1251,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod
    f[BS]   = mfbaa;
    f[BN]   = mfbca;
    f[TS]   = mfbac;
-   f[REST] = mfbbb;
+   f[DIR_000] = mfbbb;
    f[TNE]  = mfccc;
    f[TSE]  = mfcac;
    f[BNE]  = mfcca;
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
index b82616cbc..62adaa06b 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
@@ -18,14 +18,23 @@ const int DX1[] = { 0,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,
 const int DX2[] = { 0,  0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,   1,  1, -1, -1,  1,  1, -1, -1 };
 const int DX3[] = { 0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,   1,  1,  1,  1, -1, -1, -1, -1 };
 
-const double WEIGTH[] = { c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c1o54,  c1o54,  c1o54,
-                          c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,
-                          c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c8o27 };
+const double WEIGTH[] = { c8o27,  
+                          c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  
+                          c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,
+                          c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216 };
 
-const int INVDIR[] = { INV_E,   INV_W,   INV_N,   INV_S,   INV_T,   INV_B,   INV_NE,  INV_SW, INV_SE,
+const int INVDIR[] = { DIR_000, INV_E,   INV_W,   INV_N,   INV_S,   INV_T,   INV_B,   INV_NE,  INV_SW, INV_SE,
                        INV_NW,  INV_TE,  INV_BW,  INV_BE,  INV_TW,  INV_TN,  INV_BS,  INV_BN, INV_TS,
                        INV_TNE, INV_TNW, INV_TSE, INV_TSW, INV_BNE, INV_BNW, INV_BSE, INV_BSW };
 
+// index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
+// direction:        E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE
+// BSW
+//const int EX1[] = { 0, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
+//const int EX2[] = { 0, 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
+//const int EX3[] = { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
+
+//////////////////////////////////////////////////////////////////////////
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
index edfb903c1..5e80ee54f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
@@ -64,6 +64,13 @@ extern const double WEIGTH[ENDDIR + 1];
 
 extern const double cNorm[3][ENDDIR];
 
+static const int MINLEVEL = 0;
+static const int MAXLEVEL = 25;
+
+extern const int EX1[ENDDIR + 1];
+extern const int EX2[ENDDIR + 1];
+extern const int EX3[ENDDIR + 1];
+
 //static const int E    = 0;
 //static const int W    = 1;
 //static const int N    = 2;
@@ -92,7 +99,35 @@ extern const double cNorm[3][ENDDIR];
 //static const int BSW  = 25;
 //static const int REST = 26;
 
-static constexpr int REST = 0;
+//static constexpr int REST = 0;
+//static constexpr int E = 1;
+//static constexpr int W = 2;
+//static constexpr int N = 3;
+//static constexpr int S = 4;
+//static constexpr int T = 5;
+//static constexpr int B = 6;
+//static constexpr int NE = 7;
+//static constexpr int SW = 8;
+//static constexpr int SE = 9;
+//static constexpr int NW = 10;
+//static constexpr int TE = 11;
+//static constexpr int BW = 12;
+//static constexpr int BE = 13;
+//static constexpr int TW = 14;
+//static constexpr int TN = 15;
+//static constexpr int BS = 16;
+//static constexpr int BN = 17;
+//static constexpr int TS = 18;
+//static constexpr int TNE = 19;
+//static constexpr int TNW = 20;
+//static constexpr int TSE = 21;
+//static constexpr int TSW = 22;
+//static constexpr int BNE = 23;
+//static constexpr int BNW = 24;
+//static constexpr int BSE = 25;
+//static constexpr int BSW = 26;
+
+static constexpr int DIR_000 = 0;
 static constexpr int E = 1;
 static constexpr int W = 2;
 static constexpr int N = 3;
@@ -176,6 +211,180 @@ static const int ET_BNW = 11;
 static const int ET_TSW = 12;
 static const int ET_BNE = 12;
 
+//////////////////////////////////////////////////////////////////////////
+inline std::string getDirectionString(int direction)
+{
+    switch (direction) {
+        case E:
+            return "E";
+        case W:
+            return "W";
+        case N:
+            return "N";
+        case S:
+            return "S";
+        case T:
+            return "T";
+        case B:
+            return "B";
+        case NE:
+            return "NE";
+        case NW:
+            return "NW";
+        case SE:
+            return "SE";
+        case SW:
+            return "SW";
+        case TE:
+            return "TE";
+        case TW:
+            return "TW";
+        case BE:
+            return "BE";
+        case BW:
+            return "BW";
+        case TN:
+            return "TN";
+        case TS:
+            return "TS";
+        case BN:
+            return "BN";
+        case BS:
+            return "BS";
+        case TNE:
+            return "TNE";
+        case TNW:
+            return "TNW";
+        case TSE:
+            return "TSE";
+        case TSW:
+            return "TSW";
+        case BNE:
+            return "BNE";
+        case BNW:
+            return "BNW";
+        case BSE:
+            return "BSE";
+        case BSW:
+            return "BSW";
+        default:
+            return "Cell3DSystem::getDrectionString(...) - unknown dir";
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+static inline void setNeighborCoordinatesForDirection(int &x1, int &x2, int &x3, const int &direction)
+{
+    switch (direction) {
+        case D3Q27System::E:
+            x1++;
+            break;
+        case D3Q27System::N:
+            x2++;
+            break;
+        case D3Q27System::T:
+            x3++;
+            break;
+        case D3Q27System::W:
+            x1--;
+            break;
+        case D3Q27System::S:
+            x2--;
+            break;
+        case D3Q27System::B:
+            x3--;
+            break;
+        case D3Q27System::NE:
+            x1++;
+            x2++;
+            break;
+        case D3Q27System::NW:
+            x1--;
+            x2++;
+            break;
+        case D3Q27System::SW:
+            x1--;
+            x2--;
+            break;
+        case D3Q27System::SE:
+            x1++;
+            x2--;
+            break;
+        case D3Q27System::TE:
+            x1++;
+            x3++;
+            break;
+        case D3Q27System::BW:
+            x1--;
+            x3--;
+            break;
+        case D3Q27System::BE:
+            x1++;
+            x3--;
+            break;
+        case D3Q27System::TW:
+            x1--;
+            x3++;
+            break;
+        case D3Q27System::TN:
+            x2++;
+            x3++;
+            break;
+        case D3Q27System::BS:
+            x2--;
+            x3--;
+            break;
+        case D3Q27System::BN:
+            x2++;
+            x3--;
+            break;
+        case D3Q27System::TS:
+            x2--;
+            x3++;
+            break;
+        case D3Q27System::TNE:
+            x1++;
+            x2++;
+            x3++;
+            break;
+        case D3Q27System::TNW:
+            x1--;
+            x2++;
+            x3++;
+            break;
+        case D3Q27System::TSE:
+            x1++;
+            x2--;
+            x3++;
+            break;
+        case D3Q27System::TSW:
+            x1--;
+            x2--;
+            x3++;
+            break;
+        case D3Q27System::BNE:
+            x1++;
+            x2++;
+            x3--;
+            break;
+        case D3Q27System::BNW:
+            x1--;
+            x2++;
+            x3--;
+            break;
+        case D3Q27System::BSE:
+            x1++;
+            x2--;
+            x3--;
+            break;
+        case D3Q27System::BSW:
+            x1--;
+            x2--;
+            x3--;
+            break;
+        default:
+            throw UbException(UB_EXARGS, "no direction ...");
+    }
+}
 
 //////////////////////////////////////////////////////////////////////////
 // MACROSCOPIC VALUES
@@ -197,7 +406,7 @@ static void calcDensity(const LBMReal *const &f /*[27]*/, LBMReal &rho)
     rho = ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
           (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
            ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[REST];
+          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
 }
 /*=====================================================================*/
 static void calcIncompVelocityX1(const LBMReal *const &f /*[27]*/, LBMReal &vx1)
@@ -289,7 +498,7 @@ static LBMReal getCompFeqForDirection(const int &direction, const LBMReal &drho,
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
     LBMReal rho   = drho + UbMath::one;
     switch (direction) {
-        case REST:
+        case DIR_000:
             return REAL_CAST(UbMath::c8o27 * (drho + rho * (-cu_sq)));
         case E:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq)));
@@ -382,7 +591,7 @@ static void calcCompFeq(LBMReal *const &feq /*[27]*/, const LBMReal &drho, const
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
     LBMReal rho   = drho + UbMath::one;
 
-    feq[REST] = UbMath::c8o27 * (drho + rho * (-cu_sq));
+    feq[DIR_000] = UbMath::c8o27 * (drho + rho * (-cu_sq));
     feq[E]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq));
     feq[W]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq));
     feq[N]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq));
@@ -429,7 +638,7 @@ static LBMReal getIncompFeqForDirection(const int &direction, const LBMReal &drh
     LBMReal cu_sq = 1.5f * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
     switch (direction) {
-        case REST:
+        case DIR_000:
             return REAL_CAST(UbMath::c8o27 * (drho - cu_sq));
         case E:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq));
@@ -513,7 +722,7 @@ static void calcIncompFeq(LBMReal *const &feq /*[27]*/, const LBMReal &drho, con
 {
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
-    feq[REST] = UbMath::c8o27 * (drho - cu_sq);
+    feq[DIR_000] = UbMath::c8o27 * (drho - cu_sq);
     feq[E]    = UbMath::c2o27 * (drho + 3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq);
     feq[W]    = UbMath::c2o27 * (drho + 3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq);
     feq[N]    = UbMath::c2o27 * (drho + 3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq);
@@ -839,7 +1048,7 @@ static inline LBMReal getShearRate(const LBMReal *const f, LBMReal collFactorF)
     LBMReal mfaca = f[BNW];
     LBMReal mfcca = f[BNE];
 
-    LBMReal mfbbb = f[REST];
+    LBMReal mfbbb = f[DIR_000];
 
     LBMReal m0, m1, m2;
 
@@ -1143,7 +1352,7 @@ static void calcMultiphaseFeq(LBMReal *const &feq /*[27]*/, const LBMReal &rho,
     using namespace UbMath;
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
-    feq[REST] = c8o27 * (p1 + rho * c1o3 * (-cu_sq));
+    feq[DIR_000] = c8o27 * (p1 + rho * c1o3 * (-cu_sq));
     feq[E]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
     feq[W]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
     feq[N]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
@@ -1186,7 +1395,7 @@ static void calcMultiphaseFeqVB(LBMReal *const &feq /*[27]*/, const LBMReal &p1,
     using namespace UbMath;
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
-    feq[REST] = p1 + c8o27 * (-cu_sq);
+    feq[DIR_000] = p1 + c8o27 * (-cu_sq);
     feq[E]    = c2o27 * ((3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
     feq[W]    = c2o27 * ((3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
     feq[N]    = c2o27 * ((3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
@@ -1221,7 +1430,7 @@ static void calcMultiphaseHeq(LBMReal *const &heq /*[27]*/, const LBMReal &phi,
     using namespace UbMath;
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
-    heq[REST] = c8o27 * phi * (1.0 - cu_sq);
+    heq[DIR_000] = c8o27 * phi * (1.0 - cu_sq);
     heq[E]    = c2o27 * phi * (1.0 + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
     heq[W]    = c2o27 * phi * (1.0 + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
     heq[N]    = c2o27 * phi * (1.0 + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
@@ -1249,7 +1458,6 @@ static void calcMultiphaseHeq(LBMReal *const &heq /*[27]*/, const LBMReal &phi,
     heq[BSE] = c1o216 * phi * (1.0 + 3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq);
     heq[TNW] = c1o216 * phi * (1.0 + 3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
 }
-//////////////////////////////////////////////////////////////////////////
 
 } // namespace D3Q27System
 #endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
index 15e6f1ddd..b4ccea0c9 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
@@ -569,7 +569,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f
    f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
    f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
    f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
-   f[REST] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[REST];
+   f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -763,7 +763,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal*
    f[BNW]  = f_TSE  + feq[BNW];
    f[BSE]  = f_TNW  + feq[BSE];
    f[BSW]  = f_TNE  + feq[BSW];
-   f[REST] = f_ZERO + feq[REST];
+   f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
index 554fc6614..56074586c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
@@ -894,7 +894,7 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                //////////////////////////////////////////////////////////////////////////
                //read distribution
                ////////////////////////////////////////////////////////////////////////////
-               f[REST] = (*this->zeroDistributions)(x1, x2, x3);
+               f[DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 
                f[E] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
                f[N] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
@@ -928,7 +928,7 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                drho = ((f[TNE]+f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+(f[TSW]+f[BNE]))
                   +(((f[NE]+f[SW])+(f[SE]+f[NW]))+((f[TE]+f[BW])+(f[BE]+f[TW]))
                      +((f[BN]+f[TS])+(f[TN]+f[BS])))+((f[E]+f[W])+(f[N]+f[S])
-                        +(f[T]+f[B]))+f[REST];
+                        +(f[T]+f[B]))+f[DIR_000];
 
                //vx1 = ((((f[TNE]-f[BSW])+(f[TSE]-f[BNW]))+((f[BSE]-f[TNW])+(f[BNE]-f[TSW])))+
                //   (((f[BE]-f[TW])+(f[TE]-f[BW]))+((f[SE]-f[NW])+(f[NE]-f[SW])))+
@@ -956,7 +956,7 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
 
                LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
 
-               feq[REST] = c8o27*(drho-cu_sq);
+               feq[DIR_000] = c8o27*(drho-cu_sq);
                feq[E] = c2o27*(drho+3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq);
                feq[W] = c2o27*(drho+3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq);
                feq[N] = c2o27*(drho+3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq);
@@ -985,7 +985,7 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
 
                //Relaxation
-               f[REST] += (feq[REST]-f[REST])*collFactor;
+               f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
                f[E] += (feq[E]-f[E])*collFactor;
                f[W] += (feq[W]-f[W])*collFactor;
                f[N] += (feq[N]-f[N])*collFactor;
@@ -1061,7 +1061,7 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[D3Q27System::INV_BNW];
                (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = f[D3Q27System::INV_BNE];
 
-               (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::REST];
+               (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
                //////////////////////////////////////////////////////////////////////////
 
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
index 6076eb018..e48e846a4 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
@@ -88,7 +88,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                //////////////////////////////////////////////////////////////////////////
                //read distribution
                ////////////////////////////////////////////////////////////////////////////
-               f[REST] = (*this->zeroDistributions)(x1,x2,x3);
+               f[DIR_000] = (*this->zeroDistributions)(x1,x2,x3);
 
                f[E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
                f[N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
@@ -119,7 +119,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p);
                //////////////////////////////////////////////////////////////////////////
 
-               drho = f[REST] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] 
+               drho = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] 
                + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE]
                + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW]
                + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW];
@@ -138,7 +138,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
 
                LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
 
-               feq[REST] =  c8o27*(drho-cu_sq);
+               feq[DIR_000] =  c8o27*(drho-cu_sq);
                feq[E] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
                feq[W] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
                feq[N] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
@@ -167,7 +167,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                feq[TNW]= c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
 
                //Relaxation
-               f[REST] += (feq[REST]-f[REST])*collFactor;
+               f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
                f[E] += (feq[E]-f[E])*collFactor;
                f[W] += (feq[W]-f[W])*collFactor;
                f[N] += (feq[N]-f[N])*collFactor;
@@ -208,7 +208,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                   forcingX2 = muForcingX2.Eval();
                   forcingX3 = muForcingX3.Eval();
 
-                  f[REST] +=                   0.0                        ;
+                  f[DIR_000] +=                   0.0                        ;
                   f[E  ] +=  3.0*c2o27  *  (forcingX1)                    ;
                   f[W  ] +=  3.0*c2o27  *  (-forcingX1)                   ;
                   f[N  ] +=  3.0*c2o27  *             (forcingX2)         ;
@@ -283,7 +283,7 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,  x3p) = f[D3Q27System::INV_BNW];
                (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3p) = f[D3Q27System::INV_BNE];
 
-               (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::REST];
+               (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::DIR_000];
                //////////////////////////////////////////////////////////////////////////
 
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
index 5cfee04e4..9de46c4f9 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
@@ -235,13 +235,13 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         LBMReal dX3_phi = gradX3_phi();
 
                         LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9;
-                        collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+                        collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+                        LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
                         if (withForcing) {
                             // muX1 = static_cast<double>(x1-1+ix1*maxX1);
@@ -308,9 +308,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                                                (DX3[dir]) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
                         }
 
-                        LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
-                        LBMReal fac1      = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
-                        forcingTerm[REST] = (-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
+                        LBMReal gamma = WEIGTH[DIR_000] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+                        LBMReal fac1      = (gamma - WEIGTH[DIR_000]) * c1o3 * rhoToPhi;
+                        forcingTerm[DIR_000] = (-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) +
                                             (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) +
                                             (-uz) * (fac1 * dX3_phi + gamma * (mu * dX3_phi + forcingX3));
 
@@ -342,7 +342,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         mfcaa = 3.0 * (mfcaa + 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
                         mfaca = 3.0 * (mfaca + 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
                         mfcca = 3.0 * (mfcca + 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-                        mfbbb = 3.0 * (mfbbb + 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST];
+                        mfbbb = 3.0 * (mfbbb + 0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST];
 
                         LBMReal rho1 = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
                                        (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
@@ -1050,7 +1050,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         mfcaa = rho * c1o3 * (mfcaa) + 0.5 * forcingTerm[BSE];
                         mfaca = rho * c1o3 * (mfaca) + 0.5 * forcingTerm[BNW];
                         mfcca = rho * c1o3 * (mfcca) + 0.5 * forcingTerm[BNE];
-                        mfbbb = rho * c1o3 * (mfbbb) + 0.5 * forcingTerm[REST];
+                        mfbbb = rho * c1o3 * (mfbbb) + 0.5 * forcingTerm[DIR_000];
 
                         //////////////////////////////////////////////////////////////////////////
                         // write distribution for F
@@ -1119,24 +1119,24 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
                         h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                        h[REST] = (*this->zeroDistributionsH)(x1, x2, x3);
+                        h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
 
                         for (int dir = STARTF; dir < (ENDF + 1); dir++) {
                             LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
                             LBMReal velSq1  = velProd * velProd;
                             LBMReal hEq; //, gEq;
 
-                            if (dir != REST) {
+                            if (dir != DIR_000) {
                                 LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]]) / 2.0;
-                                LBMReal hSource     = (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST]) * (dirGrad_phi) / denom; 
-                                hEq = phi[REST] * WEIGTH[dir] * (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) +                                 hSource * WEIGTH[dir];
+                                LBMReal hSource     = (tauH - 0.5) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * (dirGrad_phi) / denom; 
+                                hEq = phi[DIR_000] * WEIGTH[dir] * (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) +                                 hSource * WEIGTH[dir];
 
                                 // This corresponds with the collision factor of 1.0 which equals (tauH + 0.5).
                                 h[dir] = h[dir] - (h[dir] - hEq) / (tauH); 
 
                             } else {
-                                hEq = phi[REST] * WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
-                                h[REST] = h[REST] - (h[REST] - hEq) / (tauH); 
+                                hEq = phi[DIR_000] * WEIGTH[DIR_000] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+                                h[DIR_000] = h[DIR_000] - (h[DIR_000] - hEq) / (tauH); 
                             }
                         }
 
@@ -1168,7 +1168,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p)  = h[D3Q27System::INV_BNW];
                         (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p)   = h[D3Q27System::INV_BNE];
 
-                        (*this->zeroDistributionsH)(x1, x2, x3) = h[D3Q27System::REST];
+                        (*this->zeroDistributionsH)(x1, x2, x3) = h[D3Q27System::DIR_000];
 
                         /////////////////////   END OF OLD BGK SOLVER ///////////////////////////////
                     }
@@ -1215,7 +1215,7 @@ LBMReal MultiphaseCumulantLBMKernel::nabla2_phi()
     using namespace D3Q27System;
     LBMReal sum = 0.0;
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
-        sum += WEIGTH[k] * (phi[k] - phi[REST]);
+        sum += WEIGTH[k] * (phi[k] - phi[DIR_000]);
     }
     return 6.0 * sum;
 }
@@ -1270,7 +1270,7 @@ void MultiphaseCumulantLBMKernel::computePhasefield()
                     h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
                     h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                    h[REST] = (*this->zeroDistributionsH)(x1, x2, x3);
+                    h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
                 }
             }
         }
@@ -1284,7 +1284,7 @@ void MultiphaseCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1
 
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-    phi[REST] = (*ph)(x1, x2, x3);
+    phi[DIR_000] = (*ph)(x1, x2, x3);
 
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
index 01fb23625..50885d680 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
@@ -383,13 +383,13 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
 
 
 
-					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-					LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+					LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
 					//----------- Calculating Macroscopic Values -------------
-					LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH); //Incompressible
+					LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH); //Incompressible
 					//LBMReal rho = rhoL + (rhoH - rhoL) * phi[REST] + (one - phi[REST]) * (*pressure)(x1, x2, x3) * three; //compressible
 
 					LBMReal m0, m1, m2;
@@ -457,7 +457,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
 					}
 
 					//Viscosity increase by pressure gradient
-					LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+					LBMReal errPhi = (((1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale)- denom);
 					//LBMReal limVis = 0.0000001*10;//0.01;
 					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
 					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
@@ -1333,11 +1333,11 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
 
 						// collision of 1st order moments
 						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 						cx2 = cx * cx;
 						cy2 = cy * cy;
@@ -1524,17 +1524,17 @@ LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::nabla2_phi()
 {
 	using namespace D3Q27System;
 	LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-		(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-		((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1590,7 +1590,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::computePhasefield()
 					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
 					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-					h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+					h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
 				}
 			}
 		}
@@ -1604,7 +1604,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors(CbArray3D<L
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi[REST] = (*ph)(x1, x2, x3);
+	phi[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -1624,7 +1624,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors2(CbArray3D<
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi2[REST] = (*ph)(x1, x2, x3);
+	phi2[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 64b3cf168..2b68a072d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -375,17 +375,17 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					LBMReal normX2 = dX2_phi / denom;
 					LBMReal normX3 = dX3_phi / denom;
 
-					dX1_phi = normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
-                    dX2_phi = normX2 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
-                    dX3_phi = normX3 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+					dX1_phi = normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+                    dX2_phi = normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+                    dX3_phi = normX3 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
 
-					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-					LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+					LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
 					//----------- Calculating Macroscopic Values -------------
-					LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+					LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
 					LBMReal m0, m1, m2;
 					LBMReal rhoRef=c1;
@@ -452,7 +452,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					}
 
 					//Viscosity increase by pressure gradient
-					LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+					LBMReal errPhi = (((1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale)- denom);
 					//LBMReal limVis = 0.0000001*10;//0.01;
 					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
 					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
@@ -1482,11 +1482,11 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 
 						// collision of 1st order moments
 						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+							normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 						cx2 = cx * cx;
 						cy2 = cy * cy;
@@ -1649,17 +1649,17 @@ LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
 {
 	using namespace D3Q27System;
 	LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-		(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+		(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-		((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1715,7 +1715,7 @@ void MultiphasePressureFilterLBMKernel::computePhasefield()
 					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
 					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-					h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+					h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
 				}
 			}
 		}
@@ -1729,7 +1729,7 @@ void MultiphasePressureFilterLBMKernel::findNeighbors(CbArray3D<LBMReal, Indexer
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi[REST] = (*ph)(x1, x2, x3);
+	phi[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
index 77695179c..f251dfafa 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
@@ -431,13 +431,13 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 						///!test
 
-						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 						//collFactorM = phi[REST] - phiL < (phiH - phiL) * 0.05 ? collFactorG : collFactorL;
 
-                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+                        LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
 						if (withForcing) {
 							// muX1 = static_cast<double>(x1-1+ix1*maxX1);
@@ -588,9 +588,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 				  // vvxF = vvxF;
 			   //}
 			   LBMReal weightGrad =  1.0-denom*denom/(denom*denom+0.0001*0.001);
-			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
-			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
-			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX1;
+			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX2;
+			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX3;
 
 			   //dX1_phiF *= 1.2;
 			   //dX2_phiF *= 1.2;
@@ -646,9 +646,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 			   }
 
-			   LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
-			   LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
-			   forcingTerm[REST] = (-vvxF) * (fac1 * dX1_phiF ) +
+			   LBMReal gamma = WEIGTH[DIR_000] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+			   LBMReal fac1 = (gamma - WEIGTH[DIR_000]) * c1o3 * rhoToPhi;
+			   forcingTerm[DIR_000] = (-vvxF) * (fac1 * dX1_phiF ) +
 				   (-vvyF) * (fac1 * dX2_phiF ) +
 				   (-vvzF) * (fac1 * dX3_phiF );
 
@@ -774,7 +774,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   mfcaa +=3.0 * ( 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
 			   mfaca +=3.0 * ( 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
 			   mfcca +=3.0 * ( 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-			   mfbbb +=3.0 * ( 0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+			   mfbbb +=3.0 * ( 0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 			   //--------------------------------------------------------
 
@@ -1162,7 +1162,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 			   ////relax unfiltered
 			   //! divergenceFilter 10.05.2021
-			   LBMReal divMag= (1.0 - phi[REST]) * (phi[REST])*10*5*sqrt(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
+			   LBMReal divMag= (1.0 - phi[DIR_000]) * (phi[DIR_000])*10*5*sqrt(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
 			  // LBMReal divMag = 500 *500* 50*(fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))))* (fabs((OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz))));
 			   //LBMReal divMag = (dX1_phi * dxux) > 0 ? (dX1_phi * dxux) : 0;
 			   //divMag += (dX2_phi * dyuy) > 0 ? (dX2_phi * dyuy) : 0;
@@ -1645,7 +1645,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
 			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
 			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-			   mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 
 
@@ -2671,9 +2671,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   LBMReal Mccb = mfccb - mfaab * c1o9;
 
 			   // collision of 1st order moments
-			   cx = cx * (c1 - omegaD) + omegaD * vvx * concentration + normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
-			   cy = cy * (c1 - omegaD) + omegaD * vvy * concentration + normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
-			   cz = cz * (c1 - omegaD) + omegaD * vvz * concentration + normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+			   cx = cx * (c1 - omegaD) + omegaD * vvx * concentration + normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
+			   cy = cy * (c1 - omegaD) + omegaD * vvy * concentration + normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
+			   cz = cz * (c1 - omegaD) + omegaD * vvz * concentration + normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
 			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -2961,17 +2961,17 @@ LBMReal MultiphaseScratchCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3029,7 +3029,7 @@ void MultiphaseScratchCumulantLBMKernel::computePhasefield()
                     h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
                     h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                    h[REST] = (*this->zeroDistributionsH)(x1, x2, x3);
+                    h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
                 }
             }
         }
@@ -3043,7 +3043,7 @@ void MultiphaseScratchCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal, Indexe
 
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-    phi[REST] = (*ph)(x1, x2, x3);
+    phi[DIR_000] = (*ph)(x1, x2, x3);
 
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index f226b8ecf..4212683ed 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -346,13 +346,13 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 
 
-						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+                        LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
                             			   ////Incompressible Kernal
 
@@ -446,9 +446,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 				  // vvxF = vvxF;
 			   //}
 			   LBMReal weightGrad = 1.0;// -denom * denom / (denom * denom + 0.0001 * 0.001);
-			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX1;
-			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX2;
-			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[REST]) * (phi[REST]) * normX3;
+			   LBMReal dX1_phiF = dX1_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX1;
+			   LBMReal dX2_phiF = dX2_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX2;
+			   LBMReal dX3_phiF = dX3_phi * weightGrad + (1.0 - weightGrad) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * normX3;
 
 			   //dX1_phiF *= 1.2;
 			   //dX2_phiF *= 1.2;
@@ -498,9 +498,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 			   }
 
-			   LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
-			   LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi;
-			   forcingTerm[REST] =	 (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
+			   LBMReal gamma = WEIGTH[DIR_000] * (1.0 - 1.5 * (ux2 + uy2 + uz2));
+			   LBMReal fac1 = (gamma - WEIGTH[DIR_000]) * c1o3 * rhoToPhi;
+			   forcingTerm[DIR_000] =	 (-vvxF) * (fac1 * (dX1_phiF * rhoH + dX2_phi2 * rhoL)) +
 				   (-vvyF) * (fac1 * (dX2_phiF * rhoH + dX2_phi2 * rhoL)) +
 				   (-vvzF) * (fac1 * (dX3_phiF * rhoH + dX3_phi2 * rhoL));
 
@@ -626,7 +626,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
 			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
 			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-			   mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 			   //--------------------------------------------------------
 
@@ -1370,7 +1370,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
 			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
 			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
-			   mfbbb += 3.0 * (0.5 * forcingTerm[REST]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
+			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 
 
@@ -2422,11 +2422,11 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   
 
                cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
 			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -2735,11 +2735,11 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
    // collision of 1st order moments
    cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
    //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
    //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -3067,17 +3067,17 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3135,7 +3135,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::computePhasefield()
                     h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
                     h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                    h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+                    h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
             }
         }
@@ -3149,7 +3149,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal,
 
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-    phi[REST] = (*ph)(x1, x2, x3);
+    phi[DIR_000] = (*ph)(x1, x2, x3);
 
 
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3169,7 +3169,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors2(CbArray3D<LBMReal
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi2[REST] = (*ph)(x1, x2, x3);
+	phi2[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 179fc6f4d..b2eddb874 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -567,13 +567,13 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 
 
-						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+                        LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
 						//! variable density -> TRANSFER!
 						//LBMReal rho = rhoH * ((*phaseField)(x1, x2, x3)) + rhoL * ((*phaseField2)(x1, x2, x3));
@@ -712,7 +712,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   }
 
 			   //Viscosity increase by pressure gradient
-			   LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+			   LBMReal errPhi = (((1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale)- denom);
 			   //LBMReal limVis = 0.0000001*10;//0.01;
 			  // collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
 			  // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
@@ -2780,11 +2780,11 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   
 
                cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 			   //cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
 				  // normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST])*(phi[REST]+phi2[REST]) * c1o3 * oneOverInterfaceScale;
@@ -3100,11 +3100,11 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
    // collision of 1st order moments
    cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
    //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
    //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -3432,17 +3432,17 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3500,7 +3500,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::computePhasefield()
                     h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
                     h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                    h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+                    h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
             }
         }
@@ -3514,7 +3514,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors(CbArray3D<LB
 
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-    phi[REST] = (*ph)(x1, x2, x3);
+    phi[DIR_000] = (*ph)(x1, x2, x3);
 
 
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3534,7 +3534,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors2(CbArray3D<L
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi2[REST] = (*ph)(x1, x2, x3);
+	phi2[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index 294568b4f..b10c528bd 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -295,7 +295,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 							+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
 							+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
 
-						LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+						LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 						(*pressure)(x1, x2, x3) = (*pressure)(x1, x2, x3) + rho * c1o3 * drho;
 
 						////!!!!!! relplace by pointer swap!
@@ -545,13 +545,13 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 
 
-						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+						collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
 
 
-                        LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+                        LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
 
                         //----------- Calculating Macroscopic Values -------------
-                        LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH);
+                        LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH);
 
                             			   ////Incompressible Kernal
 
@@ -2719,11 +2719,11 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   
 
                cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX1 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX2 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
                cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[REST]) * (phi[REST]) * c1o3 * oneOverInterfaceScale;
+                    normX3 * (c1 - 0.5 * omegaD) * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
 			   //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
 			   //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -3032,11 +3032,11 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
    // collision of 1st order moments
    cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
-	   normX1 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX1 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
-	   normX2 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX2 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
    cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
-	   normX3 * (c1 - 0.5 * omegaD) * ( phi[REST]) * (phi2[REST]) * c1o3 * oneOverInterfaceScale;
+	   normX3 * (c1 - 0.5 * omegaD) * ( phi[DIR_000]) * (phi2[DIR_000]) * c1o3 * oneOverInterfaceScale;
 
    //mhx = (ux * phi[REST] + normX1 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhx;
    //mhy = (uy * phi[REST] + normX2 * (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST])) / tauH + (1.0 - 1.0 / tauH) * mhy;
@@ -3364,17 +3364,17 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[REST]) + (phi[BSW] - phi[REST])) + ((phi[TSW] - phi[REST]) + (phi[BNE] - phi[REST])))
-		+ (((phi[TNW] - phi[REST]) + (phi[BSE] - phi[REST])) + ((phi[TSE] - phi[REST]) + (phi[BNW] - phi[REST]))));
+	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
+		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
 	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[REST]) + (phi[BS] - phi[REST])) + ((phi[TS] - phi[REST]) + (phi[BN] - phi[REST])))
-		+	(((phi[TE] - phi[REST]) + (phi[BW] - phi[REST])) + ((phi[TW] - phi[REST]) + (phi[BE] - phi[REST])))
-		+	(((phi[NE] - phi[REST]) + (phi[SW] - phi[REST])) + ((phi[NW] - phi[REST]) + (phi[SE] - phi[REST])))
+			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
+		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
-			((phi[T] - phi[REST]) + (phi[B] - phi[REST]))
-		+	((phi[N] - phi[REST]) + (phi[S] - phi[REST]))
-		+	((phi[E] - phi[REST]) + (phi[W] - phi[REST]))
+			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
+		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
+		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3432,7 +3432,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::computePhasefield()
                     h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
                     h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
-                    h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+                    h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
             }
         }
@@ -3446,7 +3446,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors(CbArray3D<
 
     SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-    phi[REST] = (*ph)(x1, x2, x3);
+    phi[DIR_000] = (*ph)(x1, x2, x3);
 
 
     for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3466,7 +3466,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors2(CbArray3D
 
 	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
 
-	phi2[REST] = (*ph)(x1, x2, x3);
+	phi2[DIR_000] = (*ph)(x1, x2, x3);
 
 
 	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
index 7ee35063f..fee069a10 100644
--- a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
@@ -469,7 +469,7 @@ void RheologyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMReal
    f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
    f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
    f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
-   f[REST] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[REST];
+   f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -658,7 +658,7 @@ void RheologyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal
    f[BNW]  = f_TSE  + feq[BNW];
    f[BSE]  = f_TNW  + feq[BSE];
    f[BSW]  = f_TNE  + feq[BSW];
-   f[REST] = f_ZERO + feq[REST];
+   f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void RheologyInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp
index a6372fc31..f5c87b9fc 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp
@@ -39,7 +39,7 @@
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "DataSet3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "BCAdapter.h"
 #include "Block3D.h"
 #include "BCArray3D.h"
@@ -52,7 +52,9 @@
 #include "ThixotropyVelocityWithDensityBCAlgorithm.h"
 
 
-BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) {}
+BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL)
+{
+}
 //////////////////////////////////////////////////////////////////////////
 BoundaryConditionsBlockVisitor::~BoundaryConditionsBlockVisitor() = default;
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp
index b222d2c67..e26b59729 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp
@@ -4,11 +4,11 @@
 #include "Block3D.h"
 #include "BoundaryConditions.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 
 ChangeBoundaryDensityBlockVisitor::ChangeBoundaryDensityBlockVisitor(float oldBoundaryDensity, float newBoundaryDensity)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), oldBoundaryDensity(oldBoundaryDensity),
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), oldBoundaryDensity(oldBoundaryDensity),
       newBoundaryDensity(newBoundaryDensity)
 {
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
index 1f8a9c30e..d329763a4 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
@@ -1,10 +1,10 @@
 #include "CheckRatioBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 
 CheckRatioBlockVisitor::CheckRatioBlockVisitor(int levelDepth /*shut be maxGridLevel*/, bool includeNotActiveBlocks)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), levelDepth(levelDepth), includeNotActiveBlocks(includeNotActiveBlocks),
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), levelDepth(levelDepth), includeNotActiveBlocks(includeNotActiveBlocks),
       state(true)
 {
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/GenBlocksGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/GenBlocksGridVisitor.cpp
index a8270d40d..29ea3bfda 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/GenBlocksGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/GenBlocksGridVisitor.cpp
@@ -35,7 +35,7 @@
 #include "Block3D.h"
 #include "CoordinateTransformation3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 
 #include <geometry3d/GbObject3D.h>
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
index aba67e674..fd0b68655 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
@@ -38,10 +38,10 @@
 #include "DataSet3D.h"
 #include "EsoTwist3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 
-InitDistributionsBlockVisitor::InitDistributionsBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+InitDistributionsBlockVisitor::InitDistributionsBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL)
 {
     this->setVx1(0.0);
     this->setVx2(0.0);
@@ -273,7 +273,7 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D>
                f[BNW]  = f_TSE  + feq[BNW];
                f[BSE]  = f_TNW  + feq[BSE];
                f[BSW]  = f_TNE  + feq[BSW];
-               f[REST] = f_ZERO + feq[REST];
+               f[DIR_000] = f_ZERO + feq[DIR_000];
 
                //calcFeqsFct(f,rho,vx1,vx2,vx3);
                distributions->setDistribution(f, ix1, ix2, ix3);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
index b10151a9d..c20cccdf6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
@@ -5,14 +5,14 @@
 #include "DataSet3D.h"
 #include "EsoTwist3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "InitDensityLBMKernel.h"
 #include "LBMKernel.h"
 #include <basics/utilities/UbFileInputASCII.h>
 
 InitDistributionsFromFileBlockVisitor::InitDistributionsFromFileBlockVisitor(/*LBMReal nu, */ LBMReal rho,
                                                                              std::string filename)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), /*nu(nu),*/ rho(rho)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), /*nu(nu),*/ rho(rho)
 {
     UbFileInputASCII in(filename);
     if (!in) {
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
index 343353c7b..567ce2e7f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
@@ -7,7 +7,7 @@
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "DataSet3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "InterpolationProcessor.h"
 #include "LBMKernel.h"
 #include <CbArray2D.h>
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
index f9be89177..d35b9d18f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
@@ -34,7 +34,7 @@
 #include "InitThixotropyBlockVisitor.h"
 #include "LBMKernel.h"
 #include "BCProcessor.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "DataSet3D.h"
 #include "EsoTwist3D.h"
 #include "Grid3D.h"
@@ -42,7 +42,7 @@
 #include "BCArray3D.h"
 
 InitThixotropyBlockVisitor::InitThixotropyBlockVisitor()
-   : Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+   : Block3DVisitor(0, D3Q27System::MAXLEVEL)
 {
    //this->setVx1(0.0);
    //this->setVx2(0.0);
@@ -56,7 +56,7 @@ InitThixotropyBlockVisitor::InitThixotropyBlockVisitor()
 }
 //////////////////////////////////////////////////////////////////////////
 //InitThixotropyBlockVisitor::InitThixotropyBlockVisitor(LBMReal lambda /*LBMReal nu, LBMReal D, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3, LBMReal c, LBMReal f1, LBMReal f2, LBMReal f3*/)
-//	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+//	: Block3DVisitor(0, D3Q27System::MAXLEVEL)
 //{
 //	//this->setVx1(vx1);
 //	//this->setVx2(vx2);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp
index 34dba7411..003d5d312 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp
@@ -39,14 +39,14 @@
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "DataSet3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "BCAdapter.h"
 #include "Block3D.h"
 #include "BCArray3D.h"
 #include "LBMKernel.h"
 
 MultiphaseBoundaryConditionsBlockVisitor::MultiphaseBoundaryConditionsBlockVisitor() :
-Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+Block3DVisitor(0, D3Q27System::MAXLEVEL)
 {
 
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index 484972355..a6ae293a6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -38,11 +38,11 @@
 #include "DataSet3D.h"
 #include "EsoTwist3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 
 MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor() 
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+	: Block3DVisitor(0, D3Q27System::MAXLEVEL)
 {
 	this->setVx1(0.0);
 	this->setVx2(0.0);
@@ -51,7 +51,7 @@ MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor
 }
 //////////////////////////////////////////////////////////////////////////
 MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal vx1, LBMReal vx2, LBMReal vx3, LBMReal rho)
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio) 
+	: Block3DVisitor(0, D3Q27System::MAXLEVEL), densityRatio(densityRatio) 
 {
 	this->setVx1(vx1);
 	this->setVx2(vx2);
@@ -253,7 +253,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					f[BNW]  =  geq[BNW]  ;
 					f[BSE]  =  geq[BSE]  ;
 					f[BSW]  =  geq[BSW]  ;
-					f[REST] =  geq[REST] ;
+					f[DIR_000] =  geq[DIR_000] ;
 
 					distributionsF->setDistribution(f, ix1, ix2, ix3);
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
@@ -284,7 +284,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					f[BNW]  =  phi * feq[BNW]  / rho;
 					f[BSE]  =  phi * feq[BSE]  / rho;
 					f[BSW]  =  phi * feq[BSW]  / rho;
-					f[REST] =  phi * feq[REST] / rho;
+					f[DIR_000] =  phi * feq[DIR_000] / rho;
 
 					distributionsH->setDistribution(f, ix1, ix2, ix3);
 					distributionsH->setDistributionInv(f, ix1, ix2, ix3);
@@ -317,7 +317,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 						f[BNW]  = (1.-phi) * feq[BNW] / rho;
 						f[BSE]  = (1.-phi) * feq[BSE] / rho;
 						f[BSW]  = (1.-phi) * feq[BSW] / rho;
-						f[REST] = (1.-phi) * feq[REST] / rho;
+						f[DIR_000] = (1.-phi) * feq[DIR_000] / rho;
 
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
                         distributionsH2->setDistributionInv(f, ix1, ix2, ix3);                    
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
index afe288e8c..4990690e2 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp
@@ -1,17 +1,17 @@
 #include "MultiphaseSetKernelBlockVisitor.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMSystem.h"
 #include "Block3D.h"
 #include "Grid3D.h"
 
 //SetKernelBlockVisitor::SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue) : 
-//                        Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nue(nue)
+//                        Block3DVisitor(0, D3Q27System::MAXLEVEL), kernel(kernel), nue(nue)
 //{
 //
 //}
 //////////////////////////////////////////////////////////////////////////
 //SetKernelBlockVisitor::SetKernelBlockVisitor( LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem ) : 
-//                                              Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nue(nue)
+//                                              Block3DVisitor(0, D3Q27System::MAXLEVEL), kernel(kernel), nue(nue)
 //{
 //   if (needMem > availMem)
 //   {
@@ -20,7 +20,7 @@
 //}
 //////////////////////////////////////////////////////////////////////////
 MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) :
-	Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), action(action), dataSetFlag(true)
+	Block3DVisitor(0, D3Q27System::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), action(action), dataSetFlag(true)
 {
 	if (needMem > availMem)
 	{
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
index 8a201fa3e..e10a9774d 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
@@ -38,11 +38,11 @@
 #include "DataSet3D.h"
 #include "EsoTwist3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 
 MultiphaseVelocityFormInitDistributionsBlockVisitor::MultiphaseVelocityFormInitDistributionsBlockVisitor() 
-	: Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+	: Block3DVisitor(0, D3Q27System::MAXLEVEL)
 {
 	this->setVx1(0.0);
 	this->setVx2(0.0);
@@ -245,7 +245,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					f[BNW]  =  geq[BNW]  ;
 					f[BSE]  =  geq[BSE]  ;
 					f[BSW]  =  geq[BSW]  ;
-					f[REST] =  geq[REST] ;
+					f[DIR_000] =  geq[DIR_000] ;
 
 					distributionsF->setDistribution(f, ix1, ix2, ix3);
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
@@ -276,7 +276,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					f[BNW]  =  phi * feq[BNW]  ;// / rho;
 					f[BSE]  =  phi * feq[BSE]  ;// / rho;
 					f[BSW]  =  phi * feq[BSW]  ;// / rho;
-					f[REST] =  phi * feq[REST] ;// / rho;
+					f[DIR_000] =  phi * feq[DIR_000] ;// / rho;
 
 					distributionsH->setDistribution(f, ix1, ix2, ix3);
 					distributionsH->setDistributionInv(f, ix1, ix2, ix3);
@@ -309,7 +309,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 						f[BNW]  = (1.-phi) * feq[BNW] ;// / rho;
 						f[BSE]  = (1.-phi) * feq[BSE] ;// / rho;
 						f[BSW]  = (1.-phi) * feq[BSW] ;// / rho;
-						f[REST] = (1.-phi) * feq[REST];//  / rho;
+						f[DIR_000] = (1.-phi) * feq[DIR_000];//  / rho;
 
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
                         distributionsH2->setDistributionInv(f, ix1, ix2, ix3);                    
diff --git a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
index 338c6de90..54bbeda59 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
@@ -1,10 +1,10 @@
 #include "OverlapBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 
 OverlapBlockVisitor::OverlapBlockVisitor(int levelDepth /*shut be maxGridLevel*/, bool includeNotActiveBlocks)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), levelDepth(levelDepth), includeNotActiveBlocks(includeNotActiveBlocks)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), levelDepth(levelDepth), includeNotActiveBlocks(includeNotActiveBlocks)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
index bf25b8876..137c737e6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
@@ -1,10 +1,10 @@
 #include "RatioBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 
 RatioBlockVisitor::RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), maxLevelRatio(1), expandBlocks(true), levelDepth(levelDepth),
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), maxLevelRatio(1), expandBlocks(true), levelDepth(levelDepth),
       includeNotActiveBlocks(includeNotActiveBlocks)
 {
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
index 3bcdd2929..b48aee7cd 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
@@ -1,10 +1,10 @@
 #include "RatioSmoothBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 
 RatioSmoothBlockVisitor::RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
-    : Block3DVisitor(Grid3DSystem::MAXLEVEL, 0), maxLevelRatio(1), expandBlocks(true), levelDepth(levelDepth),
+    : Block3DVisitor(D3Q27System::MAXLEVEL, 0), maxLevelRatio(1), expandBlocks(true), levelDepth(levelDepth),
       includeNotActiveBlocks(includeNotActiveBlocks)
 {
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
index 538fd9511..b2a4d9337 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
@@ -1,12 +1,12 @@
 #include "RenumberBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMSystem.h"
 
 int RenumberBlockVisitor::counter = 0;
 
-RenumberBlockVisitor::RenumberBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) {}
+RenumberBlockVisitor::RenumberBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL) {}
 //////////////////////////////////////////////////////////////////////////
 void RenumberBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
 {
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp
index fc9c5c203..ed9a3ee59 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp
@@ -1,7 +1,7 @@
 #include "RenumberGridVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 //#include <mpi.h>
 
 RenumberGridVisitor::RenumberGridVisitor(std::shared_ptr<vf::mpi::Communicator> com) : comm(com) {}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetBcBlocksBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetBcBlocksBlockVisitor.cpp
index bbccaa785..de3924453 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetBcBlocksBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetBcBlocksBlockVisitor.cpp
@@ -35,11 +35,11 @@
 
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "Interactor3D.h"
 
 SetBcBlocksBlockVisitor::SetBcBlocksBlockVisitor(SPtr<Interactor3D> interactor)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), interactor(interactor)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), interactor(interactor)
 {
 }
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 91f18e729..c47c275cf 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -38,7 +38,7 @@
 
 #include "Block3DVisitor.h"
 #include "D3Q27System.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "Grid3D.h"
 #include "CreateTransmittersHelper.h"
 #include <mpi/Communicator.h>
@@ -75,7 +75,7 @@ protected:
 
 template <class T1, class T2>
 SetConnectorsBlockVisitor<T1, T2>::SetConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), comm(comm)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), comm(comm)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
index 679b63de4..abf828a06 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
@@ -1,18 +1,18 @@
 #include "SetForcingBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMSystem.h"
 
 SetForcingBlockVisitor::SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), forcingX1(forcingX1), forcingX2(forcingX2), forcingX3(forcingX3)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), forcingX1(forcingX1), forcingX2(forcingX2), forcingX3(forcingX3)
 {
     ftype = 0;
 }
 //////////////////////////////////////////////////////////////////////////
 SetForcingBlockVisitor::SetForcingBlockVisitor(const mu::Parser &muForcingX1, const mu::Parser &muForcingX2,
                                                const mu::Parser &muForcingX3)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), muForcingX1(muForcingX1), muForcingX2(muForcingX2),
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), muForcingX1(muForcingX1), muForcingX2(muForcingX2),
       muForcingX3(muForcingX3)
 
 {
@@ -21,7 +21,7 @@ SetForcingBlockVisitor::SetForcingBlockVisitor(const mu::Parser &muForcingX1, co
 //////////////////////////////////////////////////////////////////////////
 SetForcingBlockVisitor::SetForcingBlockVisitor(const std::string &sForcingX1, const std::string &sForcingX2,
                                                const std::string &sForcingX3)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), sForcingX1(sForcingX1), sForcingX2(sForcingX2), sForcingX3(sForcingX3)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), sForcingX1(sForcingX1), sForcingX2(sForcingX2), sForcingX3(sForcingX3)
 
 {
     ftype = 2;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
index 6a55ee5af..4badec1f4 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
@@ -36,14 +36,14 @@
 #include "FineToCoarseVectorConnector.h"
 #include "TwoDistributionsFullDirectConnector.h"
 #include "TwoDistributionsFullVectorConnector.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include <basics/transmitter/TbTransmitterLocal.h>
 
 #include <mpi/Communicator.h>
 #include "InterpolationProcessor.h"
 
 SetInterpolationConnectorsBlockVisitor::SetInterpolationConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm, LBMReal nue, SPtr<InterpolationProcessor> iProcessor) :
-Block3DVisitor(0, Grid3DSystem::MAXLEVEL), 
+Block3DVisitor(0, D3Q27System::MAXLEVEL), 
 	comm(comm),
 	nue(nue),
 	iProcessor(iProcessor)
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
index bb1ae7962..c4b542f1c 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
@@ -1,11 +1,11 @@
 #include "SetInterpolationDirsBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include <D3Q27System.h>
 
 SetInterpolationDirsBlockVisitor::SetInterpolationDirsBlockVisitor(std::vector<int> &dirs)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), dirs(dirs)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), dirs(dirs)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
index 5c813d289..8cf73ca6f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
@@ -38,7 +38,7 @@
 #include "Block3D.h"
 #include "DataSet3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMKernel.h"
 #include "LBMSystem.h"
 #include <utility>
@@ -46,7 +46,7 @@
 //////////////////////////////////////////////////////////////////////////
 SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
                                              SetKernelBlockVisitor::Action action)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(std::move(kernel)), nue(nue), action(action), dataSetFlag(true)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), kernel(std::move(kernel)), nue(nue), action(action), dataSetFlag(true)
 {
     if (needMem > availMem) {
         throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!");
@@ -55,7 +55,7 @@ SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue
 
 SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int &numberOfProcesses,
                                              SetKernelBlockVisitor::Action action)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(std::move(kernel)), nue(nue), action(action), dataSetFlag(true),
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), kernel(std::move(kernel)), nue(nue), action(action), dataSetFlag(true),
       numberOfProcesses(numberOfProcesses)
 {
 }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetSolidBlocksBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetSolidBlocksBlockVisitor.cpp
index 3354755f2..e78300c5a 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetSolidBlocksBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetSolidBlocksBlockVisitor.cpp
@@ -37,11 +37,11 @@
 
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "Interactor3D.h"
 
 SetSolidBlocksBlockVisitor::SetSolidBlocksBlockVisitor(SPtr<Interactor3D> interactor)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), interactor(std::move(interactor))
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), interactor(std::move(interactor))
 {
 }
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
index 040f54b0f..789b3e3dc 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
@@ -1,5 +1,5 @@
 #include "SetSpongeLayerBlockVisitor.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMSystem.h"
 
 #include "Block3D.h"
@@ -7,7 +7,7 @@
 #include "LBMKernel.h"
 
 SetSpongeLayerBlockVisitor::SetSpongeLayerBlockVisitor(const mu::Parser &spongeLayer)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), spongeLayer(spongeLayer)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), spongeLayer(spongeLayer)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
index 15c8b82ba..6e3e6823d 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
@@ -5,11 +5,11 @@
 #include "BoundaryConditions.h"
 #include "D3Q27System.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "ILBMKernel.h"
 
 SetUndefinedNodesBlockVisitor::SetUndefinedNodesBlockVisitor(bool twoTypeOfConnectorsCheck)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), twoTypeOfConnectorsCheck(twoTypeOfConnectorsCheck)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), twoTypeOfConnectorsCheck(twoTypeOfConnectorsCheck)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
index c9bbc78cd..d763fe680 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
@@ -1,5 +1,5 @@
 #include "SpongeLayerBlockVisitor.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "LBMSystem.h"
 
 #include "BCArray3D.h"
@@ -15,7 +15,7 @@ using namespace std;
 
 SpongeLayerBlockVisitor::SpongeLayerBlockVisitor(SPtr<GbCuboid3D> boundingBox, SPtr<LBMKernel> kernel, double nue,
                                                  int dir)
-    : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), boundingBox(boundingBox), kernel(kernel), nue(nue), dir(dir)
+    : Block3DVisitor(0, D3Q27System::MAXLEVEL), boundingBox(boundingBox), kernel(kernel), nue(nue), dir(dir)
 {
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
index 67d185d6a..311a8bf19 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
@@ -1,11 +1,11 @@
 #include "ViscosityBlockVisitor.h"
 #include "Block3D.h"
 #include "Grid3D.h"
-#include "Grid3DSystem.h"
+#include "D3Q27System.h"
 #include "ILBMKernel.h"
 #include "LBMSystem.h"
 
-ViscosityBlockVisitor::ViscosityBlockVisitor(LBMReal nu) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), nu(nu) {}
+ViscosityBlockVisitor::ViscosityBlockVisitor(LBMReal nu) : Block3DVisitor(0, D3Q27System::MAXLEVEL), nu(nu) {}
 //////////////////////////////////////////////////////////////////////////
 void ViscosityBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
 {
-- 
GitLab


From d5979ac8dac5ecfda6c9b187d7f4e7f9e46c6120 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 13 Jul 2022 18:02:12 +0200
Subject: [PATCH 080/179] remove Grid3DSystem files

---
 src/cpu/VirtualFluids.h                       |   1 -
 .../VirtualFluidsCore/Grid/Grid3DSystem.cpp   |  58 ----
 src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h | 291 ------------------
 3 files changed, 350 deletions(-)
 delete mode 100644 src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
 delete mode 100644 src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h

diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index a7e4e798b..a9181e228 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -175,7 +175,6 @@
 #include <Grid/Block3D.h>
 #include <Grid/Calculator.h>
 #include <Grid/Grid3D.h>
-#include <Grid/Grid3DSystem.h>
 
 #include <Interactors/D3Q27Interactor.h>
 #include <Interactors/D3Q27TriFaceMeshInteractor.h>
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
deleted file mode 100644
index 33db1b0cf..000000000
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
-//      \    \  |    |   ________________________________________________________________
-//       \    \ |    |  |  ______________________________________________________________|
-//        \    \|    |  |  |         __          __     __     __     ______      _______
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
-//
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can
-//  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of
-//  the License, or (at your option) any later version.
-//
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-//  for more details.
-//
-//  You should have received a copy of the GNU General Public License along
-//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
-//
-//! \file Grid3DSystem.cpp
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include <Grid3DSystem.h>
-
-namespace Grid3DSystem
-{
-const int INVDIR[] = { INV_E,   INV_W,   INV_N,   INV_S,   INV_T,   INV_B,   INV_NE,  INV_NW, INV_SE,
-                       INV_SW,  INV_TE,  INV_TW,  INV_BE,  INV_BW,  INV_TN,  INV_TS,  INV_BN, INV_BS,
-                       INV_TNE, INV_TNW, INV_TSE, INV_TSW, INV_BNE, INV_BNW, INV_BSE, INV_BSW };
-
-// index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
-// direction:        E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE
-// BSW
-const int EX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
-const int EX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
-const int EX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
-} // namespace Grid3DSystem
-
-//////////////////////////////////////////////////////////////////////////
-const int &Grid3DSystem::getInvertDirection(const int &direction)
-{
-#ifdef _DEBUG
-    if (direction < STARTDIR || direction > ENDDIR)
-        throw UbException(UB_EXARGS, "unknown direction");
-#endif
-    return INVDIR[direction];
-}
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h
deleted file mode 100644
index 94c3bf2a7..000000000
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h
+++ /dev/null
@@ -1,291 +0,0 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
-//      \    \  |    |   ________________________________________________________________
-//       \    \ |    |  |  ______________________________________________________________|
-//        \    \|    |  |  |         __          __     __     __     ______      _______
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
-//
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can
-//  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of
-//  the License, or (at your option) any later version.
-//
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-//  for more details.
-//
-//  You should have received a copy of the GNU General Public License along
-//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
-//
-//! \file Grid3DSystem.h
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef Grid3DSystem_H
-#define Grid3DSystem_H
-
-#include <cmath>
-#include <iostream>
-#include <string>
-
-#include <basics/utilities/UbException.h>
-#include <basics/utilities/UbMath.h>
-
-namespace Grid3DSystem
-{
-static const int STARTDIR = 0;
-
-static const int E /*f1 */    = 0;
-static const int W /*f2 */    = 1;
-static const int N /*f3 */    = 2;
-static const int S /*f4 */    = 3;
-static const int T /*f5 */    = 4;
-static const int B /*f6 */    = 5;
-static const int NE /*f7 */   = 6;
-static const int SW /*f8 */   = 7;
-static const int SE /*f9 */   = 8;
-static const int NW /*f10*/   = 9;
-static const int TE /*f11*/   = 10;
-static const int BW /*f12*/   = 11;
-static const int BE /*f13*/   = 12;
-static const int TW /*f14*/   = 13;
-static const int TN /*f15*/   = 14;
-static const int BS /*f16*/   = 15;
-static const int BN /*f17*/   = 16;
-static const int TS /*f18*/   = 17;
-static const int TNE          = 18;
-static const int TNW          = 19;
-static const int TSE          = 20;
-static const int TSW          = 21;
-static const int BNE          = 22;
-static const int BNW          = 23;
-static const int BSE          = 24;
-static const int BSW          = 25;
-static const int REST /*f0 */ = 26;
-
-static const int ENDDIR = 25;
-
-static const int INV_E   = W;
-static const int INV_W   = E;
-static const int INV_N   = S;
-static const int INV_S   = N;
-static const int INV_T   = B;
-static const int INV_B   = T;
-static const int INV_NE  = SW;
-static const int INV_NW  = SE;
-static const int INV_SE  = NW;
-static const int INV_SW  = NE;
-static const int INV_TE  = BW;
-static const int INV_TW  = BE;
-static const int INV_BE  = TW;
-static const int INV_BW  = TE;
-static const int INV_TN  = BS;
-static const int INV_TS  = BN;
-static const int INV_BN  = TS;
-static const int INV_BS  = TN;
-static const int INV_TNE = BSW;
-static const int INV_TNW = BSE;
-static const int INV_TSE = BNW;
-static const int INV_TSW = BNE;
-static const int INV_BNE = TSW;
-static const int INV_BNW = TSE;
-static const int INV_BSE = TNW;
-static const int INV_BSW = TNE;
-
-extern const int INVDIR[ENDDIR + 1];
-
-static const int MINLEVEL = 0;
-static const int MAXLEVEL = 25;
-
-extern const int EX1[ENDDIR + 1];
-extern const int EX2[ENDDIR + 1];
-extern const int EX3[ENDDIR + 1];
-
-inline std::string getDirectionString(int direction)
-{
-    switch (direction) {
-        case E:
-            return "E";
-        case W:
-            return "W";
-        case N:
-            return "N";
-        case S:
-            return "S";
-        case T:
-            return "T";
-        case B:
-            return "B";
-        case NE:
-            return "NE";
-        case NW:
-            return "NW";
-        case SE:
-            return "SE";
-        case SW:
-            return "SW";
-        case TE:
-            return "TE";
-        case TW:
-            return "TW";
-        case BE:
-            return "BE";
-        case BW:
-            return "BW";
-        case TN:
-            return "TN";
-        case TS:
-            return "TS";
-        case BN:
-            return "BN";
-        case BS:
-            return "BS";
-        case TNE:
-            return "TNE";
-        case TNW:
-            return "TNW";
-        case TSE:
-            return "TSE";
-        case TSW:
-            return "TSW";
-        case BNE:
-            return "BNE";
-        case BNW:
-            return "BNW";
-        case BSE:
-            return "BSE";
-        case BSW:
-            return "BSW";
-        default:
-            return "Cell3DSystem::getDrectionString(...) - unknown dir";
-    }
-}
-static const int &getInvertDirection(const int &direction);
-
-//////////////////////////////////////////////////////////////////////////
-static inline void setNeighborCoordinatesForDirection(int &x1, int &x2, int &x3, const int &direction)
-{
-    switch (direction) {
-        case Grid3DSystem::E:
-            x1++;
-            break;
-        case Grid3DSystem::N:
-            x2++;
-            break;
-        case Grid3DSystem::T:
-            x3++;
-            break;
-        case Grid3DSystem::W:
-            x1--;
-            break;
-        case Grid3DSystem::S:
-            x2--;
-            break;
-        case Grid3DSystem::B:
-            x3--;
-            break;
-        case Grid3DSystem::NE:
-            x1++;
-            x2++;
-            break;
-        case Grid3DSystem::NW:
-            x1--;
-            x2++;
-            break;
-        case Grid3DSystem::SW:
-            x1--;
-            x2--;
-            break;
-        case Grid3DSystem::SE:
-            x1++;
-            x2--;
-            break;
-        case Grid3DSystem::TE:
-            x1++;
-            x3++;
-            break;
-        case Grid3DSystem::BW:
-            x1--;
-            x3--;
-            break;
-        case Grid3DSystem::BE:
-            x1++;
-            x3--;
-            break;
-        case Grid3DSystem::TW:
-            x1--;
-            x3++;
-            break;
-        case Grid3DSystem::TN:
-            x2++;
-            x3++;
-            break;
-        case Grid3DSystem::BS:
-            x2--;
-            x3--;
-            break;
-        case Grid3DSystem::BN:
-            x2++;
-            x3--;
-            break;
-        case Grid3DSystem::TS:
-            x2--;
-            x3++;
-            break;
-        case Grid3DSystem::TNE:
-            x1++;
-            x2++;
-            x3++;
-            break;
-        case Grid3DSystem::TNW:
-            x1--;
-            x2++;
-            x3++;
-            break;
-        case Grid3DSystem::TSE:
-            x1++;
-            x2--;
-            x3++;
-            break;
-        case Grid3DSystem::TSW:
-            x1--;
-            x2--;
-            x3++;
-            break;
-        case Grid3DSystem::BNE:
-            x1++;
-            x2++;
-            x3--;
-            break;
-        case Grid3DSystem::BNW:
-            x1--;
-            x2++;
-            x3--;
-            break;
-        case Grid3DSystem::BSE:
-            x1++;
-            x2--;
-            x3--;
-            break;
-        case Grid3DSystem::BSW:
-            x1--;
-            x2--;
-            x3--;
-            break;
-        default:
-            throw UbException(UB_EXARGS, "no direction ...");
-    }
-}
-} // namespace Grid3DSystem
-
-#endif
-- 
GitLab


From 75cd008bc6691a2e8344118070a97ea4f06c3765 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 18 Jul 2022 23:21:18 +0200
Subject: [PATCH 081/179] add Immersed Boundary: it doesn't work yet

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          | 101 ++-
 apps/cpu/LiggghtsApp/in.lbdem                 |  72 ++
 apps/cpu/LiggghtsApp/in2.lbdem                |  21 +
 .../LiggghtsCoupling/IBdynamicsParticleData.h |  50 ++
 .../LiggghtsCouplingCoProcessor.cpp           | 219 +++++-
 .../LiggghtsCouplingCoProcessor.h             |  36 +-
 .../LBM/IBcumulantK17LBMKernel.cpp            | 660 ++++++++++++++++++
 .../LBM/IBcumulantK17LBMKernel.h              | 156 +++++
 8 files changed, 1311 insertions(+), 4 deletions(-)
 create mode 100644 apps/cpu/LiggghtsApp/in.lbdem
 create mode 100644 apps/cpu/LiggghtsApp/in2.lbdem
 create mode 100644 src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 61f835128..634ca28dd 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -21,10 +21,109 @@ using namespace std;
 int main(int argc, char *argv[])
 {
     SPtr<Communicator> comm = MPICommunicator::getInstance();
-    //MPI_Init(&argc, &argv);
+    int myid                                        = comm->getProcessID();
+
+
+    // bounding box
+    double g_minX1 = 0;
+    double g_minX2 = 0;
+    double g_minX3 = 0;
+
+    double g_maxX1 = 1;
+    double g_maxX2 = 1;
+    double g_maxX3 = 2;
+
+    int blockNX[3] = { 10, 10, 20 };
+
+    double dx = 0.1;
+
+    double nuLB = 0.005;
+
+    SPtr<Grid3D> grid = make_shared<Grid3D>(comm);
+    grid->setPeriodicX1(true);
+    grid->setPeriodicX2(true);
+    grid->setPeriodicX3(true);
+    grid->setDeltaX(dx);
+    grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
+
+    string outputPath = "d:/temp/lll2";
+    
+    SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
+    if (myid == 0)
+        GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+    GenBlocksGridVisitor genBlocks(gridCube);
+    grid->accept(genBlocks);
+
+    SPtr<CoProcessor> ppblocks =
+        make_shared <WriteBlocksCoProcessor>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath,
+                                                          WbWriterVtkXmlBinary::getInstance(), comm);
+    ppblocks->process(0);
+    ppblocks.reset();
+
+    SPtr<LBMKernel> kernel = make_shared<IncompressibleCumulantLBMKernel>();
+    SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
+    kernel->setBCProcessor(bcProc);
+
+    SetKernelBlockVisitor kernelVisitor(kernel, nuLB, 1e9, 1e9);
+    grid->accept(kernelVisitor);
+
+    InitDistributionsBlockVisitor initVisitor;
+    grid->accept(initVisitor);
+
+    SPtr<UbScheduler> lScheduler                    = make_shared<UbScheduler>(1);
+    string inFile1                                   = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in.lbdem";
+    //string inFile1 = "d:/Tools/LIGGGHTS/examples/LIGGGHTS/Tutorials_public/chute_wear/in.chute_wear2";
+    string inFile2                                   = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem";
     MPI_Comm mpi_comm       = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
+    double d_part = 0.1;
+    double v_frac = 0.1;
+    double dt_phys  = 1; // units.getPhysTime(1);
+    int demSubsteps = 1;
+    double dt_dem   = 1e-1; //dt_phys / (double)demSubsteps;
+    int vtkSteps    = 1;
+    string demOutDir = "d:/temp/lll2/";
+
+    wrapper.setVariable("r_part", d_part / 2);
+    wrapper.setVariable("v_frac", v_frac);
+
+    wrapper.execFile((char*)inFile1.c_str());
+
+    //// set timestep and output directory
+    wrapper.setVariable("t_step", dt_dem);
+    wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
+    wrapper.setVariable("dmp_dir", demOutDir);
+
+    wrapper.execFile((char *)inFile2.c_str());
+    //wrapper.runUpto(demSubsteps - 1);
+
+    SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
+        make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps);
+
+    // write data for visualization of macroscopic quantities
+    SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
+    SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
+        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(),
+                                                  SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+
+    int endTime = 20;
+    SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
+    calculator->addCoProcessor(lcCoProcessor);
+    calculator->addCoProcessor(writeMQCoProcessor);
+
+    if (myid == 0) UBLOG(logINFO, "Simulation-start");
+    calculator->calculate();
+    if (myid == 0) UBLOG(logINFO, "Simulation-end");
+
+    //MPI_Init(&argc, &argv);
+    //MPI_Comm mpi_comm       = *(MPI_Comm*)(comm->getNativeCommunicator());
+    //LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
+
+    //wrapper.execFile("in2.lbdem");
+    //wrapper.runUpto(demSubsteps - 1);
+
 	//LAMMPS_NS::LAMMPS *lmp;
  //   // custom argument vector for LAMMPS library
  //   const char *lmpargv[] {"liblammps", "-log", "none"};
diff --git a/apps/cpu/LiggghtsApp/in.lbdem b/apps/cpu/LiggghtsApp/in.lbdem
new file mode 100644
index 000000000..f15eab6f8
--- /dev/null
+++ b/apps/cpu/LiggghtsApp/in.lbdem
@@ -0,0 +1,72 @@
+
+units		si
+atom_style	granular
+atom_modify	map array
+
+communicate	single vel yes
+
+boundary	f f f
+newton		off
+
+processors * * 1
+region		box block 0. 1. 0. 1. 0. 2. units box
+create_box	1 box
+
+variable	skin equal 0.01
+neighbor	${skin} bin
+neigh_modify	delay 0 binsize 0.01 one 1000
+
+fix grav all gravity 0.981 vector 0 0 -1
+
+
+fix 		m1 all property/global youngsModulus peratomtype 1e8
+fix 		m2 all property/global poissonsRatio peratomtype 0.4
+fix 		m3 all property/global coefficientRestitution peratomtypepair 1 0.95
+fix 		m4 all property/global coefficientFriction peratomtypepair 1 0.45
+fix 		m5 all property/global coefficientRollingFriction peratomtypepair 1 0.020
+
+# lb coupling fix
+fix lbcoupling all couple/lb/onetoone
+
+
+pair_style	gran model hertz tangential history rolling_friction cdt
+pair_coeff	* *
+
+fix		1 all nve/sphere
+
+fix xwalls1 all wall/gran model hertz tangential history primitive type 1 xplane 0.
+fix xwalls2 all wall/gran model hertz tangential history primitive type 1 xplane 1.
+fix ywalls1 all wall/gran model hertz tangential history primitive type 1 yplane 0.
+fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane 1.
+fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
+fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
+
+create_atoms 1 single 0.5 0.5 1.75
+#create_atoms 1 single 0.38 0.05 0.05
+
+set group all diameter 0.3 density 2400
+
+atom_modify sort 0 0.0
+
+#fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.015 
+#fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.01 
+#fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1100 radius constant ${r_part} 
+
+# fix pdd1 all particledistribution/discrete 6778  1 pts1 1.0
+# #fix pdd2 all particledistribution/discrete 6778  2 pts2 0.2 pts3 0.8
+
+# # region  insreg block 0.1 0.9 0.1 0.9 1.3 1.9 units box
+
+
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+# #                         overlapcheck yes particles_in_region 350 region insreg ntry_mc 10000 
+# fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+                        # overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd2 insert_every once &
+# #                        overlapcheck yes volumefraction_region 0.05 region insreg ntry_mc 10000 
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+# #                        overlapcheck yes particles_in_region 1 region insreg ntry_mc 10000 
+
+
+
+run 1
diff --git a/apps/cpu/LiggghtsApp/in2.lbdem b/apps/cpu/LiggghtsApp/in2.lbdem
new file mode 100644
index 000000000..3e2fa90d2
--- /dev/null
+++ b/apps/cpu/LiggghtsApp/in2.lbdem
@@ -0,0 +1,21 @@
+
+timestep        ${t_step}      
+
+# thermo settings
+fix		ts all check/timestep/gran 10000 0.1 0.1
+compute		1 all erotate/sphere
+thermo_style	custom step atoms ke c_1 f_ts[1] f_ts[2] cpu
+thermo		10000
+thermo_modify	lost ignore norm no flush yes
+compute_modify	thermo_temp dynamic yes
+
+# particle dump
+variable dmp_fname string ${dmp_dir}d_*.liggghts
+
+# dump		dmp all custom ${dmp_stp} ${dmp_fname} & 
+		# id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+
+# dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
+# 		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+	
+dump   dmp all custom/vtk 1 ${dmp_dir}post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
diff --git a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
new file mode 100644
index 000000000..8bf11ca7a
--- /dev/null
+++ b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
@@ -0,0 +1,50 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file DataSet3D.h
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef IBdynamicsParticleData_h
+#define IBdynamicsParticleData_h
+
+#include<array>
+
+constexpr auto SOLFRAC_MIN = 0.001;
+constexpr auto SOLFRAC_MAX = 0.999;
+
+struct IBdynamicsParticleData {
+public:
+    int partId{0};
+    double solidFraction{0};
+    std::array<double, 3> uPart{ 0., 0., 0. };
+    std::array<double, 3> hydrodynamicForce{ 0., 0., 0. };
+};
+
+#endif
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index 6dc8539c6..ae3335374 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -1,7 +1,29 @@
 #include "LiggghtsCouplingCoProcessor.h"
+#include "GbSphere3D.h"
+#include "MPICommunicator.h"
+#include "CoProcessor.h"
+#include "LiggghtsCouplingWrapper.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "DistributionArray3D.h"
+#include "DataSet3D.h"
+#include "IBcumulantK17LBMKernel.h"
 
-LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor()
+LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                                         SPtr<Communicator> comm, LiggghtsCouplingWrapper &wrapper,
+                                                         int demSteps)
+    : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps)
 {
+    //gridRank     = comm->getProcessID();
+    //minInitLevel = this->grid->getCoarsestInitializedLevel();
+    //maxInitLevel = this->grid->getFinestInitializedLevel();
+
+    //blockVector.resize(maxInitLevel + 1);
+
+    //for (int level = minInitLevel; level <= maxInitLevel; level++) {
+    //    grid->getBlocks(level, gridRank, true, blockVector[level]);
+    //}
 }
 
 LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
@@ -9,5 +31,200 @@ LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
 }
 
 void LiggghtsCouplingCoProcessor::process(double actualTimeStep)
+{ 
+    setSpheresOnLattice();
+    wrapper.run(demSteps);
+    std::cout << "step: " << actualTimeStep << "\n";
+}
+
+void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
+{
+    std::vector<int> excludeType;
+
+    int nPart = wrapper.lmp->atom->nlocal + wrapper.lmp->atom->nghost;
+
+    for (int iS = 0; iS < nPart; iS++) 
+    {
+        int type = (int)wrapper.lmp->atom->type[iS];
+        bool excludeFlag(false);
+        for (int iT = 0; iT < excludeType.size(); iT++) {
+            //std::cout << iS << " " << type << " " << excludeType[iT] << std::endl;
+            if (type == excludeType[iT]) {
+                excludeFlag = true;
+                break;
+            }
+        }
+
+        if (excludeFlag)
+            continue;
+
+        double x[3], v[3], omega[3];
+        double r;
+        int id = wrapper.lmp->atom->tag[iS];
+
+        for (int i = 0; i < 3; i++) 
+        {
+            x[i] = wrapper.lmp->atom->x[iS][i];
+            v[i]     = wrapper.lmp->atom->v[iS][i];
+            omega[i] = wrapper.lmp->atom->omega[iS][i];
+        }
+        
+        r = wrapper.lmp->atom->radius[iS];
+
+        std::cout << "x[0] = " << x[0] << ", x[1] = " << x[1] << ", x[2] = " << x[2] << std::endl;
+        std::cout << "v[0] = " << v[0] << ", v[1] = " << v[1] << ", v[2] = " << v[2] << std::endl;
+        std::cout << "omega[0] = " << omega[0] << ", omega[1] = " << omega[1] << ", omega[2] = " << omega[2] << std::endl;
+        std::cout << "r = " << r << std::endl;
+        
+        setSingleSphere3D(x, v, omega, r, id);
+    }
+}
+
+void LiggghtsCouplingCoProcessor::getForcesFromLattice() {}
+
+void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r,
+                                                    int id /*, bool initVelFlag*/)
+{
+    int level = 0;
+    //UbTupleInt3 bi = grid->getBlockIndexes(x[0], x[1], x[2], level);
+    //SPtr<Block3D> block = grid->getBlock(val<1>(bi), val<2>(bi), val<3>(bi), level);
+    
+    std::vector<SPtr<Block3D>> blocks;
+    grid->getBlocksByCuboid(level, x[0] - r, x[1] - r, x[2] - r, x[0] + r, x[1] + r, x[2] + r, blocks);
+    
+
+
+
+    for (SPtr<Block3D> block : blocks) {
+        if (block) {
+            SPtr<ILBMKernel> kernel = block->getKernel();
+            // SPtr<BCArray3D> bcArray                 = kernel->getBCProcessor()->getBCArray();
+            SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+
+            CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData =
+                dynamicPointerCast<IBcumulantK17LBMKernel>(kernel)->getParticleData();
+
+            if (!particleData)
+                continue;
+
+            int minX1 = 1;
+            int minX2 = 1;
+            int minX3 = 1;
+
+            int maxX1 = (int)(distributions->getNX1()) - 1;
+            int maxX2 = (int)(distributions->getNX2()) - 1;
+            int maxX3 = (int)(distributions->getNX3()) - 1;
+
+            for (int ix3 = minX3; ix3 < maxX3; ix3++) {
+                for (int ix2 = minX2; ix2 < maxX2; ix2++) {
+                    for (int ix1 = minX1; ix1 < maxX1; ix1++) {
+
+                        Vector3D nX = grid->getNodeCoordinates(block, ix1, ix2, ix3);
+                        
+                        double const dx = nX[0] - x[0];
+                        double const dy = nX[1] - x[1];
+                        double const dz = nX[2] - x[2];
+
+                        double const sf = calcSolidFraction(dx, dy, dz, r);
+
+                        double const sf_old = (*particleData)(ix1,ix2,ix3)->solidFraction;
+                        int const id_old = (int)(*particleData)(ix1,ix2,ix3)->partId;
+
+                        int const decFlag = (sf > SOLFRAC_MIN) + 2 * (sf_old > SOLFRAC_MIN);
+
+                        switch (decFlag) {
+                            case 0: // sf == 0 && sf_old == 0
+                                setToZero(*(*particleData)(ix1, ix2, ix3).get());
+                                break; // do nothing
+                            case 1:    // sf > 0 && sf_old == 0
+                                setValues(*(*particleData)(ix1, ix2, ix3).get(), sf, dx, dy, dz, omega, id);
+                                break;
+                            case 2:               // sf == 0 && sf_old > 0
+                                if (id_old == id) // then particle has left this cell
+                                    setToZero(*(*particleData)(ix1, ix2, ix3).get());
+                                break; // else do nothing
+                            case 3:    // sf > 0 && sf_old > 0
+                                if (sf > sf_old || id_old == id)
+                                    setValues(*(*particleData)(ix1, ix2, ix3).get(), sf, dx, dy, dz, omega, id);
+                                break; // else do nothing
+                        }
+                        // if desired, initialize interior of sphere with sphere velocity
+                       // if (initVelFlag && sf > SOLFRAC_MAX)
+                       //     cell.defineVelocity(particleData->uPart);
+                    }
+                }
+            }
+        }
+    }
+
+}
+
+double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double const dy_, double const dz_,
+                                                      double const r_)
+{
+    static int const slicesPerDim = 5;
+    static double const sliceWidth       = 1. / ((double)slicesPerDim);
+    static double const fraction         = 1. / ((double)(slicesPerDim * slicesPerDim * slicesPerDim));
+
+    // should be sqrt(3.)/2.
+    // add a little to avoid roundoff errors
+    static const double sqrt3half = (double)sqrt(3.1) / 2.;
+
+    double const dist = dx_ * dx_ + dy_ * dy_ + dz_ * dz_;
+
+    double const r_p = r_ + sqrt3half;
+    if (dist > r_p * r_p)
+        return 0;
+
+    double const r_m = r_ - sqrt3half;
+    if (dist < r_m * r_m)
+        return 1;
+
+    double const r_sq = r_ * r_;
+    double dx_sq[slicesPerDim], dy_sq[slicesPerDim], dz_sq[slicesPerDim];
+
+    // pre-calculate d[xyz]_sq for efficiency
+    for (int i = 0; i < slicesPerDim; i++) {
+        double const delta = -0.5 + ((double)i + 0.5) * sliceWidth;
+        double const dx    = dx_ + delta;
+        dx_sq[i]      = dx * dx;
+        double const dy    = dy_ + delta;
+        dy_sq[i]      = dy * dy;
+        double const dz    = dz_ + delta;
+        dz_sq[i]      = dz * dz;
+    }
+
+    unsigned int n(0);
+    for (int i = 0; i < slicesPerDim; i++) {
+        for (int j = 0; j < slicesPerDim; j++) {
+            for (int k = 0; k < slicesPerDim; k++) {
+                n += (dx_sq[i] + dy_sq[j] + dz_sq[k] < r_sq);
+            }
+        }
+    }
+
+    return fraction * ((double)n);
+}
+
+  void LiggghtsCouplingCoProcessor::setValues(IBdynamicsParticleData &p, double const sf, double const dx,
+                                                 double const dy, double const dz, double* omega, int id)
+{
+    //p.uPart.from_cArray(v);
+    if (omega != 0) {
+        p.uPart[0] += omega[1] * dz - omega[2] * dy;
+        p.uPart[1] += -omega[0] * dz + omega[2] * dx;
+        p.uPart[2] += omega[0] * dy - omega[1] * dx;
+    }
+    p.solidFraction = sf;
+    p.partId        = id;
+}
+
+
+void LiggghtsCouplingCoProcessor::setToZero(IBdynamicsParticleData &p)
 {
+    p.uPart[0]      = 0;
+    p.uPart[1]      = 0;
+    p.uPart[2]      = 0;
+    p.solidFraction = 0;
+    p.partId        = 0;
 }
\ No newline at end of file
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
index d186aa750..509e83b4a 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
@@ -40,16 +40,48 @@
 #include "input.h"
 #include "atom.h"
 #include "modify.h"
-#include "fix_lb_coupling_onetoone.h"
+
+#include <memory>
+#include <vector>
+
+
+class CoProcessor;
+class Communicator;
+class LiggghtsCouplingWrapper;
+class Grid3D;
+class Block3D;
+struct IBdynamicsParticleData;
 
 class LiggghtsCouplingCoProcessor : public CoProcessor
 {
 public:
-    LiggghtsCouplingCoProcessor();
+    LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Communicator> comm,
+                                LiggghtsCouplingWrapper &wrapper, int demSteps);
     virtual ~LiggghtsCouplingCoProcessor();
 
     void process(double actualTimeStep) override;
 
+    
+protected:
+    void setSpheresOnLattice();
+    void getForcesFromLattice();
+    void setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r,
+                           int id /*, bool initVelFlag*/);
+    double calcSolidFraction(double const dx_, double const dy_, double const dz_, double const r_);
+
+    void setValues(IBdynamicsParticleData &p, double const sf, double const dx, double const dy, double const dz,
+                   double *omega, int id);
+
+    void setToZero(IBdynamicsParticleData &p);
+
+private:
+    SPtr<Communicator> comm;
+    LiggghtsCouplingWrapper &wrapper;
+    int demSteps;
+    std::vector<std::vector<SPtr<Block3D>>> blockVector;
+    int minInitLevel;
+    int maxInitLevel;
+    int gridRank;
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp
new file mode 100644
index 000000000..346a61009
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp
@@ -0,0 +1,660 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file IBcumulantK17LBMKernel.cpp
+//! \ingroup LBM
+//! \author Konstantin Kutscher, Martin Geier
+//=======================================================================================
+#include "IBcumulantK17LBMKernel.h"
+#include "D3Q27System.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include <cmath>
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include "Block3D.h"
+#include "BCArray3D.h"
+
+#define PROOF_CORRECTNESS
+
+using namespace UbMath;
+
+//////////////////////////////////////////////////////////////////////////
+IBcumulantK17LBMKernel::IBcumulantK17LBMKernel()
+{
+    this->compressible = true;
+}
+//////////////////////////////////////////////////////////////////////////
+void IBcumulantK17LBMKernel::initDataSet()
+{
+    SPtr<DistributionArray3D> d(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9));
+    dataSet->setFdistributions(d);
+
+    particleData =
+        std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0], nx[1], nx[2]);
+
+    int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = nx[0];
+    int maxX2 = nx[1];
+    int maxX3 = nx[2];
+
+    LBMReal omega = collFactor;
+
+    for (int x3 = minX3; x3 < maxX3; x3++) {
+        for (int x2 = minX2; x2 < maxX2; x2++) {
+            for (int x1 = minX1; x1 < maxX1; x1++) {
+                (*particleData)(x1, x2, x3) = std::make_shared<IBdynamicsParticleData>();
+            }
+        }
+    }
+
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> IBcumulantK17LBMKernel::clone()
+{
+    SPtr<LBMKernel> kernel(new IBcumulantK17LBMKernel());
+    kernel->setNX(nx);
+    std::dynamic_pointer_cast<IBcumulantK17LBMKernel>(kernel)->initDataSet();
+    kernel->setCollisionFactor(this->collFactor);
+    kernel->setBCProcessor(bcProcessor->clone(kernel));
+    kernel->setWithForcing(withForcing);
+    kernel->setForcingX1(muForcingX1);
+    kernel->setForcingX2(muForcingX2);
+    kernel->setForcingX3(muForcingX3);
+    kernel->setIndex(ix1, ix2, ix3);
+    kernel->setDeltaT(deltaT);
+    kernel->setBlock(block.lock());
+
+    return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+void IBcumulantK17LBMKernel::calculate(int step)
+{
+    //////////////////////////////////////////////////////////////////////////
+    //! Cumulant K17 Kernel is based on
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //! and
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.07.004 ]</b></a>
+    //!
+    //! The cumulant kernel is executed in the following steps
+    //!
+    ////////////////////////////////////////////////////////////////////////////////
+    //! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim.
+    //!
+
+    using namespace std;
+
+    //initializing of forcing stuff
+    if (withForcing)
+    {
+        muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+        muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+        muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+
+        muDeltaT = deltaT;
+
+        muForcingX1.DefineVar("dt", &muDeltaT);
+        muForcingX2.DefineVar("dt", &muDeltaT);
+        muForcingX3.DefineVar("dt", &muDeltaT);
+
+        muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+
+        muForcingX1.DefineVar("nu", &muNu);
+        muForcingX2.DefineVar("nu", &muNu);
+        muForcingX3.DefineVar("nu", &muNu);
+    }
+    /////////////////////////////////////
+
+    localDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+    nonLocalDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+    restDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+    SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+    const int bcArrayMaxX1 = (int)bcArray->getNX1();
+    const int bcArrayMaxX2 = (int)bcArray->getNX2();
+    const int bcArrayMaxX3 = (int)bcArray->getNX3();
+
+    int minX1 = ghostLayerWidth;
+    int minX2 = ghostLayerWidth;
+    int minX3 = ghostLayerWidth;
+    int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+    int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+    int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+
+    LBMReal omega = collFactor;
+
+    for (int x3 = minX3; x3 < maxX3; x3++)
+    {
+        for (int x2 = minX2; x2 < maxX2; x2++)
+        {
+            for (int x1 = minX1; x1 < maxX1; x1++)
+            {
+                if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3))
+                {
+                    int x1p = x1 + 1;
+                    int x2p = x2 + 1;
+                    int x3p = x3 + 1;
+                    //////////////////////////////////////////////////////////////////////////
+                    //////////////////////////////////////////////////////////////////////////
+                    //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm
+                    //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+                    //!
+                    ////////////////////////////////////////////////////////////////////////////
+                    //////////////////////////////////////////////////////////////////////////
+
+                    //E   N  T
+                    //c   c  c
+                    //////////
+                    //W   S  B
+                    //a   a  a
+
+                    //Rest is b
+
+                    //mfxyz
+                    //a - negative
+                    //b - null
+                    //c - positive
+
+                    // a b c
+                    //-1 0 1
+
+                    LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+                    LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+                    LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+                    LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+                    LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
+                    LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+                    LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
+                    LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+                    LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3);
+                    LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+                    LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+                    LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
+                    LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
+                    LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
+                    LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
+                    LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p);
+                    LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p);
+                    LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+                    LBMReal mfbbb = (*this->restDistributions)(x1, x2, x3);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3)
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //!
+                    LBMReal drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+                                    (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+                                    ((mfabb + mfcbb) + (mfbab + mfbcb)) + (mfbba + mfbbc)) + mfbbb;
+
+                    LBMReal rho = c1 + drho;
+                    LBMReal OOrho = c1 / rho;
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+                                   (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+                                   (mfcbb - mfabb)) / rho;
+                    LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+                                   (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+                                   (mfbcb - mfbab)) / rho;
+                    LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+                                   (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+                                   (mfbbc - mfbba)) / rho;
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //forcing
+                    ///////////////////////////////////////////////////////////////////////////////////////////
+                    if (withForcing)
+                    {
+                        muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
+                        muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
+                        muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
+
+                        forcingX1 = muForcingX1.Eval();
+                        forcingX2 = muForcingX2.Eval();
+                        forcingX3 = muForcingX3.Eval();
+
+                        ////////////////////////////////////////////////////////////////////////////////////
+                        //! - Add half of the acceleration (body force) to the velocity as in Eq. (42)
+                        //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                        //!
+                        vvx += forcingX1 * deltaT * c1o2; // X
+                        vvy += forcingX2 * deltaT * c1o2; // Y
+                        vvz += forcingX3 * deltaT * c1o2; // Z
+                    }
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // calculate the square of velocities for this lattice node
+                    LBMReal vx2 = vvx * vvx;
+                    LBMReal vy2 = vvy * vvy;
+                    LBMReal vz2 = vvz * vvz;
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to section 6 in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    LBMReal wadjust;
+                    LBMReal qudricLimitP = c1o100;
+                    LBMReal qudricLimitM = c1o100;
+                    LBMReal qudricLimitD = c1o100;
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //! see also Eq. (6)-(14) in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // Z - Dir
+                    forwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36, c1o36);
+                    forwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2, c9, c1o9);
+                    forwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36, c1o36);
+                    forwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2, c9, c1o9);
+                    forwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9);
+                    forwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2, c9, c1o9);
+                    forwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36, c1o36);
+                    forwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2, c9, c1o9);
+                    forwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36, c1o36);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // Y - Dir
+                    forwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2, c6, c1o6);
+                    forwardChimera(mfaab, mfabb, mfacb, vvy, vy2);
+                    forwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18, c1o18);
+                    forwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3);
+                    forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2);
+                    forwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9);
+                    forwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2, c6, c1o6);
+                    forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2);
+                    forwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18, c1o18);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // X - Dir
+                    forwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1, c1);
+                    forwardChimera(mfaba, mfbba, mfcba, vvx, vx2);
+                    forwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3, c1o3);
+                    forwardChimera(mfaab, mfbab, mfcab, vvx, vx2);
+                    forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2);
+                    forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2);
+                    forwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3, c1o3);
+                    forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2);
+                    forwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c9, c1o9);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations according to
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!  => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE].
+                    //!  - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$.
+                    //!  - Third order cumulants \f$ C_{120}+C_{102} \f$, \f$ C_{210}+C_{012} \f$, \f$ C_{201}+C_{021} \f$: \f$\omega_3=OxyyPxzz\f$ set according to Eq. (111) with simplifications assuming \f$\omega_2=1.0\f$.
+                    //!  - Third order cumulants \f$ C_{120}-C_{102} \f$, \f$ C_{210}-C_{012} \f$, \f$ C_{201}-C_{021} \f$: \f$\omega_4 = OxyyMxzz\f$ set according to Eq. (112) with simplifications assuming \f$\omega_2 = 1.0\f$.
+                    //!  - Third order cumulants \f$ C_{111} \f$: \f$\omega_5 = Oxyz\f$ set according to Eq. (113) with simplifications assuming \f$\omega_2 = 1.0\f$  (modify for different bulk viscosity).
+                    //!  - Fourth order cumulants \f$ C_{220} \f$, \f$ C_{202} \f$, \f$ C_{022} \f$, \f$ C_{211} \f$, \f$ C_{121} \f$, \f$ C_{112} \f$: for simplification all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$.
+                    //!  - Fifth order cumulants \f$ C_{221}\f$, \f$C_{212}\f$, \f$C_{122}\f$: \f$\omega_9=O5=1.0\f$.
+                    //!  - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$.
+                    //!
+                    ////////////////////////////////////////////////////////////
+                    //2.
+                    LBMReal OxxPyyPzz = c1;
+                    ////////////////////////////////////////////////////////////
+                    //3.
+                    LBMReal OxyyPxzz = c8  * (-c2 + omega) * ( c1 + c2*omega) / (-c8 - c14*omega + c7*omega*omega);
+                    LBMReal OxyyMxzz = c8  * (-c2 + omega) * (-c7 + c4*omega) / (c56 - c50*omega + c9*omega*omega);
+                    LBMReal Oxyz     = c24 * (-c2 + omega) * (-c2 - c7*omega + c3*omega*omega) / (c48 + c152*omega - c130*omega*omega + c29*omega*omega*omega);
+                    ////////////////////////////////////////////////////////////
+                    //4.
+                    LBMReal O4 = c1;
+                    ////////////////////////////////////////////////////////////
+                    //5.
+                    LBMReal O5 = c1;
+                    ////////////////////////////////////////////////////////////
+                    //6.
+                    LBMReal O6 = c1;
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115)
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! with simplifications assuming \f$\omega_2 = 1.0\f$ (modify for different bulk viscosity).
+                    //!
+                    LBMReal A = (c4 + c2*omega - c3*omega*omega) / (c2 - c7*omega + c5*omega*omega);
+                    LBMReal B = (c4 + c28*omega - c14*omega*omega) / (c6 - c21*omega + c15*omega*omega);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Compute cumulants from central moments according to Eq. (20)-(23) in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    ////////////////////////////////////////////////////////////
+                    //4.
+                    LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + c2 * mfbba * mfbab) * OOrho;
+                    LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + c2 * mfbba * mfabb) * OOrho;
+                    LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + c2 * mfbab * mfabb) * OOrho;
+
+                    LBMReal CUMcca = mfcca - (((mfcaa * mfaca + c2 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca)) * OOrho - c1o9 * (drho * OOrho));
+                    LBMReal CUMcac = mfcac - (((mfcaa * mfaac + c2 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac)) * OOrho - c1o9 * (drho * OOrho));
+                    LBMReal CUMacc = mfacc - (((mfaac * mfaca + c2 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) * OOrho - c1o9 * (drho * OOrho));
+                    ////////////////////////////////////////////////////////////
+                    //5.
+                    LBMReal CUMbcc = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb + c2 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)) * OOrho;
+                    LBMReal CUMcbc = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb + c2 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)) * OOrho;
+                    LBMReal CUMccb = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb + c2 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)) * OOrho;
+                    ////////////////////////////////////////////////////////////
+                    //6.
+                    LBMReal CUMccc = mfccc + ((-c4 * mfbbb * mfbbb
+                                               - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+                                               - c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+                                               - c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
+                                              + (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+                                                 + c2 * (mfcaa * mfaca * mfaac)
+                                                 + c16 * mfbba * mfbab * mfabb) * OOrho * OOrho
+                                              - c1o3 * (mfacc + mfcac + mfcca) * OOrho
+                                              - c1o9 * (mfcaa + mfaca + mfaac) * OOrho
+                                              + (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+                                                 + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * OOrho * OOrho * c2o3
+                                              + c1o27 * ((drho * drho - drho) * OOrho * OOrho));
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Compute linear combinations of second and third order cumulants
+                    //!
+                    ////////////////////////////////////////////////////////////
+                    //2.
+                    LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+                    LBMReal mxxMyy = mfcaa - mfaca;
+                    LBMReal mxxMzz = mfcaa - mfaac;
+                    ////////////////////////////////////////////////////////////
+                    //3.
+                    LBMReal mxxyPyzz = mfcba + mfabc;
+                    LBMReal mxxyMyzz = mfcba - mfabc;
+
+                    LBMReal mxxzPyyz = mfcab + mfacb;
+                    LBMReal mxxzMyyz = mfcab - mfacb;
+
+                    LBMReal mxyyPxzz = mfbca + mfbac;
+                    LBMReal mxyyMxzz = mfbca - mfbac;
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //incl. correction
+                    ////////////////////////////////////////////////////////////
+                    //! - Compute velocity  gradients from second order cumulants according to Eq. (27)-(32)
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! Further explanations of the correction in viscosity in Appendix H of
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //! Note that the division by rho is omitted here as we need rho times the gradients later.
+                    //!
+                    LBMReal Dxy = -c3 * omega * mfbba;
+                    LBMReal Dxz = -c3 * omega * mfbab;
+                    LBMReal Dyz = -c3 * omega * mfabb;
+                    LBMReal dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz);
+                    LBMReal dyuy = dxux + omega * c3o2 * mxxMyy;
+                    LBMReal dzuz = dxux + omega * c3o2 * mxxMzz;
+                    ////////////////////////////////////////////////////////////
+                    //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) - c3 * (c1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+                    mxxMyy += omega * (-mxxMyy) - c3 * (c1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy);
+                    mxxMzz += omega * (-mxxMzz) - c3 * (c1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz);
+
+                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+                    ////no correction
+                    //mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz);
+                    //mxxMyy += -(-omega) * (-mxxMyy);
+                    //mxxMzz += -(-omega) * (-mxxMzz);
+                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+                    mfabb += omega * (-mfabb);
+                    mfbab += omega * (-mfbab);
+                    mfbba += omega * (-mfbba);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //relax
+                    //////////////////////////////////////////////////////////////////////////
+                    // incl. limiter
+                    //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123)
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    wadjust = Oxyz + (c1 - Oxyz) * abs(mfbbb) / (abs(mfbbb) + qudricLimitD);
+                    mfbbb += wadjust * (-mfbbb);
+                    wadjust = OxyyPxzz + (c1 - OxyyPxzz) * abs(mxxyPyzz) / (abs(mxxyPyzz) + qudricLimitP);
+                    mxxyPyzz += wadjust * (-mxxyPyzz);
+                    wadjust = OxyyMxzz + (c1 - OxyyMxzz) * abs(mxxyMyzz) / (abs(mxxyMyzz) + qudricLimitM);
+                    mxxyMyzz += wadjust * (-mxxyMyzz);
+                    wadjust = OxyyPxzz + (c1 - OxyyPxzz) * abs(mxxzPyyz) / (abs(mxxzPyyz) + qudricLimitP);
+                    mxxzPyyz += wadjust * (-mxxzPyyz);
+                    wadjust = OxyyMxzz + (c1 - OxyyMxzz) * abs(mxxzMyyz) / (abs(mxxzMyyz) + qudricLimitM);
+                    mxxzMyyz += wadjust * (-mxxzMyyz);
+                    wadjust = OxyyPxzz + (c1 - OxyyPxzz) * abs(mxyyPxzz) / (abs(mxyyPxzz) + qudricLimitP);
+                    mxyyPxzz += wadjust * (-mxyyPxzz);
+                    wadjust = OxyyMxzz + (c1 - OxyyMxzz) * abs(mxyyMxzz) / (abs(mxyyMxzz) + qudricLimitM);
+                    mxyyMxzz += wadjust * (-mxyyMxzz);
+                    //////////////////////////////////////////////////////////////////////////
+                    // no limiter
+                    //mfbbb += OxyyMxzz * (-mfbbb);
+                    //mxxyPyzz += OxyyPxzz * (-mxxyPyzz);
+                    //mxxyMyzz += OxyyMxzz * (-mxxyMyzz);
+                    //mxxzPyyz += OxyyPxzz * (-mxxzPyyz);
+                    //mxxzMyyz += OxyyMxzz * (-mxxzMyyz);
+                    //mxyyPxzz += OxyyPxzz * (-mxyyPxzz);
+                    //mxyyMxzz += OxyyMxzz * (-mxyyMxzz);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Compute inverse linear combinations of second and third order cumulants
+                    //!
+                    mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+                    mfaca = c1o3 * (-c2 * mxxMyy + mxxMzz + mxxPyyPzz);
+                    mfaac = c1o3 * (mxxMyy - c2 * mxxMzz + mxxPyyPzz);
+
+                    mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+                    mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+                    mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+                    mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+                    mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+                    mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+                    //////////////////////////////////////////////////////////////////////////
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //4.
+                    // no limiter
+                    //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according to Eq. (43)-(48)
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    CUMacc = -O4 * (c1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1 - O4) * (CUMacc);
+                    CUMcac = -O4 * (c1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1 - O4) * (CUMcac);
+                    CUMcca = -O4 * (c1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1 - O4) * (CUMcca);
+                    CUMbbc = -O4 * (c1 / omega - c1o2) * Dxy * c1o3 * B + (c1 - O4) * (CUMbbc);
+                    CUMbcb = -O4 * (c1 / omega - c1o2) * Dxz * c1o3 * B + (c1 - O4) * (CUMbcb);
+                    CUMcbb = -O4 * (c1 / omega - c1o2) * Dyz * c1o3 * B + (c1 - O4) * (CUMcbb);
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //5.
+                    CUMbcc += O5 * (-CUMbcc);
+                    CUMcbc += O5 * (-CUMcbc);
+                    CUMccb += O5 * (-CUMccb);
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //6.
+                    CUMccc += O6 * (-CUMccc);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //4.
+                    mfcbb = CUMcbb + c1o3 * ((c3 * mfcaa + c1) * mfabb + c6 * mfbba * mfbab) * OOrho;
+                    mfbcb = CUMbcb + c1o3 * ((c3 * mfaca + c1) * mfbab + c6 * mfbba * mfabb) * OOrho;
+                    mfbbc = CUMbbc + c1o3 * ((c3 * mfaac + c1) * mfbba + c6 * mfbab * mfabb) * OOrho;
+
+                    mfcca = CUMcca + (((mfcaa * mfaca + c2 * mfbba * mfbba) * c9 + c3 * (mfcaa + mfaca)) * OOrho - (drho * OOrho)) * c1o9;
+                    mfcac = CUMcac + (((mfcaa * mfaac + c2 * mfbab * mfbab) * c9 + c3 * (mfcaa + mfaac)) * OOrho - (drho * OOrho)) * c1o9;
+                    mfacc = CUMacc + (((mfaac * mfaca + c2 * mfabb * mfabb) * c9 + c3 * (mfaac + mfaca)) * OOrho - (drho * OOrho)) * c1o9;
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //5.
+                    mfbcc = CUMbcc + c1o3 * (c3 * (mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb + c2 * (mfbab * mfacb + mfbba * mfabc)) + (mfbca + mfbac)) * OOrho;
+                    mfcbc = CUMcbc + c1o3 * (c3 * (mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb + c2 * (mfabb * mfcab + mfbba * mfbac)) + (mfcba + mfabc)) * OOrho;
+                    mfccb = CUMccb + c1o3 * (c3 * (mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb + c2 * (mfbab * mfbca + mfabb * mfcba)) + (mfacb + mfcab)) * OOrho;
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //6.
+                    mfccc = CUMccc - ((-c4 * mfbbb * mfbbb
+                                       - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+                                       - c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+                                       - c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
+                                      + (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+                                         + c2 * (mfcaa * mfaca * mfaac)
+                                         + c16 * mfbba * mfbab * mfabb) * OOrho * OOrho
+                                      - c1o3 * (mfacc + mfcac + mfcca) * OOrho
+                                      - c1o9 * (mfcaa + mfaca + mfaac) * OOrho
+                                      + (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+                                         + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * OOrho * OOrho * c2o3
+                                      + c1o27 * ((drho * drho - drho) * OOrho * OOrho));
+
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! -  Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //!
+                    mfbaa = -mfbaa;
+                    mfaba = -mfaba;
+                    mfaab = -mfaab;
+                    ////////////////////////////////////////////////////////////////////////////////////
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //! see also Eq. (88)-(96) in
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //!
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // X - Dir
+                    backwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1, c1);
+                    backwardChimera(mfaba, mfbba, mfcba, vvx, vx2);
+                    backwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3, c1o3);
+                    backwardChimera(mfaab, mfbab, mfcab, vvx, vx2);
+                    backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2);
+                    backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2);
+                    backwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3, c1o3);
+                    backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2);
+                    backwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c9, c1o9);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // Y - Dir
+                    backwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2, c6, c1o6);
+                    backwardChimera(mfaab, mfabb, mfacb, vvy, vy2);
+                    backwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18, c1o18);
+                    backwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3);
+                    backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2);
+                    backwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9);
+                    backwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2, c6, c1o6);
+                    backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2);
+                    backwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18, c1o18);
+
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    // Z - Dir
+                    backwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36, c1o36);
+                    backwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2, c9, c1o9);
+                    backwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36, c1o36);
+                    backwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2, c9, c1o9);
+                    backwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9);
+                    backwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2, c9, c1o9);
+                    backwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36, c1o36);
+                    backwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2, c9, c1o9);
+                    backwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36, c1o36);
+                    ////////////////////////////////////////////////////////////////////////////////////
+
+                    //////////////////////////////////////////////////////////////////////////
+                    //proof correctness
+                    //////////////////////////////////////////////////////////////////////////
+#ifdef  PROOF_CORRECTNESS
+                    LBMReal drho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+                                        + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+                                        + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+                    LBMReal dif = drho - drho_post;
+#ifdef SINGLEPRECISION
+                    if (dif > 10.0E-7 || dif < -10.0E-7)
+#else
+                    if (dif > 10.0E-15 || dif < -10.0E-15)
+#endif
+                    {
+                        UB_THROW(UbException(UB_EXARGS, "rho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(drho_post)
+                                                        + " dif=" + UbSystem::toString(dif)
+                                                        + " rho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)
+                                                        + " in " + block.lock()->toString() + " step = " + UbSystem::toString(step)));
+                    }
+#endif
+                    ////////////////////////////////////////////////////////////////////////////////////
+                    //! - Write distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm
+                    //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+                    //!
+                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb;
+                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab;
+                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba;
+                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;
+                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;
+                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;
+                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;
+                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;
+                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;
+                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;
+                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;
+                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;
+                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;
+
+                    (*this->restDistributions)(x1, x2, x3) = mfbbb;
+                    //////////////////////////////////////////////////////////////////////////
+
+                    if ((*particleData)(ix1, ix2, ix3)->solidFraction < SOLFRAC_MIN)
+                        return;
+
+
+                }
+            }
+        }
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h
new file mode 100644
index 000000000..1d3fb0f56
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h
@@ -0,0 +1,156 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file IBcumulantK17LBMKernel.h
+//! \ingroup LBM
+//! \author Konstantin Kutscher, Martin Geier
+//=======================================================================================
+
+#ifndef IBcumulantK17LBMKernel_h__
+#define IBcumulantK17LBMKernel_h__
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "UbTiming.h"
+#include "CbArray4D.h"
+#include "CbArray3D.h"
+#include "IBdynamicsParticleData.h"
+
+
+//! \brief   Compressible cumulant LBM kernel.
+//! \details  LBM implementation that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//!
+//! The model is publisched in
+//! <a href="http://dx.doi.org/10.1016/j.jcp.2017.05.040"><b>[ Geier et al., (2017), 10.1016/j.jcp.2017.05.040]</b></a>,
+//! <a href="http://dx.doi.org/10.1016/j.jcp.2017.07.004"><b>[ Geier et al., (2017), 10.1016/j.jcp.2017.07.004]</b></a>
+//!
+class IBcumulantK17LBMKernel : public LBMKernel
+{
+public:
+    IBcumulantK17LBMKernel();
+    ~IBcumulantK17LBMKernel() = default;
+    void calculate(int step) override;
+    SPtr<LBMKernel> clone() override;
+    double getCalculationTime() override { return .0; }
+    CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr getParticleData() { return particleData; };
+    void setParticleData(CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData)
+    {
+        this->particleData = particleData;
+    };
+
+protected:
+    inline void forwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K);
+    inline void backwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K);
+    inline void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+    inline void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+    virtual void initDataSet();
+    LBMReal f[D3Q27System::ENDF + 1];
+
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr restDistributions;
+
+    mu::value_type muX1, muX2, muX3;
+    mu::value_type muDeltaT;
+    mu::value_type muNu;
+    LBMReal forcingX1;
+    LBMReal forcingX2;
+    LBMReal forcingX3;
+
+    CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//! \brief forward chimera transformation \ref forwardInverseChimeraWithK 
+//! Transformation from distributions to central moments according to Eq. (6)-(14) in
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! Modified for lower round-off errors.
+////////////////////////////////////////////////////////////////////////////////
+inline void IBcumulantK17LBMKernel::forwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K)
+{
+    using namespace UbMath;
+    LBMReal m2 = mfa + mfc;
+    LBMReal m1 = mfc - mfa;
+    LBMReal m0 = m2 + mfb;
+    mfa = m0;
+    m0 *= Kinverse;
+    m0 += c1;
+    mfb = (m1 * Kinverse - m0 * vv) * K;
+    mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+////////////////////////////////////////////////////////////////////////////////
+//! \brief backward chimera transformation \ref backwardInverseChimeraWithK
+//! Transformation from central moments to distributions according to Eq. (57)-(65) in
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! ] Modified for lower round-off errors.
+////////////////////////////////////////////////////////////////////////////////
+inline void IBcumulantK17LBMKernel::backwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K)
+{
+    using namespace UbMath;
+    LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + c1) * (v2 - vv) * c1o2) * K;
+    LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + c1) * (-v2)) * K;
+    mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + c1) * (v2 + vv) * c1o2) * K;
+    mfa = m0;
+    mfb = m1;
+}
+////////////////////////////////////////////////////////////////////////////////
+//! \brief forward chimera transformation \ref forwardChimera 
+//! Transformation from distributions to central moments according to Eq. (6)-(14) in
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations.
+//! Modified for lower round-off errors.
+////////////////////////////////////////////////////////////////////////////////
+inline void IBcumulantK17LBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2)
+{
+    using namespace UbMath;
+    LBMReal m1 = (mfa + mfc) + mfb;
+    LBMReal m2 = mfc - mfa;
+    mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+    mfb = m2 - vv * m1;
+    mfa = m1;
+}
+////////////////////////////////////////////////////////////////////////////////
+//! \brief backward chimera transformation \ref backwardChimera 
+//! Transformation from central moments to distributions according to Eq. (57)-(65) in
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations.
+//! Modified for lower round-off errors.
+////////////////////////////////////////////////////////////////////////////////
+inline void IBcumulantK17LBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2)
+{
+    using namespace UbMath;
+    LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+    LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+    mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+    mfb = mb;
+    mfa = ma;
+}
+
+#endif // IBcumulantK17LBMKernel_h__
\ No newline at end of file
-- 
GitLab


From cc1dab6ab35caa66cb5d24526a2394abb7c930f1 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 3 Aug 2022 17:42:16 +0200
Subject: [PATCH 082/179] port of LBDEMcoupling is finished / need to validate

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          |  28 +-
 apps/cpu/LiggghtsApp/in.lbdem                 |   4 +-
 apps/cpu/LiggghtsApp/in2.lbdem                |   2 +-
 .../IBcumulantK17LBMKernel.cpp                | 613 +++++++++++++-----
 .../IBcumulantK17LBMKernel.h                  |   1 -
 .../LiggghtsCoupling/IBdynamicsParticleData.h |  19 +-
 .../LiggghtsCouplingCoProcessor.cpp           | 233 ++++++-
 .../LiggghtsCouplingCoProcessor.h             |  36 +-
 src/cpu/VirtualFluidsCore/CMakeLists.txt      |  18 +-
 .../CoProcessors/InSituVTKCoProcessor.cpp     |  10 +-
 .../VirtualFluidsCore/LBM/LBMUnitConverter.h  |  26 +-
 11 files changed, 722 insertions(+), 268 deletions(-)
 rename src/cpu/{VirtualFluidsCore/LBM => LiggghtsCoupling}/IBcumulantK17LBMKernel.cpp (55%)
 rename src/cpu/{VirtualFluidsCore/LBM => LiggghtsCoupling}/IBcumulantK17LBMKernel.h (99%)

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 634ca28dd..fd892b6b9 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -11,9 +11,8 @@
 //#include "fix_lb_coupling_onetoone.h"
 
 #include "LiggghtsCouplingCoProcessor.h"
-
 #include "LiggghtsCouplingWrapper.h"
-
+#include "IBcumulantK17LBMKernel.h"
 
 using namespace std;
 
@@ -31,9 +30,9 @@ int main(int argc, char *argv[])
 
     double g_maxX1 = 1;
     double g_maxX2 = 1;
-    double g_maxX3 = 2;
+    double g_maxX3 = 1;
 
-    int blockNX[3] = { 10, 10, 20 };
+    int blockNX[3] = { 10, 10, 10 };
 
     double dx = 0.1;
 
@@ -61,7 +60,7 @@ int main(int argc, char *argv[])
     ppblocks->process(0);
     ppblocks.reset();
 
-    SPtr<LBMKernel> kernel = make_shared<IncompressibleCumulantLBMKernel>();
+    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
     SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
     kernel->setBCProcessor(bcProc);
 
@@ -78,11 +77,17 @@ int main(int argc, char *argv[])
     MPI_Comm mpi_comm       = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
-    double d_part = 0.1;
+
+    double d_part = 0.3;
+    double r_p       = d_part / 2.0;
+ 
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::WATER, r_p / dx);
+
     double v_frac = 0.1;
-    double dt_phys  = 1; // units.getPhysTime(1);
-    int demSubsteps = 1;
-    double dt_dem   = 1e-1; //dt_phys / (double)demSubsteps;
+    double dt_phys   = units->getFactorTimeLbToW();
+    int demSubsteps = 10;
+    double dt_dem   = dt_phys / (double)demSubsteps;
     int vtkSteps    = 1;
     string demOutDir = "d:/temp/lll2/";
 
@@ -99,8 +104,9 @@ int main(int argc, char *argv[])
     wrapper.execFile((char *)inFile2.c_str());
     //wrapper.runUpto(demSubsteps - 1);
 
+    
     SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
-        make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps);
+        make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps, units);
 
     // write data for visualization of macroscopic quantities
     SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
@@ -108,7 +114,7 @@ int main(int argc, char *argv[])
         new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(),
                                                   SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
 
-    int endTime = 20;
+    int endTime = 1000; //20;
     SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
     calculator->addCoProcessor(lcCoProcessor);
     calculator->addCoProcessor(writeMQCoProcessor);
diff --git a/apps/cpu/LiggghtsApp/in.lbdem b/apps/cpu/LiggghtsApp/in.lbdem
index f15eab6f8..366f7afd1 100644
--- a/apps/cpu/LiggghtsApp/in.lbdem
+++ b/apps/cpu/LiggghtsApp/in.lbdem
@@ -9,7 +9,7 @@ boundary	f f f
 newton		off
 
 processors * * 1
-region		box block 0. 1. 0. 1. 0. 2. units box
+region		box block 0. 1. 0. 1. 0. 1. units box
 create_box	1 box
 
 variable	skin equal 0.01
@@ -41,7 +41,7 @@ fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane
 fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
 fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
 
-create_atoms 1 single 0.5 0.5 1.75
+create_atoms 1 single 0.5 0.5 0.75
 #create_atoms 1 single 0.38 0.05 0.05
 
 set group all diameter 0.3 density 2400
diff --git a/apps/cpu/LiggghtsApp/in2.lbdem b/apps/cpu/LiggghtsApp/in2.lbdem
index 3e2fa90d2..7098890cc 100644
--- a/apps/cpu/LiggghtsApp/in2.lbdem
+++ b/apps/cpu/LiggghtsApp/in2.lbdem
@@ -18,4 +18,4 @@ variable dmp_fname string ${dmp_dir}d_*.liggghts
 # dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
 # 		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
 	
-dump   dmp all custom/vtk 1 ${dmp_dir}post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
+dump   dmp all custom/vtk 10 ${dmp_dir}post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
diff --git a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
similarity index 55%
rename from src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp
rename to src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
index 346a61009..ac0bc3584 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.cpp
+++ b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
@@ -55,14 +55,14 @@ void IBcumulantK17LBMKernel::initDataSet()
     dataSet->setFdistributions(d);
 
     particleData =
-        std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0], nx[1], nx[2]);
+        std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0] + 2, nx[1] + 2, nx[2] + 2);
 
-    int minX1 = ghostLayerWidth;
-    int minX2 = ghostLayerWidth;
-    int minX3 = ghostLayerWidth;
-    int maxX1 = nx[0];
-    int maxX2 = nx[1];
-    int maxX3 = nx[2];
+    int minX1 = 0;
+    int minX2 = 0;
+    int minX3 = 0;
+    int maxX1 = nx[0]+2;
+    int maxX2 = nx[1]+2;
+    int maxX3 = nx[2]+2;
 
     LBMReal omega = collFactor;
 
@@ -150,37 +150,40 @@ void IBcumulantK17LBMKernel::calculate(int step)
 
     LBMReal omega = collFactor;
 
+
+
     for (int x3 = minX3; x3 < maxX3; x3++)
     {
         for (int x2 = minX2; x2 < maxX2; x2++)
         {
             for (int x1 = minX1; x1 < maxX1; x1++)
             {
-                if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3))
-                {
+                if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
                     int x1p = x1 + 1;
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
                     //////////////////////////////////////////////////////////////////////////
                     //////////////////////////////////////////////////////////////////////////
-                    //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm
-                    //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+                    //! - Read distributions: style of reading and writing the distributions from/to stored arrays
+                    //! dependent on timestep is based on the esoteric twist algorithm <a
+                    //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.3390/computation5020019 ]</b></a>
                     //!
                     ////////////////////////////////////////////////////////////////////////////
                     //////////////////////////////////////////////////////////////////////////
 
-                    //E   N  T
-                    //c   c  c
+                    // E   N  T
+                    // c   c  c
                     //////////
-                    //W   S  B
-                    //a   a  a
+                    // W   S  B
+                    // a   a  a
 
-                    //Rest is b
+                    // Rest is b
 
-                    //mfxyz
-                    //a - negative
-                    //b - null
-                    //c - positive
+                    // mfxyz
+                    // a - negative
+                    // b - null
+                    // c - positive
 
                     // a b c
                     //-1 0 1
@@ -215,31 +218,107 @@ void IBcumulantK17LBMKernel::calculate(int step)
 
                     LBMReal mfbbb = (*this->restDistributions)(x1, x2, x3);
 
+                    LBMReal f[D3Q27System::ENDF + 1];
+                    LBMReal fEq[D3Q27System::ENDF + 1];
+                    LBMReal fEqSolid[D3Q27System::ENDF + 1];
+                    LBMReal fPre[D3Q27System::ENDF + 1];
+
+                    f[D3Q27System::REST] = mfbbb;
+
+                    f[D3Q27System::E]   = mfcbb;
+                    f[D3Q27System::N]   = mfbcb;
+                    f[D3Q27System::T]   = mfbbc;
+                    f[D3Q27System::NE]  = mfccb;
+                    f[D3Q27System::NW]  = mfacb;
+                    f[D3Q27System::TE]  = mfcbc;
+                    f[D3Q27System::TW]  = mfabc;
+                    f[D3Q27System::TN]  = mfbcc;
+                    f[D3Q27System::TS]  = mfbac;
+                    f[D3Q27System::TNE] = mfccc;
+                    f[D3Q27System::TNW] = mfacc;
+                    f[D3Q27System::TSE] = mfcac;
+                    f[D3Q27System::TSW] = mfaac;
+
+                    f[D3Q27System::W]   = mfabb;
+                    f[D3Q27System::S]   = mfbab;
+                    f[D3Q27System::B]   = mfbba;
+                    f[D3Q27System::SW]  = mfaab;
+                    f[D3Q27System::SE]  = mfcab;
+                    f[D3Q27System::BW]  = mfaba;
+                    f[D3Q27System::BE]  = mfcba;
+                    f[D3Q27System::BS]  = mfbaa;
+                    f[D3Q27System::BN]  = mfbca;
+                    f[D3Q27System::BSW] = mfaaa;
+                    f[D3Q27System::BSE] = mfcaa;
+                    f[D3Q27System::BNW] = mfaca;
+                    f[D3Q27System::BNE] = mfcca;
+
+                    if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MIN) {
+                        fPre[D3Q27System::REST] = mfbbb;
+
+                        fPre[D3Q27System::E]   = mfcbb;
+                        fPre[D3Q27System::N]   = mfbcb;
+                        fPre[D3Q27System::T]   = mfbbc;
+                        fPre[D3Q27System::NE]  = mfccb;
+                        fPre[D3Q27System::NW]  = mfacb;
+                        fPre[D3Q27System::TE]  = mfcbc;
+                        fPre[D3Q27System::TW]  = mfabc;
+                        fPre[D3Q27System::TN]  = mfbcc;
+                        fPre[D3Q27System::TS]  = mfbac;
+                        fPre[D3Q27System::TNE] = mfccc;
+                        fPre[D3Q27System::TNW] = mfacc;
+                        fPre[D3Q27System::TSE] = mfcac;
+                        fPre[D3Q27System::TSW] = mfaac;
+
+                        fPre[D3Q27System::W]   = mfabb;
+                        fPre[D3Q27System::S]   = mfbab;
+                        fPre[D3Q27System::B]   = mfbba;
+                        fPre[D3Q27System::SW]  = mfaab;
+                        fPre[D3Q27System::SE]  = mfcab;
+                        fPre[D3Q27System::BW]  = mfaba;
+                        fPre[D3Q27System::BE]  = mfcba;
+                        fPre[D3Q27System::BS]  = mfbaa;
+                        fPre[D3Q27System::BN]  = mfbca;
+                        fPre[D3Q27System::BSW] = mfaaa;
+                        fPre[D3Q27System::BSE] = mfcaa;
+                        fPre[D3Q27System::BNW] = mfaca;
+                        fPre[D3Q27System::BNE] = mfcca;
+                    }
+
+                    (*particleData)(x1, x2, x3)->hydrodynamicForce.fill(0.0);
+
+                    if ((*particleData)(x1, x2, x3)->solidFraction <= SOLFRAC_MAX) {
+
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3)
-                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq.
+                    //! (J1)-(J3) <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
                     //!
                     LBMReal drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
-                                    (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
-                                    ((mfabb + mfcbb) + (mfbab + mfbcb)) + (mfbba + mfbbc)) + mfbbb;
+                                    (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) +
+                                     ((mfacb + mfcab) + (mfaab + mfccb))) +
+                                    ((mfabb + mfcbb) + (mfbab + mfbcb)) + (mfbba + mfbbc)) +
+                                   mfbbb;
 
-                    LBMReal rho = c1 + drho;
+                    LBMReal rho   = c1 + drho;
                     LBMReal OOrho = c1 / rho;
                     ////////////////////////////////////////////////////////////////////////////////////
                     LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
                                    (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
-                                   (mfcbb - mfabb)) / rho;
+                                   (mfcbb - mfabb)) /
+                                  rho;
                     LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
                                    (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
-                                   (mfbcb - mfbab)) / rho;
+                                   (mfbcb - mfbab)) /
+                                  rho;
                     LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
                                    (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
-                                   (mfbbc - mfbba)) / rho;
+                                   (mfbbc - mfbba)) /
+                                  rho;
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //forcing
+                    // forcing
                     ///////////////////////////////////////////////////////////////////////////////////////////
-                    if (withForcing)
-                    {
+                    if (withForcing) {
                         muX1 = static_cast<double>(x1 - 1 + ix1 * maxX1);
                         muX2 = static_cast<double>(x2 - 1 + ix2 * maxX2);
                         muX3 = static_cast<double>(x3 - 1 + ix3 * maxX3);
@@ -250,7 +329,8 @@ void IBcumulantK17LBMKernel::calculate(int step)
 
                         ////////////////////////////////////////////////////////////////////////////////////
                         //! - Add half of the acceleration (body force) to the velocity as in Eq. (42)
-                        //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                        //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                        //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
                         //!
                         vvx += forcingX1 * deltaT * c1o2; // X
                         vvy += forcingX2 * deltaT * c1o2; // Y
@@ -262,18 +342,20 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     LBMReal vy2 = vvy * vvy;
                     LBMReal vz2 = vvz * vvz;
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to section 6 in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$
+                    //! according to section 6 in <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et
+                    //! al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     LBMReal wadjust;
                     LBMReal qudricLimitP = c1o100;
                     LBMReal qudricLimitM = c1o100;
                     LBMReal qudricLimitD = c1o100;
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in
-                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
-                    //! see also Eq. (6)-(14) in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! - Chimera transform from well conditioned distributions to central moments as defined in
+                    //! Appendix J in <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (6)-(14) in <a
+                    //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     ////////////////////////////////////////////////////////////////////////////////////
                     // Z - Dir
@@ -312,86 +394,116 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     forwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c9, c1o9);
 
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations according to
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and
+                    //! equations according to <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al.
+                    //! (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!  => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE].
-                    //!  - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$.
-                    //!  - Third order cumulants \f$ C_{120}+C_{102} \f$, \f$ C_{210}+C_{012} \f$, \f$ C_{201}+C_{021} \f$: \f$\omega_3=OxyyPxzz\f$ set according to Eq. (111) with simplifications assuming \f$\omega_2=1.0\f$.
-                    //!  - Third order cumulants \f$ C_{120}-C_{102} \f$, \f$ C_{210}-C_{012} \f$, \f$ C_{201}-C_{021} \f$: \f$\omega_4 = OxyyMxzz\f$ set according to Eq. (112) with simplifications assuming \f$\omega_2 = 1.0\f$.
-                    //!  - Third order cumulants \f$ C_{111} \f$: \f$\omega_5 = Oxyz\f$ set according to Eq. (113) with simplifications assuming \f$\omega_2 = 1.0\f$  (modify for different bulk viscosity).
-                    //!  - Fourth order cumulants \f$ C_{220} \f$, \f$ C_{202} \f$, \f$ C_{022} \f$, \f$ C_{211} \f$, \f$ C_{121} \f$, \f$ C_{112} \f$: for simplification all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$.
+                    //!  - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk
+                    //!  viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$.
+                    //!  - Third order cumulants \f$ C_{120}+C_{102} \f$, \f$ C_{210}+C_{012} \f$, \f$ C_{201}+C_{021}
+                    //!  \f$: \f$\omega_3=OxyyPxzz\f$ set according to Eq. (111) with simplifications assuming
+                    //!  \f$\omega_2=1.0\f$.
+                    //!  - Third order cumulants \f$ C_{120}-C_{102} \f$, \f$ C_{210}-C_{012} \f$, \f$ C_{201}-C_{021}
+                    //!  \f$: \f$\omega_4 = OxyyMxzz\f$ set according to Eq. (112) with simplifications assuming
+                    //!  \f$\omega_2 = 1.0\f$.
+                    //!  - Third order cumulants \f$ C_{111} \f$: \f$\omega_5 = Oxyz\f$ set according to Eq. (113) with
+                    //!  simplifications assuming \f$\omega_2 = 1.0\f$  (modify for different bulk viscosity).
+                    //!  - Fourth order cumulants \f$ C_{220} \f$, \f$ C_{202} \f$, \f$ C_{022} \f$, \f$ C_{211} \f$,
+                    //!  \f$ C_{121} \f$, \f$ C_{112} \f$: for simplification all set to the same default value \f$
+                    //!  \omega_6=\omega_7=\omega_8=O4=1.0 \f$.
                     //!  - Fifth order cumulants \f$ C_{221}\f$, \f$C_{212}\f$, \f$C_{122}\f$: \f$\omega_9=O5=1.0\f$.
                     //!  - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$.
                     //!
                     ////////////////////////////////////////////////////////////
-                    //2.
+                    // 2.
                     LBMReal OxxPyyPzz = c1;
                     ////////////////////////////////////////////////////////////
-                    //3.
-                    LBMReal OxyyPxzz = c8  * (-c2 + omega) * ( c1 + c2*omega) / (-c8 - c14*omega + c7*omega*omega);
-                    LBMReal OxyyMxzz = c8  * (-c2 + omega) * (-c7 + c4*omega) / (c56 - c50*omega + c9*omega*omega);
-                    LBMReal Oxyz     = c24 * (-c2 + omega) * (-c2 - c7*omega + c3*omega*omega) / (c48 + c152*omega - c130*omega*omega + c29*omega*omega*omega);
+                    // 3.
+                    LBMReal OxyyPxzz =
+                        c8 * (-c2 + omega) * (c1 + c2 * omega) / (-c8 - c14 * omega + c7 * omega * omega);
+                    LBMReal OxyyMxzz =
+                        c8 * (-c2 + omega) * (-c7 + c4 * omega) / (c56 - c50 * omega + c9 * omega * omega);
+                    LBMReal Oxyz = c24 * (-c2 + omega) * (-c2 - c7 * omega + c3 * omega * omega) /
+                                   (c48 + c152 * omega - c130 * omega * omega + c29 * omega * omega * omega);
                     ////////////////////////////////////////////////////////////
-                    //4.
+                    // 4.
                     LBMReal O4 = c1;
                     ////////////////////////////////////////////////////////////
-                    //5.
+                    // 5.
                     LBMReal O5 = c1;
                     ////////////////////////////////////////////////////////////
-                    //6.
+                    // 6.
                     LBMReal O6 = c1;
 
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115)
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
-                    //! with simplifications assuming \f$\omega_2 = 1.0\f$ (modify for different bulk viscosity).
+                    //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114)
+                    //! and (115) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$\omega_2 = 1.0\f$
+                    //! (modify for different bulk viscosity).
                     //!
-                    LBMReal A = (c4 + c2*omega - c3*omega*omega) / (c2 - c7*omega + c5*omega*omega);
-                    LBMReal B = (c4 + c28*omega - c14*omega*omega) / (c6 - c21*omega + c15*omega*omega);
+                    LBMReal A = (c4 + c2 * omega - c3 * omega * omega) / (c2 - c7 * omega + c5 * omega * omega);
+                    LBMReal B = (c4 + c28 * omega - c14 * omega * omega) / (c6 - c21 * omega + c15 * omega * omega);
 
                     ////////////////////////////////////////////////////////////////////////////////////
                     //! - Compute cumulants from central moments according to Eq. (20)-(23) in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     ////////////////////////////////////////////////////////////
-                    //4.
+                    // 4.
                     LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + c2 * mfbba * mfbab) * OOrho;
                     LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + c2 * mfbba * mfabb) * OOrho;
                     LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + c2 * mfbab * mfabb) * OOrho;
 
-                    LBMReal CUMcca = mfcca - (((mfcaa * mfaca + c2 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca)) * OOrho - c1o9 * (drho * OOrho));
-                    LBMReal CUMcac = mfcac - (((mfcaa * mfaac + c2 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac)) * OOrho - c1o9 * (drho * OOrho));
-                    LBMReal CUMacc = mfacc - (((mfaac * mfaca + c2 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) * OOrho - c1o9 * (drho * OOrho));
+                    LBMReal CUMcca = mfcca - (((mfcaa * mfaca + c2 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca)) * OOrho -
+                                              c1o9 * (drho * OOrho));
+                    LBMReal CUMcac = mfcac - (((mfcaa * mfaac + c2 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac)) * OOrho -
+                                              c1o9 * (drho * OOrho));
+                    LBMReal CUMacc = mfacc - (((mfaac * mfaca + c2 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) * OOrho -
+                                              c1o9 * (drho * OOrho));
                     ////////////////////////////////////////////////////////////
-                    //5.
-                    LBMReal CUMbcc = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb + c2 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)) * OOrho;
-                    LBMReal CUMcbc = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb + c2 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)) * OOrho;
-                    LBMReal CUMccb = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb + c2 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)) * OOrho;
+                    // 5.
+                    LBMReal CUMbcc =
+                        mfbcc -
+                        ((mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb + c2 * (mfbab * mfacb + mfbba * mfabc)) +
+                         c1o3 * (mfbca + mfbac)) *
+                            OOrho;
+                    LBMReal CUMcbc =
+                        mfcbc -
+                        ((mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb + c2 * (mfabb * mfcab + mfbba * mfbac)) +
+                         c1o3 * (mfcba + mfabc)) *
+                            OOrho;
+                    LBMReal CUMccb =
+                        mfccb -
+                        ((mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb + c2 * (mfbab * mfbca + mfabb * mfcba)) +
+                         c1o3 * (mfacb + mfcab)) *
+                            OOrho;
                     ////////////////////////////////////////////////////////////
-                    //6.
-                    LBMReal CUMccc = mfccc + ((-c4 * mfbbb * mfbbb
-                                               - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
-                                               - c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
-                                               - c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
-                                              + (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
-                                                 + c2 * (mfcaa * mfaca * mfaac)
-                                                 + c16 * mfbba * mfbab * mfabb) * OOrho * OOrho
-                                              - c1o3 * (mfacc + mfcac + mfcca) * OOrho
-                                              - c1o9 * (mfcaa + mfaca + mfaac) * OOrho
-                                              + (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
-                                                 + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * OOrho * OOrho * c2o3
-                                              + c1o27 * ((drho * drho - drho) * OOrho * OOrho));
+                    // 6.
+                    LBMReal CUMccc =
+                        mfccc + ((-c4 * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+                                  c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) -
+                                  c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) *
+                                     OOrho +
+                                 (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+                                  c2 * (mfcaa * mfaca * mfaac) + c16 * mfbba * mfbab * mfabb) *
+                                     OOrho * OOrho -
+                                 c1o3 * (mfacc + mfcac + mfcca) * OOrho - c1o9 * (mfcaa + mfaca + mfaac) * OOrho +
+                                 (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+                                  (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) *
+                                     OOrho * OOrho * c2o3 +
+                                 c1o27 * ((drho * drho - drho) * OOrho * OOrho));
 
                     ////////////////////////////////////////////////////////////////////////////////////
                     //! - Compute linear combinations of second and third order cumulants
                     //!
                     ////////////////////////////////////////////////////////////
-                    //2.
+                    // 2.
                     LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
-                    LBMReal mxxMyy = mfcaa - mfaca;
-                    LBMReal mxxMzz = mfcaa - mfaac;
+                    LBMReal mxxMyy    = mfcaa - mfaca;
+                    LBMReal mxxMzz    = mfcaa - mfaac;
                     ////////////////////////////////////////////////////////////
-                    //3.
+                    // 3.
                     LBMReal mxxyPyzz = mfcba + mfabc;
                     LBMReal mxxyMyzz = mfcba - mfabc;
 
@@ -402,44 +514,48 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     LBMReal mxyyMxzz = mfbca - mfbac;
 
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //incl. correction
+                    // incl. correction
                     ////////////////////////////////////////////////////////////
                     //! - Compute velocity  gradients from second order cumulants according to Eq. (27)-(32)
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
-                    //! Further explanations of the correction in viscosity in Appendix H of
-                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
-                    //! Note that the division by rho is omitted here as we need rho times the gradients later.
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> Further explanations of the correction in viscosity in
+                    //! Appendix H of <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> Note that the division by rho is omitted here as we
+                    //! need rho times the gradients later.
                     //!
-                    LBMReal Dxy = -c3 * omega * mfbba;
-                    LBMReal Dxz = -c3 * omega * mfbab;
-                    LBMReal Dyz = -c3 * omega * mfabb;
+                    LBMReal Dxy  = -c3 * omega * mfbba;
+                    LBMReal Dxz  = -c3 * omega * mfbab;
+                    LBMReal Dyz  = -c3 * omega * mfabb;
                     LBMReal dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz);
                     LBMReal dyuy = dxux + omega * c3o2 * mxxMyy;
                     LBMReal dzuz = dxux + omega * c3o2 * mxxMzz;
                     ////////////////////////////////////////////////////////////
                     //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
-                    mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) - c3 * (c1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+                    mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) -
+                                 c3 * (c1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
                     mxxMyy += omega * (-mxxMyy) - c3 * (c1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy);
                     mxxMzz += omega * (-mxxMzz) - c3 * (c1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz);
 
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                     ////no correction
-                    //mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz);
-                    //mxxMyy += -(-omega) * (-mxxMyy);
-                    //mxxMzz += -(-omega) * (-mxxMzz);
+                    // mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz);
+                    // mxxMyy += -(-omega) * (-mxxMyy);
+                    // mxxMzz += -(-omega) * (-mxxMzz);
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                     mfabb += omega * (-mfabb);
                     mfbab += omega * (-mfbab);
                     mfbba += omega * (-mfbba);
 
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //relax
+                    // relax
                     //////////////////////////////////////////////////////////////////////////
                     // incl. limiter
                     //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123)
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     wadjust = Oxyz + (c1 - Oxyz) * abs(mfbbb) / (abs(mfbbb) + qudricLimitD);
                     mfbbb += wadjust * (-mfbbb);
@@ -457,13 +573,13 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     mxyyMxzz += wadjust * (-mxyyMxzz);
                     //////////////////////////////////////////////////////////////////////////
                     // no limiter
-                    //mfbbb += OxyyMxzz * (-mfbbb);
-                    //mxxyPyzz += OxyyPxzz * (-mxxyPyzz);
-                    //mxxyMyzz += OxyyMxzz * (-mxxyMyzz);
-                    //mxxzPyyz += OxyyPxzz * (-mxxzPyyz);
-                    //mxxzMyyz += OxyyMxzz * (-mxxzMyyz);
-                    //mxyyPxzz += OxyyPxzz * (-mxyyPxzz);
-                    //mxyyMxzz += OxyyMxzz * (-mxyyMxzz);
+                    // mfbbb += OxyyMxzz * (-mfbbb);
+                    // mxxyPyzz += OxyyPxzz * (-mxxyPyzz);
+                    // mxxyMyzz += OxyyMxzz * (-mxxyMyzz);
+                    // mxxzPyyz += OxyyPxzz * (-mxxzPyyz);
+                    // mxxzMyyz += OxyyMxzz * (-mxxzMyyz);
+                    // mxyyPxzz += OxyyPxzz * (-mxyyPxzz);
+                    // mxyyMxzz += OxyyMxzz * (-mxyyMxzz);
 
                     ////////////////////////////////////////////////////////////////////////////////////
                     //! - Compute inverse linear combinations of second and third order cumulants
@@ -481,10 +597,11 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     //////////////////////////////////////////////////////////////////////////
 
                     //////////////////////////////////////////////////////////////////////////
-                    //4.
-                    // no limiter
-                    //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according to Eq. (43)-(48)
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    // 4.
+                    //  no limiter
+                    //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion
+                    //! according to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et
+                    //! al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     CUMacc = -O4 * (c1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1 - O4) * (CUMacc);
                     CUMcac = -O4 * (c1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1 - O4) * (CUMcac);
@@ -494,55 +611,75 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     CUMcbb = -O4 * (c1 / omega - c1o2) * Dyz * c1o3 * B + (c1 - O4) * (CUMcbb);
 
                     //////////////////////////////////////////////////////////////////////////
-                    //5.
+                    // 5.
                     CUMbcc += O5 * (-CUMbcc);
                     CUMcbc += O5 * (-CUMcbc);
                     CUMccb += O5 * (-CUMccb);
 
                     //////////////////////////////////////////////////////////////////////////
-                    //6.
+                    // 6.
                     CUMccc += O6 * (-CUMccc);
 
                     ////////////////////////////////////////////////////////////////////////////////////
                     //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
 
                     //////////////////////////////////////////////////////////////////////////
-                    //4.
+                    // 4.
                     mfcbb = CUMcbb + c1o3 * ((c3 * mfcaa + c1) * mfabb + c6 * mfbba * mfbab) * OOrho;
                     mfbcb = CUMbcb + c1o3 * ((c3 * mfaca + c1) * mfbab + c6 * mfbba * mfabb) * OOrho;
                     mfbbc = CUMbbc + c1o3 * ((c3 * mfaac + c1) * mfbba + c6 * mfbab * mfabb) * OOrho;
 
-                    mfcca = CUMcca + (((mfcaa * mfaca + c2 * mfbba * mfbba) * c9 + c3 * (mfcaa + mfaca)) * OOrho - (drho * OOrho)) * c1o9;
-                    mfcac = CUMcac + (((mfcaa * mfaac + c2 * mfbab * mfbab) * c9 + c3 * (mfcaa + mfaac)) * OOrho - (drho * OOrho)) * c1o9;
-                    mfacc = CUMacc + (((mfaac * mfaca + c2 * mfabb * mfabb) * c9 + c3 * (mfaac + mfaca)) * OOrho - (drho * OOrho)) * c1o9;
+                    mfcca = CUMcca + (((mfcaa * mfaca + c2 * mfbba * mfbba) * c9 + c3 * (mfcaa + mfaca)) * OOrho -
+                                      (drho * OOrho)) *
+                                         c1o9;
+                    mfcac = CUMcac + (((mfcaa * mfaac + c2 * mfbab * mfbab) * c9 + c3 * (mfcaa + mfaac)) * OOrho -
+                                      (drho * OOrho)) *
+                                         c1o9;
+                    mfacc = CUMacc + (((mfaac * mfaca + c2 * mfabb * mfabb) * c9 + c3 * (mfaac + mfaca)) * OOrho -
+                                      (drho * OOrho)) *
+                                         c1o9;
 
                     //////////////////////////////////////////////////////////////////////////
-                    //5.
-                    mfbcc = CUMbcc + c1o3 * (c3 * (mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb + c2 * (mfbab * mfacb + mfbba * mfabc)) + (mfbca + mfbac)) * OOrho;
-                    mfcbc = CUMcbc + c1o3 * (c3 * (mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb + c2 * (mfabb * mfcab + mfbba * mfbac)) + (mfcba + mfabc)) * OOrho;
-                    mfccb = CUMccb + c1o3 * (c3 * (mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb + c2 * (mfbab * mfbca + mfabb * mfcba)) + (mfacb + mfcab)) * OOrho;
+                    // 5.
+                    mfbcc = CUMbcc + c1o3 *
+                                         (c3 * (mfaac * mfbca + mfaca * mfbac + c4 * mfabb * mfbbb +
+                                                c2 * (mfbab * mfacb + mfbba * mfabc)) +
+                                          (mfbca + mfbac)) *
+                                         OOrho;
+                    mfcbc = CUMcbc + c1o3 *
+                                         (c3 * (mfaac * mfcba + mfcaa * mfabc + c4 * mfbab * mfbbb +
+                                                c2 * (mfabb * mfcab + mfbba * mfbac)) +
+                                          (mfcba + mfabc)) *
+                                         OOrho;
+                    mfccb = CUMccb + c1o3 *
+                                         (c3 * (mfcaa * mfacb + mfaca * mfcab + c4 * mfbba * mfbbb +
+                                                c2 * (mfbab * mfbca + mfabb * mfcba)) +
+                                          (mfacb + mfcab)) *
+                                         OOrho;
 
                     //////////////////////////////////////////////////////////////////////////
-                    //6.
-                    mfccc = CUMccc - ((-c4 * mfbbb * mfbbb
-                                       - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
-                                       - c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
-                                       - c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
-                                      + (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
-                                         + c2 * (mfcaa * mfaca * mfaac)
-                                         + c16 * mfbba * mfbab * mfabb) * OOrho * OOrho
-                                      - c1o3 * (mfacc + mfcac + mfcca) * OOrho
-                                      - c1o9 * (mfcaa + mfaca + mfaac) * OOrho
-                                      + (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
-                                         + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * OOrho * OOrho * c2o3
-                                      + c1o27 * ((drho * drho - drho) * OOrho * OOrho));
-
+                    // 6.
+                    mfccc =
+                        CUMccc - ((-c4 * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) -
+                                   c4 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) -
+                                   c2 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) *
+                                      OOrho +
+                                  (c4 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) +
+                                   c2 * (mfcaa * mfaca * mfaac) + c16 * mfbba * mfbab * mfabb) *
+                                      OOrho * OOrho -
+                                  c1o3 * (mfacc + mfcac + mfcca) * OOrho - c1o9 * (mfcaa + mfaca + mfaac) * OOrho +
+                                  (c2 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) +
+                                   (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) *
+                                      OOrho * OOrho * c2o3 +
+                                  c1o27 * ((drho * drho - drho) * OOrho * OOrho));
 
                     ////////////////////////////////////////////////////////////////////////////////////
                     //! -  Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in
-                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
                     //!
                     mfbaa = -mfbaa;
                     mfaba = -mfaba;
@@ -550,10 +687,11 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     ////////////////////////////////////////////////////////////////////////////////////
 
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
-                    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
-                    //! see also Eq. (88)-(96) in
-                    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+                    //! - Chimera transform from central moments to well conditioned distributions as defined in
+                    //! Appendix J in <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+                    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a
+                    //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
                     //!
                     ////////////////////////////////////////////////////////////////////////////////////
                     // X - Dir
@@ -593,12 +731,13 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     ////////////////////////////////////////////////////////////////////////////////////
 
                     //////////////////////////////////////////////////////////////////////////
-                    //proof correctness
+                    // proof correctness
                     //////////////////////////////////////////////////////////////////////////
-#ifdef  PROOF_CORRECTNESS
-                    LBMReal drho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
-                                        + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
-                                        + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+#ifdef PROOF_CORRECTNESS
+                    LBMReal drho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
+                                        (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) +
+                                        (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) +
+                                        (mfbba + mfbbc) + mfbbb;
                     LBMReal dif = drho - drho_post;
 #ifdef SINGLEPRECISION
                     if (dif > 10.0E-7 || dif < -10.0E-7)
@@ -606,51 +745,165 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     if (dif > 10.0E-15 || dif < -10.0E-15)
 #endif
                     {
-                        UB_THROW(UbException(UB_EXARGS, "rho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(drho_post)
-                                                        + " dif=" + UbSystem::toString(dif)
-                                                        + " rho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)
-                                                        + " in " + block.lock()->toString() + " step = " + UbSystem::toString(step)));
+                        UB_THROW(UbException(
+                            UB_EXARGS,
+                            "rho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(drho_post) +
+                                " dif=" + UbSystem::toString(dif) + " rho is not correct for node " +
+                                UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3) +
+                                " in " + block.lock()->toString() + " step = " + UbSystem::toString(step)));
                     }
 #endif
                     ////////////////////////////////////////////////////////////////////////////////////
-                    //! - Write distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm
-                    //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+                    //! - Write distributions: style of reading and writing the distributions from/to stored arrays
+                    //! dependent on timestep is based on the esoteric twist algorithm <a
+                    //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017),
+                    //! DOI:10.3390/computation5020019 ]</b></a>
                     //!
-                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb;
-                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab;
-                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba;
-                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;
-                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;
-                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;
-                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;
-                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;
-                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;
-                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;
-                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;
-                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;
+                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)     = mfabb;
+                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)     = mfbab;
+                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)     = mfbba;
+                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)    = mfaab;
+                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)   = mfcab;
+                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)    = mfaba;
+                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)   = mfcba;
+                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)    = mfbaa;
+                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)   = mfbca;
+                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)   = mfaaa;
+                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)  = mfcaa;
+                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)  = mfaca;
                     (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
 
-                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     = mfcbb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     = mfbcb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     = mfbbc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfccb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    = mfacb;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfcbc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    = mfabc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfbcc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    = mfbac;
                     (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfacc;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfcac;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfaac;
 
                     (*this->restDistributions)(x1, x2, x3) = mfbbb;
                     //////////////////////////////////////////////////////////////////////////
-
-                    if ((*particleData)(ix1, ix2, ix3)->solidFraction < SOLFRAC_MIN)
-                        return;
-
-
+                    f[D3Q27System::REST] = mfbbb;
+                     
+                    f[D3Q27System::E]    = mfcbb;
+                    f[D3Q27System::N]    = mfbcb;
+                    f[D3Q27System::T]    = mfbbc;
+                    f[D3Q27System::NE]   = mfccb;
+                    f[D3Q27System::NW]   = mfacb;
+                    f[D3Q27System::TE]   = mfcbc;
+                    f[D3Q27System::TW]   = mfabc;
+                    f[D3Q27System::TN]   = mfbcc;
+                    f[D3Q27System::TS]   = mfbac;
+                    f[D3Q27System::TNE]  = mfccc;
+                    f[D3Q27System::TNW]  = mfacc;
+                    f[D3Q27System::TSE]  = mfcac;
+                    f[D3Q27System::TSW]  = mfaac;
+                                     
+                    f[D3Q27System::W]    = mfabb;
+                    f[D3Q27System::S]    = mfbab;
+                    f[D3Q27System::B]    = mfbba;
+                    f[D3Q27System::SW]   = mfaab;
+                    f[D3Q27System::SE]   = mfcab;
+                    f[D3Q27System::BW]   = mfaba;
+                    f[D3Q27System::BE]   = mfcba;
+                    f[D3Q27System::BS]   = mfbaa;
+                    f[D3Q27System::BN]   = mfbca;
+                    f[D3Q27System::BSW]  = mfaaa;
+                    f[D3Q27System::BSE]  = mfcaa;
+                    f[D3Q27System::BNW]  = mfaca;
+                    f[D3Q27System::BNE]  = mfcca;
+                }
+                    if ((*particleData)(x1, x2, x3)->solidFraction < SOLFRAC_MIN)
+                        continue;
+
+                    LBMReal vx1, vx2, vx3, drho;
+                    D3Q27System::calcCompMacroscopicValues(f, drho, vx1, vx2, vx3);
+                    D3Q27System::calcCompFeq(fEq, drho, vx1, vx2, vx3);
+
+                    std::array<double, 3> uPart;
+                    uPart[0] = (*particleData)(x1, x2, x3)->uPart[0] * (1. + drho);
+                    uPart[1] = (*particleData)(x1, x2, x3)->uPart[1] * (1. + drho);
+                    uPart[2] = (*particleData)(x1, x2, x3)->uPart[2] * (1. + drho);
+
+                    D3Q27System::calcCompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]);
+
+                    if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) {
+                        double const bb0     = fEq[D3Q27System::REST] - fEqSolid[D3Q27System::REST];
+                        f[D3Q27System::REST] = fPre[D3Q27System::REST] + bb0;
+                        for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) {
+                            const int iOpp        = D3Q27System::INVDIR[iPop];
+                            double const bb       = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop]));
+                            double const bbOpp    = ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp]));
+
+
+                            f[iPop] = fPre[iPop] + bb;
+                            f[iOpp] = fPre[iOpp] + bbOpp;
+
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp);
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp);
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp);
+                        }
+                    } else { /* particleData.solidFraction < SOLFRAC_MAX */
+//#ifdef LBDEM_USE_WEIGHING
+                        double const ooo = 1. / omega - 0.5;
+                        double const B   = (*particleData)(x1, x2, x3)->solidFraction * ooo / ((1. - (*particleData)(x1, x2, x3)->solidFraction) + ooo);
+//#else
+//                        T const B = particleData.solidFraction;
+//#endif
+                        double const oneMinB = 1. - B;
+
+                        double const bb0 = fEq[D3Q27System::REST] - fEqSolid[D3Q27System::REST];
+                        f[D3Q27System::REST] = fPre[D3Q27System::REST] + oneMinB * (f[D3Q27System::REST] - fPre[D3Q27System::REST]) + B * bb0;
+
+                        for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) {
+                            int const iOpp = D3Q27System::INVDIR[iPop];
+                            double const bb       = B * ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop]));
+                            double const bbOpp    = B * ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp]));
+
+                            f[iPop] = fPre[iPop] + oneMinB * (f[iPop] - fPre[iPop]) + bb;
+                            f[iOpp] = fPre[iOpp] + oneMinB * (f[iOpp] - fPre[iOpp]) + bbOpp;
+
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp);
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp);
+                            (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp);
+                        }
+                    } /* if solidFraction > SOLFRAC_MAX */
+
+                    (*this->restDistributions)(x1, x2, x3)                             = f[D3Q27System::REST];
+                                                                                          
+                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)         = f[D3Q27System::W]   ;
+                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)         = f[D3Q27System::S]   ;
+                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)         = f[D3Q27System::B]   ;
+                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)        = f[D3Q27System::SW]  ;
+                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)       = f[D3Q27System::SE]  ;
+                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)        = f[D3Q27System::BW]  ;
+                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)       = f[D3Q27System::BE]  ;
+                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)        = f[D3Q27System::BS]  ;
+                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)       = f[D3Q27System::BN]  ;
+                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)       = f[D3Q27System::BSW] ;
+                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)      = f[D3Q27System::BSE] ;
+                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)      = f[D3Q27System::BNW] ;
+                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3)     = f[D3Q27System::BNE] ;
+                                                                                                          
+                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     =  f[D3Q27System::E]  ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     =  f[D3Q27System::N]  ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     =  f[D3Q27System::T]  ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   =  f[D3Q27System::NE] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    =  f[D3Q27System::NW] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   =  f[D3Q27System::TE] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    =  f[D3Q27System::TW] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   =  f[D3Q27System::TN] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    =  f[D3Q27System::TS] ;
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) =  f[D3Q27System::TNE];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  =  f[D3Q27System::TNW];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  =  f[D3Q27System::TSE];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   =  f[D3Q27System::TSW];
                 }
             }
         }
diff --git a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
similarity index 99%
rename from src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h
rename to src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
index 1d3fb0f56..503d19709 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IBcumulantK17LBMKernel.h
+++ b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
@@ -71,7 +71,6 @@ protected:
     inline void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
 
     virtual void initDataSet();
-    LBMReal f[D3Q27System::ENDF + 1];
 
     CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
     CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
diff --git a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
index 8bf11ca7a..28f11bf2e 100644
--- a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
+++ b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
@@ -41,10 +41,21 @@ constexpr auto SOLFRAC_MAX = 0.999;
 
 struct IBdynamicsParticleData {
 public:
-    int partId{0};
-    double solidFraction{0};
-    std::array<double, 3> uPart{ 0., 0., 0. };
-    std::array<double, 3> hydrodynamicForce{ 0., 0., 0. };
+    IBdynamicsParticleData()
+        : partId(0), solidFraction(0.)
+    {
+        uPart[0] = 0.;
+        uPart[1] = 0.;
+        uPart[2] = 0.;
+
+        hydrodynamicForce[0] = 0.;
+        hydrodynamicForce[1] = 0.;
+        hydrodynamicForce[2] = 0.;
+    };
+    int partId;
+    double solidFraction;
+    std::array<double, 3> uPart;
+    std::array<double, 3> hydrodynamicForce;
 };
 
 #endif
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index ae3335374..d4926e0b1 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -9,11 +9,12 @@
 #include "DistributionArray3D.h"
 #include "DataSet3D.h"
 #include "IBcumulantK17LBMKernel.h"
+#include "LBMUnitConverter.h"
+#include "fix_lb_coupling_onetoone.h"
 
 LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                                         SPtr<Communicator> comm, LiggghtsCouplingWrapper &wrapper,
-                                                         int demSteps)
-    : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps)
+                                                         SPtr<Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units)
+    : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units)
 {
     //gridRank     = comm->getProcessID();
     //minInitLevel = this->grid->getCoarsestInitializedLevel();
@@ -32,9 +33,11 @@ LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
 
 void LiggghtsCouplingCoProcessor::process(double actualTimeStep)
 { 
-    setSpheresOnLattice();
-    wrapper.run(demSteps);
     std::cout << "step: " << actualTimeStep << "\n";
+    
+    wrapper.run(demSteps);
+    
+    setSpheresOnLattice();
 }
 
 void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
@@ -64,12 +67,12 @@ void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
 
         for (int i = 0; i < 3; i++) 
         {
-            x[i] = wrapper.lmp->atom->x[iS][i];
-            v[i]     = wrapper.lmp->atom->v[iS][i];
-            omega[i] = wrapper.lmp->atom->omega[iS][i];
+            x[i]     = wrapper.lmp->atom->x[iS][i]; // * units->getFactorLentghWToLb(); // - 0.5; ????
+            v[i]     = wrapper.lmp->atom->v[iS][i] * units->getFactorVelocityWToLb();
+            omega[i] = wrapper.lmp->atom->omega[iS][i] / units->getFactorTimeWToLb();
         }
         
-        r = wrapper.lmp->atom->radius[iS];
+        r = wrapper.lmp->atom->radius[iS]; // * units->getFactorLentghWToLb();
 
         std::cout << "x[0] = " << x[0] << ", x[1] = " << x[1] << ", x[2] = " << x[2] << std::endl;
         std::cout << "v[0] = " << v[0] << ", v[1] = " << v[1] << ", v[2] = " << v[2] << std::endl;
@@ -80,8 +83,6 @@ void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
     }
 }
 
-void LiggghtsCouplingCoProcessor::getForcesFromLattice() {}
-
 void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r,
                                                     int id /*, bool initVelFlag*/)
 {
@@ -98,7 +99,6 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
     for (SPtr<Block3D> block : blocks) {
         if (block) {
             SPtr<ILBMKernel> kernel = block->getKernel();
-            // SPtr<BCArray3D> bcArray                 = kernel->getBCProcessor()->getBCArray();
             SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
 
             CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData =
@@ -111,21 +111,27 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
             int minX2 = 1;
             int minX3 = 1;
 
-            int maxX1 = (int)(distributions->getNX1()) - 1;
-            int maxX2 = (int)(distributions->getNX2()) - 1;
-            int maxX3 = (int)(distributions->getNX3()) - 1;
+            int maxX1 = (int)(distributions->getNX1()) - 2;
+            int maxX2 = (int)(distributions->getNX2()) - 2;
+            int maxX3 = (int)(distributions->getNX3()) - 2;
 
             for (int ix3 = minX3; ix3 < maxX3; ix3++) {
                 for (int ix2 = minX2; ix2 < maxX2; ix2++) {
                     for (int ix1 = minX1; ix1 < maxX1; ix1++) {
 
-                        Vector3D nX = grid->getNodeCoordinates(block, ix1, ix2, ix3);
-                        
-                        double const dx = nX[0] - x[0];
-                        double const dy = nX[1] - x[1];
-                        double const dz = nX[2] - x[2];
+                        //UbTupleInt3 blockNX = grid->getBlockNX();
+
+                        //double const dx = val<1>(blockNX) * block->getX1() + ix1 - x[0];
+                        //double const dy = val<2>(blockNX) * block->getX2() + ix2 - x[1];
+                        //double const dz = val<3>(blockNX) * block->getX3() + ix3 - x[2];
+
+                        Vector3D worldCoordinates = grid->getNodeCoordinates(block, ix1, ix2, ix3);
+
+                        double const dx = (worldCoordinates[0] - x[0]) * units->getFactorLentghWToLb();
+                        double const dy = (worldCoordinates[1] - x[1]) * units->getFactorLentghWToLb();
+                        double const dz = (worldCoordinates[2] - x[2]) * units->getFactorLentghWToLb();
 
-                        double const sf = calcSolidFraction(dx, dy, dz, r);
+                        double const sf = calcSolidFraction(dx, dy, dz, r * units->getFactorLentghWToLb());
 
                         double const sf_old = (*particleData)(ix1,ix2,ix3)->solidFraction;
                         int const id_old = (int)(*particleData)(ix1,ix2,ix3)->partId;
@@ -137,7 +143,7 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
                                 setToZero(*(*particleData)(ix1, ix2, ix3).get());
                                 break; // do nothing
                             case 1:    // sf > 0 && sf_old == 0
-                                setValues(*(*particleData)(ix1, ix2, ix3).get(), sf, dx, dy, dz, omega, id);
+                                setValues(*(*particleData)(ix1, ix2, ix3).get(), id, sf, v, dx, dy, dz, omega);
                                 break;
                             case 2:               // sf == 0 && sf_old > 0
                                 if (id_old == id) // then particle has left this cell
@@ -145,12 +151,17 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
                                 break; // else do nothing
                             case 3:    // sf > 0 && sf_old > 0
                                 if (sf > sf_old || id_old == id)
-                                    setValues(*(*particleData)(ix1, ix2, ix3).get(), sf, dx, dy, dz, omega, id);
+                                    setValues(*(*particleData)(ix1, ix2, ix3).get(), id, sf, v, dx, dy, dz, omega);
                                 break; // else do nothing
                         }
                         // if desired, initialize interior of sphere with sphere velocity
                        // if (initVelFlag && sf > SOLFRAC_MAX)
                        //     cell.defineVelocity(particleData->uPart);
+
+                        //if (sf > 0) {
+                        //    std::cout << "sf = " << sf << std::endl;
+                        //    std::cout << "ix1 = " << ix1 << ", ix2 = " << ix2 << ", ix3 = " << ix3 << std::endl;
+                        //}
                     }
                 }
             }
@@ -206,10 +217,12 @@ double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double c
     return fraction * ((double)n);
 }
 
-  void LiggghtsCouplingCoProcessor::setValues(IBdynamicsParticleData &p, double const sf, double const dx,
-                                                 double const dy, double const dz, double* omega, int id)
+  void LiggghtsCouplingCoProcessor::setValues(IBdynamicsParticleData &p, int const id, double const sf, double const *v, double const dx, double const dy, double const dz, double const *omega)
 {
-    //p.uPart.from_cArray(v);
+    p.uPart[0] = v[0];
+    p.uPart[1] = v[1];
+    p.uPart[2] = v[2];
+
     if (omega != 0) {
         p.uPart[0] += omega[1] * dz - omega[2] * dy;
         p.uPart[1] += -omega[0] * dz + omega[2] * dx;
@@ -227,4 +240,172 @@ void LiggghtsCouplingCoProcessor::setToZero(IBdynamicsParticleData &p)
     p.uPart[2]      = 0;
     p.solidFraction = 0;
     p.partId        = 0;
+}
+
+void LiggghtsCouplingCoProcessor::getForcesFromLattice()
+{
+    static std::vector<double> force, torque;
+    static typename ParticleData::ParticleDataArrayVector x_lb;
+
+    int const nPart   = wrapper.lmp->atom->nlocal + wrapper.lmp->atom->nghost;
+    int const n_force = nPart * 3;
+
+    if (nPart == 0)
+        return; // no particles - no work
+
+    if (nPart > x_lb.size()) {
+        for (int iPart = 0; iPart < x_lb.size(); iPart++) {
+            x_lb[iPart][0] = wrapper.lmp->atom->x[iPart][0];
+            x_lb[iPart][1] = wrapper.lmp->atom->x[iPart][1];
+            x_lb[iPart][2] = wrapper.lmp->atom->x[iPart][2];
+        }
+        for (int iPart = x_lb.size(); iPart < nPart; iPart++) {
+            std::array<double, 3> ar = {wrapper.lmp->atom->x[iPart][0],
+                                        wrapper.lmp->atom->x[iPart][1],
+                                        wrapper.lmp->atom->x[iPart][2]};
+            x_lb.push_back(ar);
+        }
+            
+
+    } else {
+        for (int iPart = 0; iPart < nPart; iPart++) {
+            x_lb[iPart][0] = wrapper.lmp->atom->x[iPart][0];
+            x_lb[iPart][1] = wrapper.lmp->atom->x[iPart][1];
+            x_lb[iPart][2] = wrapper.lmp->atom->x[iPart][2];
+        }
+    }
+
+    if (n_force > force.size()) {
+        for (int i = 0; i < force.size(); i++) {
+            force[i]  = 0;
+            torque[i] = 0;
+        }
+        for (int i = force.size(); i < n_force; i++) {
+            force.push_back(0.);
+            torque.push_back(0.);
+        }
+    } else {
+        for (int i = 0; i < n_force; i++) {
+            force[i]  = 0;
+            torque[i] = 0;
+        }
+    }
+
+    SumForceTorque3D(x_lb, &force.front(), &torque.front());
+
+    LAMMPS_NS::FixLbCouplingOnetoone *couplingFix =
+        dynamic_cast<LAMMPS_NS::FixLbCouplingOnetoone *>(wrapper.lmp->modify->find_fix_style("couple/lb/onetoone", 0));
+
+    double **f_liggghts = couplingFix->get_force_ptr();
+    double **t_liggghts = couplingFix->get_torque_ptr();
+
+    for (int iPart = 0; iPart < nPart; iPart++)
+        for (int j = 0; j < 3; j++) {
+            f_liggghts[iPart][j] = 0;
+            t_liggghts[iPart][j] = 0;
+        }
+
+    for (int iPart = 0; iPart < nPart; iPart++) {
+        int tag          = wrapper.lmp->atom->tag[iPart];
+        int liggghts_ind = wrapper.lmp->atom->map(tag);
+
+        for (int j = 0; j < 3; j++) {
+            f_liggghts[liggghts_ind][j] += force[3 * iPart + j] * units->getFactorForceLbToW();
+            t_liggghts[liggghts_ind][j] += torque[3 * iPart + j] * units->getFactorTorqueLbToW();
+        }
+    }
+    couplingFix->comm_force_torque();
+}
+
+void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArrayVector &x, double *force, double *torque)
+{
+    int nx = grid->getNX1(), ny = grid->getNX2(), nz = grid->getNX3();
+
+    std::vector < SPtr < Block3D > > blocks;
+    int level = 0;
+    grid->getBlocks(level, gridRank, true, blocks);
+
+        
+    for (SPtr<Block3D> block : blocks) {
+        if (block) {
+            SPtr<ILBMKernel> kernel                 = block->getKernel();
+            SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+
+            CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData =
+                dynamicPointerCast<IBcumulantK17LBMKernel>(kernel)->getParticleData();
+
+            if (!particleData)
+                continue;
+
+            int minX1 = 1;
+            int minX2 = 1;
+            int minX3 = 1;
+
+            int maxX1 = (int)(distributions->getNX1()) - 2;
+            int maxX2 = (int)(distributions->getNX2()) - 2;
+            int maxX3 = (int)(distributions->getNX3()) - 2;
+
+            for (int ix3 = minX3; ix3 < maxX3; ix3++) {
+                for (int ix2 = minX2; ix2 < maxX2; ix2++) {
+                    for (int ix1 = minX1; ix1 < maxX1; ix1++) {
+
+                        // LIGGGHTS indices start at 1
+                        int const id = (*particleData)(ix1, ix2, ix3)->partId;
+                        if (id < 1)
+                            continue; // no particle here
+
+                        int const ind = wrapper.lmp->atom->map(id);
+
+                        Vector3D worldCoordinates = grid->getNodeCoordinates(block, ix1, ix2, ix3);
+
+                        double dx = (worldCoordinates[0] - x[ind][0]) * units->getFactorLentghWToLb();
+                        double dy = (worldCoordinates[1] - x[ind][1]) * units->getFactorLentghWToLb();
+                        double dz = (worldCoordinates[2] - x[ind][2]) * units->getFactorLentghWToLb();
+
+                        // minimum image convention, needed if
+                        // (1) PBC are used and
+                        // (2) both ends of PBC lie on the same processor
+                        if (dx > nx / 2)
+                            dx -= nx;
+                        else if (dx < -nx / 2)
+                            dx += nx;
+                        if (dy > ny / 2)
+                            dy -= ny;
+                        else if (dy < -ny / 2)
+                            dy += ny;
+                        if (dz > nz / 2)
+                            dz -= nz;
+                        else if (dz < -nz / 2)
+                            dz += nz;
+
+                        double const forceX = (*particleData)(ix1, ix2, ix3)->hydrodynamicForce[0];
+                        double const forceY = (*particleData)(ix1, ix2, ix3)->hydrodynamicForce[1];
+                        double const forceZ = (*particleData)(ix1, ix2, ix3)->hydrodynamicForce[2];
+
+                        double const torqueX = dy * forceZ - dz * forceY;
+                        double const torqueY = -dx * forceZ + dz * forceX;
+                        double const torqueZ = dx * forceY - dy * forceX;
+
+                        addForce(ind, 0, forceX, force);
+                        addForce(ind, 1, forceY, force);
+                        addForce(ind, 2, forceZ, force);
+
+                        addTorque(ind, 0, torqueX, torque);
+                        addTorque(ind, 1, torqueY, torque);
+                        addTorque(ind, 2, torqueZ, torque);
+                    }
+                }
+            }
+        }
+    }
+ }
+
+void LiggghtsCouplingCoProcessor::addForce(int const partId, int const coord, double const value, double *force)
+{
+    force[3 * partId + coord] += value;
+}
+
+void LiggghtsCouplingCoProcessor::addTorque(int const partId, int const coord, double const value, double *torque)
+{
+    torque[3 * partId + coord] += value;
 }
\ No newline at end of file
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
index 509e83b4a..dcaa6e16c 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
@@ -51,12 +51,18 @@ class LiggghtsCouplingWrapper;
 class Grid3D;
 class Block3D;
 struct IBdynamicsParticleData;
+class LBMUnitConverter;
+
+struct ParticleData {
+    typedef typename std::vector<std::array<double, 3>> ParticleDataArrayVector;
+    typedef typename std::vector<double> ParticleDataScalarVector;
+};
 
 class LiggghtsCouplingCoProcessor : public CoProcessor
 {
 public:
     LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Communicator> comm,
-                                LiggghtsCouplingWrapper &wrapper, int demSteps);
+                                LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units);
     virtual ~LiggghtsCouplingCoProcessor();
 
     void process(double actualTimeStep) override;
@@ -64,24 +70,34 @@ public:
     
 protected:
     void setSpheresOnLattice();
-    void getForcesFromLattice();
-    void setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r,
-                           int id /*, bool initVelFlag*/);
+    
+    void setSingleSphere3D(double *x, double *v, double *omega, double r, int id /*, bool initVelFlag*/);
+    
     double calcSolidFraction(double const dx_, double const dy_, double const dz_, double const r_);
+    
+    void setValues(IBdynamicsParticleData &p, int const id, double const sf, double const *v, double const dx, double const dy, double const dz, double const *omega);
+    
+    void setToZero(IBdynamicsParticleData &p);
+    
+    void getForcesFromLattice();
+    
+    void SumForceTorque3D(ParticleData::ParticleDataArrayVector &x, double *force, double *torque);
 
-    void setValues(IBdynamicsParticleData &p, double const sf, double const dx, double const dy, double const dz,
-                   double *omega, int id);
+    void addForce(int const partId, int const coord, double const value, double *force);
 
-    void setToZero(IBdynamicsParticleData &p);
+    void addTorque(int const partId, int const coord, double const value, double *torque);
 
 private:
     SPtr<Communicator> comm;
     LiggghtsCouplingWrapper &wrapper;
+    SPtr<LBMUnitConverter> units;
     int demSteps;
-    std::vector<std::vector<SPtr<Block3D>>> blockVector;
-    int minInitLevel;
-    int maxInitLevel;
+    //std::vector<std::vector<SPtr<Block3D>>> blockVector;
+    //int minInitLevel;
+    //int maxInitLevel;
     int gridRank;
+
+    double *force, *torque;
 };
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index ac6302dba..260c9d50e 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -16,7 +16,6 @@ IF(${USE_CATALYST})
    list(APPEND VF_LIBRARIES optimized vtkParallelMPI debug vtkParallelMPI )
 ENDIF()
 
-
 IF(${USE_DEM_COUPLING})
    INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../DemCoupling/DemCoupling.cmake)
 ENDIF()
@@ -25,12 +24,13 @@ if(BUILD_USE_OPENMP)
    list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX)
 endif()
 
-vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX ${VF_LIBRARIES} liggghts)
+IF(${USE_LIGGGHTS})
+   list(APPEND VF_LIBRARIES optimized ${LIGGGHTS_RELEASE_LIBRARY} debug ${LIGGGHTS_DEBUG_LIBRARY})
+ENDIF()
 
-vf_get_library_name(library_name)
+vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX ${VF_LIBRARIES})
 
-target_link_directories(${library_name} PUBLIC d:/Tools/LIGGGHTS/build/Debug)
-target_include_directories(${library_name} PUBLIC d:/Tools/LIGGGHTS/src)
+vf_get_library_name(library_name)
 
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors)
@@ -42,8 +42,6 @@ target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Gr
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors)
 target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LiggghtsCoupling)
-target_include_directories(${library_name} PUBLIC src/LiggghtsCoupling/Rconstructor)
 
 
 IF(${USE_METIS} AND METIS_INCLUDEDIR)
@@ -51,6 +49,12 @@ IF(${USE_METIS} AND METIS_INCLUDEDIR)
 ENDIF()
 
 target_include_directories(${library_name} PRIVATE ${ZOLTAN_INCLUDEDIR})
+
 IF(${USE_VTK})
    target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
 ENDIF()
+
+IF(${USE_LIGGGHTS})
+   target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LiggghtsCoupling)
+   target_include_directories(${library_name} PUBLIC ${LIGGGHTS_SOURCE_DIR})
+ENDIF()
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
index 8d5cec105..48d3a5c7f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
@@ -226,11 +226,11 @@ void InSituVTKCoProcessor::addData(SPtr<Block3D> block)
                                            UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
                     // vx3=999.0;
 
-                    arrays[0]->InsertNextValue(rho * conv->getFactorDensityLbToW2());
-                    arrays[1]->InsertNextValue(vx1 * conv->getFactorVelocityLbToW2());
-                    arrays[2]->InsertNextValue(vx2 * conv->getFactorVelocityLbToW2());
-                    arrays[3]->InsertNextValue(vx3 * conv->getFactorVelocityLbToW2());
-                    arrays[4]->InsertNextValue(press * conv->getFactorPressureLbToW2());
+                    arrays[0]->InsertNextValue(rho * conv->getFactorDensityLbToW());
+                    arrays[1]->InsertNextValue(vx1 * conv->getFactorVelocityLbToW());
+                    arrays[2]->InsertNextValue(vx2 * conv->getFactorVelocityLbToW());
+                    arrays[3]->InsertNextValue(vx3 * conv->getFactorVelocityLbToW());
+                    arrays[4]->InsertNextValue(press * conv->getFactorPressureLbToW());
                 }
             }
         }
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
index 40570cc38..7c4ef7372 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
@@ -97,14 +97,6 @@ public:
         this->init(refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb);
     }
 
-    LBMUnitConverter(int /*dummy*/, double uReal, double uLB, double nuReal, double nuLB)
-    {
-        factorVelocityLbToW  = uReal / uLB;
-        factorViscosityLbToW = nuReal / nuLB;
-        factorDensityLbToW   = factorViscosityLbToW * factorVelocityLbToW * factorVelocityLbToW;
-        factorPressureLbToW  = factorDensityLbToW;
-    }
-
     virtual ~LBMUnitConverter() = default;
 
     double getRefRhoLb() { return refRhoLb; }
@@ -124,10 +116,7 @@ public:
     double getFactorDensityLbToW() { return this->factorMassLbToW / std::pow(factorLengthLbToW, 3.0); }
     double getFactorDensityWToLb() { return 1.0 / this->getFactorDensityLbToW(); }
 
-    double getFactorPressureLbToW()
-    {
-        return this->factorMassLbToW / (std::pow(factorTimeLbToW, 2.0) * factorLengthLbToW);
-    }
+    double getFactorPressureLbToW(){ return this->factorMassLbToW / (factorLengthLbToW * factorTimeLbToW * factorTimeLbToW); }
     double getFactorPressureWToLb() { return 1.0 / this->getFactorPressureLbToW(); }
 
     double getFactorMassLbToW() { return this->factorMassLbToW; }
@@ -136,14 +125,14 @@ public:
     double getFactorForceLbToW() { return factorMassLbToW * factorLengthLbToW / (factorTimeLbToW * factorTimeLbToW); }
     double getFactorForceWToLb() { return 1.0 / this->getFactorForceLbToW(); }
 
+    double getFactorTorqueLbToW() { return factorMassLbToW * factorLengthLbToW * factorLengthLbToW / (factorTimeLbToW * factorTimeLbToW);}
+    double getFactorTorqueWToLb() { return 1.0 / this->getFactorTorqueWToLb(); }
+
     double getFactorAccLbToW() { return factorLengthLbToW / (factorTimeLbToW * factorTimeLbToW); }
     double getFactorAccWToLb() { return 1.0 / this->getFactorAccLbToW(); }
 
     double getFactorTimeLbToW(double deltaX) const { return factorTimeWithoutDx * deltaX; }
-    //////////////////////////////////////////////////////////////////////////
-    double getFactorVelocityLbToW2() { return factorVelocityLbToW; }
-    double getFactorDensityLbToW2() { return factorDensityLbToW; }
-    double getFactorPressureLbToW2() { return factorPressureLbToW; }
+
 
     /*==========================================================*/
     friend inline std::ostream &operator<<(std::ostream &os, LBMUnitConverter c)
@@ -212,11 +201,6 @@ protected:
     double factorMassLbToW{ 1.0 };
     double refRhoLb{ 1.0 };
     double factorTimeWithoutDx{ 0.0 };
-
-    double factorVelocityLbToW{ 1.0 };
-    double factorViscosityLbToW{ 1.0 };
-    double factorDensityLbToW{ 1.0 };
-    double factorPressureLbToW{ 1.0 };
 };
 
 #endif // LBMUNITCONVERTER_H
-- 
GitLab


From e9c37a71ea32f8ec17476770429d6b8d6e75a855 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 4 Aug 2022 16:25:01 +0200
Subject: [PATCH 083/179] fixes some small issues / falling sphere works now

---
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          | 83 +++++++++++++++----
 apps/cpu/LiggghtsApp/in.lbdem                 | 11 ++-
 apps/cpu/LiggghtsApp/in2.lbdem                |  6 +-
 .../LiggghtsCouplingCoProcessor.cpp           | 22 ++---
 4 files changed, 92 insertions(+), 30 deletions(-)

diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index fd892b6b9..978ae376f 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -30,22 +30,40 @@ int main(int argc, char *argv[])
 
     double g_maxX1 = 1;
     double g_maxX2 = 1;
-    double g_maxX3 = 1;
+    double g_maxX3 = 2;
+
+    int blockNX[3] = { 16, 16, 16 };
+
+    double dx = 1./32.;
+
+    double Re   = 300;
+    double nuLB = 5e-5;
+
+    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
+    SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
+    kernel->setBCProcessor(bcProc);
+
+    SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+    noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+    //////////////////////////////////////////////////////////////////////////////////
+    // BC visitor
+    BoundaryConditionsBlockVisitor bcVisitor;
+    bcVisitor.addBC(noSlipBCAdapter);
 
-    int blockNX[3] = { 10, 10, 10 };
 
-    double dx = 0.1;
 
-    double nuLB = 0.005;
 
     SPtr<Grid3D> grid = make_shared<Grid3D>(comm);
     grid->setPeriodicX1(true);
     grid->setPeriodicX2(true);
-    grid->setPeriodicX3(true);
+    grid->setPeriodicX3(false);
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
 
-    string outputPath = "d:/temp/lll2";
+    string outputPath = "d:/temp/lll4";
+
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
+                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
     
     SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
     if (myid == 0)
@@ -60,13 +78,27 @@ int main(int argc, char *argv[])
     ppblocks->process(0);
     ppblocks.reset();
 
-    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
-    SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
-    kernel->setBCProcessor(bcProc);
+    double dx2 = 2.0 * dx;
+    GbCuboid3DPtr wallZmin(
+        new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_minX3));
+    GbSystem3D::writeGeoObject(wallZmin.get(), outputPath + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance());
+    GbCuboid3DPtr wallZmax(
+        new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_maxX3, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+    GbSystem3D::writeGeoObject(wallZmax.get(), outputPath + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance());
+
+    SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+    SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+    InteractorsHelper intHelper(grid, metisVisitor, true);
+    intHelper.addInteractor(wallZminInt);
+    intHelper.addInteractor(wallZmaxInt);
+    intHelper.selectBlocks();
 
     SetKernelBlockVisitor kernelVisitor(kernel, nuLB, 1e9, 1e9);
     grid->accept(kernelVisitor);
 
+    intHelper.setBC();
+
     InitDistributionsBlockVisitor initVisitor;
     grid->accept(initVisitor);
 
@@ -78,18 +110,24 @@ int main(int argc, char *argv[])
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
 
-    double d_part = 0.3;
+    double d_part = 0.25;
     double r_p       = d_part / 2.0;
  
     // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
-    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::WATER, r_p / dx);
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01);
+    std::cout << units->toString() << std::endl;
+
+    //return 0;
 
     double v_frac = 0.1;
     double dt_phys   = units->getFactorTimeLbToW();
     int demSubsteps = 10;
     double dt_dem   = dt_phys / (double)demSubsteps;
     int vtkSteps    = 1;
-    string demOutDir = "d:/temp/lll2/";
+    string demOutDir = outputPath; //    "d:/temp/lll2/";
+
+    wrapper.execCommand("echo log");
 
     wrapper.setVariable("r_part", d_part / 2);
     wrapper.setVariable("v_frac", v_frac);
@@ -102,16 +140,31 @@ int main(int argc, char *argv[])
     wrapper.setVariable("dmp_dir", demOutDir);
 
     wrapper.execFile((char *)inFile2.c_str());
-    //wrapper.runUpto(demSubsteps - 1);
+    wrapper.runUpto(demSubsteps - 1);
 
-    
+  
     SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
         make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps, units);
 
+    // boundary conditions grid
+    {
+        SPtr<UbScheduler> geoSch(new UbScheduler(1));
+        SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+            grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
+        ppgeo->process(0);
+        ppgeo.reset();
+    }
+
+    grid->accept(bcVisitor);
+
+    OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+    grid->accept(setConnsVisitor);
+
+
     // write data for visualization of macroscopic quantities
     SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
     SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
-        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(),
+        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
                                                   SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
 
     int endTime = 1000; //20;
diff --git a/apps/cpu/LiggghtsApp/in.lbdem b/apps/cpu/LiggghtsApp/in.lbdem
index 366f7afd1..ae2baa373 100644
--- a/apps/cpu/LiggghtsApp/in.lbdem
+++ b/apps/cpu/LiggghtsApp/in.lbdem
@@ -1,15 +1,18 @@
+echo none
 
 units		si
 atom_style	granular
 atom_modify	map array
 
+
+
 communicate	single vel yes
 
 boundary	f f f
 newton		off
 
 processors * * 1
-region		box block 0. 1. 0. 1. 0. 1. units box
+region		box block 0. 1. 0. 1. 0. 2. units box
 create_box	1 box
 
 variable	skin equal 0.01
@@ -41,10 +44,10 @@ fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane
 fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
 fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
 
-create_atoms 1 single 0.5 0.5 0.75
+create_atoms 1 single 0.5 0.5 1.75
 #create_atoms 1 single 0.38 0.05 0.05
 
-set group all diameter 0.3 density 2400
+set group all diameter 0.25 density 2400
 
 atom_modify sort 0 0.0
 
@@ -67,6 +70,6 @@ atom_modify sort 0 0.0
 # #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
 # #                        overlapcheck yes particles_in_region 1 region insreg ntry_mc 10000 
 
-
+echo none
 
 run 1
diff --git a/apps/cpu/LiggghtsApp/in2.lbdem b/apps/cpu/LiggghtsApp/in2.lbdem
index 7098890cc..8d6a0748b 100644
--- a/apps/cpu/LiggghtsApp/in2.lbdem
+++ b/apps/cpu/LiggghtsApp/in2.lbdem
@@ -1,4 +1,6 @@
 
+echo none
+
 timestep        ${t_step}      
 
 # thermo settings
@@ -18,4 +20,6 @@ variable dmp_fname string ${dmp_dir}d_*.liggghts
 # dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
 # 		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
 	
-dump   dmp all custom/vtk 10 ${dmp_dir}post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
+dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
+
+echo none
\ No newline at end of file
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index d4926e0b1..da8c93296 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -35,6 +35,8 @@ void LiggghtsCouplingCoProcessor::process(double actualTimeStep)
 { 
     std::cout << "step: " << actualTimeStep << "\n";
     
+    getForcesFromLattice();
+
     wrapper.run(demSteps);
     
     setSpheresOnLattice();
@@ -74,10 +76,10 @@ void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
         
         r = wrapper.lmp->atom->radius[iS]; // * units->getFactorLentghWToLb();
 
-        std::cout << "x[0] = " << x[0] << ", x[1] = " << x[1] << ", x[2] = " << x[2] << std::endl;
-        std::cout << "v[0] = " << v[0] << ", v[1] = " << v[1] << ", v[2] = " << v[2] << std::endl;
-        std::cout << "omega[0] = " << omega[0] << ", omega[1] = " << omega[1] << ", omega[2] = " << omega[2] << std::endl;
-        std::cout << "r = " << r << std::endl;
+        //std::cout << "x[0] = " << x[0] << ", x[1] = " << x[1] << ", x[2] = " << x[2] << std::endl;
+        //std::cout << "v[0] = " << v[0] << ", v[1] = " << v[1] << ", v[2] = " << v[2] << std::endl;
+        //std::cout << "omega[0] = " << omega[0] << ", omega[1] = " << omega[1] << ", omega[2] = " << omega[2] << std::endl;
+        //std::cout << "r = " << r << std::endl;
         
         setSingleSphere3D(x, v, omega, r, id);
     }
@@ -111,9 +113,9 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
             int minX2 = 1;
             int minX3 = 1;
 
-            int maxX1 = (int)(distributions->getNX1()) - 2;
-            int maxX2 = (int)(distributions->getNX2()) - 2;
-            int maxX3 = (int)(distributions->getNX3()) - 2;
+            int maxX1 = (int)(distributions->getNX1()) - 1;
+            int maxX2 = (int)(distributions->getNX2()) - 1;
+            int maxX3 = (int)(distributions->getNX3()) - 1;
 
             for (int ix3 = minX3; ix3 < maxX3; ix3++) {
                 for (int ix2 = minX2; ix2 < maxX2; ix2++) {
@@ -341,9 +343,9 @@ void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArr
             int minX2 = 1;
             int minX3 = 1;
 
-            int maxX1 = (int)(distributions->getNX1()) - 2;
-            int maxX2 = (int)(distributions->getNX2()) - 2;
-            int maxX3 = (int)(distributions->getNX3()) - 2;
+            int maxX1 = (int)(distributions->getNX1()) - 1;
+            int maxX2 = (int)(distributions->getNX2()) - 1;
+            int maxX3 = (int)(distributions->getNX3()) - 1;
 
             for (int ix3 = minX3; ix3 < maxX3; ix3++) {
                 for (int ix2 = minX2; ix2 < maxX2; ix2++) {
-- 
GitLab


From 6aa23563126fdb6cb1bc9e48e90eac9a831059c6 Mon Sep 17 00:00:00 2001
From: Konstantin Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 5 Aug 2022 13:43:33 +0200
Subject: [PATCH 084/179] refactoring for direction naming

---
 apps/cpu/CouetteFlow/cflow.cpp                |   2 +-
 apps/cpu/FlowAroundCylinder/cylinder.cpp      |   2 +-
 apps/cpu/HerschelBulkleyModel/hbflow.cpp      |   2 +-
 apps/cpu/HerschelBulkleySphere/hbsphere.cpp   |   4 +-
 apps/cpu/JetBreakup/JetBreakup.cpp            |   2 +-
 apps/cpu/LaminarTubeFlow/ltf.cpp              |   4 +-
 apps/cpu/Multiphase/Multiphase.cpp            |   2 +-
 apps/cpu/MultiphaseDropletTest/droplet.cpp    |   2 +-
 apps/cpu/PoiseuilleFlow/pf1.cpp               |   2 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp    |   2 +-
 apps/cpu/ViskomatXL/viskomat.cpp              |   2 +-
 apps/cpu/rheometer/rheometer.cpp              |   4 +-
 apps/cpu/sphere/sphere.cpp                    |   2 +-
 .../BoundaryConditions/BoundaryConditions.h   |  52 +-
 .../EqDensityBCAlgorithm.cpp                  |  12 +-
 ...tiphaseNonReflectingOutflowBCAlgorithm.cpp | 442 +++++-----
 .../MultiphaseSlipBCAlgorithm.cpp             |  52 +-
 .../MultiphaseVelocityBCAlgorithm.cpp         |  12 +-
 .../NonEqDensityBCAlgorithm.cpp               |  12 +-
 .../NonReflectingOutflowBCAlgorithm.cpp       | 194 ++---
 .../SimpleSlipBCAlgorithm.cpp                 |  52 +-
 .../BoundaryConditions/SlipBCAdapter.cpp      |  12 +-
 .../BoundaryConditions/SlipBCAlgorithm.cpp    |  52 +-
 .../ThixotropyDensityBCAlgorithm.cpp          |  12 +-
 ...xotropyNonReflectingOutflowBCAlgorithm.cpp | 388 ++++-----
 .../ThixotropyVelocityBCAlgorithm.cpp         |  12 +-
 ...ixotropyVelocityWithDensityBCAlgorithm.cpp |  12 +-
 .../CoProcessors/ShearStressCoProcessor.cpp   | 160 ++--
 .../TurbulenceIntensityCoProcessor.cpp        |  12 +-
 .../CoProcessors/WriteBlocksCoProcessor.cpp   |   4 +-
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |  90 +-
 .../Connectors/CoarseToFineVectorConnector.h  | 312 +++----
 .../Connectors/FineToCoarseVectorConnector.h  | 342 ++++----
 .../Connectors/FullDirectConnector.cpp        |  52 +-
 .../Connectors/FullVectorConnector.cpp        | 140 +--
 .../OneDistributionFullVectorConnector.cpp    |  52 +-
 ...onsDoubleGhostLayerFullDirectConnector.cpp |  52 +-
 ...onsDoubleGhostLayerFullVectorConnector.cpp | 156 ++--
 .../ThreeDistributionsFullVectorConnector.cpp |  52 +-
 ...onsDoubleGhostLayerFullDirectConnector.cpp |  52 +-
 ...onsDoubleGhostLayerFullVectorConnector.cpp | 156 ++--
 .../TwoDistributionsFullVectorConnector.cpp   |  52 +-
 .../Data/D3Q27EsoTwist3DSoA.cpp               | 432 +++++-----
 .../Data/D3Q27EsoTwist3DSplittedVector.cpp    | 520 +++++------
 .../Data/EsoTwistD3Q27System.cpp              |  12 +-
 .../Data/EsoTwistD3Q27System.h                | 104 +--
 src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp     | 106 +--
 .../Interactors/D3Q27Interactor.cpp           | 192 ++---
 .../D3Q27TriFaceMeshInteractor.cpp            |  18 +-
 .../VirtualFluidsCore/LBM/BGKLBMKernel.cpp    | 284 +++---
 ...ibleCumulant4thOrderViscosityLBMKernel.cpp |   2 +-
 ...mpressibleOffsetInterpolationProcessor.cpp | 114 +--
 ...bleOffsetMomentsInterpolationProcessor.cpp | 114 +--
 ...etSquarePressureInterpolationProcessor.cpp | 114 +--
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp |  12 +-
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.h   | 808 +++++++++---------
 ...ssibleCumulantWithSpongeLayerLBMKernel.cpp |  12 +-
 ...mpressibleOffsetInterpolationProcessor.cpp |  96 +--
 .../LBM/InitDensityLBMKernel.cpp              | 182 ++--
 .../LBM/LBMKernelETD3Q27BGK.cpp               | 238 +++---
 .../LBM/MultiphaseCumulantLBMKernel.cpp       | 214 ++---
 ...PressureFilterCompressibleAirLBMKernel.cpp |  84 +-
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |  70 +-
 .../MultiphaseScratchCumulantLBMKernel.cpp    | 160 ++--
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp | 174 ++--
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp | 104 +--
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp | 104 +--
 .../LBM/RheologyInterpolationProcessor.cpp    |  90 +-
 .../InitDistributionsBlockVisitor.cpp         |  40 +-
 .../InitDistributionsFromFileBlockVisitor.cpp |   2 +-
 .../Visitors/InitThixotropyBlockVisitor.cpp   |   2 +-
 .../Visitors/MetisPartitioningGridVisitor.cpp |   4 +-
 ...ultiphaseInitDistributionsBlockVisitor.cpp | 120 +--
 ...ocityFormInitDistributionsBlockVisitor.cpp | 120 +--
 .../Visitors/RefineAroundGbObjectHelper.cpp   |   2 +-
 .../RefineCrossAndInsideGbObjectHelper.cpp    |   2 +-
 ...SetInterpolationConnectorsBlockVisitor.cpp | 104 +--
 .../SetInterpolationDirsBlockVisitor.cpp      |  38 +-
 .../SetUndefinedNodesBlockVisitor.cpp         | 108 +--
 .../Visitors/SpongeLayerBlockVisitor.cpp      |   8 +-
 80 files changed, 3971 insertions(+), 3971 deletions(-)

diff --git a/apps/cpu/CouetteFlow/cflow.cpp b/apps/cpu/CouetteFlow/cflow.cpp
index 276fbe125..3de4a3b36 100644
--- a/apps/cpu/CouetteFlow/cflow.cpp
+++ b/apps/cpu/CouetteFlow/cflow.cpp
@@ -184,7 +184,7 @@ void bflow(string configname)
 
       ////////////////////////////////////////////
       //METIS
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::KWAY));
       ////////////////////////////////////////////
       /////delete solid blocks
       if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp b/apps/cpu/FlowAroundCylinder/cylinder.cpp
index 2f470d17d..5578ecb56 100644
--- a/apps/cpu/FlowAroundCylinder/cylinder.cpp
+++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp
@@ -203,7 +203,7 @@ void run(string configname)
          SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
 
          
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
          InteractorsHelper intHelper(grid, metisVisitor);
          intHelper.addInteractor(cylinderInt);
          intHelper.addInteractor(addWallYminInt);
diff --git a/apps/cpu/HerschelBulkleyModel/hbflow.cpp b/apps/cpu/HerschelBulkleyModel/hbflow.cpp
index 8483883ac..b97942a1c 100644
--- a/apps/cpu/HerschelBulkleyModel/hbflow.cpp
+++ b/apps/cpu/HerschelBulkleyModel/hbflow.cpp
@@ -218,7 +218,7 @@ void bflow(string configname)
 
       ////////////////////////////////////////////
       //METIS
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
       ////////////////////////////////////////////
       /////delete solid blocks
       if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
index f69bce237..67f5a00ad 100644
--- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
+++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp
@@ -161,7 +161,7 @@ void bflow(string configname)
 
       ////////////////////////////////////////////
       //METIS
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::KWAY));
       ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
@@ -243,7 +243,7 @@ void bflow(string configname)
 
          ////////////////////////////////////////////
          //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::KWAY));
          ////////////////////////////////////////////
          /////delete solid blocks
          if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index 4ebc8e814..83cb83fd4 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -200,7 +200,7 @@ void run(string configname)
         grid->setGhostLayerWidth(2);
 
         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(
-            comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+            comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
 
         //////////////////////////////////////////////////////////////////////////
         // restart
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index 3c93a2151..93fd31083 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -108,7 +108,7 @@ void run(string configname)
       kernel->setBCProcessor(bcProc);
 
       //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
       //restart
       SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
       //SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, pathname + "/mig", comm));
@@ -220,7 +220,7 @@ void run(string configname)
          //outflow
          SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
 
-         //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
          InteractorsHelper intHelper(grid, metisVisitor);
          intHelper.addInteractor(cylinderInt);
          intHelper.addInteractor(inflowInt);
diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp
index 9623cd730..09d74e147 100644
--- a/apps/cpu/Multiphase/Multiphase.cpp
+++ b/apps/cpu/Multiphase/Multiphase.cpp
@@ -122,7 +122,7 @@ void run(string configname)
         grid->setGhostLayerWidth(2);
 
        
-        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
 
         //////////////////////////////////////////////////////////////////////////
         // restart
diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp
index 29a2228bb..54b59fcfd 100644
--- a/apps/cpu/MultiphaseDropletTest/droplet.cpp
+++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp
@@ -187,7 +187,7 @@ void run(string configname)
         grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
-        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
 
         //////////////////////////////////////////////////////////////////////////
         // restart
diff --git a/apps/cpu/PoiseuilleFlow/pf1.cpp b/apps/cpu/PoiseuilleFlow/pf1.cpp
index 99600ceb9..d4d856d51 100644
--- a/apps/cpu/PoiseuilleFlow/pf1.cpp
+++ b/apps/cpu/PoiseuilleFlow/pf1.cpp
@@ -76,7 +76,7 @@ void pf1()
 
    //set boundary conditions for blocks and create process decomposition for MPI
    SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
-   SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+   SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
    InteractorsHelper intHelper(grid, metisVisitor);
    intHelper.addInteractor(cylinderInt);
    intHelper.selectBlocks();
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 536936d66..f5e215fe7 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -189,7 +189,7 @@ void run(string configname)
         grid->setPeriodicX3(true);
         grid->setGhostLayerWidth(2);
 
-        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
 
         //////////////////////////////////////////////////////////////////////////
         // restart
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 983ecb06c..7cbdff384 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -191,7 +191,7 @@ void bflow(string configname)
 
       ////////////////////////////////////////////
       //METIS
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
       ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp
index 70a11bdc7..e79d9d13a 100644
--- a/apps/cpu/rheometer/rheometer.cpp
+++ b/apps/cpu/rheometer/rheometer.cpp
@@ -223,7 +223,7 @@ void bflow(string configname)
 
       ////////////////////////////////////////////
       //METIS
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::KWAY));
       ////////////////////////////////////////////
       //////////////////////////////////////////////////////////////////////////
       //restart
@@ -313,7 +313,7 @@ void bflow(string configname)
 
          ////////////////////////////////////////////
          //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::KWAY));
          ////////////////////////////////////////////
          /////delete solid blocks
          if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
diff --git a/apps/cpu/sphere/sphere.cpp b/apps/cpu/sphere/sphere.cpp
index 5ab9a2a70..bad77ee99 100644
--- a/apps/cpu/sphere/sphere.cpp
+++ b/apps/cpu/sphere/sphere.cpp
@@ -180,7 +180,7 @@ void run(string configname)
          //outflow
          SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
 
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
          InteractorsHelper intHelper(grid, metisVisitor);
          intHelper.addInteractor(sphereInt);
          intHelper.addInteractor(addWallYminInt);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
index 555ef9852..fa61e7224 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h
@@ -193,59 +193,59 @@ public:
     float getBoundaryVelocity(const int &direction)
     {
         switch (direction) {
-            case D3Q27System::E:
+            case D3Q27System::DIR_P00:
                 return (float)(UbMath::c4o9 *
                                (+bcVelocityX1)); //(2/cs^2)(=6)*rho_0(=1 bei inkompr)*wi*u*ei mit cs=1/sqrt(3)
-            case D3Q27System::W:
+            case D3Q27System::DIR_M00:
                 return (float)(UbMath::c4o9 *
                                (-bcVelocityX1)); // z.B. aus paper manfred MRT LB models in three dimensions (2002)
-            case D3Q27System::N:
+            case D3Q27System::DIR_0P0:
                 return (float)(UbMath::c4o9 * (+bcVelocityX2));
-            case D3Q27System::S:
+            case D3Q27System::DIR_0M0:
                 return (float)(UbMath::c4o9 * (-bcVelocityX2));
-            case D3Q27System::T:
+            case D3Q27System::DIR_00P:
                 return (float)(UbMath::c4o9 * (+bcVelocityX3));
-            case D3Q27System::B:
+            case D3Q27System::DIR_00M:
                 return (float)(UbMath::c4o9 * (-bcVelocityX3));
-            case D3Q27System::NE:
+            case D3Q27System::DIR_PP0:
                 return (float)(UbMath::c1o9 * (+bcVelocityX1 + bcVelocityX2));
-            case D3Q27System::SW:
+            case D3Q27System::DIR_MM0:
                 return (float)(UbMath::c1o9 * (-bcVelocityX1 - bcVelocityX2));
-            case D3Q27System::SE:
+            case D3Q27System::DIR_PM0:
                 return (float)(UbMath::c1o9 * (+bcVelocityX1 - bcVelocityX2));
-            case D3Q27System::NW:
+            case D3Q27System::DIR_MP0:
                 return (float)(UbMath::c1o9 * (-bcVelocityX1 + bcVelocityX2));
-            case D3Q27System::TE:
+            case D3Q27System::DIR_P0P:
                 return (float)(UbMath::c1o9 * (+bcVelocityX1 + bcVelocityX3));
-            case D3Q27System::BW:
+            case D3Q27System::DIR_M0M:
                 return (float)(UbMath::c1o9 * (-bcVelocityX1 - bcVelocityX3));
-            case D3Q27System::BE:
+            case D3Q27System::DIR_P0M:
                 return (float)(UbMath::c1o9 * (+bcVelocityX1 - bcVelocityX3));
-            case D3Q27System::TW:
+            case D3Q27System::DIR_M0P:
                 return (float)(UbMath::c1o9 * (-bcVelocityX1 + bcVelocityX3));
-            case D3Q27System::TN:
+            case D3Q27System::DIR_0PP:
                 return (float)(UbMath::c1o9 * (+bcVelocityX2 + bcVelocityX3));
-            case D3Q27System::BS:
+            case D3Q27System::DIR_0MM:
                 return (float)(UbMath::c1o9 * (-bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::BN:
+            case D3Q27System::DIR_0PM:
                 return (float)(UbMath::c1o9 * (+bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::TS:
+            case D3Q27System::DIR_0MP:
                 return (float)(UbMath::c1o9 * (-bcVelocityX2 + bcVelocityX3));
-            case D3Q27System::TNE:
+            case D3Q27System::DIR_PPP:
                 return (float)(UbMath::c1o36 * (+bcVelocityX1 + bcVelocityX2 + bcVelocityX3));
-            case D3Q27System::BSW:
+            case D3Q27System::DIR_MMM:
                 return (float)(UbMath::c1o36 * (-bcVelocityX1 - bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::BNE:
+            case D3Q27System::DIR_PPM:
                 return (float)(UbMath::c1o36 * (+bcVelocityX1 + bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::TSW:
+            case D3Q27System::DIR_MMP:
                 return (float)(UbMath::c1o36 * (-bcVelocityX1 - bcVelocityX2 + bcVelocityX3));
-            case D3Q27System::TSE:
+            case D3Q27System::DIR_PMP:
                 return (float)(UbMath::c1o36 * (+bcVelocityX1 - bcVelocityX2 + bcVelocityX3));
-            case D3Q27System::BNW:
+            case D3Q27System::DIR_MPM:
                 return (float)(UbMath::c1o36 * (-bcVelocityX1 + bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::BSE:
+            case D3Q27System::DIR_PMM:
                 return (float)(UbMath::c1o36 * (+bcVelocityX1 - bcVelocityX2 - bcVelocityX3));
-            case D3Q27System::TNW:
+            case D3Q27System::DIR_MPP:
                 return (float)(UbMath::c1o36 * (-bcVelocityX1 + bcVelocityX2 + bcVelocityX3));
             default:
                 throw UbException(UB_EXARGS, "unknown error");
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp
index 8551c4371..bdddd2369 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp
@@ -63,17 +63,17 @@ void EqDensityBCAlgorithm::applyBC()
     int nx3 = x3;
 
     // flag points in direction of fluid
-    if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) {
+    if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_P00)) {
         nx1 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_M00)) {
         nx1 += 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0P0)) {
         nx2 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0M0)) {
         nx2 += 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00P)) {
         nx3 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00M)) {
         nx3 += 1;
     } else
         UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
index d0a3b39c8..bc9a73dee 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
@@ -77,11 +77,11 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
    int direction = -1;
 
    //flag points in direction of fluid
-   if      (bcPtr->hasDensityBoundaryFlag(E)) { nx1 += 1; direction = E; }
-   else if (bcPtr->hasDensityBoundaryFlag(W)) { nx1 -= 1; direction = W; }
-   else if (bcPtr->hasDensityBoundaryFlag(N)) { nx2 += 1; direction = N; }
-   else if (bcPtr->hasDensityBoundaryFlag(S)) { nx2 -= 1; direction = S; }
-   else if (bcPtr->hasDensityBoundaryFlag(T)) { nx3 += 1; direction = T; }
+   if      (bcPtr->hasDensityBoundaryFlag(DIR_P00)) { nx1 += 1; direction = DIR_P00; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_M00)) { nx1 -= 1; direction = DIR_M00; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_0P0)) { nx2 += 1; direction = DIR_0P0; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_0M0)) { nx2 -= 1; direction = DIR_0M0; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_00P)) { nx3 += 1; direction = DIR_00P; }
    else if (bcPtr->hasDensityBoundaryFlag(B)) { nx3 -= 1; direction = B; }
    else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
 
@@ -98,256 +98,256 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 
    switch (direction)
    {
-   case E:
-      f[E]   = ftemp[E]   * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[E]   ;
-      f[NE]  = ftemp[NE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[NE]  ;
-      f[SE]  = ftemp[SE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[SE]  ;
-      f[TE]  = ftemp[TE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TE]  ;
-      f[BE]  = ftemp[BE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BE]  ;
-      f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TNE] ;
-      f[TSE] = ftemp[TSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[TSE] ;
-      f[BNE] = ftemp[BNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BNE] ;
-      f[BSE] = ftemp[BSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[BSE] ;
+   case DIR_P00:
+      f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P00];
+      f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PP0];
+      f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PM0];
+      f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0P];
+      f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0M];
+      f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPP];
+      f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMP];
+      f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPM];
+      f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMM];
 
-      distributions->setDistributionInvForDirection(f[E],   x1+DX1[W],   x2+DX2[W],   x3+DX3[W],   W);
-      distributions->setDistributionInvForDirection(f[NE],  x1+DX1[SW],  x2+DX2[SW],  x3+DX3[SW],  SW);
-      distributions->setDistributionInvForDirection(f[SE],  x1+DX1[NW],  x2+DX2[NW],  x3+DX3[NW],  NW);
-      distributions->setDistributionInvForDirection(f[TE],  x1+DX1[BW],  x2+DX2[BW],  x3+DX3[BW],  BW);
-      distributions->setDistributionInvForDirection(f[BE],  x1+DX1[TW],  x2+DX2[TW],  x3+DX3[TW],  TW);
-      distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
+      distributions->setDistributionInvForDirection(f[DIR_P00], x1+DX1[DIR_M00], x2+DX2[DIR_M00], x3+DX3[DIR_M00], DIR_M00);
+      distributions->setDistributionInvForDirection(f[DIR_PP0], x1+DX1[DIR_MM0], x2+DX2[DIR_MM0], x3+DX3[DIR_MM0], DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_PM0], x1+DX1[DIR_MP0], x2+DX2[DIR_MP0], x3+DX3[DIR_MP0], DIR_MP0);
+      distributions->setDistributionInvForDirection(f[DIR_P0P], x1+DX1[DIR_M0M], x2+DX2[DIR_M0M], x3+DX3[DIR_M0M], DIR_M0M);
+      distributions->setDistributionInvForDirection(f[DIR_P0M], x1+DX1[DIR_M0P], x2+DX2[DIR_M0P], x3+DX3[DIR_M0P], DIR_M0P);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
       
-	  h[E]   = htemp[E]   * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[E]   ;
-	  h[NE]  = htemp[NE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[NE]  ;
-	  h[SE]  = htemp[SE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[SE]  ;
-	  h[TE]  = htemp[TE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[TE]  ;
-	  h[BE]  = htemp[BE]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[BE]  ;
-	  h[TNE] = htemp[TNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[TNE] ;
-	  h[TSE] = htemp[TSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[TSE] ;
-	  h[BNE] = htemp[BNE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[BNE] ;
-	  h[BSE] = htemp[BSE] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[BSE] ;
+	  h[DIR_P00] = htemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P00];
+	  h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PP0];
+	  h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PM0];
+	  h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0P];
+	  h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0M];
+	  h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPP];
+	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMP];
+	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPM];
+	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMM];
 
-	  distributionsH->setDistributionInvForDirection(h[E],   x1+DX1[W],   x2+DX2[W],   x3+DX3[W],   W);
-	  distributionsH->setDistributionInvForDirection(h[NE],  x1+DX1[SW],  x2+DX2[SW],  x3+DX3[SW],  SW);
-	  distributionsH->setDistributionInvForDirection(h[SE],  x1+DX1[NW],  x2+DX2[NW],  x3+DX3[NW],  NW);
-	  distributionsH->setDistributionInvForDirection(h[TE],  x1+DX1[BW],  x2+DX2[BW],  x3+DX3[BW],  BW);
-	  distributionsH->setDistributionInvForDirection(h[BE],  x1+DX1[TW],  x2+DX2[TW],  x3+DX3[TW],  TW);
-	  distributionsH->setDistributionInvForDirection(h[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-	  distributionsH->setDistributionInvForDirection(h[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-	  distributionsH->setDistributionInvForDirection(h[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-	  distributionsH->setDistributionInvForDirection(h[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
+	  distributionsH->setDistributionInvForDirection(h[DIR_P00],   x1+DX1[DIR_M00],   x2+DX2[DIR_M00],   x3+DX3[DIR_M00],   DIR_M00);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],  DIR_MM0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],  DIR_MP0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],  DIR_M0M);
+	  distributionsH->setDistributionInvForDirection(h[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],  DIR_M0P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
 	  
 	  break;
-   case W:
-      f[W]   = ftemp[W]   * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[W]  ;
-      f[NW]  = ftemp[NW]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[NW] ;
-      f[SW]  = ftemp[SW]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[SW] ;
-      f[TW]  = ftemp[TW]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TW] ;
-      f[BW]  = ftemp[BW]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BW] ;
-      f[TNW] = ftemp[TNW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TNW];
-      f[TSW] = ftemp[TSW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[TSW];
-      f[BNW] = ftemp[BNW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BNW];
-      f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[BSW];
+   case DIR_M00:
+      f[DIR_M00]   = ftemp[DIR_M00]   * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M00]  ;
+      f[DIR_MP0]  = ftemp[DIR_MP0]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MP0] ;
+      f[DIR_MM0]  = ftemp[DIR_MM0]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MM0] ;
+      f[DIR_M0P]  = ftemp[DIR_M0P]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M0P] ;
+      f[DIR_M0M]  = ftemp[DIR_M0M]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M0M] ;
+      f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MPP];
+      f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MMP];
+      f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MPM];
+      f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MMM];
 
-      distributions->setDistributionInvForDirection(f[W],   x1+DX1[E],   x2+DX2[E],   x3+DX3[E],     E);
-      distributions->setDistributionInvForDirection(f[NW],  x1+DX1[SE],  x2+DX2[SE],  x3+DX3[SE],   SE);
-      distributions->setDistributionInvForDirection(f[SW],  x1+DX1[NE],  x2+DX2[NE],  x3+DX3[NE],   NE);
-      distributions->setDistributionInvForDirection(f[TW],  x1+DX1[BE],  x2+DX2[BE],  x3+DX3[BE],   BE);
-      distributions->setDistributionInvForDirection(f[BW],  x1+DX1[TE],  x2+DX2[TE],  x3+DX3[TE],   TE);
-      distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
-      distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
-      distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[DIR_M00],   x1+DX1[DIR_P00],   x2+DX2[DIR_P00],   x3+DX3[DIR_P00],     DIR_P00);
+      distributions->setDistributionInvForDirection(f[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
+      distributions->setDistributionInvForDirection(f[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
+      distributions->setDistributionInvForDirection(f[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
+      distributions->setDistributionInvForDirection(f[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
-	  h[W]   = htemp[W]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[W]  ;
-	  h[NW]  = htemp[NW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[NW] ;
-	  h[SW]  = htemp[SW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[SW] ;
-	  h[TW]  = htemp[TW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[TW] ;
-	  h[BW]  = htemp[BW] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[BW] ;
-	  h[TNW] = htemp[TNW]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[TNW];
-	  h[TSW] = htemp[TSW]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[TSW];
-	  h[BNW] = htemp[BNW]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[BNW];
-	  h[BSW] = htemp[BSW]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[BSW];
+	  h[DIR_M00]   = htemp[DIR_M00]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M00]  ;
+	  h[DIR_MP0]  = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MP0] ;
+	  h[DIR_MM0]  = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MM0] ;
+	  h[DIR_M0P]  = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M0P] ;
+	  h[DIR_M0M]  = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M0M] ;
+	  h[DIR_MPP] = htemp[DIR_MPP]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MPP];
+	  h[DIR_MMP] = htemp[DIR_MMP]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MMP];
+	  h[DIR_MPM] = htemp[DIR_MPM]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MPM];
+	  h[DIR_MMM] = htemp[DIR_MMM]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MMM];
 
-	  distributionsH->setDistributionInvForDirection(h[W],   x1+DX1[E],   x2+DX2[E],   x3+DX3[E],     E);
-	  distributionsH->setDistributionInvForDirection(h[NW],  x1+DX1[SE],  x2+DX2[SE],  x3+DX3[SE],   SE);
-	  distributionsH->setDistributionInvForDirection(h[SW],  x1+DX1[NE],  x2+DX2[NE],  x3+DX3[NE],   NE);
-	  distributionsH->setDistributionInvForDirection(h[TW],  x1+DX1[BE],  x2+DX2[BE],  x3+DX3[BE],   BE);
-	  distributionsH->setDistributionInvForDirection(h[BW],  x1+DX1[TE],  x2+DX2[TE],  x3+DX3[TE],   TE);
-	  distributionsH->setDistributionInvForDirection(h[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-	  distributionsH->setDistributionInvForDirection(h[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
-	  distributionsH->setDistributionInvForDirection(h[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
-	  distributionsH->setDistributionInvForDirection(h[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+	  distributionsH->setDistributionInvForDirection(h[DIR_M00],   x1+DX1[DIR_P00],   x2+DX2[DIR_P00],   x3+DX3[DIR_P00],     DIR_P00);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
+	  distributionsH->setDistributionInvForDirection(h[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
       break;
    case N:
       f[N]   = ftemp[N]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[N]   ;
-      f[NE]  = ftemp[NE]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[NE]  ;
-      f[NW]  = ftemp[NW]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[NW]  ;
-      f[TN]  = ftemp[TN]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TN]  ;
-      f[BN]  = ftemp[BN]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BN]  ;
-      f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TNE] ;
-      f[TNW] = ftemp[TNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[TNW] ;
-      f[BNE] = ftemp[BNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BNE] ;
-      f[BNW] = ftemp[BNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[BNW] ;
+      f[DIR_PP0]  = ftemp[DIR_PP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_PP0]  ;
+      f[DIR_MP0]  = ftemp[DIR_MP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_MP0]  ;
+      f[DIR_0PP]  = ftemp[DIR_0PP]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_0PP]  ;
+      f[DIR_0PM]  = ftemp[DIR_0PM]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_0PM]  ;
+      f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_PPP] ;
+      f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_MPP] ;
+      f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_PPM] ;
+      f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_MPM] ;
 
-      distributions->setDistributionInvForDirection(f[N],   x1+DX1[S],   x2+DX2[S],   x3+DX3[S],     S);
-      distributions->setDistributionInvForDirection(f[NE],  x1+DX1[SW],  x2+DX2[SW],  x3+DX3[SW],   SW);
-      distributions->setDistributionInvForDirection(f[NW],  x1+DX1[SE],  x2+DX2[SE],  x3+DX3[SE],   SE);
-      distributions->setDistributionInvForDirection(f[TN],  x1+DX1[BS],  x2+DX2[BS],  x3+DX3[BS],   BS);
-      distributions->setDistributionInvForDirection(f[BN],  x1+DX1[TS],  x2+DX2[TS],  x3+DX3[TS],   TS);
-      distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
+      distributions->setDistributionInvForDirection(f[N],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
+      distributions->setDistributionInvForDirection(f[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],   DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
+      distributions->setDistributionInvForDirection(f[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
+      distributions->setDistributionInvForDirection(f[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
 
 	  h[N]   = htemp[N]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[N]   ;
-	  h[NE]  = htemp[NE]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[NE]  ;
-	  h[NW]  = htemp[NW]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[NW]  ;
-	  h[TN]  = htemp[TN]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[TN]  ;
-	  h[BN]  = htemp[BN]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[BN]  ;
-	  h[TNE] = htemp[TNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[TNE] ;
-	  h[TNW] = htemp[TNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[TNW] ;
-	  h[BNE] = htemp[BNE] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[BNE] ;
-	  h[BNW] = htemp[BNW] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[BNW] ;
+	  h[DIR_PP0]  = htemp[DIR_PP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_PP0]  ;
+	  h[DIR_MP0]  = htemp[DIR_MP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_MP0]  ;
+	  h[DIR_0PP]  = htemp[DIR_0PP]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_0PP]  ;
+	  h[DIR_0PM]  = htemp[DIR_0PM]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_0PM]  ;
+	  h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_PPP] ;
+	  h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_MPP] ;
+	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_PPM] ;
+	  h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_MPM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[N],   x1+DX1[S],   x2+DX2[S],   x3+DX3[S],     S);
-	  distributionsH->setDistributionInvForDirection(h[NE],  x1+DX1[SW],  x2+DX2[SW],  x3+DX3[SW],   SW);
-	  distributionsH->setDistributionInvForDirection(h[NW],  x1+DX1[SE],  x2+DX2[SE],  x3+DX3[SE],   SE);
-	  distributionsH->setDistributionInvForDirection(h[TN],  x1+DX1[BS],  x2+DX2[BS],  x3+DX3[BS],   BS);
-	  distributionsH->setDistributionInvForDirection(h[BN],  x1+DX1[TS],  x2+DX2[TS],  x3+DX3[TS],   TS);
-	  distributionsH->setDistributionInvForDirection(h[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-	  distributionsH->setDistributionInvForDirection(h[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-	  distributionsH->setDistributionInvForDirection(h[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-	  distributionsH->setDistributionInvForDirection(h[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
+	  distributionsH->setDistributionInvForDirection(h[N],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],   DIR_MM0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
 
       break;
-   case S:
-      f[S]   = ftemp[S]   * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[S]   ;
-      f[SE]  = ftemp[SE]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[SE]  ;
-      f[SW]  = ftemp[SW]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[SW]  ;
-      f[TS]  = ftemp[TS]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TS]  ;
-      f[BS]  = ftemp[BS]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BS]  ;
-      f[TSE] = ftemp[TSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TSE] ;
-      f[TSW] = ftemp[TSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[TSW] ;
-      f[BSE] = ftemp[BSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BSE] ;
-      f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[BSW] ;
+   case DIR_0M0:
+      f[DIR_0M0]   = ftemp[DIR_0M0]   * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_0M0]   ;
+      f[DIR_PM0]  = ftemp[DIR_PM0]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_PM0]  ;
+      f[DIR_MM0]  = ftemp[DIR_MM0]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_MM0]  ;
+      f[DIR_0MP]  = ftemp[DIR_0MP]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_0MP]  ;
+      f[DIR_0MM]  = ftemp[DIR_0MM]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_0MM]  ;
+      f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_PMP] ;
+      f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_MMP] ;
+      f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_PMM] ;
+      f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_MMM] ;
 
-      distributions->setDistributionInvForDirection(f[S],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
-      distributions->setDistributionInvForDirection(f[SE],  x1+DX1[NW],  x2+DX2[NW],  x3+DX3[NW],   NW);
-      distributions->setDistributionInvForDirection(f[SW],  x1+DX1[NE],  x2+DX2[NE],  x3+DX3[NE],   NE);
-      distributions->setDistributionInvForDirection(f[TS],  x1+DX1[BN],  x2+DX2[BN],  x3+DX3[BN],   BN);
-      distributions->setDistributionInvForDirection(f[BS],  x1+DX1[TN],  x2+DX2[TN],  x3+DX3[TN],   TN);
-      distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
-      distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
-      distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[DIR_0M0],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
+      distributions->setDistributionInvForDirection(f[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
+      distributions->setDistributionInvForDirection(f[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
+      distributions->setDistributionInvForDirection(f[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
+      distributions->setDistributionInvForDirection(f[DIR_0MM],  x1+DX1[DIR_0PP],  x2+DX2[DIR_0PP],  x3+DX3[DIR_0PP],   DIR_0PP);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
-	  h[S]   = htemp[S]   * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[S]   ;
-	  h[SE]  = htemp[SE]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[SE]  ;
-	  h[SW]  = htemp[SW]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[SW]  ;
-	  h[TS]  = htemp[TS]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[TS]  ;
-	  h[BS]  = htemp[BS]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[BS]  ;
-	  h[TSE] = htemp[TSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[TSE] ;
-	  h[TSW] = htemp[TSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[TSW] ;
-	  h[BSE] = htemp[BSE] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[BSE] ;
-	  h[BSW] = htemp[BSW] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[BSW] ;
+	  h[DIR_0M0]   = htemp[DIR_0M0]   * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_0M0]   ;
+	  h[DIR_PM0]  = htemp[DIR_PM0]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_PM0]  ;
+	  h[DIR_MM0]  = htemp[DIR_MM0]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_MM0]  ;
+	  h[DIR_0MP]  = htemp[DIR_0MP]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_0MP]  ;
+	  h[DIR_0MM]  = htemp[DIR_0MM]  * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_0MM]  ;
+	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_PMP] ;
+	  h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_MMP] ;
+	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_PMM] ;
+	  h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_MMM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[S],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
-	  distributionsH->setDistributionInvForDirection(h[SE],  x1+DX1[NW],  x2+DX2[NW],  x3+DX3[NW],   NW);
-	  distributionsH->setDistributionInvForDirection(h[SW],  x1+DX1[NE],  x2+DX2[NE],  x3+DX3[NE],   NE);
-	  distributionsH->setDistributionInvForDirection(h[TS],  x1+DX1[BN],  x2+DX2[BN],  x3+DX3[BN],   BN);
-	  distributionsH->setDistributionInvForDirection(h[BS],  x1+DX1[TN],  x2+DX2[TN],  x3+DX3[TN],   TN);
-	  distributionsH->setDistributionInvForDirection(h[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-	  distributionsH->setDistributionInvForDirection(h[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
-	  distributionsH->setDistributionInvForDirection(h[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
-	  distributionsH->setDistributionInvForDirection(h[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0M0],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0MM],  x1+DX1[DIR_0PP],  x2+DX2[DIR_0PP],  x3+DX3[DIR_0PP],   DIR_0PP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
       break;
-   case T:
-      f[T]   = ftemp[T]   * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[T]   ;
-      f[TE]  = ftemp[TE]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TE]  ;
-      f[TW]  = ftemp[TW]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TW]  ;
-      f[TN]  = ftemp[TN]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TN]  ;
-      f[TS]  = ftemp[TS]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TS]  ;
-      f[TNE] = ftemp[TNE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TNE] ;
-      f[TNW] = ftemp[TNW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TNW] ;
-      f[TSE] = ftemp[TSE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TSE] ;
-      f[TSW] = ftemp[TSW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[TSW] ;
+   case DIR_00P:
+      f[DIR_00P]   = ftemp[DIR_00P]   * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_00P]   ;
+      f[DIR_P0P]  = ftemp[DIR_P0P]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_P0P]  ;
+      f[DIR_M0P]  = ftemp[DIR_M0P]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_M0P]  ;
+      f[DIR_0PP]  = ftemp[DIR_0PP]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_0PP]  ;
+      f[DIR_0MP]  = ftemp[DIR_0MP]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_0MP]  ;
+      f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_PPP] ;
+      f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_MPP] ;
+      f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_PMP] ;
+      f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_MMP] ;
 
-      distributions->setDistributionInvForDirection(f[T],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
-      distributions->setDistributionInvForDirection(f[TE],  x1+DX1[BW],  x2+DX2[BW],  x3+DX3[BW],   BW);
-      distributions->setDistributionInvForDirection(f[TW],  x1+DX1[BE],  x2+DX2[BE],  x3+DX3[BE],   BE);
-      distributions->setDistributionInvForDirection(f[TN],  x1+DX1[BS],  x2+DX2[BS],  x3+DX3[BS],   BS);
-      distributions->setDistributionInvForDirection(f[TS],  x1+DX1[BN],  x2+DX2[BN],  x3+DX3[BN],   BN);
-      distributions->setDistributionInvForDirection(f[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
+      distributions->setDistributionInvForDirection(f[DIR_00P],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
+      distributions->setDistributionInvForDirection(f[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
+      distributions->setDistributionInvForDirection(f[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
+      distributions->setDistributionInvForDirection(f[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
+      distributions->setDistributionInvForDirection(f[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
 
-	  h[T]   = htemp[T]   * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[T]   ;
-	  h[TE]  = htemp[TE]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TE]  ;
-	  h[TW]  = htemp[TW]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TW]  ;
-	  h[TN]  = htemp[TN]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TN]  ;
-	  h[TS]  = htemp[TS]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TS]  ;
-	  h[TNE] = htemp[TNE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TNE] ;
-	  h[TNW] = htemp[TNW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TNW] ;
-	  h[TSE] = htemp[TSE] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TSE] ;
-	  h[TSW] = htemp[TSW] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[TSW] ;
+	  h[DIR_00P]   = htemp[DIR_00P]   * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_00P]   ;
+	  h[DIR_P0P]  = htemp[DIR_P0P]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_P0P]  ;
+	  h[DIR_M0P]  = htemp[DIR_M0P]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_M0P]  ;
+	  h[DIR_0PP]  = htemp[DIR_0PP]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_0PP]  ;
+	  h[DIR_0MP]  = htemp[DIR_0MP]  * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_0MP]  ;
+	  h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_PPP] ;
+	  h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_MPP] ;
+	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_PMP] ;
+	  h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_MMP] ;
 
-	  distributionsH->setDistributionInvForDirection(h[T],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
-	  distributionsH->setDistributionInvForDirection(h[TE],  x1+DX1[BW],  x2+DX2[BW],  x3+DX3[BW],   BW);
-	  distributionsH->setDistributionInvForDirection(h[TW],  x1+DX1[BE],  x2+DX2[BE],  x3+DX3[BE],   BE);
-	  distributionsH->setDistributionInvForDirection(h[TN],  x1+DX1[BS],  x2+DX2[BS],  x3+DX3[BS],   BS);
-	  distributionsH->setDistributionInvForDirection(h[TS],  x1+DX1[BN],  x2+DX2[BN],  x3+DX3[BN],   BN);
-	  distributionsH->setDistributionInvForDirection(h[TNE], x1+DX1[BSW], x2+DX2[BSW], x3+DX3[BSW], BSW);
-	  distributionsH->setDistributionInvForDirection(h[TNW], x1+DX1[BSE], x2+DX2[BSE], x3+DX3[BSE], BSE);
-	  distributionsH->setDistributionInvForDirection(h[TSE], x1+DX1[BNW], x2+DX2[BNW], x3+DX3[BNW], BNW);
-	  distributionsH->setDistributionInvForDirection(h[TSW], x1+DX1[BNE], x2+DX2[BNE], x3+DX3[BNE], BNE);
+	  distributionsH->setDistributionInvForDirection(h[DIR_00P],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
+	  distributionsH->setDistributionInvForDirection(h[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
+	  distributionsH->setDistributionInvForDirection(h[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
 
       break;
    case B:
       f[B]   = ftemp[B]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[B]   ;
-      f[BE]  = ftemp[BE]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BE]  ;
-      f[BW]  = ftemp[BW]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BW]  ;
-      f[BN]  = ftemp[BN]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BN]  ;
-      f[BS]  = ftemp[BS]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BS]  ;
-      f[BNE] = ftemp[BNE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BNE] ;
-      f[BNW] = ftemp[BNW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BNW] ;
-      f[BSE] = ftemp[BSE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BSE] ;
-      f[BSW] = ftemp[BSW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[BSW] ;
+      f[DIR_P0M]  = ftemp[DIR_P0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_P0M]  ;
+      f[DIR_M0M]  = ftemp[DIR_M0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_M0M]  ;
+      f[DIR_0PM]  = ftemp[DIR_0PM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_0PM]  ;
+      f[DIR_0MM]  = ftemp[DIR_0MM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_0MM]  ;
+      f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_PPM] ;
+      f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_MPM] ;
+      f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_PMM] ;
+      f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_MMM] ;
 
-      distributions->setDistributionInvForDirection(f[B],   x1+DX1[T],   x2+DX2[T],   x3+DX3[T],     T);
-      distributions->setDistributionInvForDirection(f[BE],  x1+DX1[TW],  x2+DX2[TW],  x3+DX3[TW],   TW);
-      distributions->setDistributionInvForDirection(f[BW],  x1+DX1[TE],  x2+DX2[TE],  x3+DX3[TE],   TE);
-      distributions->setDistributionInvForDirection(f[BN],  x1+DX1[TS],  x2+DX2[TS],  x3+DX3[TS],   TS);
-      distributions->setDistributionInvForDirection(f[BS],  x1+DX1[TN],  x2+DX2[TN],  x3+DX3[TN],   TN);
-      distributions->setDistributionInvForDirection(f[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
-      distributions->setDistributionInvForDirection(f[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
-      distributions->setDistributionInvForDirection(f[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[B],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
+      distributions->setDistributionInvForDirection(f[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],   DIR_M0P);
+      distributions->setDistributionInvForDirection(f[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
+      distributions->setDistributionInvForDirection(f[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
+      distributions->setDistributionInvForDirection(f[DIR_0MM],  x1+DX1[DIR_0PP],  x2+DX2[DIR_0PP],  x3+DX3[DIR_0PP],   DIR_0PP);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
 	  h[B]   = htemp[B]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[B]   ;
-	  h[BE]  = htemp[BE]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BE]  ;
-	  h[BW]  = htemp[BW]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BW]  ;
-	  h[BN]  = htemp[BN]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BN]  ;
-	  h[BS]  = htemp[BS]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BS]  ;
-	  h[BNE] = htemp[BNE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BNE] ;
-	  h[BNW] = htemp[BNW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BNW] ;
-	  h[BSE] = htemp[BSE] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BSE] ;
-	  h[BSW] = htemp[BSW] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[BSW] ;
+	  h[DIR_P0M]  = htemp[DIR_P0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_P0M]  ;
+	  h[DIR_M0M]  = htemp[DIR_M0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_M0M]  ;
+	  h[DIR_0PM]  = htemp[DIR_0PM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_0PM]  ;
+	  h[DIR_0MM]  = htemp[DIR_0MM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_0MM]  ;
+	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_PPM] ;
+	  h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_MPM] ;
+	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_PMM] ;
+	  h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_MMM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[B],   x1+DX1[T],   x2+DX2[T],   x3+DX3[T],     T);
-	  distributionsH->setDistributionInvForDirection(h[BE],  x1+DX1[TW],  x2+DX2[TW],  x3+DX3[TW],   TW);
-	  distributionsH->setDistributionInvForDirection(h[BW],  x1+DX1[TE],  x2+DX2[TE],  x3+DX3[TE],   TE);
-	  distributionsH->setDistributionInvForDirection(h[BN],  x1+DX1[TS],  x2+DX2[TS],  x3+DX3[TS],   TS);
-	  distributionsH->setDistributionInvForDirection(h[BS],  x1+DX1[TN],  x2+DX2[TN],  x3+DX3[TN],   TN);
-	  distributionsH->setDistributionInvForDirection(h[BNE], x1+DX1[TSW], x2+DX2[TSW], x3+DX3[TSW], TSW);
-	  distributionsH->setDistributionInvForDirection(h[BNW], x1+DX1[TSE], x2+DX2[TSE], x3+DX3[TSE], TSE);
-	  distributionsH->setDistributionInvForDirection(h[BSE], x1+DX1[TNW], x2+DX2[TNW], x3+DX3[TNW], TNW);
-	  distributionsH->setDistributionInvForDirection(h[BSW], x1+DX1[TNE], x2+DX2[TNE], x3+DX3[TNE], TNE);
+	  distributionsH->setDistributionInvForDirection(h[B],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],   DIR_M0P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0MM],  x1+DX1[DIR_0PP],  x2+DX2[DIR_0PP],  x3+DX3[DIR_0PP],   DIR_0PP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
+	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
       break;
    default:
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
index 483cf3db8..230a543f1 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp
@@ -102,32 +102,32 @@ void MultiphaseSlipBCAlgorithm::applyBC()
          LBMReal velocity = 0.0;
          switch (invDir)
          {
-         case D3Q27System::E: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
-         case D3Q27System::W: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
-         case D3Q27System::N: velocity = (UbMath::c4o9*(+vx2)); break;
-         case D3Q27System::S: velocity = (UbMath::c4o9*(-vx2)); break;
-         case D3Q27System::T: velocity = (UbMath::c4o9*(+vx3)); break;
-         case D3Q27System::B: velocity = (UbMath::c4o9*(-vx3)); break;
-         case D3Q27System::NE: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
-         case D3Q27System::SW: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
-         case D3Q27System::SE: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
-         case D3Q27System::NW: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
-         case D3Q27System::TE: velocity = (UbMath::c1o9*(+vx1             +vx3)); break;
-         case D3Q27System::BW: velocity = (UbMath::c1o9*(-vx1             -vx3)); break;
-         case D3Q27System::BE: velocity = (UbMath::c1o9*(+vx1             -vx3)); break;
-         case D3Q27System::TW: velocity = (UbMath::c1o9*(-vx1             +vx3)); break;
-         case D3Q27System::TN: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
-         case D3Q27System::BS: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
-         case D3Q27System::BN: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
-         case D3Q27System::TS: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
-         case D3Q27System::TNE: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
-         case D3Q27System::BSW: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
-         case D3Q27System::BNE: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
-         case D3Q27System::TSW: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
-         case D3Q27System::TSE: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
-         case D3Q27System::BNW: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
-         case D3Q27System::BSE: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
-         case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_P00: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
+         case D3Q27System::DIR_M00: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
+         case D3Q27System::DIR_0P0: velocity = (UbMath::c4o9*(+vx2)); break;
+         case D3Q27System::DIR_0M0: velocity = (UbMath::c4o9*(-vx2)); break;
+         case D3Q27System::DIR_00P: velocity = (UbMath::c4o9*(+vx3)); break;
+         case D3Q27System::DIR_00M: velocity = (UbMath::c4o9*(-vx3)); break;
+         case D3Q27System::DIR_PP0: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
+         case D3Q27System::DIR_MM0: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
+         case D3Q27System::DIR_PM0: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
+         case D3Q27System::DIR_MP0: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
+         case D3Q27System::DIR_P0P: velocity = (UbMath::c1o9*(+vx1             +vx3)); break;
+         case D3Q27System::DIR_M0M: velocity = (UbMath::c1o9*(-vx1             -vx3)); break;
+         case D3Q27System::DIR_P0M: velocity = (UbMath::c1o9*(+vx1             -vx3)); break;
+         case D3Q27System::DIR_M0P: velocity = (UbMath::c1o9*(-vx1             +vx3)); break;
+         case D3Q27System::DIR_0PP: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
+         case D3Q27System::DIR_0MM: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
+         case D3Q27System::DIR_0PM: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
+         case D3Q27System::DIR_0MP: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
+         case D3Q27System::DIR_PPP: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_MMM: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_PPM: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_MMP: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_PMP: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_MPM: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_PMM: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_MPP: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
          default: throw UbException(UB_EXARGS, "unknown error");
          }
          LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
index 70b0cceff..d43d1c534 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
@@ -94,12 +94,12 @@ void MultiphaseVelocityBCAlgorithm::applyBC()
    int nx3 = x3;
 
    //flag points in direction of fluid
-   if      (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
+   if      (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_P00)) { nx1 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_M00)) { nx1 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0P0)) { nx2 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0M0)) { nx2 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00P)) { nx3 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00M)) { nx3 += 1; }
    //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
    
    phiBC = bcPtr->getBoundaryPhaseField();
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp
index 9c4e47354..cf7a627b0 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp
@@ -63,17 +63,17 @@ void NonEqDensityBCAlgorithm::applyBC()
     int nx3 = x3;
 
     // flag points in direction of fluid
-    if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) {
+    if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_P00)) {
         nx1 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_M00)) {
         nx1 += 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0P0)) {
         nx2 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0M0)) {
         nx2 += 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00P)) {
         nx3 -= 1;
-    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) {
+    } else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00M)) {
         nx3 += 1;
     } else
         return; // UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
index bb00c7bf2..f92357cdb 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
@@ -98,130 +98,130 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
 
     switch (direction) {
         case E:
-            f[E]   = ftemp[E] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[E];
+            f[DIR_P00]   = ftemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P00];
             f[NE]  = ftemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[NE];
-            f[SE]  = ftemp[SE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[SE];
-            f[TE]  = ftemp[TE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TE];
-            f[BE]  = ftemp[BE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BE];
-            f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TNE];
-            f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TSE];
-            f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BNE];
-            f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BSE];
+            f[DIR_PM0]  = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PM0];
+            f[DIR_P0P]  = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0P];
+            f[DIR_P0M]  = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0M];
+            f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPP];
+            f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMP];
+            f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPM];
+            f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMM];
 
-            distributions->setDistributionInvForDirection(f[E], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-            distributions->setDistributionInvForDirection(f[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-            distributions->setDistributionInvForDirection(f[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-            distributions->setDistributionInvForDirection(f[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-            distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-            distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-            distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-            distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
+            distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
+            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+            distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+            distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+            distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+            distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+            distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+            distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+            distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
             break;
         case W:
             f[W]   = ftemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[W];
-            f[NW]  = ftemp[NW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[NW];
-            f[SW]  = ftemp[SW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[SW];
-            f[TW]  = ftemp[TW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TW];
-            f[BW]  = ftemp[BW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BW];
-            f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TNW];
-            f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TSW];
-            f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BNW];
-            f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BSW];
+            f[DIR_MP0]  = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MP0];
+            f[DIR_MM0]  = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MM0];
+            f[DIR_M0P]  = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0P];
+            f[DIR_M0M]  = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0M];
+            f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPP];
+            f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMP];
+            f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPM];
+            f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMM];
 
-            distributions->setDistributionInvForDirection(f[W], x1 + DX1[E], x2 + DX2[E], x3 + DX3[E], E);
-            distributions->setDistributionInvForDirection(f[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-            distributions->setDistributionInvForDirection(f[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-            distributions->setDistributionInvForDirection(f[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-            distributions->setDistributionInvForDirection(f[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-            distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-            distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-            distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-            distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+            distributions->setDistributionInvForDirection(f[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+            distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+            distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+            distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+            distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+            distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+            distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+            distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
             break;
         case N:
             f[N]   = ftemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[N];
             f[NE]  = ftemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NE];
-            f[NW]  = ftemp[NW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NW];
-            f[TN]  = ftemp[TN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TN];
-            f[BN]  = ftemp[BN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BN];
-            f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TNE];
-            f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TNW];
-            f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BNE];
-            f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BNW];
+            f[DIR_MP0]  = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MP0];
+            f[DIR_0PP]  = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PP];
+            f[DIR_0PM]  = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PM];
+            f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPP];
+            f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPP];
+            f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPM];
+            f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPM];
 
             distributions->setDistributionInvForDirection(f[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-            distributions->setDistributionInvForDirection(f[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-            distributions->setDistributionInvForDirection(f[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-            distributions->setDistributionInvForDirection(f[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-            distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-            distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-            distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-            distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
+            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+            distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+            distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+            distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+            distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+            distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+            distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+            distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
             break;
         case S:
             f[S]   = ftemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[S];
-            f[SE]  = ftemp[SE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[SE];
-            f[SW]  = ftemp[SW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[SW];
-            f[TS]  = ftemp[TS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TS];
-            f[BS]  = ftemp[BS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BS];
-            f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TSE];
-            f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TSW];
-            f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BSE];
-            f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BSW];
+            f[DIR_PM0]  = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PM0];
+            f[DIR_MM0]  = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MM0];
+            f[DIR_0MP]  = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MP];
+            f[DIR_0MM]  = ftemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MM];
+            f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMP];
+            f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMP];
+            f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMM];
+            f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMM];
 
             distributions->setDistributionInvForDirection(f[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
-            distributions->setDistributionInvForDirection(f[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-            distributions->setDistributionInvForDirection(f[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-            distributions->setDistributionInvForDirection(f[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-            distributions->setDistributionInvForDirection(f[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-            distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-            distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-            distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-            distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+            distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+            distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+            distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+            distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+            distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+            distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+            distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
             break;
         case T:
             f[T]   = ftemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[T];
-            f[TE]  = ftemp[TE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TE];
-            f[TW]  = ftemp[TW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TW];
-            f[TN]  = ftemp[TN] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TN];
-            f[TS]  = ftemp[TS] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TS];
-            f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TNE];
-            f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TNW];
-            f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TSE];
-            f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TSW];
+            f[DIR_P0P]  = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_P0P];
+            f[DIR_M0P]  = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_M0P];
+            f[DIR_0PP]  = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0PP];
+            f[DIR_0MP]  = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0MP];
+            f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PPP];
+            f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MPP];
+            f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PMP];
+            f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MMP];
 
             distributions->setDistributionInvForDirection(f[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
-            distributions->setDistributionInvForDirection(f[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-            distributions->setDistributionInvForDirection(f[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-            distributions->setDistributionInvForDirection(f[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-            distributions->setDistributionInvForDirection(f[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-            distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-            distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-            distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-            distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
+            distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+            distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+            distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+            distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+            distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+            distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+            distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+            distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
             break;
         case B:
             f[B]   = ftemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[B];
-            f[BE]  = ftemp[BE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BE];
-            f[BW]  = ftemp[BW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BW];
-            f[BN]  = ftemp[BN] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BN];
-            f[BS]  = ftemp[BS] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BS];
-            f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BNE];
-            f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BNW];
-            f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BSE];
-            f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BSW];
+            f[DIR_P0M]  = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_P0M];
+            f[DIR_M0M]  = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_M0M];
+            f[DIR_0PM]  = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0PM];
+            f[DIR_0MM]  = ftemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0MM];
+            f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PPM];
+            f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MPM];
+            f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PMM];
+            f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MMM];
 
             distributions->setDistributionInvForDirection(f[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
-            distributions->setDistributionInvForDirection(f[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-            distributions->setDistributionInvForDirection(f[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-            distributions->setDistributionInvForDirection(f[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-            distributions->setDistributionInvForDirection(f[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-            distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-            distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-            distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-            distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+            distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+            distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+            distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+            distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+            distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+            distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+            distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+            distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
             break;
         default:
             UB_THROW(
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
index c22d843f0..151e10be4 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp
@@ -83,32 +83,32 @@ void SimpleSlipBCAlgorithm::applyBC()
          LBMReal velocity = 0.0;
          switch (invDir)
          {
-         case D3Q27System::E: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
-         case D3Q27System::W: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
-         case D3Q27System::N: velocity = (UbMath::c4o9*(+vx2)); break;
-         case D3Q27System::S: velocity = (UbMath::c4o9*(-vx2)); break;
-         case D3Q27System::T: velocity = (UbMath::c4o9*(+vx3)); break;
-         case D3Q27System::B: velocity = (UbMath::c4o9*(-vx3)); break;
-         case D3Q27System::NE: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
-         case D3Q27System::SW: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
-         case D3Q27System::SE: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
-         case D3Q27System::NW: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
-         case D3Q27System::TE: velocity = (UbMath::c1o9*(+vx1+vx3)); break;
-         case D3Q27System::BW: velocity = (UbMath::c1o9*(-vx1-vx3)); break;
-         case D3Q27System::BE: velocity = (UbMath::c1o9*(+vx1-vx3)); break;
-         case D3Q27System::TW: velocity = (UbMath::c1o9*(-vx1+vx3)); break;
-         case D3Q27System::TN: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
-         case D3Q27System::BS: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
-         case D3Q27System::BN: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
-         case D3Q27System::TS: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
-         case D3Q27System::TNE: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
-         case D3Q27System::BSW: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
-         case D3Q27System::BNE: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
-         case D3Q27System::TSW: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
-         case D3Q27System::TSE: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
-         case D3Q27System::BNW: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
-         case D3Q27System::BSE: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
-         case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_P00: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
+         case D3Q27System::DIR_M00: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
+         case D3Q27System::DIR_0P0: velocity = (UbMath::c4o9*(+vx2)); break;
+         case D3Q27System::DIR_0M0: velocity = (UbMath::c4o9*(-vx2)); break;
+         case D3Q27System::DIR_00P: velocity = (UbMath::c4o9*(+vx3)); break;
+         case D3Q27System::DIR_00M: velocity = (UbMath::c4o9*(-vx3)); break;
+         case D3Q27System::DIR_PP0: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
+         case D3Q27System::DIR_MM0: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
+         case D3Q27System::DIR_PM0: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
+         case D3Q27System::DIR_MP0: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
+         case D3Q27System::DIR_P0P: velocity = (UbMath::c1o9*(+vx1+vx3)); break;
+         case D3Q27System::DIR_M0M: velocity = (UbMath::c1o9*(-vx1-vx3)); break;
+         case D3Q27System::DIR_P0M: velocity = (UbMath::c1o9*(+vx1-vx3)); break;
+         case D3Q27System::DIR_M0P: velocity = (UbMath::c1o9*(-vx1+vx3)); break;
+         case D3Q27System::DIR_0PP: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
+         case D3Q27System::DIR_0MM: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
+         case D3Q27System::DIR_0PM: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
+         case D3Q27System::DIR_0MP: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
+         case D3Q27System::DIR_PPP: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_MMM: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_PPM: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_MMP: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_PMP: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_MPM: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_PMM: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_MPP: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
          default: throw UbException(UB_EXARGS, "unknown error");
          }
          LBMReal fReturn = f[invDir] - velocity * rho;
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
index 8bdc284d6..0dc2d5d66 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
@@ -56,17 +56,17 @@ void SlipBCAdapter::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryCond
     if (!geo)
         throw UbException(UB_EXARGS, "derzeit nur fuer Cubes valide");
 
-    if (bc->hasSlipBoundaryFlag(D3Q27System::E))
+    if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_P00))
         bc->setNormalVector(1.0, 0.0, 0.0);
-    else if (bc->hasSlipBoundaryFlag(D3Q27System::W))
+    else if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_M00))
         bc->setNormalVector(-1.0, 0.0, 0.0);
-    else if (bc->hasSlipBoundaryFlag(D3Q27System::N))
+    else if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_0P0))
         bc->setNormalVector(0.0, 1.0, 0.0);
-    else if (bc->hasSlipBoundaryFlag(D3Q27System::S))
+    else if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_0M0))
         bc->setNormalVector(0.0, -1.0, 0.0);
-    else if (bc->hasSlipBoundaryFlag(D3Q27System::T))
+    else if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_00P))
         bc->setNormalVector(0.0, 0.0, 1.0);
-    else if (bc->hasSlipBoundaryFlag(D3Q27System::B))
+    else if (bc->hasSlipBoundaryFlag(D3Q27System::DIR_00M))
         bc->setNormalVector(0.0, 0.0, -1.0);
 
     bc->setBcAlgorithmType(algorithmType);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp
index 825d2bc01..5d9993c45 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp
@@ -47,32 +47,32 @@ void SlipBCAlgorithm::applyBC()
          LBMReal velocity = 0.0;
          switch (invDir)
          {
-         case D3Q27System::E: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
-         case D3Q27System::W: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
-         case D3Q27System::N: velocity = (UbMath::c4o9*(+vx2)); break;
-         case D3Q27System::S: velocity = (UbMath::c4o9*(-vx2)); break;
-         case D3Q27System::T: velocity = (UbMath::c4o9*(+vx3)); break;
-         case D3Q27System::B: velocity = (UbMath::c4o9*(-vx3)); break;
-         case D3Q27System::NE: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
-         case D3Q27System::SW: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
-         case D3Q27System::SE: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
-         case D3Q27System::NW: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
-         case D3Q27System::TE: velocity = (UbMath::c1o9*(+vx1+vx3)); break;
-         case D3Q27System::BW: velocity = (UbMath::c1o9*(-vx1-vx3)); break;
-         case D3Q27System::BE: velocity = (UbMath::c1o9*(+vx1-vx3)); break;
-         case D3Q27System::TW: velocity = (UbMath::c1o9*(-vx1+vx3)); break;
-         case D3Q27System::TN: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
-         case D3Q27System::BS: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
-         case D3Q27System::BN: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
-         case D3Q27System::TS: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
-         case D3Q27System::TNE: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
-         case D3Q27System::BSW: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
-         case D3Q27System::BNE: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
-         case D3Q27System::TSW: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
-         case D3Q27System::TSE: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
-         case D3Q27System::BNW: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
-         case D3Q27System::BSE: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
-         case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_P00: velocity = (UbMath::c4o9*(+vx1)); break;      //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3)
+         case D3Q27System::DIR_M00: velocity = (UbMath::c4o9*(-vx1)); break;      //z.B. aus paper manfred MRT LB models in three dimensions (2002)   
+         case D3Q27System::DIR_0P0: velocity = (UbMath::c4o9*(+vx2)); break;
+         case D3Q27System::DIR_0M0: velocity = (UbMath::c4o9*(-vx2)); break;
+         case D3Q27System::DIR_00P: velocity = (UbMath::c4o9*(+vx3)); break;
+         case D3Q27System::DIR_00M: velocity = (UbMath::c4o9*(-vx3)); break;
+         case D3Q27System::DIR_PP0: velocity = (UbMath::c1o9*(+vx1+vx2)); break;
+         case D3Q27System::DIR_MM0: velocity = (UbMath::c1o9*(-vx1-vx2)); break;
+         case D3Q27System::DIR_PM0: velocity = (UbMath::c1o9*(+vx1-vx2)); break;
+         case D3Q27System::DIR_MP0: velocity = (UbMath::c1o9*(-vx1+vx2)); break;
+         case D3Q27System::DIR_P0P: velocity = (UbMath::c1o9*(+vx1+vx3)); break;
+         case D3Q27System::DIR_M0M: velocity = (UbMath::c1o9*(-vx1-vx3)); break;
+         case D3Q27System::DIR_P0M: velocity = (UbMath::c1o9*(+vx1-vx3)); break;
+         case D3Q27System::DIR_M0P: velocity = (UbMath::c1o9*(-vx1+vx3)); break;
+         case D3Q27System::DIR_0PP: velocity = (UbMath::c1o9*(+vx2+vx3)); break;
+         case D3Q27System::DIR_0MM: velocity = (UbMath::c1o9*(-vx2-vx3)); break;
+         case D3Q27System::DIR_0PM: velocity = (UbMath::c1o9*(+vx2-vx3)); break;
+         case D3Q27System::DIR_0MP: velocity = (UbMath::c1o9*(-vx2+vx3)); break;
+         case D3Q27System::DIR_PPP: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break;
+         case D3Q27System::DIR_MMM: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_PPM: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_MMP: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_PMP: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break;
+         case D3Q27System::DIR_MPM: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break;
+         case D3Q27System::DIR_PMM: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break;
+         case D3Q27System::DIR_MPP: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break;
          default: throw UbException(UB_EXARGS, "unknown error");
          }
          LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp
index ecfb98e67..bec8e139e 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp
@@ -95,12 +95,12 @@ void ThixotropyDensityBCAlgorithm::applyBC()
 	int nx3 = x3;
 
 	//flag points in direction of fluid
-	if (bcPtr->hasDensityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; }
-	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::W)) { nx1 += 1; }
-	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; }
-	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
-	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
-	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
+	if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_P00)) { nx1 -= 1; }
+	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_M00)) { nx1 += 1; }
+	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0P0)) { nx2 -= 1; }
+	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_0M0)) { nx2 += 1; }
+	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00P)) { nx3 -= 1; }
+	else if (bcPtr->hasDensityBoundaryFlag(D3Q27System::DIR_00M)) { nx3 += 1; }
 	else	 UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
 
 	LBMReal rhoBC = bcPtr->getBoundaryDensity();
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
index 2750e606a..27d9bd363 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
@@ -96,130 +96,130 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
    switch (direction)
    {
    case E:
-      f[E] = ftemp[E] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[E];
+      f[DIR_P00] = ftemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P00];
       f[NE] = ftemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[NE];
-      f[SE] = ftemp[SE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[SE];
-      f[TE] = ftemp[TE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TE];
-      f[BE] = ftemp[BE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BE];
-      f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TNE];
-      f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[TSE];
-      f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BNE];
-      f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[BSE];
+      f[DIR_PM0] = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PM0];
+      f[DIR_P0P] = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0P];
+      f[DIR_P0M] = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0M];
+      f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPP];
+      f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMP];
+      f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPM];
+      f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMM];
 
-      distributions->setDistributionInvForDirection(f[E], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-      distributions->setDistributionInvForDirection(f[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-      distributions->setDistributionInvForDirection(f[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-      distributions->setDistributionInvForDirection(f[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-      distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
+      distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
+      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       break;
    case W:
       f[W] = ftemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[W];
-      f[NW] = ftemp[NW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[NW];
-      f[SW] = ftemp[SW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[SW];
-      f[TW] = ftemp[TW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TW];
-      f[BW] = ftemp[BW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BW];
-      f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TNW];
-      f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[TSW];
-      f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BNW];
-      f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[BSW];
+      f[DIR_MP0] = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MP0];
+      f[DIR_MM0] = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MM0];
+      f[DIR_M0P] = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0P];
+      f[DIR_M0M] = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0M];
+      f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPP];
+      f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMP];
+      f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPM];
+      f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMM];
 
-      distributions->setDistributionInvForDirection(f[W], x1 + DX1[E], x2 + DX2[E], x3 + DX3[E], E);
-      distributions->setDistributionInvForDirection(f[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-      distributions->setDistributionInvForDirection(f[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-      distributions->setDistributionInvForDirection(f[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-      distributions->setDistributionInvForDirection(f[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-      distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-      distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-      distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+      distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+      distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    case N:
       f[N] = ftemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[N];
       f[NE] = ftemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NE];
-      f[NW] = ftemp[NW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NW];
-      f[TN] = ftemp[TN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TN];
-      f[BN] = ftemp[BN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BN];
-      f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TNE];
-      f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[TNW];
-      f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BNE];
-      f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[BNW];
+      f[DIR_MP0] = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MP0];
+      f[DIR_0PP] = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PP];
+      f[DIR_0PM] = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PM];
+      f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPP];
+      f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPP];
+      f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPM];
+      f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPM];
 
       distributions->setDistributionInvForDirection(f[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-      distributions->setDistributionInvForDirection(f[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-      distributions->setDistributionInvForDirection(f[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-      distributions->setDistributionInvForDirection(f[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-      distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
+      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+      distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       break;
    case S:
       f[S] = ftemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[S];
-      f[SE] = ftemp[SE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[SE];
-      f[SW] = ftemp[SW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[SW];
-      f[TS] = ftemp[TS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TS];
-      f[BS] = ftemp[BS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BS];
-      f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TSE];
-      f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[TSW];
-      f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BSE];
-      f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[BSW];
+      f[DIR_PM0] = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PM0];
+      f[DIR_MM0] = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MM0];
+      f[DIR_0MP] = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MP];
+      f[DIR_0MM] = ftemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MM];
+      f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMP];
+      f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMP];
+      f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMM];
+      f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMM];
 
       distributions->setDistributionInvForDirection(f[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
-      distributions->setDistributionInvForDirection(f[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-      distributions->setDistributionInvForDirection(f[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-      distributions->setDistributionInvForDirection(f[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-      distributions->setDistributionInvForDirection(f[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-      distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-      distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-      distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    case T:
       f[T] = ftemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[T];
-      f[TE] = ftemp[TE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TE];
-      f[TW] = ftemp[TW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TW];
-      f[TN] = ftemp[TN] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TN];
-      f[TS] = ftemp[TS] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TS];
-      f[TNE] = ftemp[TNE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TNE];
-      f[TNW] = ftemp[TNW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TNW];
-      f[TSE] = ftemp[TSE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TSE];
-      f[TSW] = ftemp[TSW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[TSW];
+      f[DIR_P0P] = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_P0P];
+      f[DIR_M0P] = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_M0P];
+      f[DIR_0PP] = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0PP];
+      f[DIR_0MP] = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0MP];
+      f[DIR_PPP] = ftemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PPP];
+      f[DIR_MPP] = ftemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MPP];
+      f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PMP];
+      f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MMP];
 
       distributions->setDistributionInvForDirection(f[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
-      distributions->setDistributionInvForDirection(f[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-      distributions->setDistributionInvForDirection(f[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-      distributions->setDistributionInvForDirection(f[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-      distributions->setDistributionInvForDirection(f[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-      distributions->setDistributionInvForDirection(f[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributions->setDistributionInvForDirection(f[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributions->setDistributionInvForDirection(f[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributions->setDistributionInvForDirection(f[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
+      distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+      distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributions->setDistributionInvForDirection(f[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
       break;
    case B:
       f[B] = ftemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[B];
-      f[BE] = ftemp[BE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BE];
-      f[BW] = ftemp[BW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BW];
-      f[BN] = ftemp[BN] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BN];
-      f[BS] = ftemp[BS] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BS];
-      f[BNE] = ftemp[BNE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BNE];
-      f[BNW] = ftemp[BNW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BNW];
-      f[BSE] = ftemp[BSE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BSE];
-      f[BSW] = ftemp[BSW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[BSW];
+      f[DIR_P0M] = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_P0M];
+      f[DIR_M0M] = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_M0M];
+      f[DIR_0PM] = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0PM];
+      f[DIR_0MM] = ftemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0MM];
+      f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PPM];
+      f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MPM];
+      f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PMM];
+      f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MMM];
 
       distributions->setDistributionInvForDirection(f[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
-      distributions->setDistributionInvForDirection(f[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-      distributions->setDistributionInvForDirection(f[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-      distributions->setDistributionInvForDirection(f[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-      distributions->setDistributionInvForDirection(f[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-      distributions->setDistributionInvForDirection(f[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributions->setDistributionInvForDirection(f[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-      distributions->setDistributionInvForDirection(f[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-      distributions->setDistributionInvForDirection(f[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+      distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+      distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    default:
       UB_THROW(UbException(UB_EXARGS, "It isn't implemented non reflecting density boundary for this direction!"));
@@ -240,130 +240,130 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
    switch (direction)
    {
    case E:
-      h[E]  = htemp[E] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[E];
+      h[DIR_P00]  = htemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P00];
       h[NE] = htemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[NE];
-      h[SE] = htemp[SE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[SE];
-      h[TE] = htemp[TE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[TE];
-      h[BE] = htemp[BE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[BE];
-      h[TNE] = htemp[TNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[TNE];
-      h[TSE] = htemp[TSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[TSE];
-      h[BNE] = htemp[BNE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[BNE];
-      h[BSE] = htemp[BSE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[BSE];
+      h[DIR_PM0] = htemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PM0];
+      h[DIR_P0P] = htemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P0P];
+      h[DIR_P0M] = htemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P0M];
+      h[DIR_PPP] = htemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PPP];
+      h[DIR_PMP] = htemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PMP];
+      h[DIR_PPM] = htemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PPM];
+      h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PMM];
 
-      distributionsH->setDistributionInvForDirection(h[E], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-      distributionsH->setDistributionInvForDirection(h[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-      distributionsH->setDistributionInvForDirection(h[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-      distributionsH->setDistributionInvForDirection(h[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-      distributionsH->setDistributionInvForDirection(h[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributionsH->setDistributionInvForDirection(h[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributionsH->setDistributionInvForDirection(h[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributionsH->setDistributionInvForDirection(h[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
+      distributionsH->setDistributionInvForDirection(h[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
+      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributionsH->setDistributionInvForDirection(h[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributionsH->setDistributionInvForDirection(h[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       break;
    case W:
       h[W] = htemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[W];
-      h[NW] = htemp[NW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[NW];
-      h[SW] = htemp[SW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[SW];
-      h[TW] = htemp[TW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[TW];
-      h[BW] = htemp[BW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[BW];
-      h[TNW] = htemp[TNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[TNW];
-      h[TSW] = htemp[TSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[TSW];
-      h[BNW] = htemp[BNW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[BNW];
-      h[BSW] = htemp[BSW] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[BSW];
+      h[DIR_MP0] = htemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MP0];
+      h[DIR_MM0] = htemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MM0];
+      h[DIR_M0P] = htemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_M0P];
+      h[DIR_M0M] = htemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_M0M];
+      h[DIR_MPP] = htemp[DIR_MPP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MPP];
+      h[DIR_MMP] = htemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MMP];
+      h[DIR_MPM] = htemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MPM];
+      h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MMM];
 
-      distributionsH->setDistributionInvForDirection(h[W], x1 + DX1[E], x2 + DX2[E], x3 + DX3[E], E);
-      distributionsH->setDistributionInvForDirection(h[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-      distributionsH->setDistributionInvForDirection(h[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-      distributionsH->setDistributionInvForDirection(h[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-      distributionsH->setDistributionInvForDirection(h[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-      distributionsH->setDistributionInvForDirection(h[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributionsH->setDistributionInvForDirection(h[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-      distributionsH->setDistributionInvForDirection(h[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-      distributionsH->setDistributionInvForDirection(h[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributionsH->setDistributionInvForDirection(h[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+      distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+      distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    case N:
       h[N] = htemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[N];
       h[NE] = htemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[NE];
-      h[NW] = htemp[NW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[NW];
-      h[TN] = htemp[TN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[TN];
-      h[BN] = htemp[BN] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[BN];
-      h[TNE] = htemp[TNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[TNE];
-      h[TNW] = htemp[TNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[TNW];
-      h[BNE] = htemp[BNE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[BNE];
-      h[BNW] = htemp[BNW] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[BNW];
+      h[DIR_MP0] = htemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_MP0];
+      h[DIR_0PP] = htemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_0PP];
+      h[DIR_0PM] = htemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_0PM];
+      h[DIR_PPP] = htemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_PPP];
+      h[DIR_MPP] = htemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_MPP];
+      h[DIR_PPM] = htemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_PPM];
+      h[DIR_MPM] = htemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_MPM];
 
       distributionsH->setDistributionInvForDirection(h[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[SW], x2 + DX2[SW], x3 + DX3[SW], SW);
-      distributionsH->setDistributionInvForDirection(h[NW], x1 + DX1[SE], x2 + DX2[SE], x3 + DX3[SE], SE);
-      distributionsH->setDistributionInvForDirection(h[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-      distributionsH->setDistributionInvForDirection(h[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-      distributionsH->setDistributionInvForDirection(h[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributionsH->setDistributionInvForDirection(h[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributionsH->setDistributionInvForDirection(h[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributionsH->setDistributionInvForDirection(h[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
+      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributionsH->setDistributionInvForDirection(h[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       break;
    case S:
       h[S] = htemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[S];
-      h[SE] = htemp[SE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[SE];
-      h[SW] = htemp[SW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[SW];
-      h[TS] = htemp[TS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[TS];
-      h[BS] = htemp[BS] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[BS];
-      h[TSE] = htemp[TSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[TSE];
-      h[TSW] = htemp[TSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[TSW];
-      h[BSE] = htemp[BSE] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[BSE];
-      h[BSW] = htemp[BSW] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[BSW];
+      h[DIR_PM0] = htemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_PM0];
+      h[DIR_MM0] = htemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_MM0];
+      h[DIR_0MP] = htemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_0MP];
+      h[DIR_0MM] = htemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_0MM];
+      h[DIR_PMP] = htemp[DIR_PMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_PMP];
+      h[DIR_MMP] = htemp[DIR_MMP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_MMP];
+      h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_PMM];
+      h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_MMM];
 
       distributionsH->setDistributionInvForDirection(h[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
-      distributionsH->setDistributionInvForDirection(h[SE], x1 + DX1[NW], x2 + DX2[NW], x3 + DX3[NW], NW);
-      distributionsH->setDistributionInvForDirection(h[SW], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
-      distributionsH->setDistributionInvForDirection(h[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-      distributionsH->setDistributionInvForDirection(h[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-      distributionsH->setDistributionInvForDirection(h[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributionsH->setDistributionInvForDirection(h[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
-      distributionsH->setDistributionInvForDirection(h[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-      distributionsH->setDistributionInvForDirection(h[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributionsH->setDistributionInvForDirection(h[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributionsH->setDistributionInvForDirection(h[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributionsH->setDistributionInvForDirection(h[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    case T:
       h[T] = htemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[T];
-      h[TE] = htemp[TE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TE];
-      h[TW] = htemp[TW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TW];
-      h[TN] = htemp[TN] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TN];
-      h[TS] = htemp[TS] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TS];
-      h[TNE] = htemp[TNE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TNE];
-      h[TNW] = htemp[TNW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TNW];
-      h[TSE] = htemp[TSE] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TSE];
-      h[TSW] = htemp[TSW] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[TSW];
+      h[DIR_P0P] = htemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_P0P];
+      h[DIR_M0P] = htemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_M0P];
+      h[DIR_0PP] = htemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_0PP];
+      h[DIR_0MP] = htemp[DIR_0MP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_0MP];
+      h[DIR_PPP] = htemp[DIR_PPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_PPP];
+      h[DIR_MPP] = htemp[DIR_MPP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_MPP];
+      h[DIR_PMP] = htemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_PMP];
+      h[DIR_MMP] = htemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_MMP];
 
       distributionsH->setDistributionInvForDirection(h[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
-      distributionsH->setDistributionInvForDirection(h[TE], x1 + DX1[BW], x2 + DX2[BW], x3 + DX3[BW], BW);
-      distributionsH->setDistributionInvForDirection(h[TW], x1 + DX1[BE], x2 + DX2[BE], x3 + DX3[BE], BE);
-      distributionsH->setDistributionInvForDirection(h[TN], x1 + DX1[BS], x2 + DX2[BS], x3 + DX3[BS], BS);
-      distributionsH->setDistributionInvForDirection(h[TS], x1 + DX1[BN], x2 + DX2[BN], x3 + DX3[BN], BN);
-      distributionsH->setDistributionInvForDirection(h[TNE], x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW], BSW);
-      distributionsH->setDistributionInvForDirection(h[TNW], x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE], BSE);
-      distributionsH->setDistributionInvForDirection(h[TSE], x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW], BNW);
-      distributionsH->setDistributionInvForDirection(h[TSW], x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE], BNE);
+      distributionsH->setDistributionInvForDirection(h[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+      distributionsH->setDistributionInvForDirection(h[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributionsH->setDistributionInvForDirection(h[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
       break;
    case B:
       h[B] = htemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[B];
-      h[BE] = htemp[BE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BE];
-      h[BW] = htemp[BW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BW];
-      h[BN] = htemp[BN] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BN];
-      h[BS] = htemp[BS] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BS];
-      h[BNE] = htemp[BNE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BNE];
-      h[BNW] = htemp[BNW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BNW];
-      h[BSE] = htemp[BSE] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BSE];
-      h[BSW] = htemp[BSW] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[BSW];
+      h[DIR_P0M] = htemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_P0M];
+      h[DIR_M0M] = htemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_M0M];
+      h[DIR_0PM] = htemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_0PM];
+      h[DIR_0MM] = htemp[DIR_0MM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_0MM];
+      h[DIR_PPM] = htemp[DIR_PPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_PPM];
+      h[DIR_MPM] = htemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_MPM];
+      h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_PMM];
+      h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_MMM];
 
       distributionsH->setDistributionInvForDirection(h[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
-      distributionsH->setDistributionInvForDirection(h[BE], x1 + DX1[TW], x2 + DX2[TW], x3 + DX3[TW], TW);
-      distributionsH->setDistributionInvForDirection(h[BW], x1 + DX1[TE], x2 + DX2[TE], x3 + DX3[TE], TE);
-      distributionsH->setDistributionInvForDirection(h[BN], x1 + DX1[TS], x2 + DX2[TS], x3 + DX3[TS], TS);
-      distributionsH->setDistributionInvForDirection(h[BS], x1 + DX1[TN], x2 + DX2[TN], x3 + DX3[TN], TN);
-      distributionsH->setDistributionInvForDirection(h[BNE], x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW], TSW);
-      distributionsH->setDistributionInvForDirection(h[BNW], x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE], TSE);
-      distributionsH->setDistributionInvForDirection(h[BSE], x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW], TNW);
-      distributionsH->setDistributionInvForDirection(h[BSW], x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE], TNE);
+      distributionsH->setDistributionInvForDirection(h[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+      distributionsH->setDistributionInvForDirection(h[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributionsH->setDistributionInvForDirection(h[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+      distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
    default:
       UB_THROW(UbException(UB_EXARGS, "It isn't implemented non reflecting density boundary for this direction!"));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp
index 6db2e6230..474821241 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp
@@ -92,12 +92,12 @@ void ThixotropyVelocityBCAlgorithm::applyBC()
 	int nx3 = x3;
 
 	//flag points in direction of fluid
-	if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; }
-	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; }
-	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; }
-	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
-	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
-	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
+	if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_P00)) { nx1 -= 1; }
+	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_M00)) { nx1 += 1; }
+	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0P0)) { nx2 -= 1; }
+	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0M0)) { nx2 += 1; }
+	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00P)) { nx3 -= 1; }
+	else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00M)) { nx3 += 1; }
 	else	 UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
 
 	//lambdaBC = bcPtr->getBoundaryThixotropy();
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp
index 532570386..454b29bc4 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp
@@ -85,12 +85,12 @@ void ThixotropyVelocityWithDensityBCAlgorithm::applyBC()
    int nx3 = x3;
 
    //flag points in direction of fluid
-   if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
-   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
+   if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_P00)) { nx1 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_M00)) { nx1 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0P0)) { nx2 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_0M0)) { nx2 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00P)) { nx3 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::DIR_00M)) { nx3 += 1; }
    else	 UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
 
    for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++)
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
index 3765d2a99..9d865e22b 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
@@ -172,34 +172,34 @@ void ShearStressCoProcessor::calculateShearStress(double timeStep)
                     //////////////////////////////////////////////////////////////////////////
                     // compute velocity
                     //////////////////////////////////////////////////////////////////////////
-                    vx = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-                          (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W]));
+                    vx = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                          (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W]));
 
-                    vy = ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-                          (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S]));
+                    vy = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                          (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S]));
 
-                    vz = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-                          (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B]));
+                    vz = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+                          (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B]));
 
                     sxy = 3.0 * collFactor / (collFactor - 1.0) *
-                          (((f[TNE] + f[BSW]) - (f[TSE] + f[BNW])) + (-(f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
-                           (((f[NE] + f[SW]) - (f[SE] + f[NW]))) - vx * vy);
+                          (((f[DIR_PPP] + f[DIR_MMM]) - (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
+                           (((f[NE] + f[DIR_MM0]) - (f[DIR_PM0] + f[DIR_MP0]))) - vx * vy);
 
                     sxz = 3.0 * collFactor / (collFactor - 1.0) *
-                          (((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + (-(f[BSE] + f[TNW]) - (f[TSW] + f[BNE])) +
-                           ((f[TE] + f[BW]) - (f[BE] + f[TW])) - vx * vz);
+                          (((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) - (f[DIR_MMP] + f[DIR_PPM])) +
+                           ((f[DIR_P0P] + f[DIR_M0M]) - (f[DIR_P0M] + f[DIR_M0P])) - vx * vz);
 
                     syz = 3.0 * collFactor / (collFactor - 1.0) *
-                          (((f[TNE] + f[BSW]) - (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) - (f[TSW] + f[BNE])) +
-                           (-(f[BN] + f[TS]) + (f[TN] + f[BS])) - vy * vz);
+                          (((f[DIR_PPP] + f[DIR_MMM]) - (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) - (f[DIR_MMP] + f[DIR_PPM])) +
+                           (-(f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM])) - vy * vz);
 
                     LBMReal dxxMyy = 3.0 / 2.0 * collFactor / (collFactor - 1.0) *
-                                     (((f[TE] + f[BW]) + (f[BE] + f[TW])) - ((f[BN] + f[TS]) + (f[TN] + f[BS])) +
-                                      ((f[E] + f[W]) - (f[N] + f[S])) - vx * vx + vy * vy);
+                                     (((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM])) +
+                                      ((f[DIR_P00] + f[W]) - (f[N] + f[S])) - vx * vx + vy * vy);
 
                     LBMReal dxxMzz = 3.0 / 2.0 * collFactor / (collFactor - 1.0) *
-                                     ((((f[NE] + f[SW]) + (f[SE] + f[NW])) - ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                                      ((f[E] + f[W]) - (f[T] + f[B])) - vx * vx + vz * vz);
+                                     ((((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+                                      ((f[DIR_P00] + f[W]) - (f[T] + f[B])) - vx * vx + vz * vz);
 
                     // LBMReal dyyMzz =3.0/2.0 *collFactor/(collFactor-1.0)*((((f[NE] + f[SW]) + (f[SE] +
                     // f[NW]))-((f[TE] + f[BW])+(f[BE]+ f[TW])))
@@ -562,32 +562,32 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                                 "ix2=" + UbSystem::toString(ix2) + "ix3=" + UbSystem::toString(ix3) +
                                                 "GlobalID=" + UbSystem::toString(block->getGlobalID()) +
                                                 "dx=" + UbSystem::toString(dx) +
-                                                "T=" + UbSystem::toString(bcPtr->getQ(D3Q27System::T)) +
-                                                "B=" + UbSystem::toString(bcPtr->getQ(D3Q27System::B)) +
-                                                "E=" + UbSystem::toString(bcPtr->getQ(D3Q27System::E)) +
-                                                "W=" + UbSystem::toString(bcPtr->getQ(D3Q27System::W)) +
-                                                "N=" + UbSystem::toString(bcPtr->getQ(D3Q27System::N)) +
-                                                "S=" + UbSystem::toString(bcPtr->getQ(D3Q27System::S)) +
-                                                "NE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::NE)) +
-                                                "SW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::SW)) +
-                                                "SE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::SE)) +
-                                                "NW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::NW)) +
-                                                "TE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TE)) +
-                                                "BW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BW)) +
-                                                "BE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BE)) +
-                                                "TW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TW)) +
-                                                "TN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TN)) +
-                                                "BS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BS)) +
-                                                "BN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BN)) +
-                                                "TS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TS)) +
-                                                "TNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TNE)) +
-                                                "TNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TNW)) +
-                                                "TSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TSE)) +
-                                                "TSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TSW)) +
-                                                "BNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BNE)) +
-                                                "BNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BNW)) +
-                                                "BSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BSE)) +
-                                                "BSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BSW) * dx)));
+                                                "T=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_00P)) +
+                                                "B=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_00M)) +
+                                                "E=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P00)) +
+                                                "W=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M00)) +
+                                                "N=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0P0)) +
+                                                "S=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0M0)) +
+                                                "NE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PP0)) +
+                                                "SW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MM0)) +
+                                                "SE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PM0)) +
+                                                "NW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MP0)) +
+                                                "TE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P0P)) +
+                                                "BW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M0M)) +
+                                                "BE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P0M)) +
+                                                "TW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M0P)) +
+                                                "TN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0PP)) +
+                                                "BS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0MM)) +
+                                                "BN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0PM)) +
+                                                "TS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0MP)) +
+                                                "TNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PPP)) +
+                                                "TNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MPP)) +
+                                                "TSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PMP)) +
+                                                "TSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MMP)) +
+                                                "BNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PPM)) +
+                                                "BNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MPM)) +
+                                                "BSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PMM)) +
+                                                "BSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MMM) * dx)));
         }
     }
 
@@ -608,7 +608,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                 if (ii <= 2) {
                                     LBMReal q = bcPtrIn->getQ(fdir);
                                     if (q != 999.00000) {
-                                        if (fdir == D3Q27System::E) {
+                                        if (fdir == D3Q27System::DIR_P00) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (i + q <= x + 1) {
                                                 if (ii == 0) {
@@ -634,7 +634,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                                 }
                                             }
                                         }
-                                        if (fdir == D3Q27System::W) {
+                                        if (fdir == D3Q27System::DIR_M00) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (i - q >= x) {
                                                 if (ii == 0) {
@@ -660,7 +660,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                                 }
                                             }
                                         }
-                                        if (fdir == D3Q27System::N) {
+                                        if (fdir == D3Q27System::DIR_0P0) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (j + q <= y + 1) {
                                                 if (ii == 0) {
@@ -686,7 +686,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                                 }
                                             }
                                         }
-                                        if (fdir == D3Q27System::S) {
+                                        if (fdir == D3Q27System::DIR_0M0) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (j - q >= y) {
                                                 if (ii == 0) {
@@ -713,7 +713,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                             }
                                         }
 
-                                        if (fdir == D3Q27System::T) {
+                                        if (fdir == D3Q27System::DIR_00P) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (k + q <= z + 1) {
                                                 if (ii == 0) {
@@ -739,7 +739,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                                                 }
                                             }
                                         }
-                                        if (fdir == D3Q27System::B) {
+                                        if (fdir == D3Q27System::DIR_00M) {
                                             // if(!bcArray->isSolid(i, j, k))continue;
                                             if (k - q >= z) {
                                                 if (ii == 0) {
@@ -788,32 +788,32 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g
                     UB_EXARGS, "ii is=" + UbSystem::toString(ii) + "  ix1=" + UbSystem::toString(ix1) +
                                    " ix2=" + UbSystem::toString(ix2) + " ix3=" + UbSystem::toString(ix3) +
                                    " Block3D::GlobalID=" + UbSystem::toString(block->getGlobalID()) + " dx=" +
-                                   UbSystem::toString(dx) + " T=" + UbSystem::toString(bcPtr->getQ(D3Q27System::T)) +
-                                   " B=" + UbSystem::toString(bcPtr->getQ(D3Q27System::B)) +
-                                   " E=" + UbSystem::toString(bcPtr->getQ(D3Q27System::E)) +
-                                   " W=" + UbSystem::toString(bcPtr->getQ(D3Q27System::W)) +
-                                   " N=" + UbSystem::toString(bcPtr->getQ(D3Q27System::N)) +
-                                   " S=" + UbSystem::toString(bcPtr->getQ(D3Q27System::S)) +
-                                   " NE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::NE)) +
-                                   " SW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::SW)) +
-                                   " SE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::SE)) +
-                                   " NW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::NW)) +
-                                   " TE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TE)) +
-                                   " BW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BW)) +
-                                   " BE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BE)) +
-                                   " TW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TW)) +
-                                   " TN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TN)) +
-                                   " BS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BS)) +
-                                   " BN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BN)) +
-                                   " TS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TS)) +
-                                   " TNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TNE)) +
-                                   " TNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TNW)) +
-                                   " TSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TSE)) +
-                                   " TSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::TSW)) +
-                                   " BNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BNE)) +
-                                   " BNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BNW)) +
-                                   " BSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BSE)) +
-                                   " BSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::BSW))));
+                                   UbSystem::toString(dx) + " T=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_00P)) +
+                                   " B=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_00M)) +
+                                   " E=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P00)) +
+                                   " W=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M00)) +
+                                   " N=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0P0)) +
+                                   " S=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0M0)) +
+                                   " NE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PP0)) +
+                                   " SW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MM0)) +
+                                   " SE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PM0)) +
+                                   " NW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MP0)) +
+                                   " TE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P0P)) +
+                                   " BW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M0M)) +
+                                   " BE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_P0M)) +
+                                   " TW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_M0P)) +
+                                   " TN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0PP)) +
+                                   " BS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0MM)) +
+                                   " BN=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0PM)) +
+                                   " TS=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_0MP)) +
+                                   " TNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PPP)) +
+                                   " TNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MPP)) +
+                                   " TSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PMP)) +
+                                   " TSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MMP)) +
+                                   " BNE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PPM)) +
+                                   " BNW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MPM)) +
+                                   " BSE=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_PMM)) +
+                                   " BSW=" + UbSystem::toString(bcPtr->getQ(D3Q27System::DIR_MMM))));
             }
         }
     }
@@ -876,22 +876,22 @@ void ShearStressCoProcessor::initDistance()
                         continue;
                     int numberOfCorner = 0;
 
-                    if (bc->getQ(D3Q27System::T) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_00P) != 999.000) {
                         numberOfCorner++;
                     }
-                    if (bc->getQ(D3Q27System::B) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_00M) != 999.000) {
                         numberOfCorner++;
                     }
-                    if (bc->getQ(D3Q27System::E) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_P00) != 999.000) {
                         numberOfCorner++;
                     }
-                    if (bc->getQ(D3Q27System::W) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_M00) != 999.000) {
                         numberOfCorner++;
                     }
-                    if (bc->getQ(D3Q27System::N) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_0P0) != 999.000) {
                         numberOfCorner++;
                     }
-                    if (bc->getQ(D3Q27System::S) != 999.000) {
+                    if (bc->getQ(D3Q27System::DIR_0M0) != 999.000) {
                         numberOfCorner++;
                     }
                     // if(bc->hasVelocityBoundary()||bc->hasDensityBoundary())continue;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
index 51be3b53a..5de46c899 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
@@ -215,14 +215,14 @@ void TurbulenceIntensityCoProcessor::calculateAverageValues(double timeStep)
                                 //////////////////////////////////////////////////////////////////////////
                                 // compute velocity
                                 //////////////////////////////////////////////////////////////////////////
-                                vx = f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] + f[BE] - f[TW] +
-                                     f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] + f[BSE] - f[BNW];
+                                vx = f[DIR_P00] - f[W] + f[NE] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M] + f[DIR_P0M] - f[DIR_M0P] +
+                                     f[DIR_PPP] - f[DIR_MMP] + f[DIR_PMP] - f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] + f[DIR_PMM] - f[DIR_MPM];
 
-                                vy = f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - f[TS] +
-                                     f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] + f[BNW];
+                                vy = f[N] - f[S] + f[NE] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM] - f[DIR_0MP] +
+                                     f[DIR_PPP] - f[DIR_MMP] - f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] + f[DIR_MPM];
 
-                                vz = f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] + f[TS] +
-                                     f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - f[BNW];
+                                vz = f[T] - f[B] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] + f[DIR_0MP] +
+                                     f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] - f[DIR_MPM];
                                 //////////////////////////////////////////////////////////////////////////
                                 // compute average values
                                 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
index 536d2ee13..523ae4ffb 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
@@ -123,7 +123,7 @@ void WriteBlocksCoProcessor::collectData(double step)
                 // for (std::size_t i = 0; i<connectors.size(); i++)
                 //   if (connectors[i])
                 //   {
-                //      if (connectors[i]->getSendDir() == D3Q27System::BS)
+                //      if (connectors[i]->getSendDir() == D3Q27System::DIR_0MM)
                 //      {
 
                 //         flag = true;
@@ -146,7 +146,7 @@ void WriteBlocksCoProcessor::collectData(double step)
                 // for (std::size_t i = 0; i<connectors.size(); i++)
                 //   if (connectors[i])
                 //   {
-                //      if (connectors[i]->getSendDir() == D3Q27System::BS)
+                //      if (connectors[i]->getSendDir() == D3Q27System::DIR_0MM)
                 //      {
 
                 //         flag = true;
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index c0d88a853..73bc94c73 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -225,17 +225,17 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                 if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) {
                     distributionsH->getDistribution(f, ix1, ix2, ix3);
                     (*phaseField)(ix1, ix2, ix3) =
-                        ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
-                        (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
-                        ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
+                        ((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
+                        (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                        ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+                            ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
                     if (distributionsH2) {
                     distributionsH2->getDistribution(f, ix1, ix2, ix3);
                     (*phaseField2)(ix1, ix2, ix3) =
-                        ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
-                        (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
-                        ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                            ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
+                        ((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
+                        (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                        ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+                            ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
                 }
                     else { (*phaseField2)(ix1, ix2, ix3) = 999.0; }
                     
@@ -285,38 +285,38 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         // vx2 = 0.0;
                         // vx3 = 0.0;
                     } else {
-                        phi[E]   = (*phaseField)(ix1 + DX1[E], ix2 + DX2[E], ix3 + DX3[E]);
+                        phi[DIR_P00]   = (*phaseField)(ix1 + DX1[DIR_P00], ix2 + DX2[DIR_P00], ix3 + DX3[DIR_P00]);
                         phi[N]   = (*phaseField)(ix1 + DX1[N], ix2 + DX2[N], ix3 + DX3[N]);
                         phi[T]   = (*phaseField)(ix1 + DX1[T], ix2 + DX2[T], ix3 + DX3[T]);
                         phi[W]   = (*phaseField)(ix1 + DX1[W], ix2 + DX2[W], ix3 + DX3[W]);
                         phi[S]   = (*phaseField)(ix1 + DX1[S], ix2 + DX2[S], ix3 + DX3[S]);
                         phi[B]   = (*phaseField)(ix1 + DX1[B], ix2 + DX2[B], ix3 + DX3[B]);
                         phi[NE]  = (*phaseField)(ix1 + DX1[NE], ix2 + DX2[NE], ix3 + DX3[NE]);
-                        phi[NW]  = (*phaseField)(ix1 + DX1[NW], ix2 + DX2[NW], ix3 + DX3[NW]);
-                        phi[TE]  = (*phaseField)(ix1 + DX1[TE], ix2 + DX2[TE], ix3 + DX3[TE]);
-                        phi[TW]  = (*phaseField)(ix1 + DX1[TW], ix2 + DX2[TW], ix3 + DX3[TW]);
-                        phi[TN]  = (*phaseField)(ix1 + DX1[TN], ix2 + DX2[TN], ix3 + DX3[TN]);
-                        phi[TS]  = (*phaseField)(ix1 + DX1[TS], ix2 + DX2[TS], ix3 + DX3[TS]);
-                        phi[SW]  = (*phaseField)(ix1 + DX1[SW], ix2 + DX2[SW], ix3 + DX3[SW]);
-                        phi[SE]  = (*phaseField)(ix1 + DX1[SE], ix2 + DX2[SE], ix3 + DX3[SE]);
-                        phi[BW]  = (*phaseField)(ix1 + DX1[BW], ix2 + DX2[BW], ix3 + DX3[BW]);
-                        phi[BE]  = (*phaseField)(ix1 + DX1[BE], ix2 + DX2[BE], ix3 + DX3[BE]);
-                        phi[BS]  = (*phaseField)(ix1 + DX1[BS], ix2 + DX2[BS], ix3 + DX3[BS]);
-                        phi[BN]  = (*phaseField)(ix1 + DX1[BN], ix2 + DX2[BN], ix3 + DX3[BN]);
-                        phi[BSW] = (*phaseField)(ix1 + DX1[BSW], ix2 + DX2[BSW], ix3 + DX3[BSW]);
-                        phi[BSE] = (*phaseField)(ix1 + DX1[BSE], ix2 + DX2[BSE], ix3 + DX3[BSE]);
-                        phi[BNW] = (*phaseField)(ix1 + DX1[BNW], ix2 + DX2[BNW], ix3 + DX3[BNW]);
-                        phi[BNE] = (*phaseField)(ix1 + DX1[BNE], ix2 + DX2[BNE], ix3 + DX3[BNE]);
-                        phi[TNE] = (*phaseField)(ix1 + DX1[TNE], ix2 + DX2[TNE], ix3 + DX3[TNE]);
-                        phi[TNW] = (*phaseField)(ix1 + DX1[TNW], ix2 + DX2[TNW], ix3 + DX3[TNW]);
-                        phi[TSE] = (*phaseField)(ix1 + DX1[TSE], ix2 + DX2[TSE], ix3 + DX3[TSE]);
-                        phi[TSW] = (*phaseField)(ix1 + DX1[TSW], ix2 + DX2[TSW], ix3 + DX3[TSW]);
+                        phi[DIR_MP0]  = (*phaseField)(ix1 + DX1[DIR_MP0], ix2 + DX2[DIR_MP0], ix3 + DX3[DIR_MP0]);
+                        phi[DIR_P0P]  = (*phaseField)(ix1 + DX1[DIR_P0P], ix2 + DX2[DIR_P0P], ix3 + DX3[DIR_P0P]);
+                        phi[DIR_M0P]  = (*phaseField)(ix1 + DX1[DIR_M0P], ix2 + DX2[DIR_M0P], ix3 + DX3[DIR_M0P]);
+                        phi[DIR_0PP]  = (*phaseField)(ix1 + DX1[DIR_0PP], ix2 + DX2[DIR_0PP], ix3 + DX3[DIR_0PP]);
+                        phi[DIR_0MP]  = (*phaseField)(ix1 + DX1[DIR_0MP], ix2 + DX2[DIR_0MP], ix3 + DX3[DIR_0MP]);
+                        phi[DIR_MM0]  = (*phaseField)(ix1 + DX1[DIR_MM0], ix2 + DX2[DIR_MM0], ix3 + DX3[DIR_MM0]);
+                        phi[DIR_PM0]  = (*phaseField)(ix1 + DX1[DIR_PM0], ix2 + DX2[DIR_PM0], ix3 + DX3[DIR_PM0]);
+                        phi[DIR_M0M]  = (*phaseField)(ix1 + DX1[DIR_M0M], ix2 + DX2[DIR_M0M], ix3 + DX3[DIR_M0M]);
+                        phi[DIR_P0M]  = (*phaseField)(ix1 + DX1[DIR_P0M], ix2 + DX2[DIR_P0M], ix3 + DX3[DIR_P0M]);
+                        phi[DIR_0MM]  = (*phaseField)(ix1 + DX1[DIR_0MM], ix2 + DX2[DIR_0MM], ix3 + DX3[DIR_0MM]);
+                        phi[DIR_0PM]  = (*phaseField)(ix1 + DX1[DIR_0PM], ix2 + DX2[DIR_0PM], ix3 + DX3[DIR_0PM]);
+                        phi[DIR_MMM] = (*phaseField)(ix1 + DX1[DIR_MMM], ix2 + DX2[DIR_MMM], ix3 + DX3[DIR_MMM]);
+                        phi[DIR_PMM] = (*phaseField)(ix1 + DX1[DIR_PMM], ix2 + DX2[DIR_PMM], ix3 + DX3[DIR_PMM]);
+                        phi[DIR_MPM] = (*phaseField)(ix1 + DX1[DIR_MPM], ix2 + DX2[DIR_MPM], ix3 + DX3[DIR_MPM]);
+                        phi[DIR_PPM] = (*phaseField)(ix1 + DX1[DIR_PPM], ix2 + DX2[DIR_PPM], ix3 + DX3[DIR_PPM]);
+                        phi[DIR_PPP] = (*phaseField)(ix1 + DX1[DIR_PPP], ix2 + DX2[DIR_PPP], ix3 + DX3[DIR_PPP]);
+                        phi[DIR_MPP] = (*phaseField)(ix1 + DX1[DIR_MPP], ix2 + DX2[DIR_MPP], ix3 + DX3[DIR_MPP]);
+                        phi[DIR_PMP] = (*phaseField)(ix1 + DX1[DIR_PMP], ix2 + DX2[DIR_PMP], ix3 + DX3[DIR_PMP]);
+                        phi[DIR_MMP] = (*phaseField)(ix1 + DX1[DIR_MMP], ix2 + DX2[DIR_MMP], ix3 + DX3[DIR_MMP]);
                         dX1_phi  = 0.0 * gradX1_phi(phi);
                         dX2_phi  = 0.0 * gradX2_phi(phi);
                         dX3_phi  = 0.0 * gradX3_phi(phi);
                         mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(phi);
 
-                        //phi2[E] = (*phaseField2)(ix1 + DX1[E], ix2 + DX2[E], ix3 + DX3[E]);
+                        //phi2[DIR_P00] = (*phaseField2)(ix1 + DX1[DIR_P00], ix2 + DX2[DIR_P00], ix3 + DX3[DIR_P00]);
                         //phi2[N] = (*phaseField2)(ix1 + DX1[N], ix2 + DX2[N], ix3 + DX3[N]);
                         //phi2[T] = (*phaseField2)(ix1 + DX1[T], ix2 + DX2[T], ix3 + DX3[T]);
                         //phi2[W] = (*phaseField2)(ix1 + DX1[W], ix2 + DX2[W], ix3 + DX3[W]);
@@ -362,43 +362,43 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
 
                     if (pressure) {
                         vx1 =
-                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-                            (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) ;
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W])) ;
 
                         vx2 =
-                            ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-                            (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) ;
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S])) ;
 
                         vx3 =
-                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-                            (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B]));
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B]));
 
                     }
                     else {
                         vx1 =
-                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-                            (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) /
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W])) /
                                 (rho * c1o3) +
                             mu * dX1_phi / (2 * rho);
 
                         vx2 =
-                            ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-                            (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) /
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S])) /
                                 (rho * c1o3) +
                             mu * dX2_phi / (2 * rho);
 
                         vx3 =
-                            ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-                            (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B])) /
+                            ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B])) /
                                 (rho * c1o3) +
                             mu * dX3_phi / (2 * rho);
 
                     }
 
-                    p1 = (((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
-                          (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
-                           ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-                          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000]) +
+                    p1 = (((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
+                          (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                           ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+                          ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000]) +
                          (vx1 * rhoToPhi * dX1_phi * c1o3 + vx2 * rhoToPhi * dX2_phi * c1o3 +
                           vx3 * rhoToPhi * dX3_phi * c1o3) /
                              2.0;
diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h
index 7c5c4f136..00ba4c4e9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h
@@ -156,15 +156,15 @@ CoarseToFineVectorConnector<VectorTransmitter>::CoarseToFineVectorConnector(
       receiverEvenOddNW(receiverEvenOddNW), receiverOddEvenSE(receiverOddEvenSE), receiverOddOddNE(receiverOddOddNE),
       iprocessor(iprocessor)
 {
-    if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N ||
-          sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B ||
-          sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE ||
-          sendDir == D3Q27System::NW || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW ||
-          sendDir == D3Q27System::BE || sendDir == D3Q27System::TW || sendDir == D3Q27System::TN ||
-          sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS ||
-          sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE ||
-          sendDir == D3Q27System::TSW || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW ||
-          sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW)) {
+    if (!(sendDir == D3Q27System::DIR_P00 || sendDir == D3Q27System::DIR_M00 || sendDir == D3Q27System::DIR_0P0 ||
+          sendDir == D3Q27System::DIR_0M0 || sendDir == D3Q27System::DIR_00P || sendDir == D3Q27System::DIR_00M ||
+          sendDir == D3Q27System::DIR_PP0 || sendDir == D3Q27System::DIR_MM0 || sendDir == D3Q27System::DIR_PM0 ||
+          sendDir == D3Q27System::DIR_MP0 || sendDir == D3Q27System::DIR_P0P || sendDir == D3Q27System::DIR_M0M ||
+          sendDir == D3Q27System::DIR_P0M || sendDir == D3Q27System::DIR_M0P || sendDir == D3Q27System::DIR_0PP ||
+          sendDir == D3Q27System::DIR_0MM || sendDir == D3Q27System::DIR_0PM || sendDir == D3Q27System::DIR_0MP ||
+          sendDir == D3Q27System::DIR_PPP || sendDir == D3Q27System::DIR_MPP || sendDir == D3Q27System::DIR_PMP ||
+          sendDir == D3Q27System::DIR_MMP || sendDir == D3Q27System::DIR_PPM || sendDir == D3Q27System::DIR_MPM ||
+          sendDir == D3Q27System::DIR_PMM || sendDir == D3Q27System::DIR_MMM)) {
         throw UbException(UB_EXARGS, "invalid constructor for this direction");
     }
 }
@@ -310,44 +310,44 @@ void CoarseToFineVectorConnector<VectorTransmitter>::init()
     int iCellSize       = 8; // size of interpolation cell
 
     switch (this->sendDir) {
-        case E:
-        case W:
+        case DIR_P00:
+        case DIR_M00:
             sendSize = bMaxX2 * bMaxX3 * sendDataPerNode * iCellSize;
             break;
-        case N:
-        case S:
+        case DIR_0P0:
+        case DIR_0M0:
             sendSize = bMaxX1 * bMaxX3 * sendDataPerNode * iCellSize;
             break;
-        case T:
-        case B:
+        case DIR_00P:
+        case DIR_00M:
             sendSize = bMaxX1 * bMaxX2 * sendDataPerNode * iCellSize;
             break;
-        case NE:
-        case SW:
-        case SE:
-        case NW:
+        case DIR_PP0:
+        case DIR_MM0:
+        case DIR_PM0:
+        case DIR_MP0:
             sendSize = 2 * bMaxX3 * sendDataPerNode * iCellSize;
             break;
-        case TE:
-        case BW:
-        case BE:
-        case TW:
+        case DIR_P0P:
+        case DIR_M0M:
+        case DIR_P0M:
+        case DIR_M0P:
             sendSize = 2 * bMaxX2 * sendDataPerNode * iCellSize;
             break;
-        case TN:
-        case BS:
-        case BN:
-        case TS:
+        case DIR_0PP:
+        case DIR_0MM:
+        case DIR_0PM:
+        case DIR_0MP:
             sendSize = 2 * bMaxX1 * sendDataPerNode * iCellSize;
             break;
-        case TNE:
-        case TNW:
-        case TSE:
-        case TSW:
-        case BNE:
-        case BNW:
-        case BSE:
-        case BSW:
+        case DIR_PPP:
+        case DIR_MPP:
+        case DIR_PMP:
+        case DIR_MMP:
+        case DIR_PPM:
+        case DIR_MPM:
+        case DIR_PMM:
+        case DIR_MMM:
             sendSize = 6 * bMaxX1 * sendDataPerNode * iCellSize;
             break;
         default:
@@ -408,7 +408,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
     int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
 
     switch (sendDir) {
-        case E:
+        case DIR_P00:
             lMinX1 = maxX1 - 3;
             lMaxX1 = lMinX1 + 1;
 
@@ -428,7 +428,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case W:
+        case DIR_M00:
             lMinX1 = 1;
             lMaxX1 = lMinX1 + 1;
 
@@ -448,7 +448,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case N:
+        case DIR_0P0:
             lMinX2 = maxX2 - 3;
             lMaxX2 = lMinX2 + 1;
 
@@ -468,7 +468,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case S:
+        case DIR_0M0:
             lMinX2 = 1;
             lMaxX2 = lMinX2 + 1;
 
@@ -488,7 +488,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case T:
+        case DIR_00P:
             lMinX3 = maxX3 - 3;
             lMaxX3 = lMinX3 + 1;
 
@@ -508,7 +508,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case B:
+        case DIR_00M:
             lMinX3 = 1;
             lMaxX3 = lMinX3 + 1;
 
@@ -529,7 +529,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
             /// N-S-E-W
-        case NE:
+        case DIR_PP0:
             lMinX1 = maxX1 - 3;
             lMaxX1 = lMinX1 + 2;
             lMinX2 = maxX2 - 3;
@@ -543,7 +543,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case SW:
+        case DIR_MM0:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 2;
             lMinX2 = 0;
@@ -557,7 +557,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case SE:
+        case DIR_PM0:
             lMinX1 = maxX1 - 3;
             lMaxX1 = lMinX1 + 2;
             lMinX2 = 0;
@@ -571,7 +571,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case NW:
+        case DIR_MP0:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 2;
             lMinX2 = maxX2 - 3;
@@ -585,7 +585,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
             /////T-B-E-W
-        case TE:
+        case DIR_P0P:
             lMinX1 = maxX1 - 3;
             lMaxX1 = lMinX1 + 2;
             lMinX3 = maxX3 - 3;
@@ -599,7 +599,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case BW:
+        case DIR_M0M:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 2;
             lMinX3 = 0;
@@ -613,7 +613,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case BE:
+        case DIR_P0M:
             lMinX1 = maxX1 - 3;
             lMaxX1 = lMinX1 + 2;
             lMinX3 = 0;
@@ -627,7 +627,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case TW:
+        case DIR_M0P:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 2;
             lMinX3 = maxX3 - 3;
@@ -642,7 +642,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
             ////
             /////T-B-N-S
-        case TN:
+        case DIR_0PP:
             lMinX2 = maxX2 - 3;
             lMaxX2 = lMinX2 + 2;
             lMinX3 = maxX3 - 3;
@@ -656,7 +656,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case BS:
+        case DIR_0MM:
             lMinX2 = 0;
             lMaxX2 = lMinX2 + 2;
             lMinX3 = 0;
@@ -670,7 +670,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case BN:
+        case DIR_0PM:
             lMinX2 = maxX2 - 3;
             lMaxX2 = lMinX2 + 2;
             lMinX3 = 0;
@@ -684,7 +684,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case TS:
+        case DIR_0MP:
             lMinX2 = 0;
             lMaxX2 = lMinX2 + 2;
             lMinX3 = maxX3 - 3;
@@ -699,7 +699,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
             // TNE
-        case TNE:
+        case DIR_PPP:
             lMinX1 = maxX1 - 3;
             lMaxX1 = maxX1 - 1;
             lMinX2 = maxX2 - 3;
@@ -710,7 +710,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   TNW
-        case TNW:
+        case DIR_MPP:
             lMinX1 = 0;
             lMaxX1 = 2;
             lMinX2 = maxX2 - 3;
@@ -721,7 +721,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   TSE
-        case TSE:
+        case DIR_PMP:
             lMinX1 = maxX1 - 3;
             lMaxX1 = maxX1 - 1;
             lMinX2 = 0;
@@ -732,7 +732,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   TSW
-        case TSW:
+        case DIR_MMP:
             lMinX1 = 0;
             lMaxX1 = 2;
             lMinX2 = 0;
@@ -743,7 +743,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BNE
-        case BNE:
+        case DIR_PPM:
             lMinX1 = maxX1 - 3;
             lMaxX1 = maxX1 - 1;
             lMinX2 = maxX2 - 3;
@@ -754,7 +754,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BNW
-        case BNW:
+        case DIR_MPM:
             lMinX1 = 0;
             lMaxX1 = 2;
             lMinX2 = maxX2 - 3;
@@ -765,7 +765,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BSE
-        case BSE:
+        case DIR_PMM:
             lMinX1 = maxX1 - 3;
             lMaxX1 = maxX1 - 1;
             lMinX2 = 0;
@@ -776,7 +776,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BSW
-        case BSW:
+        case DIR_MMM:
             lMinX1 = 0;
             lMaxX1 = 2;
             lMinX2 = 0;
@@ -912,7 +912,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
     int dummy;
 
     switch (sendDir) {
-        case E:
+        case DIR_P00:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 1;
             getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
@@ -935,7 +935,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case W:
+        case DIR_M00:
             lMinX1 = 3;
             lMaxX1 = lMinX1 + 1;
             getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
@@ -958,7 +958,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case N:
+        case DIR_0P0:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 1;
             getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
@@ -981,7 +981,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case S:
+        case DIR_0M0:
             lMinX2 = 3;
             lMaxX2 = lMinX2 + 1;
             getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
@@ -1004,7 +1004,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case T:
+        case DIR_00P:
             lMinX3 = maxX3 - 4;
             lMaxX3 = lMinX3 + 1;
             getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
@@ -1027,7 +1027,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
             break;
-        case B:
+        case DIR_00M:
             lMinX3 = 3;
             lMaxX3 = lMinX3 + 1;
             getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
@@ -1052,7 +1052,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
 
             //	/////E-W-N-S
-        case NE:
+        case DIR_PP0:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = maxX2 - 4;
@@ -1079,7 +1079,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case SW:
+        case DIR_MM0:
             lMinX1 = 1;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = 3;
@@ -1106,7 +1106,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case SE:
+        case DIR_PM0:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = 3;
@@ -1133,7 +1133,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case NW:
+        case DIR_MP0:
             lMinX1 = 1;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = maxX2 - 4;
@@ -1160,7 +1160,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
             //		/////T-B-E-W
-        case TE:
+        case DIR_P0P:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = maxX3 - 4;
@@ -1187,7 +1187,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case BW:
+        case DIR_M0M:
             lMinX1 = 1;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = 3;
@@ -1214,7 +1214,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case BE:
+        case DIR_P0M:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = 3;
@@ -1241,7 +1241,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case TW:
+        case DIR_M0P:
             lMinX1 = 1;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = maxX3 - 4;
@@ -1269,7 +1269,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
 
             /////////////////////////T-N-B-S
-        case TN:
+        case DIR_0PP:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = maxX3 - 4;
@@ -1296,7 +1296,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case BS:
+        case DIR_0MM:
             lMinX2 = 1;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = 3;
@@ -1323,7 +1323,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case BN:
+        case DIR_0PM:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = 3;
@@ -1350,7 +1350,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
 
-        case TS:
+        case DIR_0MP:
             lMinX2 = 1;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = maxX3 - 4;
@@ -1378,7 +1378,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
 
             // TNE
-        case TNE:
+        case DIR_PPP:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 3;
             lMinX2 = maxX2 - 4;
@@ -1405,7 +1405,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
             //   TNW
-        case TNW:
+        case DIR_MPP:
             lMinX1 = 3;
             lMaxX1 = 4;
             lMinX2 = maxX2 - 4;
@@ -1432,7 +1432,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
             //   TSE
-        case TSE:
+        case DIR_PMP:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 3;
             lMinX2 = 1;
@@ -1458,7 +1458,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   TSW
-        case TSW:
+        case DIR_MMP:
             lMinX1 = 3;
             lMaxX1 = 4;
             lMinX2 = 1;
@@ -1484,7 +1484,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BNE
-        case BNE:
+        case DIR_PPM:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 3;
             lMinX2 = maxX2 - 4;
@@ -1511,7 +1511,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
             break;
             //   BNW
-        case BNW:
+        case DIR_MPM:
             lMinX1 = 3;
             lMaxX1 = 4;
             lMinX2 = maxX2 - 4;
@@ -1537,7 +1537,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BSE
-        case BSE:
+        case DIR_PMM:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 3;
             lMinX2 = 1;
@@ -1563,7 +1563,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
             break;
             //   BSW
-        case BSW:
+        case DIR_MMM:
             lMinX1 = 3;
             lMaxX1 = 4;
             lMinX2 = 1;
@@ -1634,55 +1634,55 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     int TmaxX2 = maxX2;
     int TmaxX3 = maxX3;
 
-    if (block.lock()->hasInterpolationFlagCF(E)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(W)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(N)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0P0)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX3 == TminX3)
             minX3 += 2;
     }
 
     // E-W-N-S
-    if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(E)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_PP0) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_MM0) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_PM0) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(W)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_MP0) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (maxX2 == TmaxX2)
@@ -1690,29 +1690,29 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     //	////T-B-E-W
-    if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P0P) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M0M) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P0M) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M0P) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (maxX3 == TmaxX3)
@@ -1720,29 +1720,29 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     ////T-B-N-S
-    if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0PP) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0MM) && !block.lock()->hasInterpolationFlagCF(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX2 == TminX2)
             minX2 += 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0PM) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0MP) && !block.lock()->hasInterpolationFlagCF(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (minX2 == TminX2)
             minX2 += 2;
         if (maxX3 == TmaxX3)
@@ -1750,10 +1750,10 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     // if
-    // (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N)
-    // && !block.lock()->hasInterpolationFlagCF(D3Q27System::E)) if
-    // (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&
-    // !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
+    // (block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_PPP)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_0PP)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_PP0)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_00P)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_0P0)
+    // && !block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P00)) if
+    // (!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_00P)&&
+    // !block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P00))
     //{
     //   if (maxX1==TmaxX1) maxX1 -= 2;
     //   if (maxX2==TmaxX2) maxX2 -= 2;
@@ -1774,55 +1774,55 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     int TmaxX2 = maxX2;
     int TmaxX3 = maxX3;
 
-    if (block.lock()->hasInterpolationFlagCF(E)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(W)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(N)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0P0)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX3 == TminX3)
             minX3 += 2;
     }
 
     // E-W-N-S
-    if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(E)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_PP0) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_MM0) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(S)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_PM0) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_0M0)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (minX2 == TminX2)
             minX2 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(W)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_MP0) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (maxX2 == TmaxX2)
@@ -1830,29 +1830,29 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     //	////T-B-E-W
-    if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P0P) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M0M) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_P0M) && !block.lock()->hasInterpolationFlagCF(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M0P) && !block.lock()->hasInterpolationFlagCF(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (minX1 == TminX1)
             minX1 += 2;
         if (maxX3 == TmaxX3)
@@ -1860,29 +1860,29 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     ////T-B-N-S
-    if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0PP) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
         if (maxX3 == TmaxX3)
             maxX3 -= 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0MM) && !block.lock()->hasInterpolationFlagCF(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (minX2 == TminX2)
             minX2 += 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(B)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0PM) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00M)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 2;
         if (minX3 == TminX3)
             minX3 += 2;
     }
-    if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0MP) && !block.lock()->hasInterpolationFlagCF(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         if (minX2 == TminX2)
             minX2 += 2;
         if (maxX3 == TmaxX3)
@@ -1890,8 +1890,8 @@ void CoarseToFineVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     // if
-    // (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N)
-    // && !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
+    // (block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_PPP)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_0PP)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_PP0)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_00P)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_0P0)
+    // && !block.lock()->hasInterpolationFlagCF(D3Q27System::DIR_P00))
     //{
     //   if (maxX1==TmaxX1) maxX1 -= 2;
     //   if (maxX2==TmaxX2) maxX2 -= 2;
@@ -1923,7 +1923,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::findCFnodes()
     int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
 
     using namespace D3Q27System;
-    if (block.lock()->hasInterpolationFlagCF(W)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_M00)) {
         lMinX1 = 1;
         lMaxX1 = lMinX1 + 1;
 
@@ -1943,8 +1943,8 @@ void CoarseToFineVectorConnector<VectorTransmitter>::findCFnodes()
         getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
         findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
     }
-    if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) &&
-        !block.lock()->hasInterpolationFlagCF(T)) {
+    if (block.lock()->hasInterpolationFlagCF(DIR_0PP) && !block.lock()->hasInterpolationFlagCF(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagCF(DIR_00P)) {
         lMinX2 = maxX2 - 3;
         lMaxX2 = lMinX2 + 1;
         lMinX3 = maxX3 - 3;
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h
index e430a0ad3..f8809f17b 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h
@@ -143,16 +143,16 @@ FineToCoarseVectorConnector<VectorTransmitter>::FineToCoarseVectorConnector(SPtr
     : Block3DConnector(sendDir), block(block), sender(sender), receiver(receiver), iprocessor(iprocessor),
       connType(connType)
 {
-    if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N ||
-          sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B ||
-          sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE ||
-          sendDir == D3Q27System::NW || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW ||
-          sendDir == D3Q27System::BE || sendDir == D3Q27System::TW || sendDir == D3Q27System::TN ||
-          sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS
+    if (!(sendDir == D3Q27System::DIR_P00 || sendDir == D3Q27System::DIR_M00 || sendDir == D3Q27System::DIR_0P0 ||
+          sendDir == D3Q27System::DIR_0M0 || sendDir == D3Q27System::DIR_00P || sendDir == D3Q27System::DIR_00M ||
+          sendDir == D3Q27System::DIR_PP0 || sendDir == D3Q27System::DIR_MM0 || sendDir == D3Q27System::DIR_PM0 ||
+          sendDir == D3Q27System::DIR_MP0 || sendDir == D3Q27System::DIR_P0P || sendDir == D3Q27System::DIR_M0M ||
+          sendDir == D3Q27System::DIR_P0M || sendDir == D3Q27System::DIR_M0P || sendDir == D3Q27System::DIR_0PP ||
+          sendDir == D3Q27System::DIR_0MM || sendDir == D3Q27System::DIR_0PM || sendDir == D3Q27System::DIR_0MP
 
-          || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE ||
-          sendDir == D3Q27System::TSW || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW ||
-          sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW
+          || sendDir == D3Q27System::DIR_PPP || sendDir == D3Q27System::DIR_MPP || sendDir == D3Q27System::DIR_PMP ||
+          sendDir == D3Q27System::DIR_MMP || sendDir == D3Q27System::DIR_PPM || sendDir == D3Q27System::DIR_MPM ||
+          sendDir == D3Q27System::DIR_PMM || sendDir == D3Q27System::DIR_MMM
 
           )) {
         throw UbException(UB_EXARGS, "invalid constructor for this direction");
@@ -235,44 +235,44 @@ void FineToCoarseVectorConnector<VectorTransmitter>::init()
     int iCellSize       = 1; // size of interpolation cell
 
     switch (this->sendDir) {
-        case E:
-        case W:
+        case DIR_P00:
+        case DIR_M00:
             sendSize = (bMaxX2 - 1) / 2 * (bMaxX3 - 1) / 2 * sendDataPerNode * iCellSize;
             break;
-        case N:
-        case S:
+        case DIR_0P0:
+        case DIR_0M0:
             sendSize = (bMaxX1 - 1) / 2 * (bMaxX3 - 1) / 2 * sendDataPerNode * iCellSize;
             break;
-        case T:
-        case B:
+        case DIR_00P:
+        case DIR_00M:
             sendSize = (bMaxX1 - 1) / 2 * (bMaxX2 - 1) / 2 * sendDataPerNode * iCellSize;
             break;
-        case NE:
-        case SW:
-        case SE:
-        case NW:
+        case DIR_PP0:
+        case DIR_MM0:
+        case DIR_PM0:
+        case DIR_MP0:
             sendSize = (3 * bMaxX3 - 3) * sendDataPerNode * iCellSize;
             break; // buffer overhead, should be (3*bMaxX3-6) for even bMax3
-        case TE:
-        case BW:
-        case BE:
-        case TW:
+        case DIR_P0P:
+        case DIR_M0M:
+        case DIR_P0M:
+        case DIR_M0P:
             sendSize = (3 * bMaxX2 - 3) * sendDataPerNode * iCellSize;
             break;
-        case TN:
-        case BS:
-        case BN:
-        case TS:
+        case DIR_0PP:
+        case DIR_0MM:
+        case DIR_0PM:
+        case DIR_0MP:
             sendSize = (3 * bMaxX1 - 3) * sendDataPerNode * iCellSize;
             break;
-        case TNE:
-        case TNW:
-        case TSE:
-        case TSW:
-        case BNE:
-        case BNW:
-        case BSE:
-        case BSW:
+        case DIR_PPP:
+        case DIR_MPP:
+        case DIR_PMP:
+        case DIR_MMP:
+        case DIR_PPM:
+        case DIR_MPM:
+        case DIR_PMM:
+        case DIR_MMM:
             sendSize = 3 * (3 * bMaxX1 - 3) * sendDataPerNode * iCellSize;
             break;
         default:
@@ -321,42 +321,42 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
     //////////////
 
     switch (sendDir) {
-        case E:
+        case DIR_P00:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = maxX1 - 7;
             lMaxX1 = lMinX1 + 1;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case W:
+        case DIR_M00:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = 5;
             lMaxX1 = lMinX1 + 1;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case N:
+        case DIR_0P0:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = maxX2 - 7;
             lMaxX2 = lMinX2 + 1;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case S:
+        case DIR_0M0:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = 5;
             lMaxX2 = lMinX2 + 1;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case T:
+        case DIR_00P:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX3 = maxX3 - 7;
             lMaxX3 = lMinX3 + 1;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case B:
+        case DIR_00M:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX3 = 5;
@@ -365,7 +365,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         //	////N-S-E-W
-        case NE:
+        case DIR_PP0:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = maxX1 - 7;
@@ -380,7 +380,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             lMaxX2 = lMinX2 + 5;
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case SW:
+        case DIR_MM0:
 
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
@@ -397,7 +397,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case SE:
+        case DIR_PM0:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = maxX1 - 7;
@@ -414,7 +414,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
 
-        case NW:
+        case DIR_MP0:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = 1;
@@ -430,7 +430,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //////T-B-E-W
-        case TE:
+        case DIR_P0P:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = maxX1 - 7;
@@ -446,7 +446,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BW:
+        case DIR_M0M:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = 1;
@@ -462,7 +462,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BE:
+        case DIR_P0M:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = maxX1 - 7;
@@ -478,7 +478,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case TW:
+        case DIR_M0P:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX1 = 1;
@@ -495,7 +495,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
             ///////////////T-B-N-S
             //
-        case TN:
+        case DIR_0PP:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = maxX2 - 7;
@@ -511,7 +511,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BS:
+        case DIR_0MM:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = 1;
@@ -527,7 +527,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BN:
+        case DIR_0PM:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = maxX2 - 7;
@@ -543,7 +543,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case TS:
+        case DIR_0MP:
             getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
             getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
             lMinX2 = 1;
@@ -560,7 +560,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         // TNE
-        case TNE:
+        case DIR_PPP:
             lMinX1 = maxX1 - 7;
             lMaxX1 = maxX1 - 6;
             lMinX2 = maxX2 - 7;
@@ -587,7 +587,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         // TNW
-        case TNW:
+        case DIR_MPP:
             lMinX1 = 5;
             lMaxX1 = 6;
             lMinX2 = maxX2 - 7;
@@ -616,7 +616,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         //      TSE
-        case TSE:
+        case DIR_PMP:
             lMinX1 = maxX1 - 7;
             lMaxX1 = maxX1 - 6;
             lMinX2 = 1;
@@ -643,7 +643,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
         //      TSW
-        case TSW:
+        case DIR_MMP:
             lMinX1 = 5;
             lMaxX1 = 6;
             lMinX2 = 1;
@@ -670,7 +670,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
         //      BNE
-        case BNE:
+        case DIR_PPM:
             lMinX1 = maxX1 - 7;
             lMaxX1 = maxX1 - 6;
             lMinX2 = maxX2 - 7;
@@ -697,7 +697,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
 
             break;
         //      BNW
-        case BNW:
+        case DIR_MPM:
             lMinX1 = 5;
             lMaxX1 = 6;
             lMinX2 = maxX2 - 7;
@@ -725,7 +725,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         //      BSE
-        case BSE:
+        case DIR_PMM:
             lMinX1 = maxX1 - 7;
             lMaxX1 = maxX1 - 6;
             lMinX2 = 1;
@@ -753,7 +753,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVectors()
             break;
 
         // BSW
-        case BSW:
+        case DIR_MMM:
             lMinX1 = 5;
             lMaxX1 = 6;
             lMinX2 = 1;
@@ -869,42 +869,42 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
     lMaxX3 = maxX3 - 1;
 
     switch (sendDir) {
-        case E:
+        case DIR_P00:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 1;
             getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
             getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case W:
+        case DIR_M00:
             lMinX1 = 2;
             lMaxX1 = lMinX1 + 1;
             getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
             getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case N:
+        case DIR_0P0:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 1;
             getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
             getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case S:
+        case DIR_0M0:
             lMinX2 = 2;
             lMaxX2 = lMinX2 + 1;
             getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
             getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case T:
+        case DIR_00P:
             lMinX3 = maxX3 - 4;
             lMaxX3 = lMinX3 + 1;
             getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
             getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
-        case B:
+        case DIR_00M:
             lMinX3 = 2;
             lMaxX3 = lMinX3 + 1;
             getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
@@ -913,7 +913,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
 
             /////E-W-N-S
-        case NE:
+        case DIR_PP0:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = maxX2 - 4;
@@ -922,7 +922,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case SW:
+        case DIR_MM0:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = 0;
@@ -931,7 +931,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case SE:
+        case DIR_PM0:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = 0;
@@ -940,7 +940,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case NW:
+        case DIR_MP0:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 3;
             lMinX2 = maxX2 - 4;
@@ -950,7 +950,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
         //
         //	/////T-B-E-W
-        case TE:
+        case DIR_P0P:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = maxX3 - 4;
@@ -959,7 +959,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BW:
+        case DIR_M0M:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = 0;
@@ -968,7 +968,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BE:
+        case DIR_P0M:
             lMinX1 = maxX1 - 4;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = 0;
@@ -977,7 +977,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case TW:
+        case DIR_M0P:
             lMinX1 = 0;
             lMaxX1 = lMinX1 + 3;
             lMinX3 = maxX3 - 4;
@@ -988,7 +988,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
 
         //	////////////////T-B-N-S
         //
-        case TN:
+        case DIR_0PP:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = maxX3 - 4;
@@ -997,7 +997,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BS:
+        case DIR_0MM:
             lMinX2 = 0;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = 0;
@@ -1006,7 +1006,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case BN:
+        case DIR_0PM:
             lMinX2 = maxX2 - 4;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = 0;
@@ -1015,7 +1015,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
 
-        case TS:
+        case DIR_0MP:
             lMinX2 = 0;
             lMaxX2 = lMinX2 + 3;
             lMinX3 = maxX3 - 4;
@@ -1025,7 +1025,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             break;
 
         //   //TNE
-        case TNE:
+        case DIR_PPP:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 1;
             lMinX2 = maxX2 - 4;
@@ -1035,7 +1035,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   TNW
-        case TNW:
+        case DIR_MPP:
             lMinX1 = 0;
             lMaxX1 = 3;
             lMinX2 = maxX2 - 4;
@@ -1045,7 +1045,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   TSE
-        case TSE:
+        case DIR_PMP:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 1;
             lMinX2 = 0;
@@ -1055,7 +1055,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   TSW
-        case TSW:
+        case DIR_MMP:
             lMinX1 = 0;
             lMaxX1 = 3;
             lMinX2 = 0;
@@ -1065,7 +1065,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   BNE
-        case BNE:
+        case DIR_PPM:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 1;
             lMinX2 = maxX2 - 4;
@@ -1075,7 +1075,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   BNW
-        case BNW:
+        case DIR_MPM:
             lMinX1 = 0;
             lMaxX1 = 3;
             lMinX2 = maxX2 - 4;
@@ -1085,7 +1085,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             //   BSE
-        case BSE:
+        case DIR_PMM:
             lMinX1 = maxX1 - 4;
             lMaxX1 = maxX1 - 1;
             lMinX2 = 0;
@@ -1095,7 +1095,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::distributeReceiveVectors()
             distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
             break;
             // BSW
-        case BSW:
+        case DIR_MMM:
             lMinX1 = 0;
             lMaxX1 = 3;
             lMinX2 = 0;
@@ -1163,56 +1163,56 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     int TmaxX2 = maxX2;
     int TmaxX3 = maxX3;
 
-    if (block.lock()->hasInterpolationFlagFC(E)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(W)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(N)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0P0)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX3 == TminX3)
             minX3 += 4;
     }
 
     ////////////
     /////E-W-N-S
-    if (block.lock()->hasInterpolationFlagFC(NE) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(E)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_PP0) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(SW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_MM0) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(SE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_PM0) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(NW) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(W)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_MP0) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (maxX2 == TmaxX2)
@@ -1220,29 +1220,29 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     //////T-B-E-W
-    if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P0P) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(BW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M0M) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(BE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P0M) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(TW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M0P) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (maxX3 == TmaxX3)
@@ -1250,29 +1250,29 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     ////T-B-N-S
-    if (block.lock()->hasInterpolationFlagFC(TN) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0PP) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(BS) && !block.lock()->hasInterpolationFlagFC(S) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0MM) && !block.lock()->hasInterpolationFlagFC(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX2 == TminX2)
             minX2 += 4;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(BN) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0PM) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0MP) && !block.lock()->hasInterpolationFlagFC(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (minX2 == TminX2)
             minX2 += 4;
         if (maxX3 == TmaxX3)
@@ -1280,10 +1280,10 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     // if
-    // (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N)
-    // && !block.lock()->hasInterpolationFlagFC(D3Q27System::E)) if
-    // (!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T) &&
-    // !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
+    // (block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_PPP)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_0PP)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_PP0)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_00P)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_0P0)
+    // && !block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P00)) if
+    // (!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_00P) &&
+    // !block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P00))
     //{
     //   if (maxX1==TmaxX1) maxX1 -= 3;
     //   if (maxX2==TmaxX2) maxX2 -= 3;
@@ -1304,56 +1304,56 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     int TmaxX2 = maxX2;
     int TmaxX3 = maxX3;
 
-    if (block.lock()->hasInterpolationFlagFC(E)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(W)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(N)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0P0)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX3 == TminX3)
             minX3 += 4;
     }
 
     ////////////
     /////E-W-N-S
-    if (block.lock()->hasInterpolationFlagFC(NE) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(E)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_PP0) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_P00)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(SW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_MM0) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(SE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(S)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_PM0) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_0M0)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (minX2 == TminX2)
             minX2 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(NW) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(W)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_MP0) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_M00)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (maxX2 == TmaxX2)
@@ -1361,29 +1361,29 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     //////T-B-E-W
-    if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P0P) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(BW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M0M) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(BE) && !block.lock()->hasInterpolationFlagFC(E) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_P0M) && !block.lock()->hasInterpolationFlagFC(DIR_P00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (maxX1 == TmaxX1)
             maxX1 -= 3;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(TW) && !block.lock()->hasInterpolationFlagFC(W) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_M0P) && !block.lock()->hasInterpolationFlagFC(DIR_M00) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (minX1 == TminX1)
             minX1 += 4;
         if (maxX3 == TmaxX3)
@@ -1391,29 +1391,29 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     ////T-B-N-S
-    if (block.lock()->hasInterpolationFlagFC(TN) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0PP) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
         if (maxX3 == TmaxX3)
             maxX3 -= 3;
     }
-    if (block.lock()->hasInterpolationFlagFC(BS) && !block.lock()->hasInterpolationFlagFC(S) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0MM) && !block.lock()->hasInterpolationFlagFC(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (minX2 == TminX2)
             minX2 += 4;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(BN) && !block.lock()->hasInterpolationFlagFC(N) &&
-        !block.lock()->hasInterpolationFlagFC(B)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0PM) && !block.lock()->hasInterpolationFlagFC(DIR_0P0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00M)) {
         if (maxX2 == TmaxX2)
             maxX2 -= 3;
         if (minX3 == TminX3)
             minX3 += 4;
     }
-    if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) &&
-        !block.lock()->hasInterpolationFlagFC(T)) {
+    if (block.lock()->hasInterpolationFlagFC(DIR_0MP) && !block.lock()->hasInterpolationFlagFC(DIR_0M0) &&
+        !block.lock()->hasInterpolationFlagFC(DIR_00P)) {
         if (minX2 == TminX2)
             minX2 += 4;
         if (maxX3 == TmaxX3)
@@ -1421,8 +1421,8 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMinMax(int &minX1,
     }
 
     // if
-    // (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N)
-    // && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
+    // (block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_PPP)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P0P)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_0PP)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_PP0)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_00P)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_0P0)
+    // && !block.lock()->hasInterpolationFlagFC(D3Q27System::DIR_P00))
     //{
     //   if (maxX1==TmaxX1) maxX1 -= 3;
     //   if (maxX2==TmaxX2) maxX2 -= 3;
@@ -1448,8 +1448,8 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
     using namespace D3Q27System;
 
     switch (sendDir) {
-        case E:
-        case W:
+        case DIR_P00:
+        case DIR_M00:
             if (connType == OddEvenSE)
                 minX2 += oMinX2;
             if (connType == OddOddNE) {
@@ -1459,8 +1459,8 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
             if (connType == EvenOddNW)
                 minX3 += oMinX3;
             break;
-        case N:
-        case S:
+        case DIR_0P0:
+        case DIR_0M0:
             if (connType == OddEvenSE)
                 minX1 += oMinX1;
             if (connType == OddOddNE) {
@@ -1470,8 +1470,8 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
             if (connType == EvenOddNW)
                 minX3 += oMinX3;
             break;
-        case T:
-        case B:
+        case DIR_00P:
+        case DIR_00M:
             if (connType == OddEvenSE)
                 minX1 += oMinX1;
             if (connType == OddOddNE) {
@@ -1483,10 +1483,10 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
             break;
 
             /////
-        case NE:
-        case SW:
-        case SE:
-        case NW:
+        case DIR_PP0:
+        case DIR_MM0:
+        case DIR_PM0:
+        case DIR_MP0:
             // case SW:
             if (connType == OddEvenSE)
                 // minX2 += oMinX2;
@@ -1499,10 +1499,10 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
             break;
 
             //////
-        case TE:
-        case BW:
-        case BE:
-        case TW:
+        case DIR_P0P:
+        case DIR_M0M:
+        case DIR_P0M:
+        case DIR_M0P:
             if (connType == OddEvenSE)
                 //		minX1 += oMinX1;
                 if (connType == OddOddNE) {
@@ -1514,10 +1514,10 @@ void FineToCoarseVectorConnector<VectorTransmitter>::getLocalMins(int &minX1, in
             break;
 
         //	//////
-        case TN:
-        case BS:
-        case BN:
-        case TS:
+        case DIR_0PP:
+        case DIR_0MM:
+        case DIR_0PM:
+        case DIR_0MP:
             if (connType == OddEvenSE)
                 minX1 += oMinX1;
             if (connType == OddOddNE) {
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.cpp
index 858921de4..18a831958 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/FullDirectConnector.cpp
@@ -60,7 +60,7 @@ void FullDirectConnector::sendVectors()
 void FullDirectConnector::exchangeData()
 {
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 exchangeData(maxX1 - 1, x2, x3, 0, x2, x3);
@@ -68,7 +68,7 @@ void FullDirectConnector::exchangeData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 exchangeData(1, x2, x3, maxX1, x2, x3);
@@ -76,7 +76,7 @@ void FullDirectConnector::exchangeData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 exchangeData(x1, maxX2 - 1, x3, x1, 0, x3);
@@ -84,7 +84,7 @@ void FullDirectConnector::exchangeData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 exchangeData(x1, 1, x3, x1, maxX2, x3);
@@ -93,7 +93,7 @@ void FullDirectConnector::exchangeData()
     }
 
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 exchangeData(x1, x2, maxX3 - 1, x1, x2, 0);
@@ -101,7 +101,7 @@ void FullDirectConnector::exchangeData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 exchangeData(x1, x2, 1, x1, x2, maxX3);
@@ -109,77 +109,77 @@ void FullDirectConnector::exchangeData()
         }
     }
     // NORTHEAST
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3);
         }
     }
     // NORTHWEST
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3);
         }
     }
     // SOUTHWEST
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             exchangeData(1, 1, x3, maxX1, maxX2, x3);
         }
     }
     // SOUTHEAST
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3);
         }
-    } else if (sendDir == D3Q27System::TE)
+    } else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = 1; x2 < maxX2; x2++) {
             exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0);
         }
-    else if (sendDir == D3Q27System::BW)
+    else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = 1; x2 < maxX2; x2++) {
             exchangeData(1, x2, 1, maxX1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = 1; x2 < maxX2; x2++) {
             exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = 1; x2 < maxX2; x2++) {
             exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = 1; x1 < maxX1; x1++) {
             exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = 1; x1 < maxX1; x1++) {
             exchangeData(x1, 1, 1, x1, maxX2, maxX3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = 1; x1 < maxX1; x1++) {
             exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3);
         }
 
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = 1; x1 < maxX1; x1++) {
             exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0);
         }
 
-    else if (sendDir == D3Q27System::TSW) {
+    else if (sendDir == D3Q27System::DIR_MMP) {
         exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         exchangeData(1, 1, 1, maxX1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3);
-    } else if (sendDir == D3Q27System::BNE) {
+    } else if (sendDir == D3Q27System::DIR_PPM) {
         exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3);
     } else
         UB_THROW(UbException(UB_EXARGS, "unknown dir"));
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.cpp
index ccbd62c2f..d5b810015 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/FullVectorConnector.cpp
@@ -63,7 +63,7 @@ void FullVectorConnector::fillData()
 
     int index = 0;
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 fillData(sdata, index, maxX1 - 1, x2, x3);
@@ -71,7 +71,7 @@ void FullVectorConnector::fillData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 fillData(sdata, index, 1, x2, x3);
@@ -79,7 +79,7 @@ void FullVectorConnector::fillData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 fillData(sdata, index, x1, maxX2 - 1, x3);
@@ -87,7 +87,7 @@ void FullVectorConnector::fillData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 fillData(sdata, index, x1, 1, x3);
@@ -95,7 +95,7 @@ void FullVectorConnector::fillData()
         }
     }
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 fillData(sdata, index, x1, x2, maxX3 - 1);
@@ -103,7 +103,7 @@ void FullVectorConnector::fillData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 fillData(sdata, index, x1, x2, 1);
@@ -111,24 +111,24 @@ void FullVectorConnector::fillData()
         }
     }
     // NE NW SW SE
-    else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW ||
-             sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PP0 || sendDir == D3Q27System::DIR_MP0 || sendDir == D3Q27System::DIR_MM0 ||
+             sendDir == D3Q27System::DIR_PM0) {
         int x1 = 0;
         int x2 = 0;
         switch (sendDir) {
-            case D3Q27System::NE:
+            case D3Q27System::DIR_PP0:
                 x1 = maxX1 - 1;
                 x2 = maxX2 - 1;
                 break;
-            case D3Q27System::NW:
+            case D3Q27System::DIR_MP0:
                 x1 = 1;
                 x2 = maxX2 - 1;
                 break;
-            case D3Q27System::SW:
+            case D3Q27System::DIR_MM0:
                 x1 = 1;
                 x2 = 1;
                 break;
-            case D3Q27System::SE:
+            case D3Q27System::DIR_PM0:
                 x1 = maxX1 - 1;
                 x2 = 1;
                 break;
@@ -138,24 +138,24 @@ void FullVectorConnector::fillData()
         }
     }
     // TE TW BW BE
-    else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW ||
-             sendDir == D3Q27System::BE) {
+    else if (sendDir == D3Q27System::DIR_P0P || sendDir == D3Q27System::DIR_M0P || sendDir == D3Q27System::DIR_M0M ||
+             sendDir == D3Q27System::DIR_P0M) {
         int x1 = 0;
         int x3 = 0;
         switch (sendDir) {
-            case D3Q27System::TE:
+            case D3Q27System::DIR_P0P:
                 x1 = maxX1 - 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::TW:
+            case D3Q27System::DIR_M0P:
                 x1 = 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::BW:
+            case D3Q27System::DIR_M0M:
                 x1 = 1;
                 x3 = 1;
                 break;
-            case D3Q27System::BE:
+            case D3Q27System::DIR_P0M:
                 x1 = maxX1 - 1;
                 x3 = 1;
                 break;
@@ -165,24 +165,24 @@ void FullVectorConnector::fillData()
         }
     }
     // TN BN BS TS
-    else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS ||
-             sendDir == D3Q27System::TS) {
+    else if (sendDir == D3Q27System::DIR_0PP || sendDir == D3Q27System::DIR_0PM || sendDir == D3Q27System::DIR_0MM ||
+             sendDir == D3Q27System::DIR_0MP) {
         int x2 = 0;
         int x3 = 0;
         switch (sendDir) {
-            case D3Q27System::TN:
+            case D3Q27System::DIR_0PP:
                 x3 = maxX3 - 1;
                 x2 = maxX2 - 1;
                 break;
-            case D3Q27System::BN:
+            case D3Q27System::DIR_0PM:
                 x3 = 1;
                 x2 = maxX2 - 1;
                 break;
-            case D3Q27System::BS:
+            case D3Q27System::DIR_0MM:
                 x3 = 1;
                 x2 = 1;
                 break;
-            case D3Q27System::TS:
+            case D3Q27System::DIR_0MP:
                 x3 = maxX3 - 1;
                 x2 = 1;
                 break;
@@ -192,49 +192,49 @@ void FullVectorConnector::fillData()
         }
     }
     // TNE TNW TSW TSE BNE BNW BSW BSE
-    else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW ||
-             sendDir == D3Q27System::TSE || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW ||
-             sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE) {
+    else if (sendDir == D3Q27System::DIR_PPP || sendDir == D3Q27System::DIR_MPP || sendDir == D3Q27System::DIR_MMP ||
+             sendDir == D3Q27System::DIR_PMP || sendDir == D3Q27System::DIR_PPM || sendDir == D3Q27System::DIR_MPM ||
+             sendDir == D3Q27System::DIR_MMM || sendDir == D3Q27System::DIR_PMM) {
         int x1 = 0;
         int x2 = 0;
         int x3 = 0;
         switch (sendDir) {
-            case D3Q27System::TNE:
+            case D3Q27System::DIR_PPP:
                 x1 = maxX1 - 1;
                 x2 = maxX2 - 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::TNW:
+            case D3Q27System::DIR_MPP:
                 x1 = 1;
                 x2 = maxX2 - 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::TSW:
+            case D3Q27System::DIR_MMP:
                 x1 = 1;
                 x2 = 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::TSE:
+            case D3Q27System::DIR_PMP:
                 x1 = maxX1 - 1;
                 x2 = 1;
                 x3 = maxX3 - 1;
                 break;
-            case D3Q27System::BNE:
+            case D3Q27System::DIR_PPM:
                 x1 = maxX1 - 1;
                 x2 = maxX2 - 1;
                 x3 = 1;
                 break;
-            case D3Q27System::BNW:
+            case D3Q27System::DIR_MPM:
                 x1 = 1;
                 x2 = maxX2 - 1;
                 x3 = 1;
                 break;
-            case D3Q27System::BSW:
+            case D3Q27System::DIR_MMM:
                 x1 = 1;
                 x2 = 1;
                 x3 = 1;
                 break;
-            case D3Q27System::BSE:
+            case D3Q27System::DIR_PMM:
                 x1 = maxX1 - 1;
                 x2 = 1;
                 x3 = 1;
@@ -257,37 +257,37 @@ void FullVectorConnector::distributeData()
 
     int index = 0;
 
-    if (sendDir == D3Q27System::W) {
+    if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 distributeData(rdata, index, 0, x2, x3);
             }
         }
-    } else if (sendDir == D3Q27System::E) {
+    } else if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x2 = 1; x2 < maxX2; x2++) {
                 distributeData(rdata, index, maxX1, x2, x3);
             }
         }
-    } else if (sendDir == D3Q27System::S) {
+    } else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 distributeData(rdata, index, x1, 0, x3);
             }
         }
-    } else if (sendDir == D3Q27System::N) {
+    } else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = 1; x3 < maxX3; x3++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 distributeData(rdata, index, x1, maxX2, x3);
             }
         }
-    } else if (sendDir == D3Q27System::B) {
+    } else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 distributeData(rdata, index, x1, x2, 0);
             }
         }
-    } else if (sendDir == D3Q27System::T) {
+    } else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = 1; x2 < maxX2; x2++) {
             for (int x1 = 1; x1 < maxX1; x1++) {
                 distributeData(rdata, index, x1, x2, maxX3);
@@ -295,25 +295,25 @@ void FullVectorConnector::distributeData()
         }
     }
     // NE NW SW SE
-    else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW ||
-             sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PP0 || sendDir == D3Q27System::DIR_MP0 || sendDir == D3Q27System::DIR_MM0 ||
+             sendDir == D3Q27System::DIR_PM0) {
         int x1 = 0;
         int x2 = 0;
         switch (sendDir) // wenn sendir NE dann kommen werte von SW
         {
-            case D3Q27System::NE:
+            case D3Q27System::DIR_PP0:
                 x1 = maxX1;
                 x2 = maxX2;
                 break;
-            case D3Q27System::NW:
+            case D3Q27System::DIR_MP0:
                 x1 = 0;
                 x2 = maxX2;
                 break;
-            case D3Q27System::SW:
+            case D3Q27System::DIR_MM0:
                 x1 = 0;
                 x2 = 0;
                 break;
-            case D3Q27System::SE:
+            case D3Q27System::DIR_PM0:
                 x1 = maxX1;
                 x2 = 0;
                 break;
@@ -324,27 +324,27 @@ void FullVectorConnector::distributeData()
 
     }
     // TE TW BW BE
-    else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW ||
-             sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0P || sendDir == D3Q27System::DIR_M0P || sendDir == D3Q27System::DIR_M0M ||
+             sendDir == D3Q27System::DIR_P0M)
 
     {
         int x1 = 0;
         int x3 = 0;
         switch (sendDir) // wenn sendir NE dann kommen werte von SW
         {
-            case D3Q27System::TE:
+            case D3Q27System::DIR_P0P:
                 x1 = maxX1;
                 x3 = maxX3;
                 break;
-            case D3Q27System::TW:
+            case D3Q27System::DIR_M0P:
                 x1 = 0;
                 x3 = maxX3;
                 break;
-            case D3Q27System::BW:
+            case D3Q27System::DIR_M0M:
                 x1 = 0;
                 x3 = 0;
                 break;
-            case D3Q27System::BE:
+            case D3Q27System::DIR_P0M:
                 x1 = maxX1;
                 x3 = 0;
                 break;
@@ -354,24 +354,24 @@ void FullVectorConnector::distributeData()
         }
     }
     // TN BN BS TS
-    else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS ||
-             sendDir == D3Q27System::TS) {
+    else if (sendDir == D3Q27System::DIR_0PP || sendDir == D3Q27System::DIR_0PM || sendDir == D3Q27System::DIR_0MM ||
+             sendDir == D3Q27System::DIR_0MP) {
         int x2 = 0;
         int x3 = 0;
         switch (sendDir) {
-            case D3Q27System::TN:
+            case D3Q27System::DIR_0PP:
                 x3 = maxX3;
                 x2 = maxX2;
                 break;
-            case D3Q27System::BN:
+            case D3Q27System::DIR_0PM:
                 x3 = 0;
                 x2 = maxX2;
                 break;
-            case D3Q27System::BS:
+            case D3Q27System::DIR_0MM:
                 x3 = 0;
                 x2 = 0;
                 break;
-            case D3Q27System::TS:
+            case D3Q27System::DIR_0MP:
                 x3 = maxX3;
                 x2 = 0;
                 break;
@@ -381,50 +381,50 @@ void FullVectorConnector::distributeData()
         }
     }
     // TNE TNW TSW TSE BNE BNW BSW BSE
-    else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW ||
-             sendDir == D3Q27System::TSE || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW ||
-             sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE) {
+    else if (sendDir == D3Q27System::DIR_PPP || sendDir == D3Q27System::DIR_MPP || sendDir == D3Q27System::DIR_MMP ||
+             sendDir == D3Q27System::DIR_PMP || sendDir == D3Q27System::DIR_PPM || sendDir == D3Q27System::DIR_MPM ||
+             sendDir == D3Q27System::DIR_MMM || sendDir == D3Q27System::DIR_PMM) {
         int x1 = 0;
         int x2 = 0;
         int x3 = 0;
 
         switch (sendDir) {
-            case D3Q27System::TNE:
+            case D3Q27System::DIR_PPP:
                 x1 = maxX1;
                 x2 = maxX2;
                 x3 = maxX3;
                 break;
-            case D3Q27System::TNW:
+            case D3Q27System::DIR_MPP:
                 x1 = 0;
                 x2 = maxX2;
                 x3 = maxX3;
                 break;
-            case D3Q27System::TSW:
+            case D3Q27System::DIR_MMP:
                 x1 = 0;
                 x2 = 0;
                 x3 = maxX3;
                 break;
-            case D3Q27System::TSE:
+            case D3Q27System::DIR_PMP:
                 x1 = maxX1;
                 x2 = 0;
                 x3 = maxX3;
                 break;
-            case D3Q27System::BNE:
+            case D3Q27System::DIR_PPM:
                 x1 = maxX1;
                 x2 = maxX2;
                 x3 = 0;
                 break;
-            case D3Q27System::BNW:
+            case D3Q27System::DIR_MPM:
                 x1 = 0;
                 x2 = maxX2;
                 x3 = 0;
                 break;
-            case D3Q27System::BSW:
+            case D3Q27System::DIR_MMM:
                 x1 = 0;
                 x2 = 0;
                 x3 = 0;
                 break;
-            case D3Q27System::BSE:
+            case D3Q27System::DIR_PMM:
                 x1 = maxX1;
                 x2 = 0;
                 x3 = 0;
diff --git a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
index 21dbee2f9..72f43858a 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp
@@ -21,48 +21,48 @@ void OneDistributionFullVectorConnector::init()
         case D3Q27System::DIR_000:
             UB_THROW(UbException(UB_EXARGS, "ZERO not allowed"));
             break;
-        case D3Q27System::E:
-        case D3Q27System::W:
+        case D3Q27System::DIR_P00:
+        case D3Q27System::DIR_M00:
             sender->getData().resize(maxX2 * maxX3 * anz, 0.0);
             break;
-        case D3Q27System::N:
-        case D3Q27System::S:
+        case D3Q27System::DIR_0P0:
+        case D3Q27System::DIR_0M0:
             sender->getData().resize(maxX1 * maxX3 * anz, 0.0);
             break;
-        case D3Q27System::T:
-        case D3Q27System::B:
+        case D3Q27System::DIR_00P:
+        case D3Q27System::DIR_00M:
             sender->getData().resize(maxX1 * maxX2 * anz, 0.0);
             break;
 
-        case D3Q27System::NE:
-        case D3Q27System::SW:
-        case D3Q27System::SE:
-        case D3Q27System::NW:
+        case D3Q27System::DIR_PP0:
+        case D3Q27System::DIR_MM0:
+        case D3Q27System::DIR_PM0:
+        case D3Q27System::DIR_MP0:
             sender->getData().resize(maxX3 * anz, 0.0);
             break;
 
-        case D3Q27System::TE:
-        case D3Q27System::BW:
-        case D3Q27System::BE:
-        case D3Q27System::TW:
+        case D3Q27System::DIR_P0P:
+        case D3Q27System::DIR_M0M:
+        case D3Q27System::DIR_P0M:
+        case D3Q27System::DIR_M0P:
             sender->getData().resize(maxX2 * anz, 0.0);
             break;
 
-        case D3Q27System::TN:
-        case D3Q27System::BS:
-        case D3Q27System::BN:
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0PP:
+        case D3Q27System::DIR_0MM:
+        case D3Q27System::DIR_0PM:
+        case D3Q27System::DIR_0MP:
             sender->getData().resize(maxX1 * anz, 0.0);
             break;
 
-        case D3Q27System::TNE:
-        case D3Q27System::BSW:
-        case D3Q27System::BNE:
-        case D3Q27System::TSW:
-        case D3Q27System::TSE:
-        case D3Q27System::BNW:
-        case D3Q27System::BSE:
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_PPP:
+        case D3Q27System::DIR_MMM:
+        case D3Q27System::DIR_PPM:
+        case D3Q27System::DIR_MMP:
+        case D3Q27System::DIR_PMP:
+        case D3Q27System::DIR_MPM:
+        case D3Q27System::DIR_PMM:
+        case D3Q27System::DIR_MPP:
             sender->getData().resize(anz, 0.0);
             break;
 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
index d0ff594f7..782b0f27d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullDirectConnector.cpp
@@ -94,7 +94,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
     int maxX3m3 = maxX3 - 3;
 
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 exchangeData(maxX1m3, x2, x3, minX1, x2, x3);
@@ -103,7 +103,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 exchangeData(minX1p3, x2, x3, maxX1, x2, x3);
@@ -112,7 +112,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, maxX2m3, x3, x1, minX2, x3);
@@ -121,7 +121,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, minX2p3, x3, x1, maxX2, x3);
@@ -131,7 +131,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
     }
 
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, x2, maxX3m3, x1, x2, minX3);
@@ -140,7 +140,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, x2, minX3p3, x1, x2, maxX3);
@@ -149,7 +149,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTHEAST
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, maxX2m3, x3, minX1, minX2, x3);
             exchangeData(maxX1m2, maxX2m2, x3, minX1p1, minX2p1, x3);
@@ -158,7 +158,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTHWEST
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, maxX2m3, x3, maxX1, minX2, x3);
             exchangeData(minX1p2, maxX2m2, x3, maxX1m1, minX2p1, x3);
@@ -167,7 +167,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTHWEST
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, minX2p3, x3, maxX1, maxX2, x3);
             exchangeData(minX1p2, minX2p2, x3, maxX1m1, maxX2m1, x3);
@@ -176,70 +176,70 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTHEAST
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, minX2p3, x3, minX1, maxX2, x3);
             exchangeData(maxX1m2, minX2p2, x3, minX1p1, maxX2m1, x3);
             exchangeData(maxX1m3, minX2p2, x3, minX1, maxX2m1, x3);
             exchangeData(maxX1m2, minX2p3, x3, minX1p1, maxX2, x3);
         }
-    } else if (sendDir == D3Q27System::TE)
+    } else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, maxX3m3, minX1, x2, minX3);
             exchangeData(maxX1m2, x2, maxX3m2, minX1p1, x2, minX3p1);
             exchangeData(maxX1m3, x2, maxX3m2, minX1, x2, minX3p1);
             exchangeData(maxX1m2, x2, maxX3m3, minX1p1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::BW)
+    else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, minX3p3, maxX1, x2, maxX3);
             exchangeData(minX1p2, x2, minX3p2, maxX1m1, x2, maxX3m1);
             exchangeData(minX1p3, x2, minX3p2, maxX1, x2, maxX3m1);
             exchangeData(minX1p2, x2, minX3p3, maxX1m1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, minX3p3, minX1, x2, maxX3);
             exchangeData(maxX1m2, x2, minX3p2, minX1p1, x2, maxX3m1);
             exchangeData(maxX1m3, x2, minX3p2, minX1, x2, maxX3m1);
             exchangeData(maxX1m2, x2, minX3p3, minX1p1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, maxX3m3, maxX1, x2, minX3);
             exchangeData(minX1p2, x2, maxX3m2, maxX1m1, x2, minX3p1);
             exchangeData(minX1p3, x2, maxX3m2, maxX1, x2, minX3p1);
             exchangeData(minX1p2, x2, maxX3m3, maxX1m1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, maxX3m3, x1, minX2, minX3);
             exchangeData(x1, maxX2m2, maxX3m2, x1, minX2p1, minX3p1);
             exchangeData(x1, maxX2m3, maxX3m2, x1, minX2, minX3p1);
             exchangeData(x1, maxX2m2, maxX3m3, x1, minX2p1, minX3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, minX3p3, x1, maxX2, maxX3);
             exchangeData(x1, minX2p2, minX3p2, x1, maxX2m1, maxX3m1);
             exchangeData(x1, minX2p3, minX3p2, x1, maxX2, maxX3m1);
             exchangeData(x1, minX2p2, minX3p3, x1, maxX2m1, maxX3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, minX3p3, x1, minX2, maxX3);
             exchangeData(x1, maxX2m2, minX3p2, x1, minX2p1, maxX3m1);
             exchangeData(x1, maxX2m3, minX3p2, x1, minX2, maxX3m1);
             exchangeData(x1, maxX2m2, minX3p3, x1, minX2p1, maxX3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, maxX3m3, x1, maxX2, minX3);
             exchangeData(x1, minX2p2, maxX3m2, x1, maxX2m1, minX3p1);
             exchangeData(x1, minX2p3, maxX3m2, x1, maxX2, minX3p1);
             exchangeData(x1, minX2p2, maxX3m3, x1, maxX2m1, minX3);
         }
-    else if (sendDir == D3Q27System::TSW) {
+    else if (sendDir == D3Q27System::DIR_MMP) {
         exchangeData(minX1p3, minX2p3, maxX3m3, maxX1, maxX2, minX3);
         exchangeData(minX1p2, minX2p2, maxX3m2, maxX1m1, maxX2m1, minX3p1);
         exchangeData(minX1p3, minX2p2, maxX3m2, maxX1, maxX2m1, minX3p1);
@@ -248,7 +248,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, minX2p3, maxX3m2, maxX1, maxX2, minX3p1);
         exchangeData(minX1p3, minX2p2, maxX3m3, maxX1, maxX2m1, minX3);
         exchangeData(minX1p2, minX2p3, maxX3m3, maxX1m1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         exchangeData(maxX1m3, minX1p3, maxX3m3, minX1, maxX2, minX3);
         exchangeData(maxX1m2, minX1p2, maxX3m2, minX1p1, maxX2m1, minX3p1);
         exchangeData(maxX1m3, minX1p2, maxX3m2, minX1, maxX2m1, minX3p1);
@@ -257,7 +257,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, minX1p3, maxX3m2, minX1, maxX2, minX3p1);
         exchangeData(maxX1m3, minX1p2, maxX3m3, minX1, maxX2m1, minX3);
         exchangeData(maxX1m2, minX1p3, maxX3m3, minX1p1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         exchangeData(minX1p3, maxX2m3, maxX3m3, maxX1, minX2, minX3);
         exchangeData(minX1p2, maxX2m2, maxX3m2, maxX1m1, minX2p1, minX3p1);
         exchangeData(minX1p3, maxX2m2, maxX3m2, maxX1, minX2p1, minX3p1);
@@ -266,7 +266,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, maxX2m3, maxX3m2, maxX1, minX2, minX3p1);
         exchangeData(minX1p3, maxX2m2, maxX3m3, maxX1, minX2p1, minX3);
         exchangeData(minX1p2, maxX2m3, maxX3m3, maxX1m1, minX2, minX3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         exchangeData(maxX1m3, maxX2m3, maxX3m3, minX1, minX2, minX3);
         exchangeData(maxX1m2, maxX2m2, maxX3m2, minX1p1, minX2p1, minX3p1);
         exchangeData(maxX1m3, maxX2m2, maxX3m2, minX1, minX2p1, minX3p1);
@@ -275,7 +275,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, maxX2m3, maxX3m2, minX1, minX2, minX3p1);
         exchangeData(maxX1m3, maxX2m2, maxX3m3, minX1, minX2p1, minX3);
         exchangeData(maxX1m2, maxX2m3, maxX3m3, minX1p1, minX2, minX3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         exchangeData(minX1p3, minX2p3, minX3p3, maxX1, maxX2, maxX3);
         exchangeData(minX1p2, minX2p2, minX3p2, maxX1m1, maxX2m1, maxX3m1);
         exchangeData(minX1p3, minX2p2, minX3p2, maxX1, maxX2m1, maxX3m1);
@@ -284,7 +284,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, minX2p3, minX3p2, maxX1, maxX2, maxX3m1);
         exchangeData(minX1p3, minX2p2, minX3p3, maxX1, maxX2m1, maxX3);
         exchangeData(minX1p2, minX2p3, minX3p3, maxX1m1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         exchangeData(maxX1m3, minX2p3, minX3p3, minX1, maxX2, maxX3);
         exchangeData(maxX1m2, minX2p2, minX3p2, minX1p1, maxX2m1, maxX3m1);
         exchangeData(maxX1m3, minX2p2, minX3p2, minX1, maxX2m1, maxX3m1);
@@ -293,7 +293,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, minX2p3, minX3p2, minX1, maxX2, maxX3m1);
         exchangeData(maxX1m3, minX2p2, minX3p3, minX1, maxX2m1, maxX3);
         exchangeData(maxX1m2, minX2p3, minX3p3, minX1p1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         exchangeData(minX1p3, maxX2m3, minX3p3, maxX1, minX2, maxX3);
         exchangeData(minX1p2, maxX2m2, minX3p2, maxX1m1, minX2p1, maxX3m1);
         exchangeData(minX1p3, maxX2m2, minX3p2, maxX1, minX2p1, maxX3m1);
@@ -302,7 +302,7 @@ void ThreeDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, maxX2m3, minX3p2, maxX1, minX2, maxX3m1);
         exchangeData(minX1p3, maxX2m2, minX3p3, maxX1, minX2p1, maxX3);
         exchangeData(minX1p2, maxX2m3, minX3p3, maxX1m1, minX2, maxX3);
-    } else if (sendDir == D3Q27System::BNE) {
+    } else if (sendDir == D3Q27System::DIR_PPM) {
         exchangeData(maxX1m3, maxX2m3, minX3p3, minX1, minX2, maxX3);
         exchangeData(maxX1m2, maxX2m2, minX3p2, minX1p1, minX2p1, maxX3m1);
         exchangeData(maxX1m3, maxX2m2, minX3p2, minX1, minX2p1, maxX3m1);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
index 7d2e5e00a..0b94f7b4a 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -61,36 +61,36 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init()
    switch (sendDir)
    {
    case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
-   case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
-   case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
-   case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
+   case D3Q27System::DIR_P00:
+   case D3Q27System::DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::DIR_0P0:
+   case D3Q27System::DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::DIR_00P:
+   case D3Q27System::DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
 
-   case D3Q27System::NE:
-   case D3Q27System::SW:
-   case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
+   case D3Q27System::DIR_PP0:
+   case D3Q27System::DIR_MM0:
+   case D3Q27System::DIR_PM0:
+   case D3Q27System::DIR_MP0:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
 
-   case D3Q27System::TE:
-   case D3Q27System::BW:
-   case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
+   case D3Q27System::DIR_P0P:
+   case D3Q27System::DIR_M0M:
+   case D3Q27System::DIR_P0M:
+   case D3Q27System::DIR_M0P:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
 
-   case D3Q27System::TN:
-   case D3Q27System::BS:
-   case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
+   case D3Q27System::DIR_0PP:
+   case D3Q27System::DIR_0MM:
+   case D3Q27System::DIR_0PM:
+   case D3Q27System::DIR_0MP:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
 
-   case D3Q27System::TNE:
-   case D3Q27System::BSW:
-   case D3Q27System::BNE:
-   case D3Q27System::TSW:
-   case D3Q27System::TSE:
-   case D3Q27System::BNW:
-   case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz*8, 0.0);   break;
+   case D3Q27System::DIR_PPP:
+   case D3Q27System::DIR_MMM:
+   case D3Q27System::DIR_PPM:
+   case D3Q27System::DIR_MMP:
+   case D3Q27System::DIR_PMP:
+   case D3Q27System::DIR_MPM:
+   case D3Q27System::DIR_PMM:
+   case D3Q27System::DIR_MPP:  sender->getData().resize(anz*8, 0.0);   break;
 
    default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
    }
@@ -138,7 +138,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
 
     int index = 0;
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 fillData(sdata, index, maxX1m3, x2, x3);
@@ -147,7 +147,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 fillData(sdata, index, minX1p3, x2, x3);
@@ -156,7 +156,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, maxX2m3, x3);
@@ -165,7 +165,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, minX2p3, x3);
@@ -175,7 +175,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
     }
 
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, x2, maxX3m3);
@@ -184,7 +184,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, x2, minX3p3);
@@ -193,7 +193,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTHEAST
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, maxX1m3, maxX2m3, x3);
             fillData(sdata, index, maxX1m2, maxX2m2, x3);
@@ -202,7 +202,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTHWEST
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, minX1p3, maxX2m3, x3);
             fillData(sdata, index, minX1p2, maxX2m2, x3);
@@ -211,7 +211,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTHWEST
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, minX1p3, minX2p3, x3);
             fillData(sdata, index, minX1p2, minX2p2, x3);
@@ -220,70 +220,70 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTHEAST
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, maxX1m3, minX2p3, x3);
             fillData(sdata, index, maxX1m2, minX2p2, x3);
             fillData(sdata, index, maxX1m3, minX2p2, x3);
             fillData(sdata, index, maxX1m2, minX2p3, x3);
         }
-    } else if (sendDir == D3Q27System::TE)
+    } else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, maxX1m3, x2, maxX3m3);
             fillData(sdata, index, maxX1m2, x2, maxX3m2);
             fillData(sdata, index, maxX1m3, x2, maxX3m2);
             fillData(sdata, index, maxX1m2, x2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::BW)
+    else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, minX1p3, x2, minX3p3);
             fillData(sdata, index, minX1p2, x2, minX3p2);
             fillData(sdata, index, minX1p3, x2, minX3p2);
             fillData(sdata, index, minX1p2, x2, minX3p3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, maxX1m3, x2, minX3p3);
             fillData(sdata, index, maxX1m2, x2, minX3p2);
             fillData(sdata, index, maxX1m3, x2, minX3p2);
             fillData(sdata, index, maxX1m2, x2, minX3p3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, minX1p3, x2, maxX3m3);
             fillData(sdata, index, minX1p2, x2, maxX3m2);
             fillData(sdata, index, minX1p3, x2, maxX3m2);
             fillData(sdata, index, minX1p2, x2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, maxX2m3, maxX3m3);
             fillData(sdata, index, x1, maxX2m2, maxX3m2);
             fillData(sdata, index, x1, maxX2m3, maxX3m2);
             fillData(sdata, index, x1, maxX2m2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, minX2p3, minX3p3);
             fillData(sdata, index, x1, minX2p2, minX3p2);
             fillData(sdata, index, x1, minX2p3, minX3p2);
             fillData(sdata, index, x1, minX2p2, minX3p3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, maxX2m3, minX3p3);
             fillData(sdata, index, x1, maxX2m2, minX3p2);
             fillData(sdata, index, x1, maxX2m3, minX3p2);
             fillData(sdata, index, x1, maxX2m2, minX3p3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, minX2p3, maxX3m3);
             fillData(sdata, index, x1, minX2p2, maxX3m2);
             fillData(sdata, index, x1, minX2p3, maxX3m2);
             fillData(sdata, index, x1, minX2p2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::TSW) {
+    else if (sendDir == D3Q27System::DIR_MMP) {
         fillData(sdata, index, minX1p3, minX2p3, maxX3m3);
         fillData(sdata, index, minX1p2, minX2p2, maxX3m2);
         fillData(sdata, index, minX1p3, minX2p2, maxX3m2);
@@ -292,7 +292,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, minX2p3, maxX3m2);
         fillData(sdata, index, minX1p3, minX2p2, maxX3m3);
         fillData(sdata, index, minX1p2, minX2p3, maxX3m3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         fillData(sdata, index, maxX1m3, minX1p3, maxX3m3);
         fillData(sdata, index, maxX1m2, minX1p2, maxX3m2);
         fillData(sdata, index, maxX1m3, minX1p2, maxX3m2);
@@ -301,7 +301,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, minX1p3, maxX3m2);
         fillData(sdata, index, maxX1m3, minX1p2, maxX3m3);
         fillData(sdata, index, maxX1m2, minX1p3, maxX3m3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         fillData(sdata, index, minX1p3, maxX2m3, maxX3m3);
         fillData(sdata, index, minX1p2, maxX2m2, maxX3m2);
         fillData(sdata, index, minX1p3, maxX2m2, maxX3m2);
@@ -310,7 +310,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, maxX2m3, maxX3m2);
         fillData(sdata, index, minX1p3, maxX2m2, maxX3m3);
         fillData(sdata, index, minX1p2, maxX2m3, maxX3m3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         fillData(sdata, index, maxX1m3, maxX2m3, maxX3m3);
         fillData(sdata, index, maxX1m2, maxX2m2, maxX3m2);
         fillData(sdata, index, maxX1m3, maxX2m2, maxX3m2);
@@ -319,7 +319,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, maxX2m3, maxX3m2);
         fillData(sdata, index, maxX1m3, maxX2m2, maxX3m3);
         fillData(sdata, index, maxX1m2, maxX2m3, maxX3m3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         fillData(sdata, index, minX1p3, minX2p3, minX3p3);
         fillData(sdata, index, minX1p2, minX2p2, minX3p2);
         fillData(sdata, index, minX1p3, minX2p2, minX3p2);
@@ -328,7 +328,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, minX2p3, minX3p2);
         fillData(sdata, index, minX1p3, minX2p2, minX3p3);
         fillData(sdata, index, minX1p2, minX2p3, minX3p3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         fillData(sdata, index, maxX1m3, minX2p3, minX3p3);
         fillData(sdata, index, maxX1m2, minX2p2, minX3p2);
         fillData(sdata, index, maxX1m3, minX2p2, minX3p2);
@@ -337,7 +337,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, minX2p3, minX3p2);
         fillData(sdata, index, maxX1m3, minX2p2, minX3p3);
         fillData(sdata, index, maxX1m2, minX2p3, minX3p3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         fillData(sdata, index, minX1p3, maxX2m3, minX3p3);
         fillData(sdata, index, minX1p2, maxX2m2, minX3p2);
         fillData(sdata, index, minX1p3, maxX2m2, minX3p2);
@@ -346,7 +346,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, maxX2m3, minX3p2);
         fillData(sdata, index, minX1p3, maxX2m2, minX3p3);
         fillData(sdata, index, minX1p2, maxX2m3, minX3p3);
-    } else if (sendDir == D3Q27System::BNE) {
+    } else if (sendDir == D3Q27System::DIR_PPM) {
         fillData(sdata, index, maxX1m3, maxX2m3, minX3p3);
         fillData(sdata, index, maxX1m2, maxX2m2, minX3p2);
         fillData(sdata, index, maxX1m3, maxX2m2, minX3p2);
@@ -400,7 +400,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
     int maxX3m2 = maxX3 - 2;
     //int maxX3m3 = maxX3 - 3;
 
-    if (sendDir == D3Q27System::W) {
+    if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 distributeData(rdata, index, minX1, x2, x3);
@@ -408,7 +408,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::E) {
+    else if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 distributeData(rdata, index, maxX1, x2, x3);
@@ -416,7 +416,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, minX2, x3);
@@ -424,7 +424,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, maxX2, x3);
@@ -432,7 +432,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, x2, minX3);
@@ -440,7 +440,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, x2, maxX3);
@@ -448,7 +448,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, minX2, x3);
             distributeData(rdata, index, minX1p1, minX2p1, x3);
@@ -456,7 +456,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, minX1p1, minX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, minX2, x3);
             distributeData(rdata, index, maxX1m1, minX2p1, x3);
@@ -464,7 +464,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, maxX1m1, minX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, maxX2, x3);
             distributeData(rdata, index, maxX1m1, maxX2m1, x3);
@@ -472,70 +472,70 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, maxX1m1, maxX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, maxX2, x3);
             distributeData(rdata, index, minX1p1, maxX2m1, x3);
             distributeData(rdata, index, minX1, maxX2m1, x3);
             distributeData(rdata, index, minX1p1, maxX2, x3);
         }
-    } else if (sendDir == D3Q27System::BW)
+    } else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, minX1, x2, minX3);
             distributeData(rdata, index, minX1p1, x2, minX3p1);
             distributeData(rdata, index, minX1, x2, minX3p1);
             distributeData(rdata, index, minX1p1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::TE)
+    else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, maxX1, x2, maxX3);
             distributeData(rdata, index, maxX1m1, x2, maxX3m1);
             distributeData(rdata, index, maxX1, x2, maxX3m1);
             distributeData(rdata, index, maxX1m1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, minX1, x2, maxX3);
             distributeData(rdata, index, minX1p1, x2, maxX3m1);
             distributeData(rdata, index, minX1, x2, maxX3m1);
             distributeData(rdata, index, minX1p1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, maxX1, x2, minX3);
             distributeData(rdata, index, maxX1m1, x2, minX3p1);
             distributeData(rdata, index, maxX1, x2, minX3p1);
             distributeData(rdata, index, maxX1m1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, minX2, minX3);
             distributeData(rdata, index, x1, minX2p1, minX3p1);
             distributeData(rdata, index, x1, minX2, minX3p1);
             distributeData(rdata, index, x1, minX2p1, minX3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, maxX2, maxX3);
             distributeData(rdata, index, x1, maxX2m1, maxX3m1);
             distributeData(rdata, index, x1, maxX2, maxX3m1);
             distributeData(rdata, index, x1, maxX2m1, maxX3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, minX2, maxX3);
             distributeData(rdata, index, x1, minX2p1, maxX3m1);
             distributeData(rdata, index, x1, minX2, maxX3m1);
             distributeData(rdata, index, x1, minX2p1, maxX3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, maxX2, minX3);
             distributeData(rdata, index, x1, maxX2m1, minX3p1);
             distributeData(rdata, index, x1, maxX2, minX3p1);
             distributeData(rdata, index, x1, maxX2m1, minX3);
         }
-    else if (sendDir == D3Q27System::BNE) {
+    else if (sendDir == D3Q27System::DIR_PPM) {
         distributeData(rdata, index, maxX1, maxX2, minX3);
         distributeData(rdata, index, maxX1m1, maxX2m1, minX3p1);
         distributeData(rdata, index, maxX1, maxX2m1, minX3p1);
@@ -544,7 +544,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, maxX2, minX3p1);
         distributeData(rdata, index, maxX1, maxX2m1, minX3);
         distributeData(rdata, index, maxX1m1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         distributeData(rdata, index, minX1, maxX2, minX3);
         distributeData(rdata, index, minX1p1, maxX2m1, minX3p1);
         distributeData(rdata, index, minX1, maxX2m1, minX3p1);
@@ -553,7 +553,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, maxX2, minX3p1);
         distributeData(rdata, index, minX1, maxX2m1, minX3);
         distributeData(rdata, index, minX1p1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         distributeData(rdata, index, maxX1, minX2, minX3);
         distributeData(rdata, index, maxX1m1, minX2p1, minX3p1);
         distributeData(rdata, index, maxX1, minX2p1, minX3p1);
@@ -562,7 +562,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, minX2, minX3p1);
         distributeData(rdata, index, maxX1, minX2p1, minX3);
         distributeData(rdata, index, maxX1m1, minX2, minX3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         distributeData(rdata, index, minX1, minX2, minX3);
         distributeData(rdata, index, minX1p1, minX2p1, minX3p1);
         distributeData(rdata, index, minX1, minX2p1, minX3p1);
@@ -571,7 +571,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, minX2, minX3p1);
         distributeData(rdata, index, minX1, minX2p1, minX3);
         distributeData(rdata, index, minX1p1, minX2, minX3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         distributeData(rdata, index, maxX1, maxX2, maxX3);
         distributeData(rdata, index, maxX1m1, maxX2m1, maxX3m1);
         distributeData(rdata, index, maxX1, maxX2m1, maxX3m1);
@@ -580,7 +580,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, maxX2, maxX3m1);
         distributeData(rdata, index, maxX1, maxX2m1, maxX3);
         distributeData(rdata, index, maxX1m1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         distributeData(rdata, index, minX1, maxX2, maxX3);
         distributeData(rdata, index, minX1p1, maxX2m1, maxX3m1);
         distributeData(rdata, index, minX1, maxX2m1, maxX3m1);
@@ -589,7 +589,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, maxX2, maxX3m1);
         distributeData(rdata, index, minX1, maxX2m1, maxX3);
         distributeData(rdata, index, minX1p1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         distributeData(rdata, index, maxX1, minX2, maxX3);
         distributeData(rdata, index, maxX1m1, minX2p1, maxX3m1);
         distributeData(rdata, index, maxX1, minX2p1, maxX3m1);
@@ -598,7 +598,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, minX2, maxX3m1);
         distributeData(rdata, index, maxX1, minX2p1, maxX3);
         distributeData(rdata, index, maxX1m1, minX2, maxX3);
-    } else if (sendDir == D3Q27System::TSW) {
+    } else if (sendDir == D3Q27System::DIR_MMP) {
         distributeData(rdata, index, minX1, minX2, maxX3);
         distributeData(rdata, index, minX1p1, minX2p1, maxX3m1);
         distributeData(rdata, index, minX1, minX2p1, maxX3m1);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
index 5cd49a163..534076b7b 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp
@@ -60,36 +60,36 @@ void ThreeDistributionsFullVectorConnector::init()
    switch (sendDir)
    {
    case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
-   case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
-   case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
-   case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
+   case D3Q27System::DIR_P00:
+   case D3Q27System::DIR_M00: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_0P0:
+   case D3Q27System::DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_00P:
+   case D3Q27System::DIR_00M: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
 
-   case D3Q27System::NE:
-   case D3Q27System::SW:
-   case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_PP0:
+   case D3Q27System::DIR_MM0:
+   case D3Q27System::DIR_PM0:
+   case D3Q27System::DIR_MP0:  sender->getData().resize(maxX3*anz, 0.0);   break;
 
-   case D3Q27System::TE:
-   case D3Q27System::BW:
-   case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
+   case D3Q27System::DIR_P0P:
+   case D3Q27System::DIR_M0M:
+   case D3Q27System::DIR_P0M:
+   case D3Q27System::DIR_M0P:  sender->getData().resize(maxX2*anz, 0.0);   break;
 
-   case D3Q27System::TN:
-   case D3Q27System::BS:
-   case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
+   case D3Q27System::DIR_0PP:
+   case D3Q27System::DIR_0MM:
+   case D3Q27System::DIR_0PM:
+   case D3Q27System::DIR_0MP:  sender->getData().resize(maxX1*anz, 0.0);   break;
 
-   case D3Q27System::TNE:
-   case D3Q27System::BSW:
-   case D3Q27System::BNE:
-   case D3Q27System::TSW:
-   case D3Q27System::TSE:
-   case D3Q27System::BNW:
-   case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
+   case D3Q27System::DIR_PPP:
+   case D3Q27System::DIR_MMM:
+   case D3Q27System::DIR_PPM:
+   case D3Q27System::DIR_MMP:
+   case D3Q27System::DIR_PMP:
+   case D3Q27System::DIR_MPM:
+   case D3Q27System::DIR_PMM:
+   case D3Q27System::DIR_MPP:  sender->getData().resize(anz, 0.0);   break;
 
    default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
    }
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
index 3d0ca3f04..b46ffebeb 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.cpp
@@ -92,7 +92,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
     int maxX3m3 = maxX3 - 3;
 
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 exchangeData(maxX1m3, x2, x3, minX1, x2, x3);
@@ -101,7 +101,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 exchangeData(minX1p3, x2, x3, maxX1, x2, x3);
@@ -110,7 +110,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, maxX2m3, x3, x1, minX2, x3);
@@ -119,7 +119,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, minX2p3, x3, x1, maxX2, x3);
@@ -129,7 +129,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
     }
 
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, x2, maxX3m3, x1, x2, minX3);
@@ -138,7 +138,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 exchangeData(x1, x2, minX3p3, x1, x2, maxX3);
@@ -147,7 +147,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTHEAST
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, maxX2m3, x3, minX1, minX2, x3);
             exchangeData(maxX1m2, maxX2m2, x3, minX1p1, minX2p1, x3);
@@ -156,7 +156,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // NORTHWEST
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, maxX2m3, x3, maxX1, minX2, x3);
             exchangeData(minX1p2, maxX2m2, x3, maxX1m1, minX2p1, x3);
@@ -165,7 +165,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTHWEST
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(minX1p3, minX2p3, x3, maxX1, maxX2, x3);
             exchangeData(minX1p2, minX2p2, x3, maxX1m1, maxX2m1, x3);
@@ -174,70 +174,70 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         }
     }
     // SOUTHEAST
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             exchangeData(maxX1m3, minX2p3, x3, minX1, maxX2, x3);
             exchangeData(maxX1m2, minX2p2, x3, minX1p1, maxX2m1, x3);
             exchangeData(maxX1m3, minX2p2, x3, minX1, maxX2m1, x3);
             exchangeData(maxX1m2, minX2p3, x3, minX1p1, maxX2, x3);
         }
-    } else if (sendDir == D3Q27System::TE)
+    } else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, maxX3m3, minX1, x2, minX3);
             exchangeData(maxX1m2, x2, maxX3m2, minX1p1, x2, minX3p1);
             exchangeData(maxX1m3, x2, maxX3m2, minX1, x2, minX3p1);
             exchangeData(maxX1m2, x2, maxX3m3, minX1p1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::BW)
+    else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, minX3p3, maxX1, x2, maxX3);
             exchangeData(minX1p2, x2, minX3p2, maxX1m1, x2, maxX3m1);
             exchangeData(minX1p3, x2, minX3p2, maxX1, x2, maxX3m1);
             exchangeData(minX1p2, x2, minX3p3, maxX1m1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(maxX1m3, x2, minX3p3, minX1, x2, maxX3);
             exchangeData(maxX1m2, x2, minX3p2, minX1p1, x2, maxX3m1);
             exchangeData(maxX1m3, x2, minX3p2, minX1, x2, maxX3m1);
             exchangeData(maxX1m2, x2, minX3p3, minX1p1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             exchangeData(minX1p3, x2, maxX3m3, maxX1, x2, minX3);
             exchangeData(minX1p2, x2, maxX3m2, maxX1m1, x2, minX3p1);
             exchangeData(minX1p3, x2, maxX3m2, maxX1, x2, minX3p1);
             exchangeData(minX1p2, x2, maxX3m3, maxX1m1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, maxX3m3, x1, minX2, minX3);
             exchangeData(x1, maxX2m2, maxX3m2, x1, minX2p1, minX3p1);
             exchangeData(x1, maxX2m3, maxX3m2, x1, minX2, minX3p1);
             exchangeData(x1, maxX2m2, maxX3m3, x1, minX2p1, minX3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, minX3p3, x1, maxX2, maxX3);
             exchangeData(x1, minX2p2, minX3p2, x1, maxX2m1, maxX3m1);
             exchangeData(x1, minX2p3, minX3p2, x1, maxX2, maxX3m1);
             exchangeData(x1, minX2p2, minX3p3, x1, maxX2m1, maxX3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, maxX2m3, minX3p3, x1, minX2, maxX3);
             exchangeData(x1, maxX2m2, minX3p2, x1, minX2p1, maxX3m1);
             exchangeData(x1, maxX2m3, minX3p2, x1, minX2, maxX3m1);
             exchangeData(x1, maxX2m2, minX3p3, x1, minX2p1, maxX3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             exchangeData(x1, minX2p3, maxX3m3, x1, maxX2, minX3);
             exchangeData(x1, minX2p2, maxX3m2, x1, maxX2m1, minX3p1);
             exchangeData(x1, minX2p3, maxX3m2, x1, maxX2, minX3p1);
             exchangeData(x1, minX2p2, maxX3m3, x1, maxX2m1, minX3);
         }
-    else if (sendDir == D3Q27System::TSW) {
+    else if (sendDir == D3Q27System::DIR_MMP) {
         exchangeData(minX1p3, minX2p3, maxX3m3, maxX1, maxX2, minX3);
         exchangeData(minX1p2, minX2p2, maxX3m2, maxX1m1, maxX2m1, minX3p1);
         exchangeData(minX1p3, minX2p2, maxX3m2, maxX1, maxX2m1, minX3p1);
@@ -246,7 +246,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, minX2p3, maxX3m2, maxX1, maxX2, minX3p1);
         exchangeData(minX1p3, minX2p2, maxX3m3, maxX1, maxX2m1, minX3);
         exchangeData(minX1p2, minX2p3, maxX3m3, maxX1m1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         exchangeData(maxX1m3, minX1p3, maxX3m3, minX1, maxX2, minX3);
         exchangeData(maxX1m2, minX1p2, maxX3m2, minX1p1, maxX2m1, minX3p1);
         exchangeData(maxX1m3, minX1p2, maxX3m2, minX1, maxX2m1, minX3p1);
@@ -255,7 +255,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, minX1p3, maxX3m2, minX1, maxX2, minX3p1);
         exchangeData(maxX1m3, minX1p2, maxX3m3, minX1, maxX2m1, minX3);
         exchangeData(maxX1m2, minX1p3, maxX3m3, minX1p1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         exchangeData(minX1p3, maxX2m3, maxX3m3, maxX1, minX2, minX3);
         exchangeData(minX1p2, maxX2m2, maxX3m2, maxX1m1, minX2p1, minX3p1);
         exchangeData(minX1p3, maxX2m2, maxX3m2, maxX1, minX2p1, minX3p1);
@@ -264,7 +264,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, maxX2m3, maxX3m2, maxX1, minX2, minX3p1);
         exchangeData(minX1p3, maxX2m2, maxX3m3, maxX1, minX2p1, minX3);
         exchangeData(minX1p2, maxX2m3, maxX3m3, maxX1m1, minX2, minX3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         exchangeData(maxX1m3, maxX2m3, maxX3m3, minX1, minX2, minX3);
         exchangeData(maxX1m2, maxX2m2, maxX3m2, minX1p1, minX2p1, minX3p1);
         exchangeData(maxX1m3, maxX2m2, maxX3m2, minX1, minX2p1, minX3p1);
@@ -273,7 +273,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, maxX2m3, maxX3m2, minX1, minX2, minX3p1);
         exchangeData(maxX1m3, maxX2m2, maxX3m3, minX1, minX2p1, minX3);
         exchangeData(maxX1m2, maxX2m3, maxX3m3, minX1p1, minX2, minX3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         exchangeData(minX1p3, minX2p3, minX3p3, maxX1, maxX2, maxX3);
         exchangeData(minX1p2, minX2p2, minX3p2, maxX1m1, maxX2m1, maxX3m1);
         exchangeData(minX1p3, minX2p2, minX3p2, maxX1, maxX2m1, maxX3m1);
@@ -282,7 +282,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, minX2p3, minX3p2, maxX1, maxX2, maxX3m1);
         exchangeData(minX1p3, minX2p2, minX3p3, maxX1, maxX2m1, maxX3);
         exchangeData(minX1p2, minX2p3, minX3p3, maxX1m1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         exchangeData(maxX1m3, minX2p3, minX3p3, minX1, maxX2, maxX3);
         exchangeData(maxX1m2, minX2p2, minX3p2, minX1p1, maxX2m1, maxX3m1);
         exchangeData(maxX1m3, minX2p2, minX3p2, minX1, maxX2m1, maxX3m1);
@@ -291,7 +291,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(maxX1m3, minX2p3, minX3p2, minX1, maxX2, maxX3m1);
         exchangeData(maxX1m3, minX2p2, minX3p3, minX1, maxX2m1, maxX3);
         exchangeData(maxX1m2, minX2p3, minX3p3, minX1p1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         exchangeData(minX1p3, maxX2m3, minX3p3, maxX1, minX2, maxX3);
         exchangeData(minX1p2, maxX2m2, minX3p2, maxX1m1, minX2p1, maxX3m1);
         exchangeData(minX1p3, maxX2m2, minX3p2, maxX1, minX2p1, maxX3m1);
@@ -300,7 +300,7 @@ void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData()
         exchangeData(minX1p3, maxX2m3, minX3p2, maxX1, minX2, maxX3m1);
         exchangeData(minX1p3, maxX2m2, minX3p3, maxX1, minX2p1, maxX3);
         exchangeData(minX1p2, maxX2m3, minX3p3, maxX1m1, minX2, maxX3);
-    } else if (sendDir == D3Q27System::BNE) {
+    } else if (sendDir == D3Q27System::DIR_PPM) {
         exchangeData(maxX1m3, maxX2m3, minX3p3, minX1, minX2, maxX3);
         exchangeData(maxX1m2, maxX2m2, minX3p2, minX1p1, minX2p1, maxX3m1);
         exchangeData(maxX1m3, maxX2m2, minX3p2, minX1, minX2p1, maxX3m1);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
index 15d18279c..9dc8a99de 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp
@@ -60,36 +60,36 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::init()
    switch (sendDir)
    {
    case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
-   case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
-   case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
-   case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
+   case D3Q27System::DIR_P00:
+   case D3Q27System::DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::DIR_0P0:
+   case D3Q27System::DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, 0.0);   break;
+   case D3Q27System::DIR_00P:
+   case D3Q27System::DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, 0.0);   break;
 
-   case D3Q27System::NE:
-   case D3Q27System::SW:
-   case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
+   case D3Q27System::DIR_PP0:
+   case D3Q27System::DIR_MM0:
+   case D3Q27System::DIR_PM0:
+   case D3Q27System::DIR_MP0:  sender->getData().resize(maxX3*anz*4, 0.0);   break;
 
-   case D3Q27System::TE:
-   case D3Q27System::BW:
-   case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
+   case D3Q27System::DIR_P0P:
+   case D3Q27System::DIR_M0M:
+   case D3Q27System::DIR_P0M:
+   case D3Q27System::DIR_M0P:  sender->getData().resize(maxX2*anz*4, 0.0);   break;
 
-   case D3Q27System::TN:
-   case D3Q27System::BS:
-   case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
+   case D3Q27System::DIR_0PP:
+   case D3Q27System::DIR_0MM:
+   case D3Q27System::DIR_0PM:
+   case D3Q27System::DIR_0MP:  sender->getData().resize(maxX1*anz*4, 0.0);   break;
 
-   case D3Q27System::TNE:
-   case D3Q27System::BSW:
-   case D3Q27System::BNE:
-   case D3Q27System::TSW:
-   case D3Q27System::TSE:
-   case D3Q27System::BNW:
-   case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz*8, 0.0);   break;
+   case D3Q27System::DIR_PPP:
+   case D3Q27System::DIR_MMM:
+   case D3Q27System::DIR_PPM:
+   case D3Q27System::DIR_MMP:
+   case D3Q27System::DIR_PMP:
+   case D3Q27System::DIR_MPM:
+   case D3Q27System::DIR_PMM:
+   case D3Q27System::DIR_MPP:  sender->getData().resize(anz*8, 0.0);   break;
 
    default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
    }
@@ -137,7 +137,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
 
     int index = 0;
     // EAST
-    if (sendDir == D3Q27System::E) {
+    if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 fillData(sdata, index, maxX1m3, x2, x3);
@@ -146,7 +146,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // WEST
-    else if (sendDir == D3Q27System::W) {
+    else if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 fillData(sdata, index, minX1p3, x2, x3);
@@ -155,7 +155,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTH
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, maxX2m3, x3);
@@ -164,7 +164,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTH
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, minX2p3, x3);
@@ -174,7 +174,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
     }
 
     // TOP
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, x2, maxX3m3);
@@ -183,7 +183,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // BOTTOM
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 fillData(sdata, index, x1, x2, minX3p3);
@@ -192,7 +192,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTHEAST
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, maxX1m3, maxX2m3, x3);
             fillData(sdata, index, maxX1m2, maxX2m2, x3);
@@ -201,7 +201,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // NORTHWEST
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, minX1p3, maxX2m3, x3);
             fillData(sdata, index, minX1p2, maxX2m2, x3);
@@ -210,7 +210,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTHWEST
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, minX1p3, minX2p3, x3);
             fillData(sdata, index, minX1p2, minX2p2, x3);
@@ -219,70 +219,70 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         }
     }
     // SOUTHEAST
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             fillData(sdata, index, maxX1m3, minX2p3, x3);
             fillData(sdata, index, maxX1m2, minX2p2, x3);
             fillData(sdata, index, maxX1m3, minX2p2, x3);
             fillData(sdata, index, maxX1m2, minX2p3, x3);
         }
-    } else if (sendDir == D3Q27System::TE)
+    } else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, maxX1m3, x2, maxX3m3);
             fillData(sdata, index, maxX1m2, x2, maxX3m2);
             fillData(sdata, index, maxX1m3, x2, maxX3m2);
             fillData(sdata, index, maxX1m2, x2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::BW)
+    else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, minX1p3, x2, minX3p3);
             fillData(sdata, index, minX1p2, x2, minX3p2);
             fillData(sdata, index, minX1p3, x2, minX3p2);
             fillData(sdata, index, minX1p2, x2, minX3p3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, maxX1m3, x2, minX3p3);
             fillData(sdata, index, maxX1m2, x2, minX3p2);
             fillData(sdata, index, maxX1m3, x2, minX3p2);
             fillData(sdata, index, maxX1m2, x2, minX3p3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             fillData(sdata, index, minX1p3, x2, maxX3m3);
             fillData(sdata, index, minX1p2, x2, maxX3m2);
             fillData(sdata, index, minX1p3, x2, maxX3m2);
             fillData(sdata, index, minX1p2, x2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, maxX2m3, maxX3m3);
             fillData(sdata, index, x1, maxX2m2, maxX3m2);
             fillData(sdata, index, x1, maxX2m3, maxX3m2);
             fillData(sdata, index, x1, maxX2m2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, minX2p3, minX3p3);
             fillData(sdata, index, x1, minX2p2, minX3p2);
             fillData(sdata, index, x1, minX2p3, minX3p2);
             fillData(sdata, index, x1, minX2p2, minX3p3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, maxX2m3, minX3p3);
             fillData(sdata, index, x1, maxX2m2, minX3p2);
             fillData(sdata, index, x1, maxX2m3, minX3p2);
             fillData(sdata, index, x1, maxX2m2, minX3p3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             fillData(sdata, index, x1, minX2p3, maxX3m3);
             fillData(sdata, index, x1, minX2p2, maxX3m2);
             fillData(sdata, index, x1, minX2p3, maxX3m2);
             fillData(sdata, index, x1, minX2p2, maxX3m3);
         }
-    else if (sendDir == D3Q27System::TSW) {
+    else if (sendDir == D3Q27System::DIR_MMP) {
         fillData(sdata, index, minX1p3, minX2p3, maxX3m3);
         fillData(sdata, index, minX1p2, minX2p2, maxX3m2);
         fillData(sdata, index, minX1p3, minX2p2, maxX3m2);
@@ -291,7 +291,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, minX2p3, maxX3m2);
         fillData(sdata, index, minX1p3, minX2p2, maxX3m3);
         fillData(sdata, index, minX1p2, minX2p3, maxX3m3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         fillData(sdata, index, maxX1m3, minX1p3, maxX3m3);
         fillData(sdata, index, maxX1m2, minX1p2, maxX3m2);
         fillData(sdata, index, maxX1m3, minX1p2, maxX3m2);
@@ -300,7 +300,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, minX1p3, maxX3m2);
         fillData(sdata, index, maxX1m3, minX1p2, maxX3m3);
         fillData(sdata, index, maxX1m2, minX1p3, maxX3m3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         fillData(sdata, index, minX1p3, maxX2m3, maxX3m3);
         fillData(sdata, index, minX1p2, maxX2m2, maxX3m2);
         fillData(sdata, index, minX1p3, maxX2m2, maxX3m2);
@@ -309,7 +309,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, maxX2m3, maxX3m2);
         fillData(sdata, index, minX1p3, maxX2m2, maxX3m3);
         fillData(sdata, index, minX1p2, maxX2m3, maxX3m3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         fillData(sdata, index, maxX1m3, maxX2m3, maxX3m3);
         fillData(sdata, index, maxX1m2, maxX2m2, maxX3m2);
         fillData(sdata, index, maxX1m3, maxX2m2, maxX3m2);
@@ -318,7 +318,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, maxX2m3, maxX3m2);
         fillData(sdata, index, maxX1m3, maxX2m2, maxX3m3);
         fillData(sdata, index, maxX1m2, maxX2m3, maxX3m3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         fillData(sdata, index, minX1p3, minX2p3, minX3p3);
         fillData(sdata, index, minX1p2, minX2p2, minX3p2);
         fillData(sdata, index, minX1p3, minX2p2, minX3p2);
@@ -327,7 +327,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, minX2p3, minX3p2);
         fillData(sdata, index, minX1p3, minX2p2, minX3p3);
         fillData(sdata, index, minX1p2, minX2p3, minX3p3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         fillData(sdata, index, maxX1m3, minX2p3, minX3p3);
         fillData(sdata, index, maxX1m2, minX2p2, minX3p2);
         fillData(sdata, index, maxX1m3, minX2p2, minX3p2);
@@ -336,7 +336,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, maxX1m3, minX2p3, minX3p2);
         fillData(sdata, index, maxX1m3, minX2p2, minX3p3);
         fillData(sdata, index, maxX1m2, minX2p3, minX3p3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         fillData(sdata, index, minX1p3, maxX2m3, minX3p3);
         fillData(sdata, index, minX1p2, maxX2m2, minX3p2);
         fillData(sdata, index, minX1p3, maxX2m2, minX3p2);
@@ -345,7 +345,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData()
         fillData(sdata, index, minX1p3, maxX2m3, minX3p2);
         fillData(sdata, index, minX1p3, maxX2m2, minX3p3);
         fillData(sdata, index, minX1p2, maxX2m3, minX3p3);
-    } else if (sendDir == D3Q27System::BNE) {
+    } else if (sendDir == D3Q27System::DIR_PPM) {
         fillData(sdata, index, maxX1m3, maxX2m3, minX3p3);
         fillData(sdata, index, maxX1m2, maxX2m2, minX3p2);
         fillData(sdata, index, maxX1m3, maxX2m2, minX3p2);
@@ -399,7 +399,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
     int maxX3m2 = maxX3 - 2;
     //int maxX3m3 = maxX3 - 3;
 
-    if (sendDir == D3Q27System::W) {
+    if (sendDir == D3Q27System::DIR_M00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 distributeData(rdata, index, minX1, x2, x3);
@@ -407,7 +407,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::E) {
+    else if (sendDir == D3Q27System::DIR_P00) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
                 distributeData(rdata, index, maxX1, x2, x3);
@@ -415,7 +415,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::S) {
+    else if (sendDir == D3Q27System::DIR_0M0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, minX2, x3);
@@ -423,7 +423,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::N) {
+    else if (sendDir == D3Q27System::DIR_0P0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, maxX2, x3);
@@ -431,7 +431,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::B) {
+    else if (sendDir == D3Q27System::DIR_00M) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, x2, minX3);
@@ -439,7 +439,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::T) {
+    else if (sendDir == D3Q27System::DIR_00P) {
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
                 distributeData(rdata, index, x1, x2, maxX3);
@@ -447,7 +447,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             }
         }
     }
-    else if (sendDir == D3Q27System::SW) {
+    else if (sendDir == D3Q27System::DIR_MM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, minX2, x3);
             distributeData(rdata, index, minX1p1, minX2p1, x3);
@@ -455,7 +455,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, minX1p1, minX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::SE) {
+    else if (sendDir == D3Q27System::DIR_PM0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, minX2, x3);
             distributeData(rdata, index, maxX1m1, minX2p1, x3);
@@ -463,7 +463,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, maxX1m1, minX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::NE) {
+    else if (sendDir == D3Q27System::DIR_PP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, maxX1, maxX2, x3);
             distributeData(rdata, index, maxX1m1, maxX2m1, x3);
@@ -471,70 +471,70 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
             distributeData(rdata, index, maxX1m1, maxX2, x3);
         }
     }
-    else if (sendDir == D3Q27System::NW) {
+    else if (sendDir == D3Q27System::DIR_MP0) {
         for (int x3 = minX3p2; x3 <= maxX3m2; x3++) {
             distributeData(rdata, index, minX1, maxX2, x3);
             distributeData(rdata, index, minX1p1, maxX2m1, x3);
             distributeData(rdata, index, minX1, maxX2m1, x3);
             distributeData(rdata, index, minX1p1, maxX2, x3);
         }
-    } else if (sendDir == D3Q27System::BW)
+    } else if (sendDir == D3Q27System::DIR_M0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, minX1, x2, minX3);
             distributeData(rdata, index, minX1p1, x2, minX3p1);
             distributeData(rdata, index, minX1, x2, minX3p1);
             distributeData(rdata, index, minX1p1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::TE)
+    else if (sendDir == D3Q27System::DIR_P0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, maxX1, x2, maxX3);
             distributeData(rdata, index, maxX1m1, x2, maxX3m1);
             distributeData(rdata, index, maxX1, x2, maxX3m1);
             distributeData(rdata, index, maxX1m1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::TW)
+    else if (sendDir == D3Q27System::DIR_M0P)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, minX1, x2, maxX3);
             distributeData(rdata, index, minX1p1, x2, maxX3m1);
             distributeData(rdata, index, minX1, x2, maxX3m1);
             distributeData(rdata, index, minX1p1, x2, maxX3);
         }
-    else if (sendDir == D3Q27System::BE)
+    else if (sendDir == D3Q27System::DIR_P0M)
         for (int x2 = minX2p2; x2 <= maxX2m2; x2++) {
             distributeData(rdata, index, maxX1, x2, minX3);
             distributeData(rdata, index, maxX1m1, x2, minX3p1);
             distributeData(rdata, index, maxX1, x2, minX3p1);
             distributeData(rdata, index, maxX1m1, x2, minX3);
         }
-    else if (sendDir == D3Q27System::BS)
+    else if (sendDir == D3Q27System::DIR_0MM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, minX2, minX3);
             distributeData(rdata, index, x1, minX2p1, minX3p1);
             distributeData(rdata, index, x1, minX2, minX3p1);
             distributeData(rdata, index, x1, minX2p1, minX3);
         }
-    else if (sendDir == D3Q27System::TN)
+    else if (sendDir == D3Q27System::DIR_0PP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, maxX2, maxX3);
             distributeData(rdata, index, x1, maxX2m1, maxX3m1);
             distributeData(rdata, index, x1, maxX2, maxX3m1);
             distributeData(rdata, index, x1, maxX2m1, maxX3);
         }
-    else if (sendDir == D3Q27System::TS)
+    else if (sendDir == D3Q27System::DIR_0MP)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, minX2, maxX3);
             distributeData(rdata, index, x1, minX2p1, maxX3m1);
             distributeData(rdata, index, x1, minX2, maxX3m1);
             distributeData(rdata, index, x1, minX2p1, maxX3);
         }
-    else if (sendDir == D3Q27System::BN)
+    else if (sendDir == D3Q27System::DIR_0PM)
         for (int x1 = minX1p2; x1 <= maxX1m2; x1++) {
             distributeData(rdata, index, x1, maxX2, minX3);
             distributeData(rdata, index, x1, maxX2m1, minX3p1);
             distributeData(rdata, index, x1, maxX2, minX3p1);
             distributeData(rdata, index, x1, maxX2m1, minX3);
         }
-    else if (sendDir == D3Q27System::BNE) {
+    else if (sendDir == D3Q27System::DIR_PPM) {
         distributeData(rdata, index, maxX1, maxX2, minX3);
         distributeData(rdata, index, maxX1m1, maxX2m1, minX3p1);
         distributeData(rdata, index, maxX1, maxX2m1, minX3p1);
@@ -543,7 +543,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, maxX2, minX3p1);
         distributeData(rdata, index, maxX1, maxX2m1, minX3);
         distributeData(rdata, index, maxX1m1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::BNW) {
+    } else if (sendDir == D3Q27System::DIR_MPM) {
         distributeData(rdata, index, minX1, maxX2, minX3);
         distributeData(rdata, index, minX1p1, maxX2m1, minX3p1);
         distributeData(rdata, index, minX1, maxX2m1, minX3p1);
@@ -552,7 +552,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, maxX2, minX3p1);
         distributeData(rdata, index, minX1, maxX2m1, minX3);
         distributeData(rdata, index, minX1p1, maxX2, minX3);
-    } else if (sendDir == D3Q27System::BSE) {
+    } else if (sendDir == D3Q27System::DIR_PMM) {
         distributeData(rdata, index, maxX1, minX2, minX3);
         distributeData(rdata, index, maxX1m1, minX2p1, minX3p1);
         distributeData(rdata, index, maxX1, minX2p1, minX3p1);
@@ -561,7 +561,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, minX2, minX3p1);
         distributeData(rdata, index, maxX1, minX2p1, minX3);
         distributeData(rdata, index, maxX1m1, minX2, minX3);
-    } else if (sendDir == D3Q27System::BSW) {
+    } else if (sendDir == D3Q27System::DIR_MMM) {
         distributeData(rdata, index, minX1, minX2, minX3);
         distributeData(rdata, index, minX1p1, minX2p1, minX3p1);
         distributeData(rdata, index, minX1, minX2p1, minX3p1);
@@ -570,7 +570,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, minX2, minX3p1);
         distributeData(rdata, index, minX1, minX2p1, minX3);
         distributeData(rdata, index, minX1p1, minX2, minX3);
-    } else if (sendDir == D3Q27System::TNE) {
+    } else if (sendDir == D3Q27System::DIR_PPP) {
         distributeData(rdata, index, maxX1, maxX2, maxX3);
         distributeData(rdata, index, maxX1m1, maxX2m1, maxX3m1);
         distributeData(rdata, index, maxX1, maxX2m1, maxX3m1);
@@ -579,7 +579,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, maxX2, maxX3m1);
         distributeData(rdata, index, maxX1, maxX2m1, maxX3);
         distributeData(rdata, index, maxX1m1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::TNW) {
+    } else if (sendDir == D3Q27System::DIR_MPP) {
         distributeData(rdata, index, minX1, maxX2, maxX3);
         distributeData(rdata, index, minX1p1, maxX2m1, maxX3m1);
         distributeData(rdata, index, minX1, maxX2m1, maxX3m1);
@@ -588,7 +588,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, minX1, maxX2, maxX3m1);
         distributeData(rdata, index, minX1, maxX2m1, maxX3);
         distributeData(rdata, index, minX1p1, maxX2, maxX3);
-    } else if (sendDir == D3Q27System::TSE) {
+    } else if (sendDir == D3Q27System::DIR_PMP) {
         distributeData(rdata, index, maxX1, minX2, maxX3);
         distributeData(rdata, index, maxX1m1, minX2p1, maxX3m1);
         distributeData(rdata, index, maxX1, minX2p1, maxX3m1);
@@ -597,7 +597,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData()
         distributeData(rdata, index, maxX1, minX2, maxX3m1);
         distributeData(rdata, index, maxX1, minX2p1, maxX3);
         distributeData(rdata, index, maxX1m1, minX2, maxX3);
-    } else if (sendDir == D3Q27System::TSW) {
+    } else if (sendDir == D3Q27System::DIR_MMP) {
         distributeData(rdata, index, minX1, minX2, maxX3);
         distributeData(rdata, index, minX1p1, minX2p1, maxX3m1);
         distributeData(rdata, index, minX1, minX2p1, maxX3m1);
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
index 008b6630d..bab931d93 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp
@@ -59,36 +59,36 @@ void TwoDistributionsFullVectorConnector::init()
    switch (sendDir)
    {
    case D3Q27System::DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
-   case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
-   case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
-   case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
+   case D3Q27System::DIR_P00:
+   case D3Q27System::DIR_M00: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_0P0:
+   case D3Q27System::DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_00P:
+   case D3Q27System::DIR_00M: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
 
-   case D3Q27System::NE:
-   case D3Q27System::SW:
-   case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
+   case D3Q27System::DIR_PP0:
+   case D3Q27System::DIR_MM0:
+   case D3Q27System::DIR_PM0:
+   case D3Q27System::DIR_MP0:  sender->getData().resize(maxX3*anz, 0.0);   break;
 
-   case D3Q27System::TE:
-   case D3Q27System::BW:
-   case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
+   case D3Q27System::DIR_P0P:
+   case D3Q27System::DIR_M0M:
+   case D3Q27System::DIR_P0M:
+   case D3Q27System::DIR_M0P:  sender->getData().resize(maxX2*anz, 0.0);   break;
 
-   case D3Q27System::TN:
-   case D3Q27System::BS:
-   case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
+   case D3Q27System::DIR_0PP:
+   case D3Q27System::DIR_0MM:
+   case D3Q27System::DIR_0PM:
+   case D3Q27System::DIR_0MP:  sender->getData().resize(maxX1*anz, 0.0);   break;
 
-   case D3Q27System::TNE:
-   case D3Q27System::BSW:
-   case D3Q27System::BNE:
-   case D3Q27System::TSW:
-   case D3Q27System::TSE:
-   case D3Q27System::BNW:
-   case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
+   case D3Q27System::DIR_PPP:
+   case D3Q27System::DIR_MMM:
+   case D3Q27System::DIR_PPM:
+   case D3Q27System::DIR_MMP:
+   case D3Q27System::DIR_PMP:
+   case D3Q27System::DIR_MPM:
+   case D3Q27System::DIR_PMM:
+   case D3Q27System::DIR_MPP:  sender->getData().resize(anz, 0.0);   break;
 
    default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
    }
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
index 765461b34..058594792 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
@@ -91,33 +91,33 @@ void D3Q27EsoTwist3DSoA::getDistribution(LBMReal *const f, size_t x1, size_t x2,
     size_t x2p = x2 + 1;
     size_t x3p = x3 + 1;
 
-    f[D3Q27System::E]   = (*d.E)(x1, x2, x3);
-    f[D3Q27System::N]   = (*d.N)(x1, x2, x3);
-    f[D3Q27System::T]   = (*d.T)(x1, x2, x3);
-    f[D3Q27System::NE]  = (*d.NE)(x1, x2, x3);
-    f[D3Q27System::NW]  = (*d.NW)(x1p, x2, x3);
-    f[D3Q27System::TE]  = (*d.TE)(x1, x2, x3);
-    f[D3Q27System::TW]  = (*d.TW)(x1p, x2, x3);
-    f[D3Q27System::TN]  = (*d.TN)(x1, x2, x3);
-    f[D3Q27System::TS]  = (*d.TS)(x1, x2p, x3);
-    f[D3Q27System::TNE] = (*d.TNE)(x1, x2, x3);
-    f[D3Q27System::TNW] = (*d.TNW)(x1p, x2, x3);
-    f[D3Q27System::TSE] = (*d.TSE)(x1, x2p, x3);
-    f[D3Q27System::TSW] = (*d.TSW)(x1p, x2p, x3);
+    f[D3Q27System::DIR_P00]   = (*d.E)(x1, x2, x3);
+    f[D3Q27System::DIR_0P0]   = (*d.N)(x1, x2, x3);
+    f[D3Q27System::DIR_00P]   = (*d.T)(x1, x2, x3);
+    f[D3Q27System::DIR_PP0]  = (*d.NE)(x1, x2, x3);
+    f[D3Q27System::DIR_MP0]  = (*d.NW)(x1p, x2, x3);
+    f[D3Q27System::DIR_P0P]  = (*d.TE)(x1, x2, x3);
+    f[D3Q27System::DIR_M0P]  = (*d.TW)(x1p, x2, x3);
+    f[D3Q27System::DIR_0PP]  = (*d.TN)(x1, x2, x3);
+    f[D3Q27System::DIR_0MP]  = (*d.TS)(x1, x2p, x3);
+    f[D3Q27System::DIR_PPP] = (*d.TNE)(x1, x2, x3);
+    f[D3Q27System::DIR_MPP] = (*d.TNW)(x1p, x2, x3);
+    f[D3Q27System::DIR_PMP] = (*d.TSE)(x1, x2p, x3);
+    f[D3Q27System::DIR_MMP] = (*d.TSW)(x1p, x2p, x3);
 
-    f[D3Q27System::W]   = (*d.W)(x1p, x2, x3);
-    f[D3Q27System::S]   = (*d.S)(x1, x2p, x3);
-    f[D3Q27System::B]   = (*d.B)(x1, x2, x3p);
-    f[D3Q27System::SW]  = (*d.SW)(x1p, x2p, x3);
-    f[D3Q27System::SE]  = (*d.SE)(x1, x2p, x3);
-    f[D3Q27System::BW]  = (*d.BW)(x1p, x2, x3p);
-    f[D3Q27System::BE]  = (*d.BE)(x1, x2, x3p);
-    f[D3Q27System::BS]  = (*d.BS)(x1, x2p, x3p);
-    f[D3Q27System::BN]  = (*d.BN)(x1, x2, x3p);
-    f[D3Q27System::BSW] = (*d.BSW)(x1p, x2p, x3p);
-    f[D3Q27System::BSE] = (*d.BSE)(x1, x2p, x3p);
-    f[D3Q27System::BNW] = (*d.BNW)(x1p, x2, x3p);
-    f[D3Q27System::BNE] = (*d.BNE)(x1, x2, x3p);
+    f[D3Q27System::DIR_M00]   = (*d.W)(x1p, x2, x3);
+    f[D3Q27System::DIR_0M0]   = (*d.S)(x1, x2p, x3);
+    f[D3Q27System::DIR_00M]   = (*d.B)(x1, x2, x3p);
+    f[D3Q27System::DIR_MM0]  = (*d.SW)(x1p, x2p, x3);
+    f[D3Q27System::DIR_PM0]  = (*d.SE)(x1, x2p, x3);
+    f[D3Q27System::DIR_M0M]  = (*d.BW)(x1p, x2, x3p);
+    f[D3Q27System::DIR_P0M]  = (*d.BE)(x1, x2, x3p);
+    f[D3Q27System::DIR_0MM]  = (*d.BS)(x1, x2p, x3p);
+    f[D3Q27System::DIR_0PM]  = (*d.BN)(x1, x2, x3p);
+    f[D3Q27System::DIR_MMM] = (*d.BSW)(x1p, x2p, x3p);
+    f[D3Q27System::DIR_PMM] = (*d.BSE)(x1, x2p, x3p);
+    f[D3Q27System::DIR_MPM] = (*d.BNW)(x1p, x2, x3p);
+    f[D3Q27System::DIR_PPM] = (*d.BNE)(x1, x2, x3p);
 
     f[D3Q27System::DIR_000] = (*d.REST)(x1, x2, x3);
 }
@@ -128,99 +128,99 @@ void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal *const f, size_t x1, size
     size_t x2p = x2 + 1;
     size_t x3p = x3 + 1;
 
-    (*d.E)(x1, x2, x3)     = f[D3Q27System::INV_E];
-    (*d.N)(x1, x2, x3)     = f[D3Q27System::INV_N];
-    (*d.T)(x1, x2, x3)     = f[D3Q27System::INV_T];
-    (*d.NE)(x1, x2, x3)    = f[D3Q27System::INV_NE];
-    (*d.NW)(x1p, x2, x3)   = f[D3Q27System::INV_NW];
-    (*d.TE)(x1, x2, x3)    = f[D3Q27System::INV_TE];
-    (*d.TW)(x1p, x2, x3)   = f[D3Q27System::INV_TW];
-    (*d.TN)(x1, x2, x3)    = f[D3Q27System::INV_TN];
-    (*d.TS)(x1, x2p, x3)   = f[D3Q27System::INV_TS];
-    (*d.TNE)(x1, x2, x3)   = f[D3Q27System::INV_TNE];
-    (*d.TNW)(x1p, x2, x3)  = f[D3Q27System::INV_TNW];
-    (*d.TSE)(x1, x2p, x3)  = f[D3Q27System::INV_TSE];
-    (*d.TSW)(x1p, x2p, x3) = f[D3Q27System::INV_TSW];
+    (*d.E)(x1, x2, x3)     = f[D3Q27System::INV_P00];
+    (*d.N)(x1, x2, x3)     = f[D3Q27System::INV_0P0];
+    (*d.T)(x1, x2, x3)     = f[D3Q27System::INV_00P];
+    (*d.NE)(x1, x2, x3)    = f[D3Q27System::INV_PP0];
+    (*d.NW)(x1p, x2, x3)   = f[D3Q27System::INV_MP0];
+    (*d.TE)(x1, x2, x3)    = f[D3Q27System::INV_P0P];
+    (*d.TW)(x1p, x2, x3)   = f[D3Q27System::INV_M0P];
+    (*d.TN)(x1, x2, x3)    = f[D3Q27System::INV_0PP];
+    (*d.TS)(x1, x2p, x3)   = f[D3Q27System::INV_0MP];
+    (*d.TNE)(x1, x2, x3)   = f[D3Q27System::INV_PPP];
+    (*d.TNW)(x1p, x2, x3)  = f[D3Q27System::INV_MPP];
+    (*d.TSE)(x1, x2p, x3)  = f[D3Q27System::INV_PMP];
+    (*d.TSW)(x1p, x2p, x3) = f[D3Q27System::INV_MMP];
 
-    (*d.W)(x1p, x2, x3)     = f[D3Q27System::INV_W];
-    (*d.S)(x1, x2p, x3)     = f[D3Q27System::INV_S];
-    (*d.B)(x1, x2, x3p)     = f[D3Q27System::INV_B];
-    (*d.SW)(x1p, x2p, x3)   = f[D3Q27System::INV_SW];
-    (*d.SE)(x1, x2p, x3)    = f[D3Q27System::INV_SE];
-    (*d.BW)(x1p, x2, x3p)   = f[D3Q27System::INV_BW];
-    (*d.BE)(x1, x2, x3p)    = f[D3Q27System::INV_BE];
-    (*d.BS)(x1, x2p, x3p)   = f[D3Q27System::INV_BS];
-    (*d.BN)(x1, x2, x3p)    = f[D3Q27System::INV_BN];
-    (*d.BSW)(x1p, x2p, x3p) = f[D3Q27System::INV_BSW];
-    (*d.BSE)(x1, x2p, x3p)  = f[D3Q27System::INV_BSE];
-    (*d.BNW)(x1p, x2, x3p)  = f[D3Q27System::INV_BNW];
-    (*d.BNE)(x1, x2, x3p)   = f[D3Q27System::INV_BNE];
+    (*d.W)(x1p, x2, x3)     = f[D3Q27System::INV_M00];
+    (*d.S)(x1, x2p, x3)     = f[D3Q27System::INV_0M0];
+    (*d.B)(x1, x2, x3p)     = f[D3Q27System::INV_00M];
+    (*d.SW)(x1p, x2p, x3)   = f[D3Q27System::INV_MM0];
+    (*d.SE)(x1, x2p, x3)    = f[D3Q27System::INV_PM0];
+    (*d.BW)(x1p, x2, x3p)   = f[D3Q27System::INV_M0M];
+    (*d.BE)(x1, x2, x3p)    = f[D3Q27System::INV_P0M];
+    (*d.BS)(x1, x2p, x3p)   = f[D3Q27System::INV_0MM];
+    (*d.BN)(x1, x2, x3p)    = f[D3Q27System::INV_0PM];
+    (*d.BSW)(x1p, x2p, x3p) = f[D3Q27System::INV_MMM];
+    (*d.BSE)(x1, x2p, x3p)  = f[D3Q27System::INV_PMM];
+    (*d.BNW)(x1p, x2, x3p)  = f[D3Q27System::INV_MPM];
+    (*d.BNE)(x1, x2, x3p)   = f[D3Q27System::INV_PPM];
 
     (*d.REST)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    f[D3Q27System::INV_E]   = (*d.E)(x1, x2, x3);
-    f[D3Q27System::INV_N]   = (*d.N)(x1, x2, x3);
-    f[D3Q27System::INV_T]   = (*d.T)(x1, x2, x3);
-    f[D3Q27System::INV_NE]  = (*d.NE)(x1, x2, x3);
-    f[D3Q27System::INV_NW]  = (*d.NW)(x1 + 1, x2, x3);
-    f[D3Q27System::INV_TE]  = (*d.TE)(x1, x2, x3);
-    f[D3Q27System::INV_TW]  = (*d.TW)(x1 + 1, x2, x3);
-    f[D3Q27System::INV_TN]  = (*d.TN)(x1, x2, x3);
-    f[D3Q27System::INV_TS]  = (*d.TS)(x1, x2 + 1, x3);
-    f[D3Q27System::INV_TNE] = (*d.TNE)(x1, x2, x3);
-    f[D3Q27System::INV_TNW] = (*d.TNW)(x1 + 1, x2, x3);
-    f[D3Q27System::INV_TSE] = (*d.TSE)(x1, x2 + 1, x3);
-    f[D3Q27System::INV_TSW] = (*d.TSW)(x1 + 1, x2 + 1, x3);
+    f[D3Q27System::INV_P00]   = (*d.E)(x1, x2, x3);
+    f[D3Q27System::INV_0P0]   = (*d.N)(x1, x2, x3);
+    f[D3Q27System::INV_00P]   = (*d.T)(x1, x2, x3);
+    f[D3Q27System::INV_PP0]  = (*d.NE)(x1, x2, x3);
+    f[D3Q27System::INV_MP0]  = (*d.NW)(x1 + 1, x2, x3);
+    f[D3Q27System::INV_P0P]  = (*d.TE)(x1, x2, x3);
+    f[D3Q27System::INV_M0P]  = (*d.TW)(x1 + 1, x2, x3);
+    f[D3Q27System::INV_0PP]  = (*d.TN)(x1, x2, x3);
+    f[D3Q27System::INV_0MP]  = (*d.TS)(x1, x2 + 1, x3);
+    f[D3Q27System::INV_PPP] = (*d.TNE)(x1, x2, x3);
+    f[D3Q27System::INV_MPP] = (*d.TNW)(x1 + 1, x2, x3);
+    f[D3Q27System::INV_PMP] = (*d.TSE)(x1, x2 + 1, x3);
+    f[D3Q27System::INV_MMP] = (*d.TSW)(x1 + 1, x2 + 1, x3);
 
-    f[D3Q27System::INV_W]   = (*d.W)(x1 + 1, x2, x3);
-    f[D3Q27System::INV_S]   = (*d.S)(x1, x2 + 1, x3);
-    f[D3Q27System::INV_B]   = (*d.B)(x1, x2, x3 + 1);
-    f[D3Q27System::INV_SW]  = (*d.SW)(x1 + 1, x2 + 1, x3);
-    f[D3Q27System::INV_SE]  = (*d.SE)(x1, x2 + 1, x3);
-    f[D3Q27System::INV_BW]  = (*d.BW)(x1 + 1, x2, x3 + 1);
-    f[D3Q27System::INV_BE]  = (*d.BE)(x1, x2, x3 + 1);
-    f[D3Q27System::INV_BS]  = (*d.BS)(x1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BN]  = (*d.BN)(x1, x2, x3 + 1);
-    f[D3Q27System::INV_BSW] = (*d.BSW)(x1 + 1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BSE] = (*d.BSE)(x1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BNW] = (*d.BNW)(x1 + 1, x2, x3 + 1);
-    f[D3Q27System::INV_BNE] = (*d.BNE)(x1, x2, x3 + 1);
+    f[D3Q27System::INV_M00]   = (*d.W)(x1 + 1, x2, x3);
+    f[D3Q27System::INV_0M0]   = (*d.S)(x1, x2 + 1, x3);
+    f[D3Q27System::INV_00M]   = (*d.B)(x1, x2, x3 + 1);
+    f[D3Q27System::INV_MM0]  = (*d.SW)(x1 + 1, x2 + 1, x3);
+    f[D3Q27System::INV_PM0]  = (*d.SE)(x1, x2 + 1, x3);
+    f[D3Q27System::INV_M0M]  = (*d.BW)(x1 + 1, x2, x3 + 1);
+    f[D3Q27System::INV_P0M]  = (*d.BE)(x1, x2, x3 + 1);
+    f[D3Q27System::INV_0MM]  = (*d.BS)(x1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_0PM]  = (*d.BN)(x1, x2, x3 + 1);
+    f[D3Q27System::INV_MMM] = (*d.BSW)(x1 + 1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_PMM] = (*d.BSE)(x1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_MPM] = (*d.BNW)(x1 + 1, x2, x3 + 1);
+    f[D3Q27System::INV_PPM] = (*d.BNE)(x1, x2, x3 + 1);
 
     f[D3Q27System::DIR_000] = (*d.REST)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSoA::setDistributionInv(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    //(*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E];
-    //(*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N];
-    //(*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T];
-    //(*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE];
-    //(*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW];
-    //(*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE];
-    //(*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW];
-    //(*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN];
-    //(*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS];
-    //(*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE];
-    //(*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW];
-    //(*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE];
-    //(*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW];
+    //(*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::DIR_P00];
+    //(*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::DIR_0P0];
+    //(*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::DIR_00P];
+    //(*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::DIR_PP0];
+    //(*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::DIR_MP0];
+    //(*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::DIR_P0P];
+    //(*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::DIR_M0P];
+    //(*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::DIR_0PP];
+    //(*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::DIR_0MP];
+    //(*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::DIR_PPP];
+    //(*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::DIR_MPP];
+    //(*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::DIR_PMP];
+    //(*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::DIR_MMP];
 
-    //(*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W ];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S ];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B ];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::DIR_M00 ];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::DIR_0M0 ];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::DIR_00M ];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::DIR_MM0];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::DIR_PM0];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::DIR_M0M];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_P0M];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::DIR_0MM];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_0PM];
     //(*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
     //(*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
     //(*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
-    //(*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::BNE];
+    //(*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::DIR_DIR_PPM];
 
     //(*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::REST];
 }
@@ -230,57 +230,57 @@ void D3Q27EsoTwist3DSoA::setDistributionForDirection(const LBMReal *const f, siz
 {
     // bool directionFlag = false;
     // if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::E]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::DIR_P00]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-    //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::W]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::DIR_M00]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-    //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::S]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::DIR_0M0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::N]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::DIR_0P0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-    //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::B]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::DIR_00M]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::T]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::DIR_00P]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-    //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::SW]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::DIR_MM0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::NE]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::DIR_PP0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::NW]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::DIR_MP0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-    //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::SE]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::DIR_PM0]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-    //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::BW]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::DIR_M0M]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::TE]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::DIR_P0P]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::TW]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_M0P]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-    //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::BE]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::DIR_P0M]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-    //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::BS]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::DIR_0MM]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::DIR_0PP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::TS]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_0MP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-    //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::BN]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::DIR_0PM]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
     //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::BSW]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::DIR_PPP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
     //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::BSE]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::DIR_MPP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
     //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::TSE]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::DIR_PMP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-    //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true;
+    //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::DIR_DIR_PPM]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-    //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::TSW]; directionFlag=true;
+    //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::DIR_MMP]; directionFlag=true;
     // if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
     //   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::REST]; directionFlag=true;
     //#ifdef _DEBUG
@@ -292,82 +292,82 @@ void D3Q27EsoTwist3DSoA::setDistributionForDirection(LBMReal f, size_t x1, size_
 {
     // switch (direction)
     //{
-    // case D3Q27System::E :
+    // case D3Q27System::DIR_P00 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
     //   break;
-    // case D3Q27System::W :
+    // case D3Q27System::DIR_M00 :
     //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::S :
+    // case D3Q27System::DIR_0M0 :
     //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::N :
+    // case D3Q27System::DIR_0P0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
     //   break;
-    // case D3Q27System::B :
+    // case D3Q27System::DIR_00M :
     //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::T :
+    // case D3Q27System::DIR_00P :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
     //   break;
-    // case D3Q27System::SW :
+    // case D3Q27System::DIR_MM0 :
     //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::NE :
+    // case D3Q27System::DIR_PP0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
     //   break;
-    // case D3Q27System::NW :
+    // case D3Q27System::DIR_MP0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
     //   break;
-    // case D3Q27System::SE :
+    // case D3Q27System::DIR_PM0 :
     //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
     //   break;
-    // case D3Q27System::BW :
+    // case D3Q27System::DIR_M0M :
     //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::TE :
+    // case D3Q27System::DIR_P0P :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
     //   break;
-    // case D3Q27System::TW :
+    // case D3Q27System::DIR_M0P :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
     //   break;
-    // case D3Q27System::BE :
+    // case D3Q27System::DIR_P0M :
     //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
     //   break;
-    // case D3Q27System::BS :
+    // case D3Q27System::DIR_0MM :
     //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::TN :
+    // case D3Q27System::DIR_0PP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
     //   break;
-    // case D3Q27System::TS :
+    // case D3Q27System::DIR_0MP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
     //   break;
-    // case D3Q27System::BN :
+    // case D3Q27System::DIR_0PM :
     //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
     //   break;
     // case D3Q27System::BSW :
     //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::TNE :
+    // case D3Q27System::DIR_PPP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
     //   break;
     // case D3Q27System::BSE :
     //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
     //   break;
-    // case D3Q27System::TNW :
+    // case D3Q27System::DIR_MPP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
     //   break;
     // case D3Q27System::BNW :
     //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
     //   break;
-    // case D3Q27System::TSE :
+    // case D3Q27System::DIR_PMP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
     //   break;
-    // case D3Q27System::BNE :
+    // case D3Q27System::DIR_DIR_PPM :
     //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
     //   break;
-    // case D3Q27System::TSW :
+    // case D3Q27System::DIR_MMP :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
     //   break;
     // case D3Q27System::REST :
@@ -383,60 +383,60 @@ void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(const LBMReal *const f,
 {
     //   bool directionFlag = false;
     //   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-    //      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::DIR_P00]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::DIR_M00]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::DIR_0M0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-    //      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::DIR_0P0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::DIR_00M]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-    //      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::DIR_00P]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::DIR_MM0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-    //      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::DIR_PP0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-    //      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::DIR_MP0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::DIR_PM0]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::DIR_M0M]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-    //      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::DIR_P0P]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-    //      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::DIR_M0P]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_P0M]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::DIR_0MM]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-    //      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::DIR_0PP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-    //      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::DIR_0MP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::DIR_0PM]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
     //      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
     //      directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-    //      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::DIR_PPP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
     //      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
     //      directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-    //      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::DIR_MPP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
     //      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
     //      directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-    //      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::DIR_PMP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-    //      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::BNE]; directionFlag=true;
+    //      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::DIR_DIR_PPM]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-    //      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true;
+    //      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::DIR_MMP]; directionFlag=true;
     //   if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
     //      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::REST]; directionFlag=true;
     //#ifdef _DEBUG
@@ -449,82 +449,82 @@ void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(LBMReal f, size_t x1, si
 {
     // switch (direction)
     //{
-    // case D3Q27System::E :
+    // case D3Q27System::DIR_P00 :
     //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::W :
+    // case D3Q27System::DIR_M00 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
     //   break;
-    // case D3Q27System::S :
+    // case D3Q27System::DIR_0M0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
     //   break;
-    // case D3Q27System::N :
+    // case D3Q27System::DIR_0P0 :
     //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::B :
+    // case D3Q27System::DIR_00M :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
     //   break;
-    // case D3Q27System::T :
+    // case D3Q27System::DIR_00P :
     //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::SW :
+    // case D3Q27System::DIR_MM0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
     //   break;
-    // case D3Q27System::NE :
+    // case D3Q27System::DIR_PP0 :
     //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::NW :
+    // case D3Q27System::DIR_MP0 :
     //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
     //   break;
-    // case D3Q27System::SE :
+    // case D3Q27System::DIR_PM0 :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
     //   break;
-    // case D3Q27System::BW :
+    // case D3Q27System::DIR_M0M :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
     //   break;
-    // case D3Q27System::TE :
+    // case D3Q27System::DIR_P0P :
     //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::TW :
+    // case D3Q27System::DIR_M0P :
     //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
     //   break;
-    // case D3Q27System::BE :
+    // case D3Q27System::DIR_P0M :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
     //   break;
-    // case D3Q27System::BS :
+    // case D3Q27System::DIR_0MM :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
     //   break;
-    // case D3Q27System::TN :
+    // case D3Q27System::DIR_0PP :
     //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
     //   break;
-    // case D3Q27System::TS :
+    // case D3Q27System::DIR_0MP :
     //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
     //   break;
-    // case D3Q27System::BN :
+    // case D3Q27System::DIR_0PM :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
     //   break;
     // case D3Q27System::BSW :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
     //   break;
-    // case D3Q27System::TNE :
+    // case D3Q27System::DIR_PPP :
     //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
     //   break;
     // case D3Q27System::BSE :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
     //   break;
-    // case D3Q27System::TNW :
+    // case D3Q27System::DIR_MPP :
     //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
     //   break;
     // case D3Q27System::BNW :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
     //   break;
-    // case D3Q27System::TSE :
+    // case D3Q27System::DIR_PMP :
     //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
     //   break;
-    // case D3Q27System::BNE :
+    // case D3Q27System::DIR_DIR_PPM :
     //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
     //   break;
-    // case D3Q27System::TSW :
+    // case D3Q27System::DIR_MMP :
     //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
     //   break;
     // case D3Q27System::REST :
@@ -540,57 +540,57 @@ LBMReal D3Q27EsoTwist3DSoA::getDistributionInvForDirection(size_t /*x1*/, size_t
 {
     // switch (direction)
     //{
-    // case D3Q27System::E :
+    // case D3Q27System::DIR_P00 :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
-    // case D3Q27System::W :
+    // case D3Q27System::DIR_M00 :
     //   return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
-    // case D3Q27System::S :
+    // case D3Q27System::DIR_0M0 :
     //   return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
-    // case D3Q27System::N :
+    // case D3Q27System::DIR_0P0 :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
-    // case D3Q27System::B :
+    // case D3Q27System::DIR_00M :
     //   return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
-    // case D3Q27System::T :
+    // case D3Q27System::DIR_00P :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
-    // case D3Q27System::SW :
+    // case D3Q27System::DIR_MM0 :
     //   return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
-    // case D3Q27System::NE :
+    // case D3Q27System::DIR_PP0 :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
-    // case D3Q27System::NW :
+    // case D3Q27System::DIR_MP0 :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
-    // case D3Q27System::SE :
+    // case D3Q27System::DIR_PM0 :
     //   return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
-    // case D3Q27System::BW :
+    // case D3Q27System::DIR_M0M :
     //   return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
-    // case D3Q27System::TE :
+    // case D3Q27System::DIR_P0P :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
-    // case D3Q27System::TW :
+    // case D3Q27System::DIR_M0P :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
-    // case D3Q27System::BE :
+    // case D3Q27System::DIR_P0M :
     //   return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
-    // case D3Q27System::BS :
+    // case D3Q27System::DIR_0MM :
     //   return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
-    // case D3Q27System::TN :
+    // case D3Q27System::DIR_0PP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
-    // case D3Q27System::TS :
+    // case D3Q27System::DIR_0MP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
-    // case D3Q27System::BN :
+    // case D3Q27System::DIR_0PM :
     //   return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
     // case D3Q27System::BSW :
     //   return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
-    // case D3Q27System::TNE :
+    // case D3Q27System::DIR_PPP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
     // case D3Q27System::BSE :
     //   return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
-    // case D3Q27System::TNW :
+    // case D3Q27System::DIR_MPP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
     // case D3Q27System::BNW :
     //   return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
-    // case D3Q27System::TSE :
+    // case D3Q27System::DIR_PMP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
-    // case D3Q27System::BNE :
+    // case D3Q27System::DIR_DIR_PPM :
     //   return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-    // case D3Q27System::TSW :
+    // case D3Q27System::DIR_MMP :
     //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
     // case D3Q27System::REST :
     //   return (*this->zeroDistributions)(x1,x2,x3);
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
index ecb53fda1..684238baa 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
@@ -56,132 +56,132 @@ void D3Q27EsoTwist3DSplittedVector::swap() { std::swap(this->localDistributions,
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::getDistribution(LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    f[D3Q27System::E]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-    f[D3Q27System::N]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-    f[D3Q27System::T]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-    f[D3Q27System::NE]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-    f[D3Q27System::NW]  = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
-    f[D3Q27System::TE]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-    f[D3Q27System::TW]  = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
-    f[D3Q27System::TN]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-    f[D3Q27System::TS]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
-    f[D3Q27System::TNE] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-    f[D3Q27System::TNW] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
-    f[D3Q27System::TSE] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
-    f[D3Q27System::TSW] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+    f[D3Q27System::DIR_P00]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+    f[D3Q27System::DIR_0P0]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+    f[D3Q27System::DIR_00P]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+    f[D3Q27System::DIR_PP0]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+    f[D3Q27System::DIR_MP0]  = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+    f[D3Q27System::DIR_P0P]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+    f[D3Q27System::DIR_M0P]  = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+    f[D3Q27System::DIR_0PP]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+    f[D3Q27System::DIR_0MP]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+    f[D3Q27System::DIR_PPP] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+    f[D3Q27System::DIR_MPP] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+    f[D3Q27System::DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+    f[D3Q27System::DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
 
-    f[D3Q27System::W]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
-    f[D3Q27System::S]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
-    f[D3Q27System::B]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
-    f[D3Q27System::SW]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
-    f[D3Q27System::SE]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
-    f[D3Q27System::BW]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
-    f[D3Q27System::BE]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
-    f[D3Q27System::BS]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
-    f[D3Q27System::BN]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
-    f[D3Q27System::BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
-    f[D3Q27System::BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
-    f[D3Q27System::BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
-    f[D3Q27System::BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+    f[D3Q27System::DIR_M00]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+    f[D3Q27System::DIR_0M0]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+    f[D3Q27System::DIR_00M]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+    f[D3Q27System::DIR_MM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+    f[D3Q27System::DIR_PM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+    f[D3Q27System::DIR_M0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+    f[D3Q27System::DIR_P0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+    f[D3Q27System::DIR_0MM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+    f[D3Q27System::DIR_0PM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+    f[D3Q27System::DIR_MMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+    f[D3Q27System::DIR_PMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+    f[D3Q27System::DIR_MPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+    f[D3Q27System::DIR_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
 
     f[D3Q27System::DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)           = f[D3Q27System::INV_E];
-    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)           = f[D3Q27System::INV_N];
-    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)           = f[D3Q27System::INV_T];
-    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)          = f[D3Q27System::INV_NE];
-    (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3)      = f[D3Q27System::INV_NW];
-    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)          = f[D3Q27System::INV_TE];
-    (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3)      = f[D3Q27System::INV_TW];
-    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)          = f[D3Q27System::INV_TN];
-    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3)      = f[D3Q27System::INV_TS];
-    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)         = f[D3Q27System::INV_TNE];
-    (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3)     = f[D3Q27System::INV_TNW];
-    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3)     = f[D3Q27System::INV_TSE];
-    (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::INV_TSW];
+    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)           = f[D3Q27System::INV_P00];
+    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)           = f[D3Q27System::INV_0P0];
+    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)           = f[D3Q27System::INV_00P];
+    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)          = f[D3Q27System::INV_PP0];
+    (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3)      = f[D3Q27System::INV_MP0];
+    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)          = f[D3Q27System::INV_P0P];
+    (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3)      = f[D3Q27System::INV_M0P];
+    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)          = f[D3Q27System::INV_0PP];
+    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3)      = f[D3Q27System::INV_0MP];
+    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)         = f[D3Q27System::INV_PPP];
+    (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3)     = f[D3Q27System::INV_MPP];
+    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3)     = f[D3Q27System::INV_PMP];
+    (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::INV_MMP];
 
-    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3)           = f[D3Q27System::INV_W];
-    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3)           = f[D3Q27System::INV_S];
-    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1)           = f[D3Q27System::INV_B];
-    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3)      = f[D3Q27System::INV_SW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3)          = f[D3Q27System::INV_SE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1)      = f[D3Q27System::INV_BW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1)          = f[D3Q27System::INV_BE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1)      = f[D3Q27System::INV_BS];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1)          = f[D3Q27System::INV_BN];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::INV_BSW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1)     = f[D3Q27System::INV_BSE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::INV_BNW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::INV_BNE];
+    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3)           = f[D3Q27System::INV_M00];
+    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3)           = f[D3Q27System::INV_0M0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1)           = f[D3Q27System::INV_00M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3)      = f[D3Q27System::INV_MM0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3)          = f[D3Q27System::INV_PM0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1)      = f[D3Q27System::INV_M0M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1)          = f[D3Q27System::INV_P0M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1)      = f[D3Q27System::INV_0MM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1)          = f[D3Q27System::INV_0PM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::INV_MMM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1)     = f[D3Q27System::INV_PMM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::INV_MPM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::INV_PPM];
 
     (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    f[D3Q27System::INV_E]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-    f[D3Q27System::INV_N]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-    f[D3Q27System::INV_T]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-    f[D3Q27System::INV_NE]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-    f[D3Q27System::INV_NW]  = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
-    f[D3Q27System::INV_TE]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-    f[D3Q27System::INV_TW]  = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
-    f[D3Q27System::INV_TN]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-    f[D3Q27System::INV_TS]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
-    f[D3Q27System::INV_TNE] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-    f[D3Q27System::INV_TNW] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
-    f[D3Q27System::INV_TSE] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
-    f[D3Q27System::INV_TSW] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+    f[D3Q27System::INV_P00]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+    f[D3Q27System::INV_0P0]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+    f[D3Q27System::INV_00P]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+    f[D3Q27System::INV_PP0]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+    f[D3Q27System::INV_MP0]  = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+    f[D3Q27System::INV_P0P]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+    f[D3Q27System::INV_M0P]  = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+    f[D3Q27System::INV_0PP]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+    f[D3Q27System::INV_0MP]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+    f[D3Q27System::INV_PPP] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+    f[D3Q27System::INV_MPP] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+    f[D3Q27System::INV_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+    f[D3Q27System::INV_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
 
-    f[D3Q27System::INV_W]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
-    f[D3Q27System::INV_S]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
-    f[D3Q27System::INV_B]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
-    f[D3Q27System::INV_SW]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
-    f[D3Q27System::INV_SE]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
-    f[D3Q27System::INV_BW]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
-    f[D3Q27System::INV_BE]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
-    f[D3Q27System::INV_BS]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BN]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
-    f[D3Q27System::INV_BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
-    f[D3Q27System::INV_BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
-    f[D3Q27System::INV_BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+    f[D3Q27System::INV_M00]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+    f[D3Q27System::INV_0M0]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+    f[D3Q27System::INV_00M]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+    f[D3Q27System::INV_MM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+    f[D3Q27System::INV_PM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+    f[D3Q27System::INV_M0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+    f[D3Q27System::INV_P0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+    f[D3Q27System::INV_0MM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_0PM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+    f[D3Q27System::INV_MMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_PMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+    f[D3Q27System::INV_MPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+    f[D3Q27System::INV_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
 
     f[D3Q27System::DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal *const f, size_t x1, size_t x2, size_t x3)
 {
-    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)           = f[D3Q27System::E];
-    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)           = f[D3Q27System::N];
-    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)           = f[D3Q27System::T];
-    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)          = f[D3Q27System::NE];
-    (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3)      = f[D3Q27System::NW];
-    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)          = f[D3Q27System::TE];
-    (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3)      = f[D3Q27System::TW];
-    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)          = f[D3Q27System::TN];
-    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3)      = f[D3Q27System::TS];
-    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)         = f[D3Q27System::TNE];
-    (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3)     = f[D3Q27System::TNW];
-    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3)     = f[D3Q27System::TSE];
-    (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::TSW];
+    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)           = f[D3Q27System::DIR_P00];
+    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)           = f[D3Q27System::DIR_0P0];
+    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)           = f[D3Q27System::DIR_00P];
+    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)          = f[D3Q27System::DIR_PP0];
+    (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3)      = f[D3Q27System::DIR_MP0];
+    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)          = f[D3Q27System::DIR_P0P];
+    (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3)      = f[D3Q27System::DIR_M0P];
+    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)          = f[D3Q27System::DIR_0PP];
+    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3)      = f[D3Q27System::DIR_0MP];
+    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)         = f[D3Q27System::DIR_PPP];
+    (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3)     = f[D3Q27System::DIR_MPP];
+    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3)     = f[D3Q27System::DIR_PMP];
+    (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::DIR_MMP];
 
-    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3)           = f[D3Q27System::W];
-    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3)           = f[D3Q27System::S];
-    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1)           = f[D3Q27System::B];
-    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3)      = f[D3Q27System::SW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3)          = f[D3Q27System::SE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1)      = f[D3Q27System::BW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1)          = f[D3Q27System::BE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1)      = f[D3Q27System::BS];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1)          = f[D3Q27System::BN];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::BSW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1)     = f[D3Q27System::BSE];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::BNW];
-    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::BNE];
+    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3)           = f[D3Q27System::DIR_M00];
+    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3)           = f[D3Q27System::DIR_0M0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1)           = f[D3Q27System::DIR_00M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3)      = f[D3Q27System::DIR_MM0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3)          = f[D3Q27System::DIR_PM0];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1)      = f[D3Q27System::DIR_M0M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1)          = f[D3Q27System::DIR_P0M];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1)      = f[D3Q27System::DIR_0MM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1)          = f[D3Q27System::DIR_0PM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_MMM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1)     = f[D3Q27System::DIR_PMM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1)     = f[D3Q27System::DIR_MPM];
+    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1)         = f[D3Q27System::DIR_PPM];
 
     (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
@@ -190,57 +190,57 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal *c
                                                                 unsigned long int direction)
 {
     if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f[D3Q27System::E];
+        (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f[D3Q27System::DIR_P00];
     if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-        (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::W];
+        (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::DIR_M00];
     if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-        (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::S];
+        (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::DIR_0M0];
     if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-        (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f[D3Q27System::N];
+        (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f[D3Q27System::DIR_0P0];
     if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-        (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::B];
+        (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::DIR_00M];
     if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-        (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f[D3Q27System::T];
+        (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f[D3Q27System::DIR_00P];
     if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-        (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::SW];
+        (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::DIR_MM0];
     if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f[D3Q27System::NE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f[D3Q27System::DIR_PP0];
     if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f[D3Q27System::NW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f[D3Q27System::DIR_MP0];
     if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-        (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f[D3Q27System::SE];
+        (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f[D3Q27System::DIR_PM0];
     if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-        (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::BW];
+        (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::DIR_M0M];
     if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f[D3Q27System::TE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f[D3Q27System::DIR_P0P];
     if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f[D3Q27System::TW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f[D3Q27System::DIR_M0P];
     if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-        (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f[D3Q27System::BE];
+        (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f[D3Q27System::DIR_P0M];
     if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-        (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::BS];
+        (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::DIR_0MM];
     if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f[D3Q27System::TN];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_0PP];
     if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f[D3Q27System::TS];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f[D3Q27System::DIR_0MP];
     if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-        (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f[D3Q27System::BN];
+        (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f[D3Q27System::DIR_0PM];
     if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-        (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::BSW];
+        (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::DIR_MMM];
     if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::TNE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_PPP];
     if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-        (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f[D3Q27System::BSE];
+        (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f[D3Q27System::DIR_PMM];
     if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f[D3Q27System::TNW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_MPP];
     if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-        (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f[D3Q27System::BNW];
+        (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f[D3Q27System::DIR_MPM];
     if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f[D3Q27System::TSE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f[D3Q27System::DIR_PMP];
     if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-        (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::BNE];
+        (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::DIR_PPM];
     if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f[D3Q27System::TSW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f[D3Q27System::DIR_MMP];
     if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
         (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
@@ -249,82 +249,82 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_
                                                                 int direction)
 {
     switch (direction) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f;
             break;
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f;
             break;
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f;
             break;
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f;
             break;
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f;
             break;
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f;
             break;
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f;
             break;
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f;
             break;
         case D3Q27System::DIR_000:
@@ -339,57 +339,57 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal
                                                                    size_t x3, unsigned long int direction)
 {
     if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-        (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::E];
+        (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::DIR_P00];
     if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f[D3Q27System::W];
+        (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f[D3Q27System::DIR_M00];
     if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-        (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f[D3Q27System::S];
+        (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f[D3Q27System::DIR_0M0];
     if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-        (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::N];
+        (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::DIR_0P0];
     if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-        (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f[D3Q27System::B];
+        (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f[D3Q27System::DIR_00M];
     if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-        (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::T];
+        (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::DIR_00P];
     if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f[D3Q27System::SW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f[D3Q27System::DIR_MM0];
     if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-        (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::NE];
+        (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::DIR_PP0];
     if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-        (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f[D3Q27System::NW];
+        (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f[D3Q27System::DIR_MP0];
     if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f[D3Q27System::SE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f[D3Q27System::DIR_PM0];
     if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f[D3Q27System::BW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f[D3Q27System::DIR_M0M];
     if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-        (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::TE];
+        (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::DIR_P0P];
     if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-        (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f[D3Q27System::TW];
+        (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f[D3Q27System::DIR_M0P];
     if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f[D3Q27System::BE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f[D3Q27System::DIR_P0M];
     if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f[D3Q27System::BS];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_0MM];
     if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-        (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::TN];
+        (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::DIR_0PP];
     if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-        (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f[D3Q27System::TS];
+        (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f[D3Q27System::DIR_0MP];
     if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f[D3Q27System::BN];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f[D3Q27System::DIR_0PM];
     if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::BSW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_MMM];
     if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-        (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::TNE];
+        (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::DIR_PPP];
     if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f[D3Q27System::BSE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f[D3Q27System::DIR_PMM];
     if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-        (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f[D3Q27System::TNW];
+        (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f[D3Q27System::DIR_MPP];
     if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f[D3Q27System::BNW];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f[D3Q27System::DIR_MPM];
     if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-        (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f[D3Q27System::TSE];
+        (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f[D3Q27System::DIR_PMP];
     if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-        (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f[D3Q27System::BNE];
+        (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f[D3Q27System::DIR_PPM];
     if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-        (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::TSW];
+        (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f[D3Q27System::DIR_MMP];
     if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST)
         (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
 }
@@ -398,82 +398,82 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, si
                                                                    unsigned long int direction)
 {
     switch (direction) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f;
             break;
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f;
             break;
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f;
             break;
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f;
             break;
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f;
             break;
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f;
             break;
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f;
             break;
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = f;
             break;
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = f;
             break;
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = f;
             break;
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = f;
             break;
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = f;
             break;
         case D3Q27System::DIR_000:
@@ -487,57 +487,57 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, si
 LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction)
 {
     switch (direction) {
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             return (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             return (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             return (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             return (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             return (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             return (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             return (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             return (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             return (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             return (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             return (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             return (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             return (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             return (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             return (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
         case D3Q27System::DIR_000:
             return (*this->zeroDistributions)(x1, x2, x3);
@@ -549,57 +549,57 @@ LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, si
 LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction)
 {
     switch (direction) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             return (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             return (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             return (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             return (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             return (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             return (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             return (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             return (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             return (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             return (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             return (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             return (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             return (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             return (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             return (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             return (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             return (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
         case D3Q27System::DIR_000:
             return (*this->zeroDistributions)(x1, x2, x3);
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
index 21d1141a1..b9a2e069e 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
@@ -44,12 +44,12 @@ const int EsoTwistD3Q27System::ETX3[EsoTwistD3Q27System::ENDF + 1] = { 0, 0, 0,
                                                                        0, 1, 1, 0, 0, -1, 0, -1, 0, 1, 0, 1, 0 };
 
 const int EsoTwistD3Q27System::etINVDIR[EsoTwistD3Q27System::ENDF + 1] = {
-    D3Q27System::INV_E,   D3Q27System::INV_W,   D3Q27System::INV_N,   D3Q27System::INV_S,   D3Q27System::INV_T,
-    D3Q27System::INV_B,   D3Q27System::INV_NE,  D3Q27System::INV_SW,  D3Q27System::INV_SE,  D3Q27System::INV_NW,
-    D3Q27System::INV_TE,  D3Q27System::INV_BW,  D3Q27System::INV_BE,  D3Q27System::INV_TW,  D3Q27System::INV_TN,
-    D3Q27System::INV_BS,  D3Q27System::INV_BN,  D3Q27System::INV_TS,  D3Q27System::INV_TNE, D3Q27System::INV_TNW,
-    D3Q27System::INV_TSE, D3Q27System::INV_TSW, D3Q27System::INV_BNE, D3Q27System::INV_BNW, D3Q27System::INV_BSE,
-    D3Q27System::INV_BSW, D3Q27System::DIR_000
+    D3Q27System::INV_P00,   D3Q27System::INV_M00,   D3Q27System::INV_0P0,   D3Q27System::INV_0M0,   D3Q27System::INV_00P,
+    D3Q27System::INV_00M,   D3Q27System::INV_PP0,  D3Q27System::INV_MM0,  D3Q27System::INV_PM0,  D3Q27System::INV_MP0,
+    D3Q27System::INV_P0P,  D3Q27System::INV_M0M,  D3Q27System::INV_P0M,  D3Q27System::INV_M0P,  D3Q27System::INV_0PP,
+    D3Q27System::INV_0MM,  D3Q27System::INV_0PM,  D3Q27System::INV_0MP,  D3Q27System::INV_PPP, D3Q27System::INV_MPP,
+    D3Q27System::INV_PMP, D3Q27System::INV_MMP, D3Q27System::INV_PPM, D3Q27System::INV_MPM, D3Q27System::INV_PMM,
+    D3Q27System::INV_MMM, D3Q27System::DIR_000
 };
 
 const unsigned long int EsoTwistD3Q27System::etDIR[EsoTwistD3Q27System::ENDF + 1] = {
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
index c2ea5a9dd..7ccd413c6 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
@@ -48,59 +48,59 @@ struct EsoTwistD3Q27System {
     const static int ENDDIR   = D3Q27System::ENDDIR;
 
     static const int REST = D3Q27System::DIR_000; /*f0 */
-    static const int E    = D3Q27System::E;    /*f1 */
-    static const int W    = D3Q27System::W;    /*f2 */
-    static const int N    = D3Q27System::N;    /*f3 */
-    static const int S    = D3Q27System::S;    /*f4 */
-    static const int T    = D3Q27System::T;    /*f5 */
-    static const int B    = D3Q27System::B;    /*f6 */
-    static const int NE   = D3Q27System::NE;   /*f7 */
-    static const int SW   = D3Q27System::SW;   /*f8 */
-    static const int SE   = D3Q27System::SE;   /*f9 */
-    static const int NW   = D3Q27System::NW;   /*f10*/
-    static const int TE   = D3Q27System::TE;   /*f11*/
-    static const int BW   = D3Q27System::BW;   /*f12*/
-    static const int BE   = D3Q27System::BE;   /*f13*/
-    static const int TW   = D3Q27System::TW;   /*f14*/
-    static const int TN   = D3Q27System::TN;   /*f15*/
-    static const int BS   = D3Q27System::BS;   /*f16*/
-    static const int BN   = D3Q27System::BN;   /*f17*/
-    static const int TS   = D3Q27System::TS;   /*f18*/
-    static const int TNE  = D3Q27System::TNE;
-    static const int TNW  = D3Q27System::TNW;
-    static const int TSE  = D3Q27System::TSE;
-    static const int TSW  = D3Q27System::TSW;
-    static const int BNE  = D3Q27System::BNE;
-    static const int BNW  = D3Q27System::BNW;
-    static const int BSE  = D3Q27System::BSE;
-    static const int BSW  = D3Q27System::BSW;
+    static const int E    = D3Q27System::DIR_P00;    /*f1 */
+    static const int W    = D3Q27System::DIR_M00;    /*f2 */
+    static const int N    = D3Q27System::DIR_0P0;    /*f3 */
+    static const int S    = D3Q27System::DIR_0M0;    /*f4 */
+    static const int T    = D3Q27System::DIR_00P;    /*f5 */
+    static const int B    = D3Q27System::DIR_00M;    /*f6 */
+    static const int NE   = D3Q27System::DIR_PP0;   /*f7 */
+    static const int SW   = D3Q27System::DIR_MM0;   /*f8 */
+    static const int SE   = D3Q27System::DIR_PM0;   /*f9 */
+    static const int NW   = D3Q27System::DIR_MP0;   /*f10*/
+    static const int TE   = D3Q27System::DIR_P0P;   /*f11*/
+    static const int BW   = D3Q27System::DIR_M0M;   /*f12*/
+    static const int BE   = D3Q27System::DIR_P0M;   /*f13*/
+    static const int TW   = D3Q27System::DIR_M0P;   /*f14*/
+    static const int TN   = D3Q27System::DIR_0PP;   /*f15*/
+    static const int BS   = D3Q27System::DIR_0MM;   /*f16*/
+    static const int BN   = D3Q27System::DIR_0PM;   /*f17*/
+    static const int TS   = D3Q27System::DIR_0MP;   /*f18*/
+    static const int TNE  = D3Q27System::DIR_PPP;
+    static const int TNW  = D3Q27System::DIR_MPP;
+    static const int TSE  = D3Q27System::DIR_PMP;
+    static const int TSW  = D3Q27System::DIR_MMP;
+    static const int BNE  = D3Q27System::DIR_PPM;
+    static const int BNW  = D3Q27System::DIR_MPM;
+    static const int BSE  = D3Q27System::DIR_PMM;
+    static const int BSW  = D3Q27System::DIR_MMM;
 
-    static const int INV_E   = D3Q27System::W;
-    static const int INV_W   = D3Q27System::E;
-    static const int INV_N   = D3Q27System::S;
-    static const int INV_S   = D3Q27System::N;
-    static const int INV_T   = D3Q27System::B;
-    static const int INV_B   = D3Q27System::T;
-    static const int INV_NE  = D3Q27System::SW;
-    static const int INV_SW  = D3Q27System::NE;
-    static const int INV_SE  = D3Q27System::NW;
-    static const int INV_NW  = D3Q27System::SE;
-    static const int INV_TE  = D3Q27System::BW;
-    static const int INV_BW  = D3Q27System::TE;
-    static const int INV_BE  = D3Q27System::TW;
-    static const int INV_TW  = D3Q27System::BE;
-    static const int INV_TN  = D3Q27System::BS;
-    static const int INV_BS  = D3Q27System::TN;
-    static const int INV_BN  = D3Q27System::TS;
-    static const int INV_TS  = D3Q27System::BN;
-    static const int INV_TNE = D3Q27System::BSW;
-    static const int INV_TNW = D3Q27System::BSE;
-    static const int INV_TSE = D3Q27System::BNW;
-    static const int INV_TSW = D3Q27System::BNE;
-    static const int INV_BNE = D3Q27System::TSW;
-    static const int INV_BNW = D3Q27System::TSE;
-    static const int INV_BSE = D3Q27System::TNW;
-    static const int INV_BSW = D3Q27System::TNE;
+    static const int INV_E   = D3Q27System::DIR_M00;
+    static const int INV_W   = D3Q27System::DIR_P00;
+    static const int INV_N   = D3Q27System::DIR_0M0;
+    static const int INV_S   = D3Q27System::DIR_0P0;
+    static const int INV_T   = D3Q27System::DIR_00M;
+    static const int INV_B   = D3Q27System::DIR_00P;
+    static const int INV_NE  = D3Q27System::DIR_MM0;
+    static const int INV_SW  = D3Q27System::DIR_PP0;
+    static const int INV_SE  = D3Q27System::DIR_MP0;
+    static const int INV_NW  = D3Q27System::DIR_PM0;
+    static const int INV_TE  = D3Q27System::DIR_M0M;
+    static const int INV_BW  = D3Q27System::DIR_P0P;
+    static const int INV_BE  = D3Q27System::DIR_M0P;
+    static const int INV_TW  = D3Q27System::DIR_P0M;
+    static const int INV_TN  = D3Q27System::DIR_0MM;
+    static const int INV_BS  = D3Q27System::DIR_0PP;
+    static const int INV_BN  = D3Q27System::DIR_0MP;
+    static const int INV_TS  = D3Q27System::DIR_0PM;
+    static const int INV_TNE = D3Q27System::DIR_MMM;
+    static const int INV_TNW = D3Q27System::DIR_PMM;
+    static const int INV_TSE = D3Q27System::DIR_MPM;
+    static const int INV_TSW = D3Q27System::DIR_PPM;
+    static const int INV_BNE = D3Q27System::DIR_MMP;
+    static const int INV_BNW = D3Q27System::DIR_PMP;
+    static const int INV_BSE = D3Q27System::DIR_MPP;
+    static const int INV_BSW = D3Q27System::DIR_PPP;
 
     static const unsigned long int etZERO; // 1;/*f0 */
     static const unsigned long int etE;    //  2;    /*f1 */
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
index b4d3ba655..c8e5c24d5 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
@@ -632,7 +632,7 @@ SPtr<Block3D> Grid3D::getNeighborBlock(int dir, SPtr<Block3D> block) const
 void Grid3D::getAllNeighbors(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks)
 {
     for (int dir = D3Q27System::STARTDIR; dir <= D3Q27System::ENDDIR; dir++)
-    // for (int dir = D3Q27System::STARTDIR; dir<=D3Q27System::TS; dir++)
+    // for (int dir = D3Q27System::STARTDIR; dir<=D3Q27System::DIR_0MP; dir++)
     {
         this->getNeighborBlocksForDirection(dir, ix1, ix2, ix3, level, levelDepth, blocks);
     }
@@ -1100,82 +1100,82 @@ void Grid3D::getNeighborBlocksForDirection(int dir, int ix1, int ix2, int ix3, i
                                            std::vector<SPtr<Block3D>> &blocks)
 {
     switch (dir) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             this->getNeighborsEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             this->getNeighborsWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             this->getNeighborsNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             this->getNeighborsSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             this->getNeighborsTop(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             this->getNeighborsBottom(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             this->getNeighborsNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             this->getNeighborsSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             this->getNeighborsSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             this->getNeighborsNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             this->getNeighborsTopEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             this->getNeighborsBottomWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             this->getNeighborsBottomEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             this->getNeighborsTopWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             this->getNeighborsTopNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             this->getNeighborsBottomSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             this->getNeighborsBottomNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             this->getNeighborsTopSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
         default:
@@ -1263,82 +1263,82 @@ void Grid3D::getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2,
                                                       std::vector<SPtr<Block3D>> &blocks)
 {
     switch (dir) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             this->getNeighborsEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             this->getNeighborsWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             this->getNeighborsNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             this->getNeighborsSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             this->getNeighborsTop(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             this->getNeighborsBottom(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             this->getNeighborsNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             this->getNeighborsSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             this->getNeighborsSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             this->getNeighborsNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             this->getNeighborsTopEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             this->getNeighborsBottomWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             this->getNeighborsBottomEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             this->getNeighborsTopWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             this->getNeighborsTopNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             this->getNeighborsBottomSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             this->getNeighborsBottomNorth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             this->getNeighborsTopSouth(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             this->getNeighborsTopNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             this->getNeighborsTopNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             this->getNeighborsTopSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             this->getNeighborsTopSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             this->getNeighborsBottomNorthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             this->getNeighborsBottomNorthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             this->getNeighborsBottomSouthEast(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             this->getNeighborsBottomSouthWest(ix1, ix2, ix3, level, levelDepth, blocks);
             break;
         case D3Q27System::DIR_000:
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
index bf1895b93..a834466f8 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
@@ -90,108 +90,108 @@ void D3Q27Interactor::initRayVectors()
     int fdir;
     double c1oS2 = UbMath::one_over_sqrt2;
     double c1oS3 = UbMath::one_over_sqrt3;
-    fdir         = D3Q27System::E;
+    fdir         = D3Q27System::DIR_P00;
     rayX1[fdir]  = 1.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::W;
+    fdir         = D3Q27System::DIR_M00;
     rayX1[fdir]  = -1.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::N;
+    fdir         = D3Q27System::DIR_0P0;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 1.0;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::S;
+    fdir         = D3Q27System::DIR_0M0;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -1.0;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::T;
+    fdir         = D3Q27System::DIR_00P;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 1.0;
-    fdir         = D3Q27System::B;
+    fdir         = D3Q27System::DIR_00M;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -1.0;
-    fdir         = D3Q27System::NE;
+    fdir         = D3Q27System::DIR_PP0;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::SW;
+    fdir         = D3Q27System::DIR_MM0;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::SE;
+    fdir         = D3Q27System::DIR_PM0;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::NW;
+    fdir         = D3Q27System::DIR_MP0;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = D3Q27System::TE;
+    fdir         = D3Q27System::DIR_P0P;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = c1oS2;
-    fdir         = D3Q27System::BW;
+    fdir         = D3Q27System::DIR_M0M;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -c1oS2;
-    fdir         = D3Q27System::BE;
+    fdir         = D3Q27System::DIR_P0M;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -c1oS2;
-    fdir         = D3Q27System::TW;
+    fdir         = D3Q27System::DIR_M0P;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = c1oS2;
-    fdir         = D3Q27System::TN;
+    fdir         = D3Q27System::DIR_0PP;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = c1oS2;
-    fdir         = D3Q27System::BS;
+    fdir         = D3Q27System::DIR_0MM;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = -c1oS2;
-    fdir         = D3Q27System::BN;
+    fdir         = D3Q27System::DIR_0PM;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = -c1oS2;
-    fdir         = D3Q27System::TS;
+    fdir         = D3Q27System::DIR_0MP;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = c1oS2;
 
-    fdir        = D3Q27System::TNW;
+    fdir        = D3Q27System::DIR_MPP;
     rayX1[fdir] = -c1oS3;
     rayX2[fdir] = c1oS3;
     rayX3[fdir] = c1oS3;
-    fdir        = D3Q27System::TNE;
+    fdir        = D3Q27System::DIR_PPP;
     rayX1[fdir] = c1oS3;
     rayX2[fdir] = c1oS3;
     rayX3[fdir] = c1oS3;
-    fdir        = D3Q27System::TSW;
+    fdir        = D3Q27System::DIR_MMP;
     rayX1[fdir] = -c1oS3;
     rayX2[fdir] = -c1oS3;
     rayX3[fdir] = c1oS3;
-    fdir        = D3Q27System::TSE;
+    fdir        = D3Q27System::DIR_PMP;
     rayX1[fdir] = c1oS3;
     rayX2[fdir] = -c1oS3;
     rayX3[fdir] = c1oS3;
-    fdir        = D3Q27System::BNW;
+    fdir        = D3Q27System::DIR_MPM;
     rayX1[fdir] = -c1oS3;
     rayX2[fdir] = c1oS3;
     rayX3[fdir] = -c1oS3;
-    fdir        = D3Q27System::BNE;
+    fdir        = D3Q27System::DIR_PPM;
     rayX1[fdir] = c1oS3;
     rayX2[fdir] = c1oS3;
     rayX3[fdir] = -c1oS3;
-    fdir        = D3Q27System::BSW;
+    fdir        = D3Q27System::DIR_MMM;
     rayX1[fdir] = -c1oS3;
     rayX2[fdir] = -c1oS3;
     rayX3[fdir] = -c1oS3;
-    fdir        = D3Q27System::BSE;
+    fdir        = D3Q27System::DIR_PMM;
     rayX1[fdir] = c1oS3;
     rayX2[fdir] = -c1oS3;
     rayX3[fdir] = -c1oS3;
@@ -327,18 +327,18 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block)
                 UB_EXARGS, "fuer den bei LB nicht vorkommenden Fall deltaX1!=deltaX2!=deltaX3  nicht implementiert ");
 
         vector<double> distNeigh(D3Q27System::FENDDIR + 1, UbMath::sqrt2 * deltaX1);
-        distNeigh[D3Q27System::E] = distNeigh[D3Q27System::W] = distNeigh[D3Q27System::N] = deltaX1;
-        distNeigh[D3Q27System::S] = distNeigh[D3Q27System::T] = distNeigh[D3Q27System::B] = deltaX1;
-        distNeigh[D3Q27System::NE] = distNeigh[D3Q27System::NW] = distNeigh[D3Q27System::SW] =
-            distNeigh[D3Q27System::SE]                          = UbMath::sqrt2 * deltaX1;
-        distNeigh[D3Q27System::TE] = distNeigh[D3Q27System::TN] = distNeigh[D3Q27System::TW] =
-            distNeigh[D3Q27System::TS]                          = UbMath::sqrt2 * deltaX1;
-        distNeigh[D3Q27System::BE] = distNeigh[D3Q27System::BN] = distNeigh[D3Q27System::BW] =
-            distNeigh[D3Q27System::BS]                          = UbMath::sqrt2 * deltaX1;
-        distNeigh[D3Q27System::TNE] = distNeigh[D3Q27System::TNW] = distNeigh[D3Q27System::TSE] =
-            distNeigh[D3Q27System::TSW]                           = UbMath::sqrt3 * deltaX1;
-        distNeigh[D3Q27System::BNE] = distNeigh[D3Q27System::BNW] = distNeigh[D3Q27System::BSE] =
-            distNeigh[D3Q27System::BSW]                           = UbMath::sqrt3 * deltaX1;
+        distNeigh[D3Q27System::DIR_P00] = distNeigh[D3Q27System::DIR_M00] = distNeigh[D3Q27System::DIR_0P0] = deltaX1;
+        distNeigh[D3Q27System::DIR_0M0] = distNeigh[D3Q27System::DIR_00P] = distNeigh[D3Q27System::DIR_00M] = deltaX1;
+        distNeigh[D3Q27System::DIR_PP0] = distNeigh[D3Q27System::DIR_MP0] = distNeigh[D3Q27System::DIR_MM0] =
+            distNeigh[D3Q27System::DIR_PM0]                          = UbMath::sqrt2 * deltaX1;
+        distNeigh[D3Q27System::DIR_P0P] = distNeigh[D3Q27System::DIR_0PP] = distNeigh[D3Q27System::DIR_M0P] =
+            distNeigh[D3Q27System::DIR_0MP]                          = UbMath::sqrt2 * deltaX1;
+        distNeigh[D3Q27System::DIR_P0M] = distNeigh[D3Q27System::DIR_0PM] = distNeigh[D3Q27System::DIR_M0M] =
+            distNeigh[D3Q27System::DIR_0MM]                          = UbMath::sqrt2 * deltaX1;
+        distNeigh[D3Q27System::DIR_PPP] = distNeigh[D3Q27System::DIR_MPP] = distNeigh[D3Q27System::DIR_PMP] =
+            distNeigh[D3Q27System::DIR_MMP]                           = UbMath::sqrt3 * deltaX1;
+        distNeigh[D3Q27System::DIR_PPM] = distNeigh[D3Q27System::DIR_MPM] = distNeigh[D3Q27System::DIR_PMM] =
+            distNeigh[D3Q27System::DIR_MMM]                           = UbMath::sqrt3 * deltaX1;
         double q;
         bool pointOnBoundary = false;
 
@@ -613,132 +613,132 @@ void D3Q27Interactor::addQsLineSet(std::vector<UbTupleFloat3> &nodes, std::vecto
                     if (bc->hasBoundaryConditionFlag(D3Q27System::INVDIR[dir])) {
                         double x1b, x2b, x3b, q = bc->getQ(dir);
                         switch (dir) {
-                            case D3Q27System::E:
+                            case D3Q27System::DIR_P00:
                                 x1b = x1a + q * dx;
                                 x2b = x2a;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::N:
+                            case D3Q27System::DIR_0P0:
                                 x1b = x1a;
                                 x2b = x2a + q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::W:
+                            case D3Q27System::DIR_M00:
                                 x1b = x1a - q * dx;
                                 x2b = x2a;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::S:
+                            case D3Q27System::DIR_0M0:
                                 x1b = x1a;
                                 x2b = x2a - q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::NE:
+                            case D3Q27System::DIR_PP0:
                                 x1b = x1a + q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::NW:
+                            case D3Q27System::DIR_MP0:
                                 x1b = x1a - q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::SW:
+                            case D3Q27System::DIR_MM0:
                                 x1b = x1a - q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::SE:
+                            case D3Q27System::DIR_PM0:
                                 x1b = x1a + q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a;
                                 break;
-                            case D3Q27System::T:
+                            case D3Q27System::DIR_00P:
                                 x1b = x1a;
                                 x2b = x2a;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::TE:
+                            case D3Q27System::DIR_P0P:
                                 x1b = x1a + q * dx;
                                 x2b = x2a;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::TN:
+                            case D3Q27System::DIR_0PP:
                                 x1b = x1a;
                                 x2b = x2a + q * dx;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::TW:
+                            case D3Q27System::DIR_M0P:
                                 x1b = x1a - q * dx;
                                 x2b = x2a;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::TS:
+                            case D3Q27System::DIR_0MP:
                                 x1b = x1a;
                                 x2b = x2a - q * dx;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::B:
+                            case D3Q27System::DIR_00M:
                                 x1b = x1a;
                                 x2b = x2a;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BE:
+                            case D3Q27System::DIR_P0M:
                                 x1b = x1a + q * dx;
                                 x2b = x2a;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BN:
+                            case D3Q27System::DIR_0PM:
                                 x1b = x1a;
                                 x2b = x2a + q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BW:
+                            case D3Q27System::DIR_M0M:
                                 x1b = x1a - q * dx;
                                 x2b = x2a;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BS:
+                            case D3Q27System::DIR_0MM:
                                 x1b = x1a;
                                 x2b = x2a - q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::TNE:
+                            case D3Q27System::DIR_PPP:
                                 x1b = x1a + q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::BSW:
+                            case D3Q27System::DIR_MMM:
                                 x1b = x1a - q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BNE:
+                            case D3Q27System::DIR_PPM:
                                 x1b = x1a + q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::TSW:
+                            case D3Q27System::DIR_MMP:
                                 x1b = x1a - q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::TSE:
+                            case D3Q27System::DIR_PMP:
                                 x1b = x1a + q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a + q * dx;
                                 break;
-                            case D3Q27System::BNW:
+                            case D3Q27System::DIR_MPM:
                                 x1b = x1a - q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::BSE:
+                            case D3Q27System::DIR_PMM:
                                 x1b = x1a + q * dx;
                                 x2b = x2a - q * dx;
                                 x3b = x3a - q * dx;
                                 break;
-                            case D3Q27System::TNW:
+                            case D3Q27System::DIR_MPP:
                                 x1b = x1a - q * dx;
                                 x2b = x2a + q * dx;
                                 x3b = x3a + q * dx;
@@ -782,17 +782,17 @@ vector<pair<GbPoint3D, GbPoint3D>> D3Q27Interactor::getQsLineSet()
         bool include_TN_Edge = false; //(x1/x2/x3)=([0..blocknx1[/blocknx2/blocknx1)
         bool include_TE_Edge = false; //(x1/x2/x3)=(blocknx1/[0..blocknx2[/blocknx2)
         if (block) {
-            if (!block->getConnector(D3Q27System::N))
+            if (!block->getConnector(D3Q27System::DIR_0P0))
                 include_N_Face = true;
-            if (!block->getConnector(D3Q27System::E))
+            if (!block->getConnector(D3Q27System::DIR_P00))
                 include_E_Face = true;
-            if (!block->getConnector(D3Q27System::T))
+            if (!block->getConnector(D3Q27System::DIR_00P))
                 include_T_Face = true;
-            if (!block->getConnector(D3Q27System::NE) && include_N_Face && include_E_Face)
+            if (!block->getConnector(D3Q27System::DIR_PP0) && include_N_Face && include_E_Face)
                 include_NE_Edge = true;
-            if (!block->getConnector(D3Q27System::TN) && include_T_Face && include_N_Face)
+            if (!block->getConnector(D3Q27System::DIR_0PP) && include_T_Face && include_N_Face)
                 include_TN_Edge = true;
-            if (!block->getConnector(D3Q27System::TE) && include_T_Face && include_E_Face)
+            if (!block->getConnector(D3Q27System::DIR_P0P) && include_T_Face && include_E_Face)
                 include_TE_Edge = true;
         }
 
@@ -834,132 +834,132 @@ vector<pair<GbPoint3D, GbPoint3D>> D3Q27Interactor::getQsLineSet()
                         if (bc->hasBoundaryConditionFlag(D3Q27System::INVDIR[dir])) {
                             double x1b, x2b, x3b, q = bc->getQ(dir);
                             switch (dir) {
-                                case D3Q27System::E:
+                                case D3Q27System::DIR_P00:
                                     x1b = x1a + q * dx;
                                     x2b = x2a;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::N:
+                                case D3Q27System::DIR_0P0:
                                     x1b = x1a;
                                     x2b = x2a + q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::W:
+                                case D3Q27System::DIR_M00:
                                     x1b = x1a - q * dx;
                                     x2b = x2a;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::S:
+                                case D3Q27System::DIR_0M0:
                                     x1b = x1a;
                                     x2b = x2a - q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::NE:
+                                case D3Q27System::DIR_PP0:
                                     x1b = x1a + q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::NW:
+                                case D3Q27System::DIR_MP0:
                                     x1b = x1a - q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::SW:
+                                case D3Q27System::DIR_MM0:
                                     x1b = x1a - q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::SE:
+                                case D3Q27System::DIR_PM0:
                                     x1b = x1a + q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a;
                                     break;
-                                case D3Q27System::T:
+                                case D3Q27System::DIR_00P:
                                     x1b = x1a;
                                     x2b = x2a;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::TE:
+                                case D3Q27System::DIR_P0P:
                                     x1b = x1a + q * dx;
                                     x2b = x2a;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::TN:
+                                case D3Q27System::DIR_0PP:
                                     x1b = x1a;
                                     x2b = x2a + q * dx;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::TW:
+                                case D3Q27System::DIR_M0P:
                                     x1b = x1a - q * dx;
                                     x2b = x2a;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::TS:
+                                case D3Q27System::DIR_0MP:
                                     x1b = x1a;
                                     x2b = x2a - q * dx;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::B:
+                                case D3Q27System::DIR_00M:
                                     x1b = x1a;
                                     x2b = x2a;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BE:
+                                case D3Q27System::DIR_P0M:
                                     x1b = x1a + q * dx;
                                     x2b = x2a;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BN:
+                                case D3Q27System::DIR_0PM:
                                     x1b = x1a;
                                     x2b = x2a + q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BW:
+                                case D3Q27System::DIR_M0M:
                                     x1b = x1a - q * dx;
                                     x2b = x2a;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BS:
+                                case D3Q27System::DIR_0MM:
                                     x1b = x1a;
                                     x2b = x2a - q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::TNE:
+                                case D3Q27System::DIR_PPP:
                                     x1b = x1a + q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::BSW:
+                                case D3Q27System::DIR_MMM:
                                     x1b = x1a - q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BNE:
+                                case D3Q27System::DIR_PPM:
                                     x1b = x1a + q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::TSW:
+                                case D3Q27System::DIR_MMP:
                                     x1b = x1a - q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::TSE:
+                                case D3Q27System::DIR_PMP:
                                     x1b = x1a + q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a + q * dx;
                                     break;
-                                case D3Q27System::BNW:
+                                case D3Q27System::DIR_MPM:
                                     x1b = x1a - q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::BSE:
+                                case D3Q27System::DIR_PMM:
                                     x1b = x1a + q * dx;
                                     x2b = x2a - q * dx;
                                     x3b = x3a - q * dx;
                                     break;
-                                case D3Q27System::TNW:
+                                case D3Q27System::DIR_MPP:
                                     x1b = x1a - q * dx;
                                     x2b = x2a + q * dx;
                                     x3b = x3a + q * dx;
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
index 452042791..c7b13d383 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp
@@ -364,9 +364,9 @@ void D3Q27TriFaceMeshInteractor::setQs(const double &timeStep)
                 //            tmpSolidNodesFromOtherInteractors[block];
                 double q, distance;
 
-                double &nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::E];
-                double &nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::N];
-                double &nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::T];
+                double &nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::DIR_P00];
+                double &nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::DIR_0P0];
+                double &nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::DIR_00P];
 
                 // fuer OBB-Test
                 double qEinflussDelta = 1.1 * sqrt(nodeDx1 * nodeDx1 + nodeDx2 * nodeDx2 + nodeDx3 * nodeDx3);
@@ -880,9 +880,9 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const double &timeStep)
                 std::set<std::vector<int>> &solidsFromOtherInteractors = tmpSolidNodesFromOtherInteractors[block];
                 double q, internX1, internX2, internX3, distance;
 
-                double &nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::E];
-                double &nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::N];
-                double &nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::T];
+                double &nodeDx1 = nodeDeltaToNeigh[level][D3Q27System::DIR_P00];
+                double &nodeDx2 = nodeDeltaToNeigh[level][D3Q27System::DIR_0P0];
+                double &nodeDx3 = nodeDeltaToNeigh[level][D3Q27System::DIR_00P];
 
                 // fuer OBB-Test
                 double qEinflussDelta = 1.1 * sqrt(nodeDx1 * nodeDx1 + nodeDx2 * nodeDx2 + nodeDx3 * nodeDx3);
@@ -1181,9 +1181,9 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const double &timeStep)
 
                 std::set<UbTupleInt3> &solidNodeIndices = this->solidNodeIndicesMap[block];
 
-                float nodeDeltaX1 = (float)nodeDeltaToNeigh[level][D3Q27System::E];
-                float nodeDeltaX2 = (float)nodeDeltaToNeigh[level][D3Q27System::N];
-                float nodeDeltaX3 = (float)nodeDeltaToNeigh[level][D3Q27System::T];
+                float nodeDeltaX1 = (float)nodeDeltaToNeigh[level][D3Q27System::DIR_P00];
+                float nodeDeltaX2 = (float)nodeDeltaToNeigh[level][D3Q27System::DIR_0P0];
+                float nodeDeltaX3 = (float)nodeDeltaToNeigh[level][D3Q27System::DIR_00P];
 
                 // flagfield matrix initialisieren
                 CbArray3D<FLAGS> flagField(blocknx1, blocknx2, blocknx3, UNDEF_FLAG);
diff --git a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
index 4d4dff771..50a5339ea 100644
--- a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp
@@ -93,115 +93,115 @@ void BGKLBMKernel::calculate(int step)
                     ////////////////////////////////////////////////////////////////////////////
                     f[DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 
-                    f[E]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-                    f[N]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-                    f[T]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-                    f[NE]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-                    f[NW]  = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
-                    f[TE]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-                    f[TW]  = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
-                    f[TN]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-                    f[TS]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3);
-                    f[TNE] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-                    f[TNW] = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    f[TSE] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    f[TSW] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    f[DIR_P00]   = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+                    f[DIR_0P0]   = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+                    f[DIR_00P]   = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+                    f[DIR_PP0]  = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+                    f[DIR_MP0]  = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
+                    f[DIR_P0P]  = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+                    f[DIR_M0P]  = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
+                    f[DIR_0PP]  = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+                    f[DIR_0MP]  = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3);
+                    f[DIR_PPP] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+                    f[DIR_MPP] = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    f[DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    f[DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    f[W]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
-                    f[S]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
-                    f[B]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
-                    f[SW]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    f[SE]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
-                    f[BW]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    f[BE]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p);
-                    f[BS]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    f[BN]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p);
-                    f[BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    f[BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    f[BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    f[DIR_M00]   = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
+                    f[DIR_0M0]   = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
+                    f[DIR_00M]   = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
+                    f[DIR_MM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    f[DIR_PM0]  = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
+                    f[DIR_M0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    f[DIR_P0M]  = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p);
+                    f[DIR_0MM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    f[DIR_0PM]  = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p);
+                    f[DIR_MMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    f[DIR_PMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    f[DIR_MPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    f[DIR_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
                     //////////////////////////////////////////////////////////////////////////
 
-                    drho = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] +
-                           f[BW] + f[BE] + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] +
-                           f[BNE] + f[BSW] + f[BSE] + f[BNW];
+                    drho = f[DIR_000] + f[DIR_P00] + f[DIR_M00] + f[DIR_0P0] + f[DIR_0M0] + f[DIR_00P] + f[DIR_00M] + f[DIR_PP0] + f[DIR_MM0] + f[DIR_PM0] + f[DIR_MP0] + f[DIR_P0P] +
+                           f[DIR_M0M] + f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] + f[DIR_0MM] + f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] +
+                           f[DIR_PPM] + f[DIR_MMM] + f[DIR_PMM] + f[DIR_MPM];
 
-                    vx1 = f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW] + f[BE] - f[TW] + f[TNE] -
-                          f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW] + f[BSE] - f[BNW];
+                    vx1 = f[DIR_P00] - f[DIR_M00] + f[DIR_PP0] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M] + f[DIR_P0M] - f[DIR_M0P] + f[DIR_PPP] -
+                          f[DIR_MMP] + f[DIR_PMP] - f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] + f[DIR_PMM] - f[DIR_MPM];
 
-                    vx2 = f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN] - f[TS] + f[TNE] -
-                          f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] + f[BNW];
+                    vx2 = f[DIR_0P0] - f[DIR_0M0] + f[DIR_PP0] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM] - f[DIR_0MP] + f[DIR_PPP] -
+                          f[DIR_MMP] - f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] + f[DIR_MPM];
 
-                    vx3 = f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] + f[TS] + f[TNE] +
-                          f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] - f[BNW];
+                    vx3 = f[DIR_00P] - f[DIR_00M] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] +
+                          f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] - f[DIR_MPM];
 
                     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
                     feq[DIR_000] = c8o27 * (drho - cu_sq);
-                    feq[E]    = c2o27 * (drho + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
-                    feq[W]    = c2o27 * (drho + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
-                    feq[N]    = c2o27 * (drho + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
-                    feq[S]    = c2o27 * (drho + 3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq);
-                    feq[T]    = c2o27 * (drho + 3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq);
-                    feq[B]    = c2o27 * (drho + 3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq);
-                    feq[NE]   = c1o54 * (drho + 3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
-                    feq[SW]   = c1o54 * (drho + 3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
-                    feq[SE]   = c1o54 * (drho + 3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
-                    feq[NW]   = c1o54 * (drho + 3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
-                    feq[TE]   = c1o54 * (drho + 3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
-                    feq[BW]   = c1o54 * (drho + 3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
-                    feq[BE]   = c1o54 * (drho + 3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
-                    feq[TW]   = c1o54 * (drho + 3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
-                    feq[TN]   = c1o54 * (drho + 3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
-                    feq[BS]   = c1o54 * (drho + 3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
-                    feq[BN]   = c1o54 * (drho + 3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
-                    feq[TS]   = c1o54 * (drho + 3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
-                    feq[TNE]  = c1o216 *
+                    feq[DIR_P00]    = c2o27 * (drho + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
+                    feq[DIR_M00]    = c2o27 * (drho + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
+                    feq[DIR_0P0]    = c2o27 * (drho + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
+                    feq[DIR_0M0]    = c2o27 * (drho + 3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq);
+                    feq[DIR_00P]    = c2o27 * (drho + 3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq);
+                    feq[DIR_00M]    = c2o27 * (drho + 3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq);
+                    feq[DIR_PP0]   = c1o54 * (drho + 3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
+                    feq[DIR_MM0]   = c1o54 * (drho + 3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
+                    feq[DIR_PM0]   = c1o54 * (drho + 3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
+                    feq[DIR_MP0]   = c1o54 * (drho + 3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
+                    feq[DIR_P0P]   = c1o54 * (drho + 3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
+                    feq[DIR_M0M]   = c1o54 * (drho + 3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
+                    feq[DIR_P0M]   = c1o54 * (drho + 3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
+                    feq[DIR_M0P]   = c1o54 * (drho + 3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
+                    feq[DIR_0PP]   = c1o54 * (drho + 3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
+                    feq[DIR_0MM]   = c1o54 * (drho + 3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
+                    feq[DIR_0PM]   = c1o54 * (drho + 3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
+                    feq[DIR_0MP]   = c1o54 * (drho + 3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
+                    feq[DIR_PPP]  = c1o216 *
                                (drho + 3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq);
-                    feq[BSW] = c1o216 * (drho + 3.0 * (-vx1 - vx2 - vx3) +
+                    feq[DIR_MMM] = c1o216 * (drho + 3.0 * (-vx1 - vx2 - vx3) +
                                          c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq);
-                    feq[BNE] = c1o216 *
+                    feq[DIR_PPM] = c1o216 *
                                (drho + 3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq);
-                    feq[TSW] = c1o216 * (drho + 3.0 * (-vx1 - vx2 + vx3) +
+                    feq[DIR_MMP] = c1o216 * (drho + 3.0 * (-vx1 - vx2 + vx3) +
                                          c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq);
-                    feq[TSE] = c1o216 *
+                    feq[DIR_PMP] = c1o216 *
                                (drho + 3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq);
-                    feq[BNW] = c1o216 * (drho + 3.0 * (-vx1 + vx2 - vx3) +
+                    feq[DIR_MPM] = c1o216 * (drho + 3.0 * (-vx1 + vx2 - vx3) +
                                          c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq);
-                    feq[BSE] = c1o216 *
+                    feq[DIR_PMM] = c1o216 *
                                (drho + 3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq);
-                    feq[TNW] = c1o216 * (drho + 3.0 * (-vx1 + vx2 + vx3) +
+                    feq[DIR_MPP] = c1o216 * (drho + 3.0 * (-vx1 + vx2 + vx3) +
                                          c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
 
                     // Relaxation
                     f[DIR_000] += (feq[DIR_000] - f[DIR_000]) * collFactor;
-                    f[E] += (feq[E] - f[E]) * collFactor;
-                    f[W] += (feq[W] - f[W]) * collFactor;
-                    f[N] += (feq[N] - f[N]) * collFactor;
-                    f[S] += (feq[S] - f[S]) * collFactor;
-                    f[T] += (feq[T] - f[T]) * collFactor;
-                    f[B] += (feq[B] - f[B]) * collFactor;
-                    f[NE] += (feq[NE] - f[NE]) * collFactor;
-                    f[SW] += (feq[SW] - f[SW]) * collFactor;
-                    f[SE] += (feq[SE] - f[SE]) * collFactor;
-                    f[NW] += (feq[NW] - f[NW]) * collFactor;
-                    f[TE] += (feq[TE] - f[TE]) * collFactor;
-                    f[BW] += (feq[BW] - f[BW]) * collFactor;
-                    f[BE] += (feq[BE] - f[BE]) * collFactor;
-                    f[TW] += (feq[TW] - f[TW]) * collFactor;
-                    f[TN] += (feq[TN] - f[TN]) * collFactor;
-                    f[BS] += (feq[BS] - f[BS]) * collFactor;
-                    f[BN] += (feq[BN] - f[BN]) * collFactor;
-                    f[TS] += (feq[TS] - f[TS]) * collFactor;
+                    f[DIR_P00] += (feq[DIR_P00] - f[DIR_P00]) * collFactor;
+                    f[DIR_M00] += (feq[DIR_M00] - f[DIR_M00]) * collFactor;
+                    f[DIR_0P0] += (feq[DIR_0P0] - f[DIR_0P0]) * collFactor;
+                    f[DIR_0M0] += (feq[DIR_0M0] - f[DIR_0M0]) * collFactor;
+                    f[DIR_00P] += (feq[DIR_00P] - f[DIR_00P]) * collFactor;
+                    f[DIR_00M] += (feq[DIR_00M] - f[DIR_00M]) * collFactor;
+                    f[DIR_PP0] += (feq[DIR_PP0] - f[DIR_PP0]) * collFactor;
+                    f[DIR_MM0] += (feq[DIR_MM0] - f[DIR_MM0]) * collFactor;
+                    f[DIR_PM0] += (feq[DIR_PM0] - f[DIR_PM0]) * collFactor;
+                    f[DIR_MP0] += (feq[DIR_MP0] - f[DIR_MP0]) * collFactor;
+                    f[DIR_P0P] += (feq[DIR_P0P] - f[DIR_P0P]) * collFactor;
+                    f[DIR_M0M] += (feq[DIR_M0M] - f[DIR_M0M]) * collFactor;
+                    f[DIR_P0M] += (feq[DIR_P0M] - f[DIR_P0M]) * collFactor;
+                    f[DIR_M0P] += (feq[DIR_M0P] - f[DIR_M0P]) * collFactor;
+                    f[DIR_0PP] += (feq[DIR_0PP] - f[DIR_0PP]) * collFactor;
+                    f[DIR_0MM] += (feq[DIR_0MM] - f[DIR_0MM]) * collFactor;
+                    f[DIR_0PM] += (feq[DIR_0PM] - f[DIR_0PM]) * collFactor;
+                    f[DIR_0MP] += (feq[DIR_0MP] - f[DIR_0MP]) * collFactor;
 
-                    f[TNE] += (feq[TNE] - f[TNE]) * collFactor;
-                    f[BSW] += (feq[BSW] - f[BSW]) * collFactor;
-                    f[BNE] += (feq[BNE] - f[BNE]) * collFactor;
-                    f[TSW] += (feq[TSW] - f[TSW]) * collFactor;
-                    f[TSE] += (feq[TSE] - f[TSE]) * collFactor;
-                    f[BNW] += (feq[BNW] - f[BNW]) * collFactor;
-                    f[BSE] += (feq[BSE] - f[BSE]) * collFactor;
-                    f[TNW] += (feq[TNW] - f[TNW]) * collFactor;
+                    f[DIR_PPP] += (feq[DIR_PPP] - f[DIR_PPP]) * collFactor;
+                    f[DIR_MMM] += (feq[DIR_MMM] - f[DIR_MMM]) * collFactor;
+                    f[DIR_PPM] += (feq[DIR_PPM] - f[DIR_PPM]) * collFactor;
+                    f[DIR_MMP] += (feq[DIR_MMP] - f[DIR_MMP]) * collFactor;
+                    f[DIR_PMP] += (feq[DIR_PMP] - f[DIR_PMP]) * collFactor;
+                    f[DIR_MPM] += (feq[DIR_MPM] - f[DIR_MPM]) * collFactor;
+                    f[DIR_PMM] += (feq[DIR_PMM] - f[DIR_PMM]) * collFactor;
+                    f[DIR_MPP] += (feq[DIR_MPP] - f[DIR_MPP]) * collFactor;
 
                     //////////////////////////////////////////////////////////////////////////
                     // forcing
@@ -215,38 +215,38 @@ void BGKLBMKernel::calculate(int step)
                         forcingX3 = muForcingX3.Eval();
 
                         f[DIR_000] += 0.0;
-                        f[E] += 3.0 * c2o27 * (forcingX1);
-                        f[W] += 3.0 * c2o27 * (-forcingX1);
-                        f[N] += 3.0 * c2o27 * (forcingX2);
-                        f[S] += 3.0 * c2o27 * (-forcingX2);
-                        f[T] += 3.0 * c2o27 * (forcingX3);
-                        f[B] += 3.0 * c2o27 * (-forcingX3);
-                        f[NE] += 3.0 * c1o54 * (forcingX1 + forcingX2);
-                        f[SW] += 3.0 * c1o54 * (-forcingX1 - forcingX2);
-                        f[SE] += 3.0 * c1o54 * (forcingX1 - forcingX2);
-                        f[NW] += 3.0 * c1o54 * (-forcingX1 + forcingX2);
-                        f[TE] += 3.0 * c1o54 * (forcingX1 + forcingX3);
-                        f[BW] += 3.0 * c1o54 * (-forcingX1 - forcingX3);
-                        f[BE] += 3.0 * c1o54 * (forcingX1 - forcingX3);
-                        f[TW] += 3.0 * c1o54 * (-forcingX1 + forcingX3);
-                        f[TN] += 3.0 * c1o54 * (forcingX2 + forcingX3);
-                        f[BS] += 3.0 * c1o54 * (-forcingX2 - forcingX3);
-                        f[BN] += 3.0 * c1o54 * (forcingX2 - forcingX3);
-                        f[TS] += 3.0 * c1o54 * (-forcingX2 + forcingX3);
-                        f[TNE] += 3.0 * c1o216 * (forcingX1 + forcingX2 + forcingX3);
-                        f[BSW] += 3.0 * c1o216 * (-forcingX1 - forcingX2 - forcingX3);
-                        f[BNE] += 3.0 * c1o216 * (forcingX1 + forcingX2 - forcingX3);
-                        f[TSW] += 3.0 * c1o216 * (-forcingX1 - forcingX2 + forcingX3);
-                        f[TSE] += 3.0 * c1o216 * (forcingX1 - forcingX2 + forcingX3);
-                        f[BNW] += 3.0 * c1o216 * (-forcingX1 + forcingX2 - forcingX3);
-                        f[BSE] += 3.0 * c1o216 * (forcingX1 - forcingX2 - forcingX3);
-                        f[TNW] += 3.0 * c1o216 * (-forcingX1 + forcingX2 + forcingX3);
+                        f[DIR_P00] += 3.0 * c2o27 * (forcingX1);
+                        f[DIR_M00] += 3.0 * c2o27 * (-forcingX1);
+                        f[DIR_0P0] += 3.0 * c2o27 * (forcingX2);
+                        f[DIR_0M0] += 3.0 * c2o27 * (-forcingX2);
+                        f[DIR_00P] += 3.0 * c2o27 * (forcingX3);
+                        f[DIR_00M] += 3.0 * c2o27 * (-forcingX3);
+                        f[DIR_PP0] += 3.0 * c1o54 * (forcingX1 + forcingX2);
+                        f[DIR_MM0] += 3.0 * c1o54 * (-forcingX1 - forcingX2);
+                        f[DIR_PM0] += 3.0 * c1o54 * (forcingX1 - forcingX2);
+                        f[DIR_MP0] += 3.0 * c1o54 * (-forcingX1 + forcingX2);
+                        f[DIR_P0P] += 3.0 * c1o54 * (forcingX1 + forcingX3);
+                        f[DIR_M0M] += 3.0 * c1o54 * (-forcingX1 - forcingX3);
+                        f[DIR_P0M] += 3.0 * c1o54 * (forcingX1 - forcingX3);
+                        f[DIR_M0P] += 3.0 * c1o54 * (-forcingX1 + forcingX3);
+                        f[DIR_0PP] += 3.0 * c1o54 * (forcingX2 + forcingX3);
+                        f[DIR_0MM] += 3.0 * c1o54 * (-forcingX2 - forcingX3);
+                        f[DIR_0PM] += 3.0 * c1o54 * (forcingX2 - forcingX3);
+                        f[DIR_0MP] += 3.0 * c1o54 * (-forcingX2 + forcingX3);
+                        f[DIR_PPP] += 3.0 * c1o216 * (forcingX1 + forcingX2 + forcingX3);
+                        f[DIR_MMM] += 3.0 * c1o216 * (-forcingX1 - forcingX2 - forcingX3);
+                        f[DIR_PPM] += 3.0 * c1o216 * (forcingX1 + forcingX2 - forcingX3);
+                        f[DIR_MMP] += 3.0 * c1o216 * (-forcingX1 - forcingX2 + forcingX3);
+                        f[DIR_PMP] += 3.0 * c1o216 * (forcingX1 - forcingX2 + forcingX3);
+                        f[DIR_MPM] += 3.0 * c1o216 * (-forcingX1 + forcingX2 - forcingX3);
+                        f[DIR_PMM] += 3.0 * c1o216 * (forcingX1 - forcingX2 - forcingX3);
+                        f[DIR_MPP] += 3.0 * c1o216 * (-forcingX1 + forcingX2 + forcingX3);
                     }
                     //////////////////////////////////////////////////////////////////////////
 #ifdef PROOF_CORRECTNESS
-                    LBMReal rho_post = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] + f[NE] + f[SW] + f[SE] +
-                                       f[NW] + f[TE] + f[BW] + f[BE] + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] +
-                                       f[TSW] + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW];
+                    LBMReal rho_post = f[DIR_000] + f[DIR_P00] + f[DIR_M00] + f[DIR_0P0] + f[DIR_0M0] + f[DIR_00P] + f[DIR_00M] + f[DIR_PP0] + f[DIR_MM0] + f[DIR_PM0] +
+                                       f[DIR_MP0] + f[DIR_P0P] + f[DIR_M0M] + f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] + f[DIR_0MM] + f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] +
+                                       f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] + f[DIR_MMM] + f[DIR_PMM] + f[DIR_MPM];
                     LBMReal dif = drho - rho_post;
 #ifdef SINGLEPRECISION
                     if (dif > 10.0E-7 || dif < -10.0E-7)
@@ -263,33 +263,33 @@ void BGKLBMKernel::calculate(int step)
                     //////////////////////////////////////////////////////////////////////////
                     // write distribution
                     //////////////////////////////////////////////////////////////////////////
-                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)     = f[D3Q27System::INV_E];
-                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)     = f[D3Q27System::INV_N];
-                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)     = f[D3Q27System::INV_T];
-                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)    = f[D3Q27System::INV_NE];
-                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)   = f[D3Q27System::INV_NW];
-                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)    = f[D3Q27System::INV_TE];
-                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)   = f[D3Q27System::INV_TW];
-                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)    = f[D3Q27System::INV_TN];
-                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)   = f[D3Q27System::INV_TS];
-                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)   = f[D3Q27System::INV_TNE];
-                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)  = f[D3Q27System::INV_TNW];
-                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)  = f[D3Q27System::INV_TSE];
-                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[D3Q27System::INV_TSW];
+                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)     = f[D3Q27System::INV_P00];
+                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)     = f[D3Q27System::INV_0P0];
+                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)     = f[D3Q27System::INV_00P];
+                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)    = f[D3Q27System::INV_PP0];
+                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)   = f[D3Q27System::INV_MP0];
+                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)    = f[D3Q27System::INV_P0P];
+                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)   = f[D3Q27System::INV_M0P];
+                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)    = f[D3Q27System::INV_0PP];
+                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)   = f[D3Q27System::INV_0MP];
+                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)   = f[D3Q27System::INV_PPP];
+                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)  = f[D3Q27System::INV_MPP];
+                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)  = f[D3Q27System::INV_PMP];
+                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[D3Q27System::INV_MMP];
 
-                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     = f[D3Q27System::INV_W];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     = f[D3Q27System::INV_S];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     = f[D3Q27System::INV_B];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   = f[D3Q27System::INV_SW];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    = f[D3Q27System::INV_SE];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   = f[D3Q27System::INV_BW];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    = f[D3Q27System::INV_BE];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   = f[D3Q27System::INV_BS];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    = f[D3Q27System::INV_BN];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[D3Q27System::INV_BSW];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  = f[D3Q27System::INV_BSE];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  = f[D3Q27System::INV_BNW];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   = f[D3Q27System::INV_BNE];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     = f[D3Q27System::INV_M00];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     = f[D3Q27System::INV_0M0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     = f[D3Q27System::INV_00M];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   = f[D3Q27System::INV_MM0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    = f[D3Q27System::INV_PM0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   = f[D3Q27System::INV_M0M];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    = f[D3Q27System::INV_P0M];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   = f[D3Q27System::INV_0MM];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    = f[D3Q27System::INV_0PM];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[D3Q27System::INV_MMM];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  = f[D3Q27System::INV_PMM];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  = f[D3Q27System::INV_MPM];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   = f[D3Q27System::INV_PPM];
 
                     (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
                     //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp
index 94635f858..b1e48abd9 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp
@@ -117,7 +117,7 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step)
    //LBMReal B = (four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega);
 
    LBMReal A = (4.0*omega*omega+2.0*omega*OxxPyyPzz*(omega-6.0)+OxxPyyPzz*OxxPyyPzz*(omega*(10.0-3.0*omega)-4.0))/((omega-OxxPyyPzz)*(OxxPyyPzz*(2.0+3.0*omega)-8.0*omega));
-   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
    LBMReal B = (4.0*omega*OxxPyyPzz*(9.0*omega-16.0)-4.0*omega*omega-2.0*OxxPyyPzz*OxxPyyPzz*(2.0+9.0*omega*(omega-2.0)))/(3.0*(omega-OxxPyyPzz)*(OxxPyyPzz*(2.0+3.0*omega)-8.0*omega));
 
    for (int x3 = minX3; x3 < maxX3; x3++)
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
index 21b23b61d..a359db9cd 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
@@ -66,11 +66,11 @@ void CompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const
    
    press = drho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))/(one + drho)-(vx2*vx3));
+   kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))/(one + drho)-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))/(one + drho)-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(one + drho)-(vx1*vx1-vx3*vx3));
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
@@ -471,32 +471,32 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f
    LBMReal feq[ENDF+1];
    D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3);
 
-   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
-   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
-   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
-   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
-   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
-   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
-   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
-   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
-   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
-   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
-   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
-   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
-   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
-   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
-   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
-   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
-   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
-   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
-   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
-   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
-   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
-   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
-   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
-   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
-   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
-   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
+   f[DIR_P00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_P00];
+   f[DIR_M00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_PP0];
+   f[DIR_MM0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_PPP];
+   f[DIR_MMP]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_MMP];
+   f[DIR_PMP]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_PMP];
+   f[DIR_MPP]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_MPP];
+   f[DIR_PPM]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_PPM];
+   f[DIR_MMM]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_MMM];
+   f[DIR_PMM]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_PMM];
+   f[DIR_MPM]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_MPM];
    f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
@@ -665,32 +665,32 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f
    f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
    f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
 
-   f[E]    = f_E    + feq[E];
-   f[W]    = f_E    + feq[W];
-   f[N]    = f_N    + feq[N];
-   f[S]    = f_N    + feq[S];
-   f[T]    = f_T    + feq[T];
-   f[B]    = f_T    + feq[B];
-   f[NE]   = f_NE   + feq[NE];
-   f[SW]   = f_NE   + feq[SW];
-   f[SE]   = f_SE   + feq[SE];
-   f[NW]   = f_SE   + feq[NW];
-   f[TE]   = f_TE   + feq[TE];
-   f[BW]   = f_TE   + feq[BW];
-   f[BE]   = f_BE   + feq[BE];
-   f[TW]   = f_BE   + feq[TW];
-   f[TN]   = f_TN   + feq[TN];
-   f[BS]   = f_TN   + feq[BS];
-   f[BN]   = f_BN   + feq[BN];
-   f[TS]   = f_BN   + feq[TS];
-   f[TNE]  = f_TNE  + feq[TNE];
-   f[TNW]  = f_TNW  + feq[TNW];
-   f[TSE]  = f_TSE  + feq[TSE];
-   f[TSW]  = f_TSW  + feq[TSW];
-   f[BNE]  = f_TSW  + feq[BNE];
-   f[BNW]  = f_TSE  + feq[BNW];
-   f[BSE]  = f_TNW  + feq[BSE];
-   f[BSW]  = f_TNE  + feq[BSW];
+   f[DIR_P00]    = f_E    + feq[DIR_P00];
+   f[DIR_M00]    = f_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + feq[DIR_PP0];
+   f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + feq[DIR_PPP];
+   f[DIR_MPP]  = f_TNW  + feq[DIR_MPP];
+   f[DIR_PMP]  = f_TSE  + feq[DIR_PMP];
+   f[DIR_MMP]  = f_TSW  + feq[DIR_MMP];
+   f[DIR_PPM]  = f_TSW  + feq[DIR_PPM];
+   f[DIR_MPM]  = f_TSE  + feq[DIR_MPM];
+   f[DIR_PMM]  = f_TNW  + feq[DIR_PMM];
+   f[DIR_MMM]  = f_TNE  + feq[DIR_MMM];
    f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
index 936cf18ab..3df8aa6bb 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
@@ -95,11 +95,11 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const LBMReal*
    
    press = drho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))/(one + drho)-(vx2*vx3));
+   kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))/(one + drho)-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))/(one + drho)-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(one + drho)-(vx1*vx1-vx3*vx3));
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
@@ -785,33 +785,33 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBM
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
+   f[DIR_P00]    = mfcbb;
+   f[DIR_M00]    = mfabb;
+   f[DIR_0P0]    = mfbcb;
+   f[DIR_0M0]    = mfbab;
+   f[DIR_00P]    = mfbbc;
+   f[DIR_00M]    = mfbba;
+   f[DIR_PP0]   = mfccb;
+   f[DIR_MM0]   = mfaab;
+   f[DIR_PM0]   = mfcab;
+   f[DIR_MP0]   = mfacb;
+   f[DIR_P0P]   = mfcbc;
+   f[DIR_M0M]   = mfaba;
+   f[DIR_P0M]   = mfcba;
+   f[DIR_M0P]   = mfabc;
+   f[DIR_0PP]   = mfbcc;
+   f[DIR_0MM]   = mfbaa;
+   f[DIR_0PM]   = mfbca;
+   f[DIR_0MP]   = mfbac;
    f[DIR_000] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
+   f[DIR_PPP]  = mfccc;
+   f[DIR_PMP]  = mfcac;
+   f[DIR_PPM]  = mfcca;
+   f[DIR_PMM]  = mfcaa;
+   f[DIR_MPP]  = mfacc;
+   f[DIR_MMP]  = mfaac;
+   f[DIR_MPM]  = mfaca;
+   f[DIR_MMM]  = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -1233,33 +1233,33 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBM
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
+   f[DIR_P00]    = mfcbb;
+   f[DIR_M00]    = mfabb;
+   f[DIR_0P0]    = mfbcb;
+   f[DIR_0M0]    = mfbab;
+   f[DIR_00P]    = mfbbc;
+   f[DIR_00M]    = mfbba;
+   f[DIR_PP0]   = mfccb;
+   f[DIR_MM0]   = mfaab;
+   f[DIR_PM0]   = mfcab;
+   f[DIR_MP0]   = mfacb;
+   f[DIR_P0P]   = mfcbc;
+   f[DIR_M0M]   = mfaba;
+   f[DIR_P0M]   = mfcba;
+   f[DIR_M0P]   = mfabc;
+   f[DIR_0PP]   = mfbcc;
+   f[DIR_0MM]   = mfbaa;
+   f[DIR_0PM]   = mfbca;
+   f[DIR_0MP]   = mfbac;
    f[DIR_000] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
+   f[DIR_PPP]  = mfccc;
+   f[DIR_PMP]  = mfcac;
+   f[DIR_PPM]  = mfcca;
+   f[DIR_PMM]  = mfcaa;
+   f[DIR_MPP]  = mfacc;
+   f[DIR_MMP]  = mfaac;
+   f[DIR_MPM]  = mfaca;
+   f[DIR_MMM]  = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
index 721dc5dad..c9cc8138d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp
@@ -85,11 +85,11 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcMoments(const L
    
    press = drho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))/(one + drho)-(vx2*vx3));
+   kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))/(one + drho)-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))/(one + drho)-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(one + drho)-(vx1*vx1-vx3*vx3));
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
@@ -780,33 +780,33 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
+   f[DIR_P00]    = mfcbb;
+   f[DIR_M00]    = mfabb;
+   f[DIR_0P0]    = mfbcb;
+   f[DIR_0M0]    = mfbab;
+   f[DIR_00P]    = mfbbc;
+   f[DIR_00M]    = mfbba;
+   f[DIR_PP0]   = mfccb;
+   f[DIR_MM0]   = mfaab;
+   f[DIR_PM0]   = mfcab;
+   f[DIR_MP0]   = mfacb;
+   f[DIR_P0P]   = mfcbc;
+   f[DIR_M0M]   = mfaba;
+   f[DIR_P0M]   = mfcba;
+   f[DIR_M0P]   = mfabc;
+   f[DIR_0PP]   = mfbcc;
+   f[DIR_0MM]   = mfbaa;
+   f[DIR_0PM]   = mfbca;
+   f[DIR_0MP]   = mfbac;
    f[DIR_000] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
+   f[DIR_PPP]  = mfccc;
+   f[DIR_PMP]  = mfcac;
+   f[DIR_PPM]  = mfcca;
+   f[DIR_PMM]  = mfcaa;
+   f[DIR_MPP]  = mfacc;
+   f[DIR_MMP]  = mfaac;
+   f[DIR_MPM]  = mfaca;
+   f[DIR_MMM]  = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -1233,33 +1233,33 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
+   f[DIR_P00]    = mfcbb;
+   f[DIR_M00]    = mfabb;
+   f[DIR_0P0]    = mfbcb;
+   f[DIR_0M0]    = mfbab;
+   f[DIR_00P]    = mfbbc;
+   f[DIR_00M]    = mfbba;
+   f[DIR_PP0]   = mfccb;
+   f[DIR_MM0]   = mfaab;
+   f[DIR_PM0]   = mfcab;
+   f[DIR_MP0]   = mfacb;
+   f[DIR_P0P]   = mfcbc;
+   f[DIR_M0M]   = mfaba;
+   f[DIR_P0M]   = mfcba;
+   f[DIR_M0P]   = mfabc;
+   f[DIR_0PP]   = mfbcc;
+   f[DIR_0MM]   = mfbaa;
+   f[DIR_0PM]   = mfbca;
+   f[DIR_0MP]   = mfbac;
    f[DIR_000] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
+   f[DIR_PPP]  = mfccc;
+   f[DIR_PMP]  = mfcac;
+   f[DIR_PPM]  = mfcca;
+   f[DIR_PMM]  = mfcaa;
+   f[DIR_MPP]  = mfacc;
+   f[DIR_MMP]  = mfaac;
+   f[DIR_MPM]  = mfaca;
+   f[DIR_MMM]  = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
index 62adaa06b..7e2fd17c0 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
@@ -23,16 +23,16 @@ const double WEIGTH[] = { c8o27,
                           c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,  c1o54,
                           c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216 };
 
-const int INVDIR[] = { DIR_000, INV_E,   INV_W,   INV_N,   INV_S,   INV_T,   INV_B,   INV_NE,  INV_SW, INV_SE,
-                       INV_NW,  INV_TE,  INV_BW,  INV_BE,  INV_TW,  INV_TN,  INV_BS,  INV_BN, INV_TS,
-                       INV_TNE, INV_TNW, INV_TSE, INV_TSW, INV_BNE, INV_BNW, INV_BSE, INV_BSW };
+const int INVDIR[] = { DIR_000, INV_P00,   INV_M00,   INV_0P0,   INV_0M0,   INV_00P,   INV_00M,   INV_PP0,  INV_MM0, INV_PM0,
+                       INV_MP0,  INV_P0P,  INV_M0M,  INV_P0M,  INV_M0P,  INV_0PP,  INV_0MM,  INV_0PM, INV_0MP,
+                       INV_PPP, INV_MPP, INV_PMP, INV_MMP, INV_PPM, INV_MPM, INV_PMM, INV_MMM };
 
 // index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
 // direction:        E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE
 // BSW
-//const int EX1[] = { 0, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
-//const int EX2[] = { 0, 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
-//const int EX3[] = { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
+const int EX1[] = { 0, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
+const int EX2[] = { 0, 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
+const int EX3[] = { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
 
 //////////////////////////////////////////////////////////////////////////
 
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
index 5e80ee54f..773e8b695 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
@@ -128,59 +128,59 @@ extern const int EX3[ENDDIR + 1];
 //static constexpr int BSW = 26;
 
 static constexpr int DIR_000 = 0;
-static constexpr int E = 1;
-static constexpr int W = 2;
-static constexpr int N = 3;
-static constexpr int S = 4;
-static constexpr int T = 5;
-static constexpr int B = 6;
-static constexpr int NE = 7;
-static constexpr int SW = 8;
-static constexpr int SE = 9;
-static constexpr int NW = 10;
-static constexpr int TE = 11;
-static constexpr int BW = 12;
-static constexpr int BE = 13;
-static constexpr int TW = 14;
-static constexpr int TN = 15;
-static constexpr int BS = 16;
-static constexpr int BN = 17;
-static constexpr int TS = 18;
-static constexpr int TNE = 19;
-static constexpr int TNW = 20;
-static constexpr int TSE = 21;
-static constexpr int TSW = 22;
-static constexpr int BNE = 23;
-static constexpr int BNW = 24;
-static constexpr int BSE = 25;
-static constexpr int BSW = 26;
+static constexpr int DIR_P00 = 1;
+static constexpr int DIR_M00 = 2;
+static constexpr int DIR_0P0 = 3;
+static constexpr int DIR_0M0 = 4;
+static constexpr int DIR_00P = 5;
+static constexpr int DIR_00M = 6;
+static constexpr int DIR_PP0 = 7;
+static constexpr int DIR_MM0 = 8;
+static constexpr int DIR_PM0 = 9;
+static constexpr int DIR_MP0 = 10;
+static constexpr int DIR_P0P = 11;
+static constexpr int DIR_M0M = 12;
+static constexpr int DIR_P0M = 13;
+static constexpr int DIR_M0P = 14;
+static constexpr int DIR_0PP = 15;
+static constexpr int DIR_0MM = 16;
+static constexpr int DIR_0PM = 17;
+static constexpr int DIR_0MP = 18;
+static constexpr int DIR_PPP = 19;
+static constexpr int DIR_MPP = 20;
+static constexpr int DIR_PMP = 21;
+static constexpr int DIR_MMP = 22;
+static constexpr int DIR_PPM = 23;
+static constexpr int DIR_MPM = 24;
+static constexpr int DIR_PMM = 25;
+static constexpr int DIR_MMM = 26;
 
-static const int INV_E   = W;
-static const int INV_W   = E;
-static const int INV_N   = S;
-static const int INV_S   = N;
-static const int INV_T   = B;
-static const int INV_B   = T;
-static const int INV_NE  = SW;
-static const int INV_SW  = NE;
-static const int INV_SE  = NW;
-static const int INV_NW  = SE;
-static const int INV_TE  = BW;
-static const int INV_BW  = TE;
-static const int INV_BE  = TW;
-static const int INV_TW  = BE;
-static const int INV_TN  = BS;
-static const int INV_BS  = TN;
-static const int INV_BN  = TS;
-static const int INV_TS  = BN;
-static const int INV_TNE = BSW;
-static const int INV_TNW = BSE;
-static const int INV_TSE = BNW;
-static const int INV_TSW = BNE;
-static const int INV_BNE = TSW;
-static const int INV_BNW = TSE;
-static const int INV_BSE = TNW;
-static const int INV_BSW = TNE;
+static constexpr int INV_P00 = DIR_M00;
+static constexpr int INV_M00 = DIR_P00;
+static constexpr int INV_0P0 = DIR_0M0;
+static constexpr int INV_0M0 = DIR_0P0;
+static constexpr int INV_00P = DIR_00M;
+static constexpr int INV_00M = DIR_00P;
+static constexpr int INV_PP0 = DIR_MM0;
+static constexpr int INV_MM0 = DIR_PP0;
+static constexpr int INV_PM0 = DIR_MP0;
+static constexpr int INV_MP0 = DIR_PM0;
+static constexpr int INV_P0P = DIR_M0M;
+static constexpr int INV_M0M = DIR_P0P;
+static constexpr int INV_P0M = DIR_M0P;
+static constexpr int INV_M0P = DIR_P0M;
+static constexpr int INV_0PP = DIR_0MM;
+static constexpr int INV_0MM = DIR_0PP;
+static constexpr int INV_0PM = DIR_0MP;
+static constexpr int INV_0MP = DIR_0PM;
+static constexpr int INV_PPP = DIR_MMM;
+static constexpr int INV_MPP = DIR_PMM;
+static constexpr int INV_PMP = DIR_MPM;
+static constexpr int INV_MMP = DIR_PPM;
+static constexpr int INV_PPM = DIR_MMP;
+static constexpr int INV_MPM = DIR_PMP;
+static constexpr int INV_PMM = DIR_MPP;
+static constexpr int INV_MMM = DIR_PPP;
 
 extern const int INVDIR[ENDDIR + 1];
 
@@ -215,57 +215,57 @@ static const int ET_BNE = 12;
 inline std::string getDirectionString(int direction)
 {
     switch (direction) {
-        case E:
+        case DIR_P00:
             return "E";
-        case W:
+        case DIR_M00:
             return "W";
-        case N:
+        case DIR_0P0:
             return "N";
-        case S:
+        case DIR_0M0:
             return "S";
-        case T:
+        case DIR_00P:
             return "T";
-        case B:
+        case DIR_00M:
             return "B";
-        case NE:
+        case DIR_PP0:
             return "NE";
-        case NW:
+        case DIR_MP0:
             return "NW";
-        case SE:
+        case DIR_PM0:
             return "SE";
-        case SW:
+        case DIR_MM0:
             return "SW";
-        case TE:
+        case DIR_P0P:
             return "TE";
-        case TW:
+        case DIR_M0P:
             return "TW";
-        case BE:
+        case DIR_P0M:
             return "BE";
-        case BW:
+        case DIR_M0M:
             return "BW";
-        case TN:
+        case DIR_0PP:
             return "TN";
-        case TS:
+        case DIR_0MP:
             return "TS";
-        case BN:
+        case DIR_0PM:
             return "BN";
-        case BS:
+        case DIR_0MM:
             return "BS";
-        case TNE:
+        case DIR_PPP:
             return "TNE";
-        case TNW:
+        case DIR_MPP:
             return "TNW";
-        case TSE:
+        case DIR_PMP:
             return "TSE";
-        case TSW:
+        case DIR_MMP:
             return "TSW";
-        case BNE:
+        case DIR_PPM:
             return "BNE";
-        case BNW:
+        case DIR_MPM:
             return "BNW";
-        case BSE:
+        case DIR_PMM:
             return "BSE";
-        case BSW:
+        case DIR_MMM:
             return "BSW";
         default:
             return "Cell3DSystem::getDrectionString(...) - unknown dir";
@@ -275,108 +275,108 @@ inline std::string getDirectionString(int direction)
 static inline void setNeighborCoordinatesForDirection(int &x1, int &x2, int &x3, const int &direction)
 {
     switch (direction) {
-        case D3Q27System::E:
+        case D3Q27System::DIR_P00:
             x1++;
             break;
-        case D3Q27System::N:
+        case D3Q27System::DIR_0P0:
             x2++;
             break;
-        case D3Q27System::T:
+        case D3Q27System::DIR_00P:
             x3++;
             break;
-        case D3Q27System::W:
+        case D3Q27System::DIR_M00:
             x1--;
             break;
-        case D3Q27System::S:
+        case D3Q27System::DIR_0M0:
             x2--;
             break;
-        case D3Q27System::B:
+        case D3Q27System::DIR_00M:
             x3--;
             break;
-        case D3Q27System::NE:
+        case D3Q27System::DIR_PP0:
             x1++;
             x2++;
             break;
-        case D3Q27System::NW:
+        case D3Q27System::DIR_MP0:
             x1--;
             x2++;
             break;
-        case D3Q27System::SW:
+        case D3Q27System::DIR_MM0:
             x1--;
             x2--;
             break;
-        case D3Q27System::SE:
+        case D3Q27System::DIR_PM0:
             x1++;
             x2--;
             break;
-        case D3Q27System::TE:
+        case D3Q27System::DIR_P0P:
             x1++;
             x3++;
             break;
-        case D3Q27System::BW:
+        case D3Q27System::DIR_M0M:
             x1--;
             x3--;
             break;
-        case D3Q27System::BE:
+        case D3Q27System::DIR_P0M:
             x1++;
             x3--;
             break;
-        case D3Q27System::TW:
+        case D3Q27System::DIR_M0P:
             x1--;
             x3++;
             break;
-        case D3Q27System::TN:
+        case D3Q27System::DIR_0PP:
             x2++;
             x3++;
             break;
-        case D3Q27System::BS:
+        case D3Q27System::DIR_0MM:
             x2--;
             x3--;
             break;
-        case D3Q27System::BN:
+        case D3Q27System::DIR_0PM:
             x2++;
             x3--;
             break;
-        case D3Q27System::TS:
+        case D3Q27System::DIR_0MP:
             x2--;
             x3++;
             break;
-        case D3Q27System::TNE:
+        case D3Q27System::DIR_PPP:
             x1++;
             x2++;
             x3++;
             break;
-        case D3Q27System::TNW:
+        case D3Q27System::DIR_MPP:
             x1--;
             x2++;
             x3++;
             break;
-        case D3Q27System::TSE:
+        case D3Q27System::DIR_PMP:
             x1++;
             x2--;
             x3++;
             break;
-        case D3Q27System::TSW:
+        case D3Q27System::DIR_MMP:
             x1--;
             x2--;
             x3++;
             break;
-        case D3Q27System::BNE:
+        case D3Q27System::DIR_PPM:
             x1++;
             x2++;
             x3--;
             break;
-        case D3Q27System::BNW:
+        case D3Q27System::DIR_MPM:
             x1--;
             x2++;
             x3--;
             break;
-        case D3Q27System::BSE:
+        case D3Q27System::DIR_PMM:
             x1++;
             x2--;
             x3--;
             break;
-        case D3Q27System::BSW:
+        case D3Q27System::DIR_MMM:
             x1--;
             x2--;
             x3--;
@@ -403,69 +403,69 @@ LBMReal getIncompVelocityX3(const LBMReal *const &f /*[27]*/);
 /*=====================================================================*/
 static void calcDensity(const LBMReal *const &f /*[27]*/, LBMReal &rho)
 {
-    rho = ((f[TNE] + f[BSW]) + (f[TSE] + f[BNW])) + ((f[BSE] + f[TNW]) + (f[TSW] + f[BNE])) +
-          (((f[NE] + f[SW]) + (f[SE] + f[NW])) + ((f[TE] + f[BW]) + (f[BE] + f[TW])) +
-           ((f[BN] + f[TS]) + (f[TN] + f[BS]))) +
-          ((f[E] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
+    rho = ((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
+          (((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+           ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+          ((f[DIR_P00] + f[DIR_M00]) + (f[DIR_0P0] + f[DIR_0M0]) + (f[DIR_00P] + f[DIR_00M])) + f[DIR_000];
 }
 /*=====================================================================*/
 static void calcIncompVelocityX1(const LBMReal *const &f /*[27]*/, LBMReal &vx1)
 {
-    vx1 = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-           (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W]));
+    vx1 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+           (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00]));
 }
 /*=====================================================================*/
 static void calcIncompVelocityX2(const LBMReal *const &f /*[27]*/, LBMReal &vx2)
 {
-    vx2 = ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-           (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S]));
+    vx2 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+           (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0]));
 }
 /*=====================================================================*/
 static void calcIncompVelocityX3(const LBMReal *const &f /*[27]*/, LBMReal &vx3)
 {
-    vx3 = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-           (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B]));
+    vx3 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+           (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M]));
 }
 /*=====================================================================*/
 static LBMReal getCompVelocityX1(const LBMReal *const &f /*[27]*/)
 {
-    return ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-            (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) /
+    return ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00])) /
            getDensity(f);
 }
 /*=====================================================================*/
 static LBMReal getCompVelocityX2(const LBMReal *const &f /*[27]*/)
 {
-    return ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-            (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) /
+    return ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0])) /
            getDensity(f);
 }
 /*=====================================================================*/
 static LBMReal getCompVelocityX3(const LBMReal *const &f /*[27]*/)
 {
-    return ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-            (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B])) /
+    return ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M])) /
            getDensity(f);
 }
 /*=====================================================================*/
 static void calcCompVelocityX1(const LBMReal *const &f /*[27]*/, LBMReal &vx1)
 {
-    vx1 = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[BSE] - f[TNW]) + (f[BNE] - f[TSW]))) +
-           (((f[BE] - f[TW]) + (f[TE] - f[BW])) + ((f[SE] - f[NW]) + (f[NE] - f[SW]))) + (f[E] - f[W])) /
+    vx1 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+           (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00])) /
           getDensity(f);
 }
 /*=====================================================================*/
 static void calcCompVelocityX2(const LBMReal *const &f /*[27]*/, LBMReal &vx2)
 {
-    vx2 = ((((f[TNE] - f[BSW]) + (f[BNW] - f[TSE])) + ((f[TNW] - f[BSE]) + (f[BNE] - f[TSW]))) +
-           (((f[BN] - f[TS]) + (f[TN] - f[BS])) + ((f[NW] - f[SE]) + (f[NE] - f[SW]))) + (f[N] - f[S])) /
+    vx2 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
+           (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0])) /
           getDensity(f);
 }
 /*=====================================================================*/
 static void calcCompVelocityX3(const LBMReal *const &f /*[27]*/, LBMReal &vx3)
 {
-    vx3 = ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-           (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) + (f[T] - f[B])) /
+    vx3 = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
+           (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M])) /
           getDensity(f);
 }
 /*=====================================================================*/
@@ -500,83 +500,83 @@ static LBMReal getCompFeqForDirection(const int &direction, const LBMReal &drho,
     switch (direction) {
         case DIR_000:
             return REAL_CAST(UbMath::c8o27 * (drho + rho * (-cu_sq)));
-        case E:
+        case DIR_P00:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq)));
-        case W:
+        case DIR_M00:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq)));
-        case N:
+        case DIR_0P0:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq)));
-        case S:
+        case DIR_0M0:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq)));
-        case T:
+        case DIR_00P:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq)));
-        case B:
+        case DIR_00M:
             return REAL_CAST(UbMath::c2o27 * (drho + rho * (3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq)));
-        case NE:
+        case DIR_PP0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq)));
-        case SW:
+        case DIR_MM0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq)));
-        case SE:
+        case DIR_PM0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq)));
-        case NW:
+        case DIR_MP0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq)));
-        case TE:
+        case DIR_P0P:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq)));
-        case BW:
+        case DIR_M0M:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq)));
-        case BE:
+        case DIR_P0M:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq)));
-        case TW:
+        case DIR_M0P:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq)));
-        case TN:
+        case DIR_0PP:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq)));
-        case BS:
+        case DIR_0MM:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq)));
-        case BN:
+        case DIR_0PM:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq)));
-        case TS:
+        case DIR_0MP:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + rho * (3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq)));
-        case TNE:
+        case DIR_PPP:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (vx1 + vx2 + vx3) +
                                             UbMath::c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq)));
-        case BSW:
+        case DIR_MMM:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (-vx1 - vx2 - vx3) +
                                             UbMath::c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq)));
-        case BNE:
+        case DIR_PPM:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (vx1 + vx2 - vx3) +
                                             UbMath::c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq)));
-        case TSW:
+        case DIR_MMP:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (-vx1 - vx2 + vx3) +
                                             UbMath::c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq)));
-        case TSE:
+        case DIR_PMP:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (vx1 - vx2 + vx3) +
                                             UbMath::c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq)));
-        case BNW:
+        case DIR_MPM:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (-vx1 + vx2 - vx3) +
                                             UbMath::c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq)));
-        case BSE:
+        case DIR_PMM:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (vx1 - vx2 - vx3) +
                                             UbMath::c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq)));
-        case TNW:
+        case DIR_MPP:
             return REAL_CAST(UbMath::c1o216 *
                              (drho + rho * (3.0 * (-vx1 + vx2 + vx3) +
                                             UbMath::c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq)));
@@ -592,42 +592,42 @@ static void calcCompFeq(LBMReal *const &feq /*[27]*/, const LBMReal &drho, const
     LBMReal rho   = drho + UbMath::one;
 
     feq[DIR_000] = UbMath::c8o27 * (drho + rho * (-cu_sq));
-    feq[E]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq));
-    feq[W]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq));
-    feq[N]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq));
-    feq[S]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq));
-    feq[T]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq));
-    feq[B]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq));
-    feq[NE]   = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
-    feq[SW]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
-    feq[SE]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
-    feq[NW]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
-    feq[TE]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
-    feq[BW]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
-    feq[BE]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
-    feq[TW]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
-    feq[TN]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
-    feq[BS]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
-    feq[BN]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
-    feq[TS]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
-    feq[TNE] = UbMath::c1o216 *
+    feq[DIR_P00]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq));
+    feq[DIR_M00]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq));
+    feq[DIR_0P0]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq));
+    feq[DIR_0M0]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq));
+    feq[DIR_00P]    = UbMath::c2o27 * (drho + rho * (3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq));
+    feq[DIR_00M]    = UbMath::c2o27 * (drho + rho * (3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq));
+    feq[DIR_PP0]   = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
+    feq[DIR_MM0]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
+    feq[DIR_PM0]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
+    feq[DIR_MP0]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
+    feq[DIR_P0P]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
+    feq[DIR_M0M]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
+    feq[DIR_P0M]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
+    feq[DIR_M0P]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
+    feq[DIR_0PP]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
+    feq[DIR_0MM]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
+    feq[DIR_0PM]  = UbMath::c1o54 * (drho + rho * (3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
+    feq[DIR_0MP]  = UbMath::c1o54 * (drho + rho * (3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
+    feq[DIR_PPP] = UbMath::c1o216 *
                (drho + rho * (3.0 * (vx1 + vx2 + vx3) + UbMath::c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq));
-    feq[BSW] =
+    feq[DIR_MMM] =
         UbMath::c1o216 *
         (drho + rho * (3.0 * (-vx1 - vx2 - vx3) + UbMath::c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq));
-    feq[BNE] = UbMath::c1o216 *
+    feq[DIR_PPM] = UbMath::c1o216 *
                (drho + rho * (3.0 * (vx1 + vx2 - vx3) + UbMath::c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq));
-    feq[TSW] =
+    feq[DIR_MMP] =
         UbMath::c1o216 *
         (drho + rho * (3.0 * (-vx1 - vx2 + vx3) + UbMath::c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq));
-    feq[TSE] = UbMath::c1o216 *
+    feq[DIR_PMP] = UbMath::c1o216 *
                (drho + rho * (3.0 * (vx1 - vx2 + vx3) + UbMath::c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq));
-    feq[BNW] =
+    feq[DIR_MPM] =
         UbMath::c1o216 *
         (drho + rho * (3.0 * (-vx1 + vx2 - vx3) + UbMath::c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq));
-    feq[BSE] = UbMath::c1o216 *
+    feq[DIR_PMM] = UbMath::c1o216 *
                (drho + rho * (3.0 * (vx1 - vx2 - vx3) + UbMath::c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq));
-    feq[TNW] =
+    feq[DIR_MPP] =
         UbMath::c1o216 *
         (drho + rho * (3.0 * (-vx1 + vx2 + vx3) + UbMath::c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq));
 }
@@ -640,76 +640,76 @@ static LBMReal getIncompFeqForDirection(const int &direction, const LBMReal &drh
     switch (direction) {
         case DIR_000:
             return REAL_CAST(UbMath::c8o27 * (drho - cu_sq));
-        case E:
+        case DIR_P00:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq));
-        case W:
+        case DIR_M00:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq));
-        case N:
+        case DIR_0P0:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq));
-        case S:
+        case DIR_0M0:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq));
-        case T:
+        case DIR_00P:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq));
-        case B:
+        case DIR_00M:
             return REAL_CAST(UbMath::c2o27 * (drho + 3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq));
-        case NE:
+        case DIR_PP0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
-        case SW:
+        case DIR_MM0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
-        case SE:
+        case DIR_PM0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
-        case NW:
+        case DIR_MP0:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
-        case TE:
+        case DIR_P0P:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
-        case BW:
+        case DIR_M0M:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
-        case BE:
+        case DIR_P0M:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
-        case TW:
+        case DIR_M0P:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
-        case TN:
+        case DIR_0PP:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
-        case BS:
+        case DIR_0MM:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
-        case BN:
+        case DIR_0PM:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
-        case TS:
+        case DIR_0MP:
             return REAL_CAST(UbMath::c1o54 *
                              (drho + 3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
-        case TNE:
+        case DIR_PPP:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (vx1 + vx2 + vx3) +
                                                UbMath::c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq));
-        case BSW:
+        case DIR_MMM:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (-vx1 - vx2 - vx3) +
                                                UbMath::c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq));
-        case BNE:
+        case DIR_PPM:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (vx1 + vx2 - vx3) +
                                                UbMath::c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq));
-        case TSW:
+        case DIR_MMP:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (-vx1 - vx2 + vx3) +
                                                UbMath::c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq));
-        case TSE:
+        case DIR_PMP:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (vx1 - vx2 + vx3) +
                                                UbMath::c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq));
-        case BNW:
+        case DIR_MPM:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (-vx1 + vx2 - vx3) +
                                                UbMath::c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq));
-        case BSE:
+        case DIR_PMM:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (vx1 - vx2 - vx3) +
                                                UbMath::c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq));
-        case TNW:
+        case DIR_MPP:
             return REAL_CAST(UbMath::c1o216 * (drho + 3.0 * (-vx1 + vx2 + vx3) +
                                                UbMath::c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq));
         default:
@@ -723,39 +723,39 @@ static void calcIncompFeq(LBMReal *const &feq /*[27]*/, const LBMReal &drho, con
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
     feq[DIR_000] = UbMath::c8o27 * (drho - cu_sq);
-    feq[E]    = UbMath::c2o27 * (drho + 3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq);
-    feq[W]    = UbMath::c2o27 * (drho + 3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq);
-    feq[N]    = UbMath::c2o27 * (drho + 3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq);
-    feq[S]    = UbMath::c2o27 * (drho + 3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq);
-    feq[T]    = UbMath::c2o27 * (drho + 3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq);
-    feq[B]    = UbMath::c2o27 * (drho + 3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq);
-    feq[NE]   = UbMath::c1o54 * (drho + 3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
-    feq[SW]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
-    feq[SE]   = UbMath::c1o54 * (drho + 3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
-    feq[NW]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
-    feq[TE]   = UbMath::c1o54 * (drho + 3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
-    feq[BW]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
-    feq[BE]   = UbMath::c1o54 * (drho + 3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
-    feq[TW]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
-    feq[TN]   = UbMath::c1o54 * (drho + 3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
-    feq[BS]   = UbMath::c1o54 * (drho + 3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
-    feq[BN]   = UbMath::c1o54 * (drho + 3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
-    feq[TS]   = UbMath::c1o54 * (drho + 3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
-    feq[TNE]  = UbMath::c1o216 *
+    feq[DIR_P00]    = UbMath::c2o27 * (drho + 3.0 * (vx1) + UbMath::c9o2 * (vx1) * (vx1)-cu_sq);
+    feq[DIR_M00]    = UbMath::c2o27 * (drho + 3.0 * (-vx1) + UbMath::c9o2 * (-vx1) * (-vx1) - cu_sq);
+    feq[DIR_0P0]    = UbMath::c2o27 * (drho + 3.0 * (vx2) + UbMath::c9o2 * (vx2) * (vx2)-cu_sq);
+    feq[DIR_0M0]    = UbMath::c2o27 * (drho + 3.0 * (-vx2) + UbMath::c9o2 * (-vx2) * (-vx2) - cu_sq);
+    feq[DIR_00P]    = UbMath::c2o27 * (drho + 3.0 * (vx3) + UbMath::c9o2 * (vx3) * (vx3)-cu_sq);
+    feq[DIR_00M]    = UbMath::c2o27 * (drho + 3.0 * (-vx3) + UbMath::c9o2 * (-vx3) * (-vx3) - cu_sq);
+    feq[DIR_PP0]   = UbMath::c1o54 * (drho + 3.0 * (vx1 + vx2) + UbMath::c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
+    feq[DIR_MM0]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 - vx2) + UbMath::c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
+    feq[DIR_PM0]   = UbMath::c1o54 * (drho + 3.0 * (vx1 - vx2) + UbMath::c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
+    feq[DIR_MP0]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 + vx2) + UbMath::c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
+    feq[DIR_P0P]   = UbMath::c1o54 * (drho + 3.0 * (vx1 + vx3) + UbMath::c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
+    feq[DIR_M0M]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 - vx3) + UbMath::c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
+    feq[DIR_P0M]   = UbMath::c1o54 * (drho + 3.0 * (vx1 - vx3) + UbMath::c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
+    feq[DIR_M0P]   = UbMath::c1o54 * (drho + 3.0 * (-vx1 + vx3) + UbMath::c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
+    feq[DIR_0PP]   = UbMath::c1o54 * (drho + 3.0 * (vx2 + vx3) + UbMath::c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
+    feq[DIR_0MM]   = UbMath::c1o54 * (drho + 3.0 * (-vx2 - vx3) + UbMath::c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
+    feq[DIR_0PM]   = UbMath::c1o54 * (drho + 3.0 * (vx2 - vx3) + UbMath::c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
+    feq[DIR_0MP]   = UbMath::c1o54 * (drho + 3.0 * (-vx2 + vx3) + UbMath::c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
+    feq[DIR_PPP]  = UbMath::c1o216 *
                (drho + 3.0 * (vx1 + vx2 + vx3) + UbMath::c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq);
-    feq[BSW] = UbMath::c1o216 *
+    feq[DIR_MMM] = UbMath::c1o216 *
                (drho + 3.0 * (-vx1 - vx2 - vx3) + UbMath::c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq);
-    feq[BNE] = UbMath::c1o216 *
+    feq[DIR_PPM] = UbMath::c1o216 *
                (drho + 3.0 * (vx1 + vx2 - vx3) + UbMath::c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq);
-    feq[TSW] = UbMath::c1o216 *
+    feq[DIR_MMP] = UbMath::c1o216 *
                (drho + 3.0 * (-vx1 - vx2 + vx3) + UbMath::c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq);
-    feq[TSE] = UbMath::c1o216 *
+    feq[DIR_PMP] = UbMath::c1o216 *
                (drho + 3.0 * (vx1 - vx2 + vx3) + UbMath::c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq);
-    feq[BNW] = UbMath::c1o216 *
+    feq[DIR_MPM] = UbMath::c1o216 *
                (drho + 3.0 * (-vx1 + vx2 - vx3) + UbMath::c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq);
-    feq[BSE] = UbMath::c1o216 *
+    feq[DIR_PMM] = UbMath::c1o216 *
                (drho + 3.0 * (vx1 - vx2 - vx3) + UbMath::c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq);
-    feq[TNW] = UbMath::c1o216 *
+    feq[DIR_MPP] = UbMath::c1o216 *
                (drho + 3.0 * (-vx1 + vx2 + vx3) + UbMath::c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
 }
 //////////////////////////////////////////////////////////////////////////
@@ -763,57 +763,57 @@ static inline float getBoundaryVelocityForDirection(const int &direction, const
                                                     const float &bcVelocityX2, const float &bcVelocityX3)
 {
     switch (direction) {
-        case E:
+        case DIR_P00:
             return (float)(UbMath::c4o9 * (+bcVelocityX1));
-        case W:
+        case DIR_M00:
             return (float)(UbMath::c4o9 * (-bcVelocityX1));
-        case N:
+        case DIR_0P0:
             return (float)(UbMath::c4o9 * (+bcVelocityX2));
-        case S:
+        case DIR_0M0:
             return (float)(UbMath::c4o9 * (-bcVelocityX2));
-        case T:
+        case DIR_00P:
             return (float)(UbMath::c4o9 * (+bcVelocityX3));
-        case B:
+        case DIR_00M:
             return (float)(UbMath::c4o9 * (-bcVelocityX3));
-        case NE:
+        case DIR_PP0:
             return (float)(UbMath::c1o9 * (+bcVelocityX1 + bcVelocityX2));
-        case SW:
+        case DIR_MM0:
             return (float)(UbMath::c1o9 * (-bcVelocityX1 - bcVelocityX2));
-        case SE:
+        case DIR_PM0:
             return (float)(UbMath::c1o9 * (+bcVelocityX1 - bcVelocityX2));
-        case NW:
+        case DIR_MP0:
             return (float)(UbMath::c1o9 * (-bcVelocityX1 + bcVelocityX2));
-        case TE:
+        case DIR_P0P:
             return (float)(UbMath::c1o9 * (+bcVelocityX1 + bcVelocityX3));
-        case BW:
+        case DIR_M0M:
             return (float)(UbMath::c1o9 * (-bcVelocityX1 - bcVelocityX3));
-        case BE:
+        case DIR_P0M:
             return (float)(UbMath::c1o9 * (+bcVelocityX1 - bcVelocityX3));
-        case TW:
+        case DIR_M0P:
             return (float)(UbMath::c1o9 * (-bcVelocityX1 + bcVelocityX3));
-        case TN:
+        case DIR_0PP:
             return (float)(UbMath::c1o9 * (+bcVelocityX2 + bcVelocityX3));
-        case BS:
+        case DIR_0MM:
             return (float)(UbMath::c1o9 * (-bcVelocityX2 - bcVelocityX3));
-        case BN:
+        case DIR_0PM:
             return (float)(UbMath::c1o9 * (+bcVelocityX2 - bcVelocityX3));
-        case TS:
+        case DIR_0MP:
             return (float)(UbMath::c1o9 * (-bcVelocityX2 + bcVelocityX3));
-        case TNE:
+        case DIR_PPP:
             return (float)(UbMath::c1o36 * (+bcVelocityX1 + bcVelocityX2 + bcVelocityX3));
-        case BSW:
+        case DIR_MMM:
             return (float)(UbMath::c1o36 * (-bcVelocityX1 - bcVelocityX2 - bcVelocityX3));
-        case BNE:
+        case DIR_PPM:
             return (float)(UbMath::c1o36 * (+bcVelocityX1 + bcVelocityX2 - bcVelocityX3));
-        case TSW:
+        case DIR_MMP:
             return (float)(UbMath::c1o36 * (-bcVelocityX1 - bcVelocityX2 + bcVelocityX3));
-        case TSE:
+        case DIR_PMP:
             return (float)(UbMath::c1o36 * (+bcVelocityX1 - bcVelocityX2 + bcVelocityX3));
-        case BNW:
+        case DIR_MPM:
             return (float)(UbMath::c1o36 * (-bcVelocityX1 + bcVelocityX2 - bcVelocityX3));
-        case BSE:
+        case DIR_PMM:
             return (float)(UbMath::c1o36 * (+bcVelocityX1 - bcVelocityX2 - bcVelocityX3));
-        case TNW:
+        case DIR_MPP:
             return (float)(UbMath::c1o36 * (-bcVelocityX1 + bcVelocityX2 + bcVelocityX3));
         default:
             throw UbException(UB_EXARGS, "unknown direction");
@@ -870,28 +870,28 @@ static inline void calcDistanceToNeighbors(std::vector<double> &distNeigh, const
 {
     // distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
 
-    distNeigh[E] = distNeigh[W] = distNeigh[N] = deltaX1;
-    distNeigh[S] = distNeigh[T] = distNeigh[B] = deltaX1;
-    distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = UbMath::sqrt2 * deltaX1;
-    distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = UbMath::sqrt2 * deltaX1;
-    distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = UbMath::sqrt2 * deltaX1;
-    distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = UbMath::sqrt3 * deltaX1;
-    distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = UbMath::sqrt3 * deltaX1;
+    distNeigh[DIR_P00] = distNeigh[DIR_M00] = distNeigh[DIR_0P0] = deltaX1;
+    distNeigh[DIR_0M0] = distNeigh[DIR_00P] = distNeigh[DIR_00M] = deltaX1;
+    distNeigh[DIR_PP0] = distNeigh[DIR_MP0] = distNeigh[DIR_MM0] = distNeigh[DIR_PM0] = UbMath::sqrt2 * deltaX1;
+    distNeigh[DIR_P0P] = distNeigh[DIR_0PP] = distNeigh[DIR_M0P] = distNeigh[DIR_0MP] = UbMath::sqrt2 * deltaX1;
+    distNeigh[DIR_P0M] = distNeigh[DIR_0PM] = distNeigh[DIR_M0M] = distNeigh[DIR_0MM] = UbMath::sqrt2 * deltaX1;
+    distNeigh[DIR_PPP] = distNeigh[DIR_MPP] = distNeigh[DIR_PMP] = distNeigh[DIR_MMP] = UbMath::sqrt3 * deltaX1;
+    distNeigh[DIR_PPM] = distNeigh[DIR_MPM] = distNeigh[DIR_PMM] = distNeigh[DIR_MMM] = UbMath::sqrt3 * deltaX1;
 }
 //////////////////////////////////////////////////////////////////////////
 static inline void calcDistanceToNeighbors(std::vector<double> &distNeigh, const double &deltaX1, const double &deltaX2,
                                            const double &deltaX3)
 {
     // distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
-    distNeigh[E] = distNeigh[W] = deltaX1;
-    distNeigh[N] = distNeigh[S] = deltaX2;
-    distNeigh[T] = distNeigh[B] = deltaX3;
-    distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt(deltaX1 * deltaX1 + deltaX2 * deltaX2);
-    distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt(deltaX1 * deltaX1 + deltaX3 * deltaX3);
-    distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt(deltaX2 * deltaX2 + deltaX3 * deltaX3);
-    distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] =
+    distNeigh[DIR_P00] = distNeigh[DIR_M00] = deltaX1;
+    distNeigh[DIR_0P0] = distNeigh[DIR_0M0] = deltaX2;
+    distNeigh[DIR_00P] = distNeigh[DIR_00M] = deltaX3;
+    distNeigh[DIR_PP0] = distNeigh[DIR_MP0] = distNeigh[DIR_MM0] = distNeigh[DIR_PM0] = sqrt(deltaX1 * deltaX1 + deltaX2 * deltaX2);
+    distNeigh[DIR_P0P] = distNeigh[DIR_0PP] = distNeigh[DIR_M0P] = distNeigh[DIR_0MP] = sqrt(deltaX1 * deltaX1 + deltaX3 * deltaX3);
+    distNeigh[DIR_P0M] = distNeigh[DIR_0PM] = distNeigh[DIR_M0M] = distNeigh[DIR_0MM] = sqrt(deltaX2 * deltaX2 + deltaX3 * deltaX3);
+    distNeigh[DIR_PPP] = distNeigh[DIR_MPP] = distNeigh[DIR_PMP] = distNeigh[DIR_MMP] =
         sqrt(deltaX1 * deltaX1 + deltaX2 * deltaX2 + deltaX3 * deltaX3);
-    distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] =
+    distNeigh[DIR_PPM] = distNeigh[DIR_MPM] = distNeigh[DIR_PMM] = distNeigh[DIR_MMM] =
         sqrt(deltaX1 * deltaX1 + deltaX2 * deltaX2 + deltaX3 * deltaX3);
 }
 //////////////////////////////////////////////////////////////////////////
@@ -900,107 +900,107 @@ static inline void initRayVectors(double *const &rayX1, double *const &rayX2, do
     int fdir;
     double c1oS2 = UbMath::one_over_sqrt2;
     double c1oS3 = UbMath::one_over_sqrt3;
-    fdir         = E;
+    fdir         = DIR_P00;
     rayX1[fdir]  = 1.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 0.0;
-    fdir         = W;
+    fdir         = DIR_M00;
     rayX1[fdir]  = -1.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 0.0;
-    fdir         = N;
+    fdir         = DIR_0P0;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 1.0;
     rayX3[fdir]  = 0.0;
-    fdir         = S;
+    fdir         = DIR_0M0;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -1.0;
     rayX3[fdir]  = 0.0;
-    fdir         = T;
+    fdir         = DIR_00P;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = 1.0;
-    fdir         = B;
+    fdir         = DIR_00M;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -1.0;
-    fdir         = NE;
+    fdir         = DIR_PP0;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = SW;
+    fdir         = DIR_MM0;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = SE;
+    fdir         = DIR_PM0;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = NW;
+    fdir         = DIR_MP0;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = 0.0;
-    fdir         = TE;
+    fdir         = DIR_P0P;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = c1oS2;
-    fdir         = BW;
+    fdir         = DIR_M0M;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -c1oS2;
-    fdir         = BE;
+    fdir         = DIR_P0M;
     rayX1[fdir]  = c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = -c1oS2;
-    fdir         = TW;
+    fdir         = DIR_M0P;
     rayX1[fdir]  = -c1oS2;
     rayX2[fdir]  = 0.0;
     rayX3[fdir]  = c1oS2;
-    fdir         = TN;
+    fdir         = DIR_0PP;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = c1oS2;
-    fdir         = BS;
+    fdir         = DIR_0MM;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = -c1oS2;
-    fdir         = BN;
+    fdir         = DIR_0PM;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = c1oS2;
     rayX3[fdir]  = -c1oS2;
-    fdir         = TS;
+    fdir         = DIR_0MP;
     rayX1[fdir]  = 0.0;
     rayX2[fdir]  = -c1oS2;
     rayX3[fdir]  = c1oS2;
-    fdir         = TNE;
+    fdir         = DIR_PPP;
     rayX1[fdir]  = c1oS3;
     rayX2[fdir]  = c1oS3;
     rayX3[fdir]  = c1oS3;
-    fdir         = TNW;
+    fdir         = DIR_MPP;
     rayX1[fdir]  = -c1oS3;
     rayX2[fdir]  = c1oS3;
     rayX3[fdir]  = c1oS3;
-    fdir         = TSE;
+    fdir         = DIR_PMP;
     rayX1[fdir]  = c1oS3;
     rayX2[fdir]  = -c1oS3;
     rayX3[fdir]  = c1oS3;
-    fdir         = TSW;
+    fdir         = DIR_MMP;
     rayX1[fdir]  = -c1oS3;
     rayX2[fdir]  = -c1oS3;
     rayX3[fdir]  = c1oS3;
-    fdir         = BNE;
+    fdir         = DIR_PPM;
     rayX1[fdir]  = c1oS3;
     rayX2[fdir]  = c1oS3;
     rayX3[fdir]  = -c1oS3;
-    fdir         = BNW;
+    fdir         = DIR_MPM;
     rayX1[fdir]  = -c1oS3;
     rayX2[fdir]  = c1oS3;
     rayX3[fdir]  = -c1oS3;
-    fdir         = BSE;
+    fdir         = DIR_PMM;
     rayX1[fdir]  = c1oS3;
     rayX2[fdir]  = -c1oS3;
     rayX3[fdir]  = -c1oS3;
-    fdir         = BSW;
+    fdir         = DIR_MMM;
     rayX1[fdir]  = -c1oS3;
     rayX2[fdir]  = -c1oS3;
     rayX3[fdir]  = -c1oS3;
@@ -1009,9 +1009,9 @@ static inline void initRayVectors(double *const &rayX1, double *const &rayX2, do
 static inline LBMReal calcPress(const LBMReal *const f, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3)
 {
     LBMReal op = 1.0;
-    return ((f[E] + f[W] + f[N] + f[S] + f[T] + f[B] +
-             2. * (f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE] + f[TW] + f[TN] + f[BS] + f[BN] + f[TS]) +
-             3. * (f[TNE] + f[TSW] + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW]) -
+    return ((f[DIR_P00] + f[DIR_M00] + f[DIR_0P0] + f[DIR_0M0] + f[DIR_00P] + f[DIR_00M] +
+             2. * (f[DIR_PP0] + f[DIR_MM0] + f[DIR_PM0] + f[DIR_MP0] + f[DIR_P0P] + f[DIR_M0M] + f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] + f[DIR_0MM] + f[DIR_0PM] + f[DIR_0MP]) +
+             3. * (f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] + f[DIR_MMM] + f[DIR_PMM] + f[DIR_MPM]) -
              (vx1 * vx1 + vx2 * vx2 + vx3 * vx3)) *
                 (1 - 0.5 * op) +
             op * 0.5 * (rho)) *
@@ -1020,33 +1020,33 @@ static inline LBMReal calcPress(const LBMReal *const f, LBMReal rho, LBMReal vx1
 //////////////////////////////////////////////////////////////////////////
 static inline LBMReal getShearRate(const LBMReal *const f, LBMReal collFactorF)
 {
-    LBMReal mfcbb = f[E];
-    LBMReal mfbcb = f[N];
-    LBMReal mfbbc = f[T];
-    LBMReal mfccb = f[NE];
-    LBMReal mfacb = f[NW];
-    LBMReal mfcbc = f[TE];
-    LBMReal mfabc = f[TW];
-    LBMReal mfbcc = f[TN];
-    LBMReal mfbac = f[TS];
-    LBMReal mfccc = f[TNE];
-    LBMReal mfacc = f[TNW];
-    LBMReal mfcac = f[TSE];
-    LBMReal mfaac = f[TSW];
+    LBMReal mfcbb = f[DIR_P00];
+    LBMReal mfbcb = f[DIR_0P0];
+    LBMReal mfbbc = f[DIR_00P];
+    LBMReal mfccb = f[DIR_PP0];
+    LBMReal mfacb = f[DIR_MP0];
+    LBMReal mfcbc = f[DIR_P0P];
+    LBMReal mfabc = f[DIR_M0P];
+    LBMReal mfbcc = f[DIR_0PP];
+    LBMReal mfbac = f[DIR_0MP];
+    LBMReal mfccc = f[DIR_PPP];
+    LBMReal mfacc = f[DIR_MPP];
+    LBMReal mfcac = f[DIR_PMP];
+    LBMReal mfaac = f[DIR_MMP];
 
-    LBMReal mfabb = f[W];
-    LBMReal mfbab = f[S];
-    LBMReal mfbba = f[B];
-    LBMReal mfaab = f[SW];
-    LBMReal mfcab = f[SE];
-    LBMReal mfaba = f[BW];
-    LBMReal mfcba = f[BE];
-    LBMReal mfbaa = f[BS];
-    LBMReal mfbca = f[BN];
-    LBMReal mfaaa = f[BSW];
-    LBMReal mfcaa = f[BSE];
-    LBMReal mfaca = f[BNW];
-    LBMReal mfcca = f[BNE];
+    LBMReal mfabb = f[DIR_M00];
+    LBMReal mfbab = f[DIR_0M0];
+    LBMReal mfbba = f[DIR_00M];
+    LBMReal mfaab = f[DIR_MM0];
+    LBMReal mfcab = f[DIR_PM0];
+    LBMReal mfaba = f[DIR_M0M];
+    LBMReal mfcba = f[DIR_P0M];
+    LBMReal mfbaa = f[DIR_0MM];
+    LBMReal mfbca = f[DIR_0PM];
+    LBMReal mfaaa = f[DIR_MMM];
+    LBMReal mfcaa = f[DIR_PMM];
+    LBMReal mfaca = f[DIR_MPM];
+    LBMReal mfcca = f[DIR_PPM];
 
     LBMReal mfbbb = f[DIR_000];
 
@@ -1353,39 +1353,39 @@ static void calcMultiphaseFeq(LBMReal *const &feq /*[27]*/, const LBMReal &rho,
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
     feq[DIR_000] = c8o27 * (p1 + rho * c1o3 * (-cu_sq));
-    feq[E]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
-    feq[W]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
-    feq[N]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
-    feq[S]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq));
-    feq[T]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq));
-    feq[B]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq));
-    feq[NE]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
-    feq[SW]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
-    feq[SE]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
-    feq[NW]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
-    feq[TE]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
-    feq[BW]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
-    feq[BE]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
-    feq[TW]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
-    feq[TN]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
-    feq[BS]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
-    feq[BN]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
-    feq[TS]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
-    feq[TNE] =
+    feq[DIR_P00]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
+    feq[DIR_M00]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
+    feq[DIR_0P0]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
+    feq[DIR_0M0]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq));
+    feq[DIR_00P]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq));
+    feq[DIR_00M]    = c2o27 * (p1 + rho * c1o3 * (3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq));
+    feq[DIR_PP0]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
+    feq[DIR_MM0]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
+    feq[DIR_PM0]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
+    feq[DIR_MP0]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
+    feq[DIR_P0P]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
+    feq[DIR_M0M]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
+    feq[DIR_P0M]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
+    feq[DIR_M0P]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
+    feq[DIR_0PP]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
+    feq[DIR_0MM]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
+    feq[DIR_0PM]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
+    feq[DIR_0MP]   = c1o54 * (p1 + rho * c1o3 * (3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
+    feq[DIR_PPP] =
         c1o216 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq));
-    feq[BSW] = c1o216 *
+    feq[DIR_MMM] = c1o216 *
                (p1 + rho * c1o3 * (3.0 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq));
-    feq[BNE] =
+    feq[DIR_PPM] =
         c1o216 * (p1 + rho * c1o3 * (3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq));
-    feq[TSW] = c1o216 *
+    feq[DIR_MMP] = c1o216 *
                (p1 + rho * c1o3 * (3.0 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq));
-    feq[TSE] =
+    feq[DIR_PMP] =
         c1o216 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq));
-    feq[BNW] = c1o216 *
+    feq[DIR_MPM] = c1o216 *
                (p1 + rho * c1o3 * (3.0 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq));
-    feq[BSE] =
+    feq[DIR_PMM] =
         c1o216 * (p1 + rho * c1o3 * (3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq));
-    feq[TNW] = c1o216 *
+    feq[DIR_MPP] = c1o216 *
                (p1 + rho * c1o3 * (3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq));
 }
 //////////////////////////////////////////////////////////////////////////
@@ -1396,32 +1396,32 @@ static void calcMultiphaseFeqVB(LBMReal *const &feq /*[27]*/, const LBMReal &p1,
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
     feq[DIR_000] = p1 + c8o27 * (-cu_sq);
-    feq[E]    = c2o27 * ((3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
-    feq[W]    = c2o27 * ((3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
-    feq[N]    = c2o27 * ((3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
-    feq[S]    = c2o27 * ((3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq));
-    feq[T]    = c2o27 * ((3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq));
-    feq[B]    = c2o27 * ((3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq));
-    feq[NE]   = c1o54 * ((3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
-    feq[SW]   = c1o54 * ((3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
-    feq[SE]   = c1o54 * ((3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
-    feq[NW]   = c1o54 * ((3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
-    feq[TE]   = c1o54 * ((3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
-    feq[BW]   = c1o54 * ((3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
-    feq[BE]   = c1o54 * ((3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
-    feq[TW]   = c1o54 * ((3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
-    feq[TN]   = c1o54 * ((3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
-    feq[BS]   = c1o54 * ((3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
-    feq[BN]   = c1o54 * ((3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
-    feq[TS]   = c1o54 * ((3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
-    feq[TNE]  = c1o216 * ((3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq));
-    feq[BSW]  = c1o216 * ((3.0 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq));
-    feq[BNE]  = c1o216 * ((3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq));
-    feq[TSW]  = c1o216 * ((3.0 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq));
-    feq[TSE]  = c1o216 * ((3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq));
-    feq[BNW]  = c1o216 * ((3.0 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq));
-    feq[BSE]  = c1o216 * ((3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq));
-    feq[TNW]  = c1o216 * ((3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq));
+    feq[DIR_P00]    = c2o27 * ((3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq));
+    feq[DIR_M00]    = c2o27 * ((3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq));
+    feq[DIR_0P0]    = c2o27 * ((3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq));
+    feq[DIR_0M0]    = c2o27 * ((3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq));
+    feq[DIR_00P]    = c2o27 * ((3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq));
+    feq[DIR_00M]    = c2o27 * ((3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq));
+    feq[DIR_PP0]   = c1o54 * ((3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq));
+    feq[DIR_MM0]   = c1o54 * ((3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq));
+    feq[DIR_PM0]   = c1o54 * ((3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq));
+    feq[DIR_MP0]   = c1o54 * ((3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq));
+    feq[DIR_P0P]   = c1o54 * ((3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq));
+    feq[DIR_M0M]   = c1o54 * ((3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq));
+    feq[DIR_P0M]   = c1o54 * ((3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq));
+    feq[DIR_M0P]   = c1o54 * ((3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq));
+    feq[DIR_0PP]   = c1o54 * ((3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq));
+    feq[DIR_0MM]   = c1o54 * ((3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq));
+    feq[DIR_0PM]   = c1o54 * ((3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq));
+    feq[DIR_0MP]   = c1o54 * ((3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq));
+    feq[DIR_PPP]  = c1o216 * ((3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq));
+    feq[DIR_MMM]  = c1o216 * ((3.0 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq));
+    feq[DIR_PPM]  = c1o216 * ((3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq));
+    feq[DIR_MMP]  = c1o216 * ((3.0 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq));
+    feq[DIR_PMP]  = c1o216 * ((3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq));
+    feq[DIR_MPM]  = c1o216 * ((3.0 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq));
+    feq[DIR_PMM]  = c1o216 * ((3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq));
+    feq[DIR_MPP]  = c1o216 * ((3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq));
 }
 //////////////////////////////////////////////////////////////////////////
 static void calcMultiphaseHeq(LBMReal *const &heq /*[27]*/, const LBMReal &phi, const LBMReal &vx1, const LBMReal &vx2,
@@ -1431,32 +1431,32 @@ static void calcMultiphaseHeq(LBMReal *const &heq /*[27]*/, const LBMReal &phi,
     LBMReal cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
     heq[DIR_000] = c8o27 * phi * (1.0 - cu_sq);
-    heq[E]    = c2o27 * phi * (1.0 + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
-    heq[W]    = c2o27 * phi * (1.0 + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
-    heq[N]    = c2o27 * phi * (1.0 + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
-    heq[S]    = c2o27 * phi * (1.0 + 3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq);
-    heq[T]    = c2o27 * phi * (1.0 + 3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq);
-    heq[B]    = c2o27 * phi * (1.0 + 3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq);
-    heq[NE]   = c1o54 * phi * (1.0 + 3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
-    heq[SW]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
-    heq[SE]   = c1o54 * phi * (1.0 + 3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
-    heq[NW]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
-    heq[TE]   = c1o54 * phi * (1.0 + 3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
-    heq[BW]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
-    heq[BE]   = c1o54 * phi * (1.0 + 3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
-    heq[TW]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
-    heq[TN]   = c1o54 * phi * (1.0 + 3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
-    heq[BS]   = c1o54 * phi * (1.0 + 3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
-    heq[BN]   = c1o54 * phi * (1.0 + 3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
-    heq[TS]   = c1o54 * phi * (1.0 + 3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
-    heq[TNE]  = c1o216 * phi * (1.0 + 3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq);
-    heq[BSW] = c1o216 * phi * (1.0 + 3.0 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq);
-    heq[BNE] = c1o216 * phi * (1.0 + 3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq);
-    heq[TSW] = c1o216 * phi * (1.0 + 3.0 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq);
-    heq[TSE] = c1o216 * phi * (1.0 + 3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq);
-    heq[BNW] = c1o216 * phi * (1.0 + 3.0 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq);
-    heq[BSE] = c1o216 * phi * (1.0 + 3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq);
-    heq[TNW] = c1o216 * phi * (1.0 + 3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
+    heq[DIR_P00]    = c2o27 * phi * (1.0 + 3.0 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq);
+    heq[DIR_M00]    = c2o27 * phi * (1.0 + 3.0 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq);
+    heq[DIR_0P0]    = c2o27 * phi * (1.0 + 3.0 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq);
+    heq[DIR_0M0]    = c2o27 * phi * (1.0 + 3.0 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq);
+    heq[DIR_00P]    = c2o27 * phi * (1.0 + 3.0 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq);
+    heq[DIR_00M]    = c2o27 * phi * (1.0 + 3.0 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq);
+    heq[DIR_PP0]   = c1o54 * phi * (1.0 + 3.0 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq);
+    heq[DIR_MM0]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq);
+    heq[DIR_PM0]   = c1o54 * phi * (1.0 + 3.0 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq);
+    heq[DIR_MP0]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq);
+    heq[DIR_P0P]   = c1o54 * phi * (1.0 + 3.0 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq);
+    heq[DIR_M0M]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq);
+    heq[DIR_P0M]   = c1o54 * phi * (1.0 + 3.0 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq);
+    heq[DIR_M0P]   = c1o54 * phi * (1.0 + 3.0 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq);
+    heq[DIR_0PP]   = c1o54 * phi * (1.0 + 3.0 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq);
+    heq[DIR_0MM]   = c1o54 * phi * (1.0 + 3.0 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq);
+    heq[DIR_0PM]   = c1o54 * phi * (1.0 + 3.0 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq);
+    heq[DIR_0MP]   = c1o54 * phi * (1.0 + 3.0 * (-vx2 + vx3) + c9o2 * (-vx2 + vx3) * (-vx2 + vx3) - cu_sq);
+    heq[DIR_PPP]  = c1o216 * phi * (1.0 + 3.0 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq);
+    heq[DIR_MMM] = c1o216 * phi * (1.0 + 3.0 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq);
+    heq[DIR_PPM] = c1o216 * phi * (1.0 + 3.0 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq);
+    heq[DIR_MMP] = c1o216 * phi * (1.0 + 3.0 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq);
+    heq[DIR_PMP] = c1o216 * phi * (1.0 + 3.0 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq);
+    heq[DIR_MPM] = c1o216 * phi * (1.0 + 3.0 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq);
+    heq[DIR_PMM] = c1o216 * phi * (1.0 + 3.0 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq);
+    heq[DIR_MPP] = c1o216 * phi * (1.0 + 3.0 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq);
 }
 
 } // namespace D3Q27System
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp
index 089b505a5..90bc19984 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp
@@ -68,37 +68,37 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::initRelaxFactor(int vdir, d
          {
             switch (direction)
             {
-            case D3Q27System::E:
+            case D3Q27System::DIR_P00:
                muX1 = (double)(x1 + ix1 * maxX1);
                if (muX1 >= (sizeX - sizeSP) / deltaT)
                   spongeFactor = (sizeX - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
                else spongeFactor = 1.0;
                break;
-            case D3Q27System::W:
+            case D3Q27System::DIR_M00:
                muX1 = (double)(x1 + ix1 * maxX1);
                if (muX1 <= sizeSP / deltaT)
                   spongeFactor = (sizeSP - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
                else spongeFactor = 1.0;
                break;
-            case D3Q27System::N:
+            case D3Q27System::DIR_0P0:
                muX2 = (double)(x2 + ix2 * maxX2);
                if (muX2 >= (sizeX - sizeSP) / deltaT)
                   spongeFactor = (sizeX - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
                else spongeFactor = 1.0;
                break;
-            case D3Q27System::S:
+            case D3Q27System::DIR_0M0:
                muX2 = (double)(x2 + ix2 * maxX2);
                if (muX2 <= sizeSP / deltaT)
                   spongeFactor = (sizeSP - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
                else spongeFactor = 1.0;
                break;
-            case D3Q27System::T:
+            case D3Q27System::DIR_00P:
                muX3 = (double)(x3 + ix3 * maxX3);
                if (muX3 >= (sizeX - sizeSP) / deltaT)
                   spongeFactor = (sizeX - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
                else spongeFactor = 1.0;
                break;
-            case D3Q27System::B:
+            case D3Q27System::DIR_00M:
                muX3 = (double)(x3 + ix3 * maxX3);
                if (muX3 <= sizeSP / deltaT)
                   spongeFactor = (sizeSP - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5;
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
index b4ccea0c9..2d8f71843 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
@@ -61,7 +61,7 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* cons
 {
    using namespace D3Q27System;
 
-   //UBLOG(logINFO,"D3Q27System::BW  = " << D3Q27System::BW);
+   //UBLOG(logINFO,"D3Q27System::DIR_M0M  = " << D3Q27System::DIR_M0M);
    //UBLOG(logINFO,"BW  = " << BW);
 
    LBMReal rho = 0.0;
@@ -82,14 +82,14 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* cons
    //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
    press = rho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[D3Q27System::BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
-   //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3));
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[NE])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))-(vx2*vx3));
+   kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[NE])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
+   //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[DIR_P00])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3));
 
-   //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])));
+   //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[DIR_P00])-(f[B]+f[T])));
    //UBLOG(logINFO, "kxxMzz = "<<kxxMzz);
 
    //UBLOG(logINFO,"f[BW]  = " << f[BW] << " BW  = " << BW);
@@ -543,32 +543,32 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f
    LBMReal feq[ENDF+1];
    D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
 
-   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
+   f[DIR_P00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_P00];
    f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
    f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
    f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
    f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
    f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
    f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
-   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
-   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
-   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
-   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
-   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
-   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
-   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
-   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
-   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
-   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
-   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
-   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
-   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
-   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
-   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
-   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
-   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
-   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
-   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
+   f[DIR_MM0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_PPP];
+   f[DIR_MMP]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_MMP];
+   f[DIR_PMP]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_PMP];
+   f[DIR_MPP]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_MPP];
+   f[DIR_PPM]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_PPM];
+   f[DIR_MMM]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_MMM];
+   f[DIR_PMM]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_PMM];
+   f[DIR_MPM]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_MPM];
    f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
@@ -737,32 +737,32 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal*
    f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
    f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
 
-   f[E]    = f_E    + feq[E];
+   f[DIR_P00]    = f_E    + feq[DIR_P00];
    f[W]    = f_E    + feq[W];
    f[N]    = f_N    + feq[N];
    f[S]    = f_N    + feq[S];
    f[T]    = f_T    + feq[T];
    f[B]    = f_T    + feq[B];
    f[NE]   = f_NE   + feq[NE];
-   f[SW]   = f_NE   + feq[SW];
-   f[SE]   = f_SE   + feq[SE];
-   f[NW]   = f_SE   + feq[NW];
-   f[TE]   = f_TE   + feq[TE];
-   f[BW]   = f_TE   + feq[BW];
-   f[BE]   = f_BE   + feq[BE];
-   f[TW]   = f_BE   + feq[TW];
-   f[TN]   = f_TN   + feq[TN];
-   f[BS]   = f_TN   + feq[BS];
-   f[BN]   = f_BN   + feq[BN];
-   f[TS]   = f_BN   + feq[TS];
-   f[TNE]  = f_TNE  + feq[TNE];
-   f[TNW]  = f_TNW  + feq[TNW];
-   f[TSE]  = f_TSE  + feq[TSE];
-   f[TSW]  = f_TSW  + feq[TSW];
-   f[BNE]  = f_TSW  + feq[BNE];
-   f[BNW]  = f_TSE  + feq[BNW];
-   f[BSE]  = f_TNW  + feq[BSE];
-   f[BSW]  = f_TNE  + feq[BSW];
+   f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + feq[DIR_PPP];
+   f[DIR_MPP]  = f_TNW  + feq[DIR_MPP];
+   f[DIR_PMP]  = f_TSE  + feq[DIR_PMP];
+   f[DIR_MMP]  = f_TSW  + feq[DIR_MMP];
+   f[DIR_PPM]  = f_TSW  + feq[DIR_PPM];
+   f[DIR_MPM]  = f_TSE  + feq[DIR_MPM];
+   f[DIR_PMM]  = f_TNW  + feq[DIR_PMM];
+   f[DIR_MMM]  = f_TNE  + feq[DIR_MMM];
    f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
index 56074586c..9a5396636 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
@@ -896,43 +896,43 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                ////////////////////////////////////////////////////////////////////////////
                f[DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 
-               f[E] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+               f[DIR_P00] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
                f[N] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
                f[T] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
                f[NE] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-               f[NW] = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
-               f[TE] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-               f[TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
-               f[TN] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-               f[TS] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3);
-               f[TNE] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-               f[TNW] = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3);
-               f[TSE] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
-               f[TSW] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
+               f[DIR_MP0] = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
+               f[DIR_P0P] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+               f[DIR_M0P] = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
+               f[DIR_0PP] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+               f[DIR_0MP] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3);
+               f[DIR_PPP] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+               f[DIR_MPP] = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3);
+               f[DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
+               f[DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                f[W] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
                f[S] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
                f[B] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
-               f[SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
-               f[SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
-               f[BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
-               f[BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p);
-               f[BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p);
-               f[BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p);
-               f[BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-               f[BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p);
-               f[BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p);
-               f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
+               f[DIR_MM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
+               f[DIR_PM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
+               f[DIR_M0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
+               f[DIR_P0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p);
+               f[DIR_0MM] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p);
+               f[DIR_0PM] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p);
+               f[DIR_MMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+               f[DIR_PMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p);
+               f[DIR_MPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p);
+               f[DIR_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p);
                //////////////////////////////////////////////////////////////////////////
 
-               drho = ((f[TNE]+f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+(f[TSW]+f[BNE]))
-                  +(((f[NE]+f[SW])+(f[SE]+f[NW]))+((f[TE]+f[BW])+(f[BE]+f[TW]))
-                     +((f[BN]+f[TS])+(f[TN]+f[BS])))+((f[E]+f[W])+(f[N]+f[S])
+               drho = ((f[DIR_PPP]+f[DIR_MMM])+(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])+(f[DIR_MMP]+f[DIR_PPM]))
+                  +(((f[NE]+f[DIR_MM0])+(f[DIR_PM0]+f[DIR_MP0]))+((f[DIR_P0P]+f[DIR_M0M])+(f[DIR_P0M]+f[DIR_M0P]))
+                     +((f[DIR_0PM]+f[DIR_0MP])+(f[DIR_0PP]+f[DIR_0MM])))+((f[DIR_P00]+f[W])+(f[N]+f[S])
                         +(f[T]+f[B]))+f[DIR_000];
 
                //vx1 = ((((f[TNE]-f[BSW])+(f[TSE]-f[BNW]))+((f[BSE]-f[TNW])+(f[BNE]-f[TSW])))+
                //   (((f[BE]-f[TW])+(f[TE]-f[BW]))+((f[SE]-f[NW])+(f[NE]-f[SW])))+
-               //   (f[E]-f[W]));
+               //   (f[DIR_P00]-f[W]));
 
                //vx2 = ((((f[TNE]-f[BSW])+(f[BNW]-f[TSE]))+((f[TNW]-f[BSE])+(f[BNE]-f[TSW])))+
                //   (((f[BN]-f[TS])+(f[TN]-f[BS]))+((f[NW]-f[SE])+(f[NE]-f[SW])))+
@@ -957,66 +957,66 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
 
                feq[DIR_000] = c8o27*(drho-cu_sq);
-               feq[E] = c2o27*(drho+3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq);
+               feq[DIR_P00] = c2o27*(drho+3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq);
                feq[W] = c2o27*(drho+3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq);
                feq[N] = c2o27*(drho+3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq);
                feq[S] = c2o27*(drho+3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq);
                feq[T] = c2o27*(drho+3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq);
                feq[B] = c2o27*(drho+3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq);
                feq[NE] = c1o54*(drho+3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq);
-               feq[SW] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
-               feq[SE] = c1o54*(drho+3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq);
-               feq[NW] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
-               feq[TE] = c1o54*(drho+3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq);
-               feq[BW] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
-               feq[BE] = c1o54*(drho+3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq);
-               feq[TW] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
-               feq[TN] = c1o54*(drho+3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq);
-               feq[BS] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
-               feq[BN] = c1o54*(drho+3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq);
-               feq[TS] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
-               feq[TNE] = c1o216*(drho+3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq);
-               feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
-               feq[BNE] = c1o216*(drho+3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq);
-               feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
-               feq[TSE] = c1o216*(drho+3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq);
-               feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
-               feq[BSE] = c1o216*(drho+3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq);
-               feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
+               feq[DIR_MM0] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
+               feq[DIR_PM0] = c1o54*(drho+3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq);
+               feq[DIR_MP0] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
+               feq[DIR_P0P] = c1o54*(drho+3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq);
+               feq[DIR_M0M] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
+               feq[DIR_P0M] = c1o54*(drho+3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq);
+               feq[DIR_M0P] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
+               feq[DIR_0PP] = c1o54*(drho+3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq);
+               feq[DIR_0MM] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
+               feq[DIR_0PM] = c1o54*(drho+3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq);
+               feq[DIR_0MP] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
+               feq[DIR_PPP] = c1o216*(drho+3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq);
+               feq[DIR_MMM] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
+               feq[DIR_PPM] = c1o216*(drho+3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq);
+               feq[DIR_MMP] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
+               feq[DIR_PMP] = c1o216*(drho+3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq);
+               feq[DIR_MPM] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
+               feq[DIR_PMM] = c1o216*(drho+3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq);
+               feq[DIR_MPP] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
 
                //Relaxation
                f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
-               f[E] += (feq[E]-f[E])*collFactor;
+               f[DIR_P00] += (feq[DIR_P00]-f[DIR_P00])*collFactor;
                f[W] += (feq[W]-f[W])*collFactor;
                f[N] += (feq[N]-f[N])*collFactor;
                f[S] += (feq[S]-f[S])*collFactor;
                f[T] += (feq[T]-f[T])*collFactor;
                f[B] += (feq[B]-f[B])*collFactor;
                f[NE] += (feq[NE]-f[NE])*collFactor;
-               f[SW] += (feq[SW]-f[SW])*collFactor;
-               f[SE] += (feq[SE]-f[SE])*collFactor;
-               f[NW] += (feq[NW]-f[NW])*collFactor;
-               f[TE] += (feq[TE]-f[TE])*collFactor;
-               f[BW] += (feq[BW]-f[BW])*collFactor;
-               f[BE] += (feq[BE]-f[BE])*collFactor;
-               f[TW] += (feq[TW]-f[TW])*collFactor;
-               f[TN] += (feq[TN]-f[TN])*collFactor;
-               f[BS] += (feq[BS]-f[BS])*collFactor;
-               f[BN] += (feq[BN]-f[BN])*collFactor;
-               f[TS] += (feq[TS]-f[TS])*collFactor;
+               f[DIR_MM0] += (feq[DIR_MM0]-f[DIR_MM0])*collFactor;
+               f[DIR_PM0] += (feq[DIR_PM0]-f[DIR_PM0])*collFactor;
+               f[DIR_MP0] += (feq[DIR_MP0]-f[DIR_MP0])*collFactor;
+               f[DIR_P0P] += (feq[DIR_P0P]-f[DIR_P0P])*collFactor;
+               f[DIR_M0M] += (feq[DIR_M0M]-f[DIR_M0M])*collFactor;
+               f[DIR_P0M] += (feq[DIR_P0M]-f[DIR_P0M])*collFactor;
+               f[DIR_M0P] += (feq[DIR_M0P]-f[DIR_M0P])*collFactor;
+               f[DIR_0PP] += (feq[DIR_0PP]-f[DIR_0PP])*collFactor;
+               f[DIR_0MM] += (feq[DIR_0MM]-f[DIR_0MM])*collFactor;
+               f[DIR_0PM] += (feq[DIR_0PM]-f[DIR_0PM])*collFactor;
+               f[DIR_0MP] += (feq[DIR_0MP]-f[DIR_0MP])*collFactor;
 
-               f[TNE] += (feq[TNE]-f[TNE])*collFactor;
-               f[BSW] += (feq[BSW]-f[BSW])*collFactor;
-               f[BNE] += (feq[BNE]-f[BNE])*collFactor;
-               f[TSW] += (feq[TSW]-f[TSW])*collFactor;
-               f[TSE] += (feq[TSE]-f[TSE])*collFactor;
-               f[BNW] += (feq[BNW]-f[BNW])*collFactor;
-               f[BSE] += (feq[BSE]-f[BSE])*collFactor;
-               f[TNW] += (feq[TNW]-f[TNW])*collFactor;
+               f[DIR_PPP] += (feq[DIR_PPP]-f[DIR_PPP])*collFactor;
+               f[DIR_MMM] += (feq[DIR_MMM]-f[DIR_MMM])*collFactor;
+               f[DIR_PPM] += (feq[DIR_PPM]-f[DIR_PPM])*collFactor;
+               f[DIR_MMP] += (feq[DIR_MMP]-f[DIR_MMP])*collFactor;
+               f[DIR_PMP] += (feq[DIR_PMP]-f[DIR_PMP])*collFactor;
+               f[DIR_MPM] += (feq[DIR_MPM]-f[DIR_MPM])*collFactor;
+               f[DIR_PMM] += (feq[DIR_PMM]-f[DIR_PMM])*collFactor;
+               f[DIR_MPP] += (feq[DIR_MPP]-f[DIR_MPP])*collFactor;
 
                //////////////////////////////////////////////////////////////////////////
 #ifdef  PROOF_CORRECTNESS
-               LBMReal rho_post = f[REST]+f[E]+f[W]+f[N]+f[S]+f[T]+f[B]
+               LBMReal rho_post = f[REST]+f[DIR_P00]+f[W]+f[N]+f[S]+f[T]+f[B]
                   +f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]
                   +f[TW]+f[TN]+f[BS]+f[BN]+f[TS]+f[TNE]+f[TSW]
                   +f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW];
@@ -1033,33 +1033,33 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                //////////////////////////////////////////////////////////////////////////
                //write distribution
                //////////////////////////////////////////////////////////////////////////
-               (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::INV_E];
-               (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::INV_N];
-               (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::INV_T];
-               (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::INV_NE];
-               (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = f[D3Q27System::INV_NW];
-               (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::INV_TE];
-               (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = f[D3Q27System::INV_TW];
-               (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::INV_TN];
-               (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = f[D3Q27System::INV_TS];
-               (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::INV_TNE];
-               (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = f[D3Q27System::INV_TNW];
-               (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = f[D3Q27System::INV_TSE];
-               (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[D3Q27System::INV_TSW];
+               (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[D3Q27System::INV_P00];
+               (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[D3Q27System::INV_0P0];
+               (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[D3Q27System::INV_00P];
+               (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[D3Q27System::INV_PP0];
+               (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = f[D3Q27System::INV_MP0];
+               (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[D3Q27System::INV_P0P];
+               (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = f[D3Q27System::INV_M0P];
+               (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[D3Q27System::INV_0PP];
+               (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = f[D3Q27System::INV_0MP];
+               (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[D3Q27System::INV_PPP];
+               (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = f[D3Q27System::INV_MPP];
+               (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = f[D3Q27System::INV_PMP];
+               (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[D3Q27System::INV_MMP];
 
-               (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = f[D3Q27System::INV_W];
-               (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = f[D3Q27System::INV_S];
-               (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = f[D3Q27System::INV_B];
-               (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = f[D3Q27System::INV_SW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = f[D3Q27System::INV_SE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = f[D3Q27System::INV_BW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = f[D3Q27System::INV_BE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = f[D3Q27System::INV_BS];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = f[D3Q27System::INV_BN];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[D3Q27System::INV_BSW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[D3Q27System::INV_BSE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[D3Q27System::INV_BNW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = f[D3Q27System::INV_BNE];
+               (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = f[D3Q27System::INV_M00];
+               (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = f[D3Q27System::INV_0M0];
+               (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = f[D3Q27System::INV_00M];
+               (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = f[D3Q27System::INV_MM0];
+               (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = f[D3Q27System::INV_PM0];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = f[D3Q27System::INV_M0M];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = f[D3Q27System::INV_P0M];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = f[D3Q27System::INV_0MM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = f[D3Q27System::INV_0PM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[D3Q27System::INV_MMM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[D3Q27System::INV_PMM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[D3Q27System::INV_MPM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = f[D3Q27System::INV_PPM];
 
                (*this->zeroDistributions)(x1, x2, x3) = f[D3Q27System::DIR_000];
                //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
index e48e846a4..5a4034ec0 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
@@ -90,111 +90,111 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                ////////////////////////////////////////////////////////////////////////////
                f[DIR_000] = (*this->zeroDistributions)(x1,x2,x3);
 
-               f[E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
+               f[DIR_P00] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
                f[N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
                f[T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
                f[NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
-               f[NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,x3);
-               f[TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
-               f[TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1p,x2,x3);
-               f[TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
-               f[TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2p,x3);
-               f[TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
-               f[TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,x3);
-               f[TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2p,x3);
-               f[TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3);
+               f[DIR_MP0] = (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,x3);
+               f[DIR_P0P] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
+               f[DIR_M0P] = (*this->localDistributions)(D3Q27System::ET_TW, x1p,x2,x3);
+               f[DIR_0PP] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
+               f[DIR_0MP] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2p,x3);
+               f[DIR_PPP] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
+               f[DIR_MPP] = (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,x3);
+               f[DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2p,x3);
+               f[DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3);
 
                f[W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,x3  );
                f[S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2p,x3  );
                f[B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3p  );
-               f[SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 );
-               f[SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2p,x3 );
-               f[BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,x3p );
-               f[BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3p );
-               f[BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2p,x3p );
-               f[BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3p );
-               f[BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p);
-               f[BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2p,x3p);
-               f[BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,x3p);
-               f[BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p);
+               f[DIR_MM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 );
+               f[DIR_PM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2p,x3 );
+               f[DIR_M0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,x3p );
+               f[DIR_P0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3p );
+               f[DIR_0MM] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2p,x3p );
+               f[DIR_0PM] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3p );
+               f[DIR_MMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p);
+               f[DIR_PMM] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2p,x3p);
+               f[DIR_MPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,x3p);
+               f[DIR_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p);
                //////////////////////////////////////////////////////////////////////////
 
-               drho = f[DIR_000] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] 
-               + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE]
-               + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW]
-               + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW];
+               drho = f[DIR_000] + f[DIR_P00] + f[W] + f[N] + f[S] + f[T] + f[B] 
+               + f[NE] + f[DIR_MM0] + f[DIR_PM0] + f[DIR_MP0] + f[DIR_P0P] + f[DIR_M0M] + f[DIR_P0M]
+               + f[DIR_M0P] + f[DIR_0PP] + f[DIR_0MM] + f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP]
+               + f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] + f[DIR_MMM] + f[DIR_PMM] + f[DIR_MPM];
 
-               vx1 = f[E] - f[W] + f[NE] - f[SW] + f[SE] - f[NW] + f[TE] - f[BW]
-               + f[BE] - f[TW] + f[TNE] - f[TSW] + f[TSE] - f[TNW] + f[BNE] - f[BSW]
-               + f[BSE] - f[BNW]; 
+               vx1 = f[DIR_P00] - f[W] + f[NE] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M]
+               + f[DIR_P0M] - f[DIR_M0P] + f[DIR_PPP] - f[DIR_MMP] + f[DIR_PMP] - f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM]
+               + f[DIR_PMM] - f[DIR_MPM]; 
 
-               vx2 = f[N] - f[S] + f[NE] - f[SW] - f[SE] + f[NW] + f[TN] - f[BS] + f[BN]
-               - f[TS] + f[TNE] - f[TSW] - f[TSE] + f[TNW] + f[BNE] - f[BSW] - f[BSE] 
-               + f[BNW]; 
+               vx2 = f[N] - f[S] + f[NE] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM]
+               - f[DIR_0MP] + f[DIR_PPP] - f[DIR_MMP] - f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] 
+               + f[DIR_MPM]; 
 
-               vx3 = f[T] - f[B] + f[TE] - f[BW] - f[BE] + f[TW] + f[TN] - f[BS] - f[BN] 
-               + f[TS] + f[TNE] + f[TSW] + f[TSE] + f[TNW] - f[BNE] - f[BSW] - f[BSE] 
-               - f[BNW];
+               vx3 = f[T] - f[B] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] 
+               + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] 
+               - f[DIR_MPM];
 
                LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
 
                feq[DIR_000] =  c8o27*(drho-cu_sq);
-               feq[E] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
+               feq[DIR_P00] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
                feq[W] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
                feq[N] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
                feq[S] =  c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq);
                feq[T] =  c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq);
                feq[B] =  c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq);
                feq[NE] = c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq);
-               feq[SW] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
-               feq[SE] = c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq);
-               feq[NW] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
-               feq[TE] = c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq);
-               feq[BW] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
-               feq[BE] = c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq);
-               feq[TW] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
-               feq[TN] = c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq);
-               feq[BS] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
-               feq[BN] = c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq);
-               feq[TS] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
-               feq[TNE]= c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
-               feq[BSW]= c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
-               feq[BNE]= c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
-               feq[TSW]= c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
-               feq[TSE]= c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
-               feq[BNW]= c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
-               feq[BSE]= c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
-               feq[TNW]= c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
+               feq[DIR_MM0] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
+               feq[DIR_PM0] = c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq);
+               feq[DIR_MP0] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
+               feq[DIR_P0P] = c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq);
+               feq[DIR_M0M] = c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
+               feq[DIR_P0M] = c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq);
+               feq[DIR_M0P] = c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
+               feq[DIR_0PP] = c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq);
+               feq[DIR_0MM] = c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
+               feq[DIR_0PM] = c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq);
+               feq[DIR_0MP] = c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
+               feq[DIR_PPP]= c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
+               feq[DIR_MMM]= c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
+               feq[DIR_PPM]= c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
+               feq[DIR_MMP]= c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
+               feq[DIR_PMP]= c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
+               feq[DIR_MPM]= c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
+               feq[DIR_PMM]= c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
+               feq[DIR_MPP]= c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
 
                //Relaxation
                f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
-               f[E] += (feq[E]-f[E])*collFactor;
+               f[DIR_P00] += (feq[DIR_P00]-f[DIR_P00])*collFactor;
                f[W] += (feq[W]-f[W])*collFactor;
                f[N] += (feq[N]-f[N])*collFactor;
                f[S] += (feq[S]-f[S])*collFactor;
                f[T] += (feq[T]-f[T])*collFactor;
                f[B] += (feq[B]-f[B])*collFactor;
                f[NE] += (feq[NE]-f[NE])*collFactor;
-               f[SW] += (feq[SW]-f[SW])*collFactor;
-               f[SE] += (feq[SE]-f[SE])*collFactor;
-               f[NW] += (feq[NW]-f[NW])*collFactor;
-               f[TE] += (feq[TE]-f[TE])*collFactor;
-               f[BW] += (feq[BW]-f[BW])*collFactor;
-               f[BE] += (feq[BE]-f[BE])*collFactor;
-               f[TW] += (feq[TW]-f[TW])*collFactor;
-               f[TN] += (feq[TN]-f[TN])*collFactor;
-               f[BS] += (feq[BS]-f[BS])*collFactor;
-               f[BN] += (feq[BN]-f[BN])*collFactor;
-               f[TS] += (feq[TS]-f[TS])*collFactor;
+               f[DIR_MM0] += (feq[DIR_MM0]-f[DIR_MM0])*collFactor;
+               f[DIR_PM0] += (feq[DIR_PM0]-f[DIR_PM0])*collFactor;
+               f[DIR_MP0] += (feq[DIR_MP0]-f[DIR_MP0])*collFactor;
+               f[DIR_P0P] += (feq[DIR_P0P]-f[DIR_P0P])*collFactor;
+               f[DIR_M0M] += (feq[DIR_M0M]-f[DIR_M0M])*collFactor;
+               f[DIR_P0M] += (feq[DIR_P0M]-f[DIR_P0M])*collFactor;
+               f[DIR_M0P] += (feq[DIR_M0P]-f[DIR_M0P])*collFactor;
+               f[DIR_0PP] += (feq[DIR_0PP]-f[DIR_0PP])*collFactor;
+               f[DIR_0MM] += (feq[DIR_0MM]-f[DIR_0MM])*collFactor;
+               f[DIR_0PM] += (feq[DIR_0PM]-f[DIR_0PM])*collFactor;
+               f[DIR_0MP] += (feq[DIR_0MP]-f[DIR_0MP])*collFactor;
 
-               f[TNE] += (feq[TNE]-f[TNE])*collFactor;
-               f[BSW] += (feq[BSW]-f[BSW])*collFactor;
-               f[BNE] += (feq[BNE]-f[BNE])*collFactor;
-               f[TSW] += (feq[TSW]-f[TSW])*collFactor;
-               f[TSE] += (feq[TSE]-f[TSE])*collFactor;
-               f[BNW] += (feq[BNW]-f[BNW])*collFactor;
-               f[BSE] += (feq[BSE]-f[BSE])*collFactor;
-               f[TNW] += (feq[TNW]-f[TNW])*collFactor;
+               f[DIR_PPP] += (feq[DIR_PPP]-f[DIR_PPP])*collFactor;
+               f[DIR_MMM] += (feq[DIR_MMM]-f[DIR_MMM])*collFactor;
+               f[DIR_PPM] += (feq[DIR_PPM]-f[DIR_PPM])*collFactor;
+               f[DIR_MMP] += (feq[DIR_MMP]-f[DIR_MMP])*collFactor;
+               f[DIR_PMP] += (feq[DIR_PMP]-f[DIR_PMP])*collFactor;
+               f[DIR_MPM] += (feq[DIR_MPM]-f[DIR_MPM])*collFactor;
+               f[DIR_PMM] += (feq[DIR_PMM]-f[DIR_PMM])*collFactor;
+               f[DIR_MPP] += (feq[DIR_MPP]-f[DIR_MPP])*collFactor;
 
                //////////////////////////////////////////////////////////////////////////
                //forcing
@@ -216,29 +216,29 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                   f[T  ] +=  3.0*c2o27  *                     (forcingX3) ;
                   f[B  ] +=  3.0*c2o27  *                     (-forcingX3);
                   f[NE ] +=  3.0*c1o54 * ( forcingX1+forcingX2          ) ;
-                  f[SW ] +=  3.0*c1o54 * (-forcingX1-forcingX2          ) ;
-                  f[SE ] +=  3.0*c1o54 * ( forcingX1-forcingX2          ) ;
-                  f[NW ] +=  3.0*c1o54 * (-forcingX1+forcingX2          ) ;
-                  f[TE ] +=  3.0*c1o54 * ( forcingX1          +forcingX3) ;
-                  f[BW ] +=  3.0*c1o54 * (-forcingX1          -forcingX3) ;
-                  f[BE ] +=  3.0*c1o54 * ( forcingX1          -forcingX3) ;
-                  f[TW ] +=  3.0*c1o54 * (-forcingX1          +forcingX3) ;
-                  f[TN ] +=  3.0*c1o54 * (           forcingX2+forcingX3) ;
-                  f[BS ] +=  3.0*c1o54 * (          -forcingX2-forcingX3) ;
-                  f[BN ] +=  3.0*c1o54 * (           forcingX2-forcingX3) ;
-                  f[TS ] +=  3.0*c1o54 * (          -forcingX2+forcingX3) ;
-                  f[TNE] +=  3.0*c1o216* ( forcingX1+forcingX2+forcingX3) ;
-                  f[BSW] +=  3.0*c1o216* (-forcingX1-forcingX2-forcingX3) ;
-                  f[BNE] +=  3.0*c1o216* ( forcingX1+forcingX2-forcingX3) ;
-                  f[TSW] +=  3.0*c1o216* (-forcingX1-forcingX2+forcingX3) ;
-                  f[TSE] +=  3.0*c1o216* ( forcingX1-forcingX2+forcingX3) ;
-                  f[BNW] +=  3.0*c1o216* (-forcingX1+forcingX2-forcingX3) ;
-                  f[BSE] +=  3.0*c1o216* ( forcingX1-forcingX2-forcingX3) ;
-                  f[TNW] +=  3.0*c1o216* (-forcingX1+forcingX2+forcingX3) ;
+                  f[DIR_MM0 ] +=  3.0*c1o54 * (-forcingX1-forcingX2          ) ;
+                  f[DIR_PM0 ] +=  3.0*c1o54 * ( forcingX1-forcingX2          ) ;
+                  f[DIR_MP0 ] +=  3.0*c1o54 * (-forcingX1+forcingX2          ) ;
+                  f[DIR_P0P ] +=  3.0*c1o54 * ( forcingX1          +forcingX3) ;
+                  f[DIR_M0M ] +=  3.0*c1o54 * (-forcingX1          -forcingX3) ;
+                  f[DIR_P0M ] +=  3.0*c1o54 * ( forcingX1          -forcingX3) ;
+                  f[DIR_M0P ] +=  3.0*c1o54 * (-forcingX1          +forcingX3) ;
+                  f[DIR_0PP ] +=  3.0*c1o54 * (           forcingX2+forcingX3) ;
+                  f[DIR_0MM ] +=  3.0*c1o54 * (          -forcingX2-forcingX3) ;
+                  f[DIR_0PM ] +=  3.0*c1o54 * (           forcingX2-forcingX3) ;
+                  f[DIR_0MP ] +=  3.0*c1o54 * (          -forcingX2+forcingX3) ;
+                  f[DIR_PPP] +=  3.0*c1o216* ( forcingX1+forcingX2+forcingX3) ;
+                  f[DIR_MMM] +=  3.0*c1o216* (-forcingX1-forcingX2-forcingX3) ;
+                  f[DIR_PPM] +=  3.0*c1o216* ( forcingX1+forcingX2-forcingX3) ;
+                  f[DIR_MMP] +=  3.0*c1o216* (-forcingX1-forcingX2+forcingX3) ;
+                  f[DIR_PMP] +=  3.0*c1o216* ( forcingX1-forcingX2+forcingX3) ;
+                  f[DIR_MPM] +=  3.0*c1o216* (-forcingX1+forcingX2-forcingX3) ;
+                  f[DIR_PMM] +=  3.0*c1o216* ( forcingX1-forcingX2-forcingX3) ;
+                  f[DIR_MPP] +=  3.0*c1o216* (-forcingX1+forcingX2+forcingX3) ;
                }
                //////////////////////////////////////////////////////////////////////////
 #ifdef  PROOF_CORRECTNESS
-               LBMReal rho_post = f[REST] + f[E] + f[W] + f[N] + f[S] + f[T] + f[B] 
+               LBMReal rho_post = f[REST] + f[DIR_P00] + f[W] + f[N] + f[S] + f[T] + f[B] 
                + f[NE] + f[SW] + f[SE] + f[NW] + f[TE] + f[BW] + f[BE]
                + f[TW] + f[TN] + f[BS] + f[BN] + f[TS] + f[TNE] + f[TSW]
                + f[TSE] + f[TNW] + f[BNE] + f[BSW] + f[BSE] + f[BNW];
@@ -255,33 +255,33 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                //////////////////////////////////////////////////////////////////////////
                //write distribution
                //////////////////////////////////////////////////////////////////////////
-               (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::INV_E];
-               (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::INV_N];
-               (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::INV_T];
-               (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::INV_NE];
-               (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,  x3) = f[D3Q27System::INV_NW];
-               (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::INV_TE];
-               (*this->localDistributions)(D3Q27System::ET_TW,x1p,x2,  x3) = f[D3Q27System::INV_TW];
-               (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::INV_TN];
-               (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2p,x3) = f[D3Q27System::INV_TS];
-               (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::INV_TNE];
-               (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,  x3) = f[D3Q27System::INV_TNW];
-               (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2p,x3) = f[D3Q27System::INV_TSE];
-               (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3) = f[D3Q27System::INV_TSW];
+               (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::INV_P00];
+               (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::INV_0P0];
+               (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::INV_00P];
+               (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::INV_PP0];
+               (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,  x3) = f[D3Q27System::INV_MP0];
+               (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::INV_P0P];
+               (*this->localDistributions)(D3Q27System::ET_TW,x1p,x2,  x3) = f[D3Q27System::INV_M0P];
+               (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::INV_0PP];
+               (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2p,x3) = f[D3Q27System::INV_0MP];
+               (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::INV_PPP];
+               (*this->localDistributions)(D3Q27System::ET_TNW,x1p,x2,  x3) = f[D3Q27System::INV_MPP];
+               (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2p,x3) = f[D3Q27System::INV_PMP];
+               (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3) = f[D3Q27System::INV_MMP];
 
-               (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,  x3    ) = f[D3Q27System::INV_W ];
-               (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2p,x3    ) = f[D3Q27System::INV_S ];
-               (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3p  ) = f[D3Q27System::INV_B ];
-               (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3   ) = f[D3Q27System::INV_SW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2p,x3   ) = f[D3Q27System::INV_SE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,  x3p ) = f[D3Q27System::INV_BW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3p ) = f[D3Q27System::INV_BE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2p,x3p ) = f[D3Q27System::INV_BS];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3p ) = f[D3Q27System::INV_BN];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p) = f[D3Q27System::INV_BSW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2p,x3p) = f[D3Q27System::INV_BSE];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,  x3p) = f[D3Q27System::INV_BNW];
-               (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3p) = f[D3Q27System::INV_BNE];
+               (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,  x3    ) = f[D3Q27System::INV_M00 ];
+               (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2p,x3    ) = f[D3Q27System::INV_0M0 ];
+               (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3p  ) = f[D3Q27System::INV_00M ];
+               (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3   ) = f[D3Q27System::INV_MM0];
+               (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2p,x3   ) = f[D3Q27System::INV_PM0];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,  x3p ) = f[D3Q27System::INV_M0M];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3p ) = f[D3Q27System::INV_P0M];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2p,x3p ) = f[D3Q27System::INV_0MM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3p ) = f[D3Q27System::INV_0PM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1p,x2p,x3p) = f[D3Q27System::INV_MMM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2p,x3p) = f[D3Q27System::INV_PMM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1p,x2,  x3p) = f[D3Q27System::INV_MPM];
+               (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3p) = f[D3Q27System::INV_PPM];
 
                (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::DIR_000];
                //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
index 9de46c4f9..b1270904a 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
@@ -316,32 +316,32 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
 
                         //--------------------------------------------------------
 
-                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
                         mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
                         mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
                         mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-                        mfacb = 3.0 * (mfacb + 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-                        mfcbc = 3.0 * (mfcbc + 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-                        mfabc = 3.0 * (mfabc + 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-                        mfbcc = 3.0 * (mfbcc + 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-                        mfbac = 3.0 * (mfbac + 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-                        mfccc = 3.0 * (mfccc + 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-                        mfacc = 3.0 * (mfacc + 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-                        mfcac = 3.0 * (mfcac + 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-                        mfaac = 3.0 * (mfaac + 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+                        mfacb = 3.0 * (mfacb + 0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+                        mfcbc = 3.0 * (mfcbc + 0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+                        mfabc = 3.0 * (mfabc + 0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+                        mfbcc = 3.0 * (mfbcc + 0.5 * forcingTerm[DIR_0PP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+                        mfbac = 3.0 * (mfbac + 0.5 * forcingTerm[DIR_0MP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+                        mfccc = 3.0 * (mfccc + 0.5 * forcingTerm[DIR_PPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+                        mfacc = 3.0 * (mfacc + 0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+                        mfcac = 3.0 * (mfcac + 0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+                        mfaac = 3.0 * (mfaac + 0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
                         mfabb = 3.0 * (mfabb + 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
                         mfbab = 3.0 * (mfbab + 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
                         mfbba = 3.0 * (mfbba + 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-                        mfaab = 3.0 * (mfaab + 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-                        mfcab = 3.0 * (mfcab + 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-                        mfaba = 3.0 * (mfaba + 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-                        mfcba = 3.0 * (mfcba + 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-                        mfbaa = 3.0 * (mfbaa + 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-                        mfbca = 3.0 * (mfbca + 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-                        mfaaa = 3.0 * (mfaaa + 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-                        mfcaa = 3.0 * (mfcaa + 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-                        mfaca = 3.0 * (mfaca + 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-                        mfcca = 3.0 * (mfcca + 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+                        mfaab = 3.0 * (mfaab + 0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+                        mfcab = 3.0 * (mfcab + 0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+                        mfaba = 3.0 * (mfaba + 0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+                        mfcba = 3.0 * (mfcba + 0.5 * forcingTerm[DIR_P0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+                        mfbaa = 3.0 * (mfbaa + 0.5 * forcingTerm[DIR_0MM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+                        mfbca = 3.0 * (mfbca + 0.5 * forcingTerm[DIR_0PM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+                        mfaaa = 3.0 * (mfaaa + 0.5 * forcingTerm[DIR_MMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+                        mfcaa = 3.0 * (mfcaa + 0.5 * forcingTerm[DIR_PMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+                        mfaca = 3.0 * (mfaca + 0.5 * forcingTerm[DIR_MPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+                        mfcca = 3.0 * (mfcca + 0.5 * forcingTerm[DIR_PPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
                         mfbbb = 3.0 * (mfbbb + 0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST];
 
                         LBMReal rho1 = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) +
@@ -1024,32 +1024,32 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         }
 #endif
 
-                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
                         mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
                         mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
                         mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
-                        mfacb = rho * c1o3 * (mfacb) + 0.5 * forcingTerm[NW];
-                        mfcbc = rho * c1o3 * (mfcbc) + 0.5 * forcingTerm[TE];
-                        mfabc = rho * c1o3 * (mfabc) + 0.5 * forcingTerm[TW];
-                        mfbcc = rho * c1o3 * (mfbcc) + 0.5 * forcingTerm[TN];
-                        mfbac = rho * c1o3 * (mfbac) + 0.5 * forcingTerm[TS];
-                        mfccc = rho * c1o3 * (mfccc) + 0.5 * forcingTerm[TNE];
-                        mfacc = rho * c1o3 * (mfacc) + 0.5 * forcingTerm[TNW];
-                        mfcac = rho * c1o3 * (mfcac) + 0.5 * forcingTerm[TSE];
-                        mfaac = rho * c1o3 * (mfaac) + 0.5 * forcingTerm[TSW];
+                        mfacb = rho * c1o3 * (mfacb) + 0.5 * forcingTerm[DIR_MP0];
+                        mfcbc = rho * c1o3 * (mfcbc) + 0.5 * forcingTerm[DIR_P0P];
+                        mfabc = rho * c1o3 * (mfabc) + 0.5 * forcingTerm[DIR_M0P];
+                        mfbcc = rho * c1o3 * (mfbcc) + 0.5 * forcingTerm[DIR_0PP];
+                        mfbac = rho * c1o3 * (mfbac) + 0.5 * forcingTerm[DIR_0MP];
+                        mfccc = rho * c1o3 * (mfccc) + 0.5 * forcingTerm[DIR_PPP];
+                        mfacc = rho * c1o3 * (mfacc) + 0.5 * forcingTerm[DIR_MPP];
+                        mfcac = rho * c1o3 * (mfcac) + 0.5 * forcingTerm[DIR_PMP];
+                        mfaac = rho * c1o3 * (mfaac) + 0.5 * forcingTerm[DIR_MMP];
                         mfabb = rho * c1o3 * (mfabb) + 0.5 * forcingTerm[W];
                         mfbab = rho * c1o3 * (mfbab) + 0.5 * forcingTerm[S];
                         mfbba = rho * c1o3 * (mfbba) + 0.5 * forcingTerm[B];
-                        mfaab = rho * c1o3 * (mfaab) + 0.5 * forcingTerm[SW];
-                        mfcab = rho * c1o3 * (mfcab) + 0.5 * forcingTerm[SE];
-                        mfaba = rho * c1o3 * (mfaba) + 0.5 * forcingTerm[BW];
-                        mfcba = rho * c1o3 * (mfcba) + 0.5 * forcingTerm[BE];
-                        mfbaa = rho * c1o3 * (mfbaa) + 0.5 * forcingTerm[BS];
-                        mfbca = rho * c1o3 * (mfbca) + 0.5 * forcingTerm[BN];
-                        mfaaa = rho * c1o3 * (mfaaa) + 0.5 * forcingTerm[BSW];
-                        mfcaa = rho * c1o3 * (mfcaa) + 0.5 * forcingTerm[BSE];
-                        mfaca = rho * c1o3 * (mfaca) + 0.5 * forcingTerm[BNW];
-                        mfcca = rho * c1o3 * (mfcca) + 0.5 * forcingTerm[BNE];
+                        mfaab = rho * c1o3 * (mfaab) + 0.5 * forcingTerm[DIR_MM0];
+                        mfcab = rho * c1o3 * (mfcab) + 0.5 * forcingTerm[DIR_PM0];
+                        mfaba = rho * c1o3 * (mfaba) + 0.5 * forcingTerm[DIR_M0M];
+                        mfcba = rho * c1o3 * (mfcba) + 0.5 * forcingTerm[DIR_P0M];
+                        mfbaa = rho * c1o3 * (mfbaa) + 0.5 * forcingTerm[DIR_0MM];
+                        mfbca = rho * c1o3 * (mfbca) + 0.5 * forcingTerm[DIR_0PM];
+                        mfaaa = rho * c1o3 * (mfaaa) + 0.5 * forcingTerm[DIR_MMM];
+                        mfcaa = rho * c1o3 * (mfcaa) + 0.5 * forcingTerm[DIR_PMM];
+                        mfaca = rho * c1o3 * (mfaca) + 0.5 * forcingTerm[DIR_MPM];
+                        mfcca = rho * c1o3 * (mfcca) + 0.5 * forcingTerm[DIR_PPM];
                         mfbbb = rho * c1o3 * (mfbbb) + 0.5 * forcingTerm[DIR_000];
 
                         //////////////////////////////////////////////////////////////////////////
@@ -1091,33 +1091,33 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
 
                         /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 
-                        h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                         h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                         h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                         h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
-                        h[NW]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
-                        h[TE]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
-                        h[TW]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
-                        h[TN]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
-                        h[TS]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
-                        h[TNE] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
-                        h[TNW] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
-                        h[TSE] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
-                        h[TSW] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                        h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
+                        h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
+                        h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
+                        h[DIR_0PP]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
+                        h[DIR_0MP]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
+                        h[DIR_PPP] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
+                        h[DIR_MPP] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
+                        h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
+                        h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                         h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
                         h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
                         h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
-                        h[SW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
-                        h[SE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
-                        h[BW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
-                        h[BE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
-                        h[BS]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
-                        h[BN]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
-                        h[BSW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                        h[BSE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                        h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                        h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
+                        h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
+                        h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
+                        h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
+                        h[DIR_P0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
+                        h[DIR_0MM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
+                        h[DIR_0PM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
+                        h[DIR_MMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                        h[DIR_PMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                        h[DIR_MPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                        h[DIR_PPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                         h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
 
@@ -1140,33 +1140,33 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                             }
                         }
 
-                        (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3)     = h[D3Q27System::INV_E];
-                        (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3)     = h[D3Q27System::INV_N];
-                        (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3)     = h[D3Q27System::INV_T];
-                        (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3)    = h[D3Q27System::INV_NE];
-                        (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3)   = h[D3Q27System::INV_NW];
-                        (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3)    = h[D3Q27System::INV_TE];
-                        (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3)   = h[D3Q27System::INV_TW];
-                        (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3)    = h[D3Q27System::INV_TN];
-                        (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3)   = h[D3Q27System::INV_TS];
-                        (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3)   = h[D3Q27System::INV_TNE];
-                        (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3)  = h[D3Q27System::INV_TNW];
-                        (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3)  = h[D3Q27System::INV_TSE];
-                        (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3) = h[D3Q27System::INV_TSW];
-
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3)     = h[D3Q27System::INV_W];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3)     = h[D3Q27System::INV_S];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p)     = h[D3Q27System::INV_B];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3)   = h[D3Q27System::INV_SW];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3)    = h[D3Q27System::INV_SE];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p)   = h[D3Q27System::INV_BW];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p)    = h[D3Q27System::INV_BE];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p)   = h[D3Q27System::INV_BS];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p)    = h[D3Q27System::INV_BN];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p) = h[D3Q27System::INV_BSW];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p)  = h[D3Q27System::INV_BSE];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p)  = h[D3Q27System::INV_BNW];
-                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p)   = h[D3Q27System::INV_BNE];
+                        (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3)     = h[D3Q27System::INV_P00];
+                        (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3)     = h[D3Q27System::INV_0P0];
+                        (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3)     = h[D3Q27System::INV_00P];
+                        (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3)    = h[D3Q27System::INV_PP0];
+                        (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3)   = h[D3Q27System::INV_MP0];
+                        (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3)    = h[D3Q27System::INV_P0P];
+                        (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3)   = h[D3Q27System::INV_M0P];
+                        (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3)    = h[D3Q27System::INV_0PP];
+                        (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3)   = h[D3Q27System::INV_0MP];
+                        (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3)   = h[D3Q27System::INV_PPP];
+                        (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3)  = h[D3Q27System::INV_MPP];
+                        (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3)  = h[D3Q27System::INV_PMP];
+                        (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3) = h[D3Q27System::INV_MMP];
+
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3)     = h[D3Q27System::INV_M00];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3)     = h[D3Q27System::INV_0M0];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p)     = h[D3Q27System::INV_00M];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3)   = h[D3Q27System::INV_MM0];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3)    = h[D3Q27System::INV_PM0];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p)   = h[D3Q27System::INV_M0M];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p)    = h[D3Q27System::INV_P0M];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p)   = h[D3Q27System::INV_0MM];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p)    = h[D3Q27System::INV_0PM];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p) = h[D3Q27System::INV_MMM];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p)  = h[D3Q27System::INV_PMM];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p)  = h[D3Q27System::INV_MPM];
+                        (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p)   = h[D3Q27System::INV_PPM];
 
                         (*this->zeroDistributionsH)(x1, x2, x3) = h[D3Q27System::DIR_000];
 
@@ -1242,33 +1242,33 @@ void MultiphaseCumulantLBMKernel::computePhasefield()
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
 
-                    h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                    h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                     h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                     h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                     h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
-                    h[NW]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
-                    h[TE]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
-                    h[TW]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
-                    h[TN]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
-                    h[TS]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
-                    h[TNE] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
-                    h[TNW] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    h[TSE] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    h[TSW] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[DIR_0PP]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[DIR_0MP]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[DIR_PPP] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[DIR_MPP] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                     h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
                     h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
                     h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
-                    h[SW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    h[SE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
-                    h[BW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    h[BE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
-                    h[BS]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    h[BN]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
-                    h[BSW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    h[BSE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[DIR_P0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[DIR_0MM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[DIR_0PM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[DIR_MMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[DIR_PMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[DIR_MPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[DIR_PPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                     h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
                 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
index 50885d680..04cfbdf2d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
@@ -767,7 +767,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
 					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 					//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1475,48 +1475,48 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step)
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi()
 {
 	using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
-		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
+		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
-		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
 		+WEIGTH[N] * (phi2[N] - phi2[S]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
 		+WEIGTH[N] * (phi2[T] - phi2[B]));
 }
 
@@ -1524,17 +1524,17 @@ LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::nabla2_phi()
 {
 	using namespace D3Q27System;
 	LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-		(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+		(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1562,33 +1562,33 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::computePhasefield()
 					int x2p = x2 + 1;
 					int x3p = x3 + 1;
 
-					h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
 					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
 					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
 					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
-					h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
-					h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
-					h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
-					h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
-					h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
-					h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
-					h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
-					h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
-					h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
 					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
 					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
 					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
-					h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
-					h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
-					h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
-					h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
-					h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
-					h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
-					h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-					h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
-					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
-					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+					h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
 					h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
 				}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 2b68a072d..e5fcc71d8 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -884,7 +884,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 					LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1624,24 +1624,24 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 LBMReal MultiphasePressureFilterLBMKernel::gradX1_phi()
 {
 	using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
 }
 
 LBMReal MultiphasePressureFilterLBMKernel::gradX2_phi()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
 }
 
 LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
 }
 
@@ -1649,17 +1649,17 @@ LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
 {
 	using namespace D3Q27System;
 	LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-		(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+		(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1687,33 +1687,33 @@ void MultiphasePressureFilterLBMKernel::computePhasefield()
 					int x2p = x2 + 1;
 					int x3p = x3 + 1;
 
-					h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
 					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
 					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
 					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
-					h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
-					h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
-					h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
-					h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
-					h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
-					h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
-					h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
-					h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
-					h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
 					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
 					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
 					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
-					h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
-					h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
-					h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
-					h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
-					h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
-					h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
-					h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-					h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
-					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
-					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+					h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
 					h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
 				}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
index f251dfafa..caa9272f5 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
@@ -654,7 +654,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 			   ////////
 			  // LBMReal divAfterSource=
-			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
 			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
 			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
 			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
@@ -717,7 +717,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
 				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
 
-				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[DIR_P00]	 *=scaleDiv;
 				  // forcingTerm[N]	 *=scaleDiv;
 				  // forcingTerm[T]	 *=scaleDiv;
 				  // forcingTerm[NE]	 *=scaleDiv;
@@ -748,32 +748,32 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   ////////
 
 
-			   mfcbb +=3.0 * ( 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfcbb +=3.0 * ( 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   mfbcb +=3.0 * ( 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   mfbbc +=3.0 * ( 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   mfccb +=3.0 * ( 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-			   mfacb +=3.0 * ( 0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-			   mfcbc +=3.0 * ( 0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-			   mfabc +=3.0 * ( 0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-			   mfbcc +=3.0 * ( 0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-			   mfbac +=3.0 * ( 0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-			   mfccc +=3.0 * ( 0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-			   mfacc +=3.0 * ( 0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-			   mfcac +=3.0 * ( 0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-			   mfaac +=3.0 * ( 0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfacb +=3.0 * ( 0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc +=3.0 * ( 0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc +=3.0 * ( 0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc +=3.0 * ( 0.5 * forcingTerm[DIR_0PP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac +=3.0 * ( 0.5 * forcingTerm[DIR_0MP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc +=3.0 * ( 0.5 * forcingTerm[DIR_PPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc +=3.0 * ( 0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac +=3.0 * ( 0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac +=3.0 * ( 0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
 			   mfabb +=3.0 * ( 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
 			   mfbab +=3.0 * ( 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
 			   mfbba +=3.0 * ( 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-			   mfaab +=3.0 * ( 0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-			   mfcab +=3.0 * ( 0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-			   mfaba +=3.0 * ( 0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-			   mfcba +=3.0 * ( 0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-			   mfbaa +=3.0 * ( 0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-			   mfbca +=3.0 * ( 0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-			   mfaaa +=3.0 * ( 0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-			   mfcaa +=3.0 * ( 0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-			   mfaca +=3.0 * ( 0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-			   mfcca +=3.0 * ( 0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfaab +=3.0 * ( 0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab +=3.0 * ( 0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba +=3.0 * ( 0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba +=3.0 * ( 0.5 * forcingTerm[DIR_P0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa +=3.0 * ( 0.5 * forcingTerm[DIR_0MM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca +=3.0 * ( 0.5 * forcingTerm[DIR_0PM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa +=3.0 * ( 0.5 * forcingTerm[DIR_MMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa +=3.0 * ( 0.5 * forcingTerm[DIR_PMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca +=3.0 * ( 0.5 * forcingTerm[DIR_MPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca +=3.0 * ( 0.5 * forcingTerm[DIR_PPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
 			   mfbbb +=3.0 * ( 0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 			   //--------------------------------------------------------
@@ -1086,7 +1086,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   LBMReal OxyyMxzz =  8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 			   LBMReal Oxyz =  24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A =  (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 			   LBMReal BB =   (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1619,32 +1619,32 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 			   /////classical source term 8.4.2021
 
-			   mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-			   mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-			   mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-			   mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-			   mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-			   mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-			   mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-			   mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-			   mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-			   mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc += 3.0 * (0.5 * forcingTerm[DIR_0PP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac += 3.0 * (0.5 * forcingTerm[DIR_0MP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc += 3.0 * (0.5 * forcingTerm[DIR_PPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
 			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
 			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
 			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-			   mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-			   mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-			   mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-			   mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-			   mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-			   mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-			   mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba += 3.0 * (0.5 * forcingTerm[DIR_P0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa += 3.0 * (0.5 * forcingTerm[DIR_0MM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca += 3.0 * (0.5 * forcingTerm[DIR_0PM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa += 3.0 * (0.5 * forcingTerm[DIR_MMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa += 3.0 * (0.5 * forcingTerm[DIR_PMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca += 3.0 * (0.5 * forcingTerm[DIR_MPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca += 3.0 * (0.5 * forcingTerm[DIR_PPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
 			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 
@@ -1740,7 +1740,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 //
 //                        //--------------------------------------------------------
 //
-//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 //                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 //                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 //                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -2448,7 +2448,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 //                        }
 //#endif
 //
-//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
 //                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
 //                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
 //                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
@@ -2823,7 +2823,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
                         ///////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 //using namespace D3Q27System;
 
-      //                  h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+      //                  h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
       //                  h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
       //                  h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
       //                  h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
@@ -2921,9 +2921,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 LBMReal MultiphaseScratchCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -2934,8 +2934,8 @@ LBMReal MultiphaseScratchCumulantLBMKernel::gradX1_phi()
 LBMReal MultiphaseScratchCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -2947,8 +2947,8 @@ LBMReal MultiphaseScratchCumulantLBMKernel::gradX2_phi()
 LBMReal MultiphaseScratchCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -2961,17 +2961,17 @@ LBMReal MultiphaseScratchCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3001,33 +3001,33 @@ void MultiphaseScratchCumulantLBMKernel::computePhasefield()
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
 
-                    h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                    h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                     h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                     h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                     h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
-                    h[NW]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
-                    h[TE]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
-                    h[TW]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
-                    h[TN]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
-                    h[TS]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
-                    h[TNE] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
-                    h[TNW] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    h[TSE] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    h[TSW] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[DIR_0PP]  = (*this->localDistributionsH)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[DIR_0MP]  = (*this->localDistributionsH)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[DIR_PPP] = (*this->localDistributionsH)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[DIR_MPP] = (*this->localDistributionsH)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                     h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
                     h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
                     h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
-                    h[SW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    h[SE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
-                    h[BW]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    h[BE]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
-                    h[BS]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    h[BN]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
-                    h[BSW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    h[BSE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    h[BNW] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[DIR_P0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[DIR_0MM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[DIR_0PM]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[DIR_MMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[DIR_PMM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[DIR_MPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[DIR_PPM] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                     h[DIR_000] = (*this->zeroDistributionsH)(x1, x2, x3);
                 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index 4212683ed..08c196105 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -506,7 +506,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 			   ////////
 			  // LBMReal divAfterSource=
-			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
 			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
 			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
 			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
@@ -569,7 +569,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
 				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
 
-				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[DIR_P00]	 *=scaleDiv;
 				  // forcingTerm[N]	 *=scaleDiv;
 				  // forcingTerm[T]	 *=scaleDiv;
 				  // forcingTerm[NE]	 *=scaleDiv;
@@ -600,32 +600,32 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   ////////
 
 
-			   mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-			   mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-			   mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-			   mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-			   mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-			   mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-			   mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-			   mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-			   mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-			   mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc += 3.0 * (0.5 * forcingTerm[DIR_0PP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac += 3.0 * (0.5 * forcingTerm[DIR_0MP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc += 3.0 * (0.5 * forcingTerm[DIR_PPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
 			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
 			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
 			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-			   mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-			   mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-			   mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-			   mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-			   mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-			   mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-			   mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba += 3.0 * (0.5 * forcingTerm[DIR_P0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa += 3.0 * (0.5 * forcingTerm[DIR_0MM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca += 3.0 * (0.5 * forcingTerm[DIR_0PM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa += 3.0 * (0.5 * forcingTerm[DIR_MMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa += 3.0 * (0.5 * forcingTerm[DIR_PMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca += 3.0 * (0.5 * forcingTerm[DIR_MPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca += 3.0 * (0.5 * forcingTerm[DIR_PPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
 			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 			   //--------------------------------------------------------
@@ -940,7 +940,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1344,32 +1344,32 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 			   /////classical source term 8.4.2021
 
-			   mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
-			   mfacb += 3.0 * (0.5 * forcingTerm[NW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
-			   mfcbc += 3.0 * (0.5 * forcingTerm[TE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
-			   mfabc += 3.0 * (0.5 * forcingTerm[TW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
-			   mfbcc += 3.0 * (0.5 * forcingTerm[TN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
-			   mfbac += 3.0 * (0.5 * forcingTerm[TS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
-			   mfccc += 3.0 * (0.5 * forcingTerm[TNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
-			   mfacc += 3.0 * (0.5 * forcingTerm[TNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
-			   mfcac += 3.0 * (0.5 * forcingTerm[TSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
-			   mfaac += 3.0 * (0.5 * forcingTerm[TSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
+			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
+			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
+			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
+			   mfbcc += 3.0 * (0.5 * forcingTerm[DIR_0PP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TN ];
+			   mfbac += 3.0 * (0.5 * forcingTerm[DIR_0MP]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TS ];
+			   mfccc += 3.0 * (0.5 * forcingTerm[DIR_PPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNE];
+			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
+			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
+			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
 			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
 			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
 			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
-			   mfaab += 3.0 * (0.5 * forcingTerm[SW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
-			   mfcab += 3.0 * (0.5 * forcingTerm[SE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
-			   mfaba += 3.0 * (0.5 * forcingTerm[BW]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
-			   mfcba += 3.0 * (0.5 * forcingTerm[BE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
-			   mfbaa += 3.0 * (0.5 * forcingTerm[BS]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
-			   mfbca += 3.0 * (0.5 * forcingTerm[BN]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
-			   mfaaa += 3.0 * (0.5 * forcingTerm[BSW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
-			   mfcaa += 3.0 * (0.5 * forcingTerm[BSE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
-			   mfaca += 3.0 * (0.5 * forcingTerm[BNW]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
-			   mfcca += 3.0 * (0.5 * forcingTerm[BNE]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
+			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
+			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
+			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
+			   mfcba += 3.0 * (0.5 * forcingTerm[DIR_P0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BE ];
+			   mfbaa += 3.0 * (0.5 * forcingTerm[DIR_0MM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BS ];
+			   mfbca += 3.0 * (0.5 * forcingTerm[DIR_0PM]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BN ];
+			   mfaaa += 3.0 * (0.5 * forcingTerm[DIR_MMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSW];
+			   mfcaa += 3.0 * (0.5 * forcingTerm[DIR_PMM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BSE];
+			   mfaca += 3.0 * (0.5 * forcingTerm[DIR_MPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNW];
+			   mfcca += 3.0 * (0.5 * forcingTerm[DIR_PPM]) / rho;  //-(3.0*p1 - rho)*WEIGTH[BNE];
 			   mfbbb += 3.0 * (0.5 * forcingTerm[DIR_000]) / rho; //- (3.0*p1 - rho)*WEIGTH[REST]
 
 
@@ -1487,7 +1487,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 //
 //                        //--------------------------------------------------------
 //
-//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 //                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 //                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 //                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -2195,7 +2195,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 //                        }
 //#endif
 //
-//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
 //                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
 //                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
 //                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
@@ -2892,7 +2892,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
                         /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 
-                        //h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        //h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                         //h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                         //h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                         //h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
@@ -2984,9 +2984,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -2997,8 +2997,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi()
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3010,8 +3010,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi()
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3023,9 +3023,9 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi()
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
-		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
+		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3036,8 +3036,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi2()
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
-		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
 		+WEIGTH[N] * (phi2[N] - phi2[S]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3049,8 +3049,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi2()
 LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
 		+WEIGTH[N] * (phi2[T] - phi2[B]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3067,17 +3067,17 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3107,33 +3107,33 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::computePhasefield()
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
 
-                    h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                    h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
                     h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
                     h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
                     h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
-                    h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
-                    h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
-                    h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
-                    h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
-                    h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
-                    h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
-                    h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                     h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
                     h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
                     h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
-                    h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
-                    h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
-                    h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
-                    h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                     h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index b2eddb874..2f9d1d394 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -641,7 +641,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
 					 //  + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
 
 			   //LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
@@ -649,7 +649,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
 					 //  + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
 
 			   //LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
@@ -657,7 +657,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
 					 //  + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
 			  
 			   
 			   LBMReal gradPx = 0.0;
@@ -835,7 +835,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   ////////
 			  // LBMReal divAfterSource=
-			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
 			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
 			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
 			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
@@ -898,7 +898,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
 				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
 
-				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[DIR_P00]	 *=scaleDiv;
 				  // forcingTerm[N]	 *=scaleDiv;
 				  // forcingTerm[T]	 *=scaleDiv;
 				  // forcingTerm[NE]	 *=scaleDiv;
@@ -929,7 +929,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   ////////
 
 
-			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -1272,7 +1272,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1697,7 +1697,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
 			   /////classical source term 8.4.2021
 
-			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -1845,7 +1845,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 //
 //                        //--------------------------------------------------------
 //
-//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 //                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 //                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 //                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -2553,7 +2553,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 //                        }
 //#endif
 //
-//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
 //                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
 //                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
 //                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
@@ -3257,7 +3257,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 
                         /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 
-                        //h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        //h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                         //h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                         //h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                         //h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
@@ -3349,9 +3349,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step)
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -3362,8 +3362,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi()
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3375,8 +3375,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi()
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3388,9 +3388,9 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi()
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
-		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
+		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3401,8 +3401,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi2()
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
-		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
 		+WEIGTH[N] * (phi2[N] - phi2[S]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3414,8 +3414,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi2()
 LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
 		+WEIGTH[N] * (phi2[T] - phi2[B]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3432,17 +3432,17 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3472,33 +3472,33 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::computePhasefield()
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
 
-                    h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                    h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
                     h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
                     h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
                     h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
-                    h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
-                    h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
-                    h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
-                    h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
-                    h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
-                    h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
-                    h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                     h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
                     h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
                     h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
-                    h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
-                    h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
-                    h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
-                    h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                     h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index b10c528bd..7fdd5f2ee 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -615,7 +615,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 + 1, x2 - 1, x3) - (*pressure)(x1 - 1, x2 + 1, x3)))
 					 //  + (((*pressure)(x1 + 1, x2, x3 - 1) - (*pressure)(x1 - 1, x2, x3 + 1)) + ((*pressure)(x1 + 1, x2, x3 + 1) - (*pressure)(x1 - 1, x2, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1 + 1, x2, x3) - (*pressure)(x1 - 1, x2, x3)));
 
 			   //LBMReal gradPy = 3.0 * (WEIGTH[TNE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
@@ -623,7 +623,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3) - (*pressure)(x1 - 1, x2 - 1, x3)) + ((*pressure)(x1 - 1, x2 + 1, x3) - (*pressure)(x1 + 1, x2 - 1, x3)))
 					 //  + (((*pressure)(x1, x2+1, x3 - 1) - (*pressure)(x1, x2-1, x3 + 1)) + ((*pressure)(x1, x2+1, x3 + 1) - (*pressure)(x1, x2-1, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1, x2+1, x3) - (*pressure)(x1, x2-1, x3)));
 
 			   //LBMReal gradPz = 3.0 * (WEIGTH[TNE] * (
 				  // (((*pressure)(x1 + 1, x2 + 1, x3 + 1) - (*pressure)(x1 - 1, x2 - 1, x3 - 1)) + ((*pressure)(x1 - 1, x2 + 1, x3 + 1) - (*pressure)(x1 + 1, x2 - 1, x3 - 1)))
@@ -631,7 +631,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 				  // + WEIGTH[NE] * (
 				  // (((*pressure)(x1 + 1, x2, x3+1) - (*pressure)(x1 - 1, x2, x3-1)) + ((*pressure)(x1 - 1, x2, x3+1) - (*pressure)(x1 + 1, x2, x3-1)))
 					 //  + (((*pressure)(x1, x2 - 1, x3 + 1) - (*pressure)(x1, x2 + 1, x3 - 1)) + ((*pressure)(x1, x2 + 1, x3 + 1) - (*pressure)(x1, x2 - 1, x3 - 1))))
-				  // + WEIGTH[E] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
+				  // + WEIGTH[DIR_P00] * ((*pressure)(x1, x2, x3+1) - (*pressure)(x1, x2, x3-1)));
 			  
 			   
 			   LBMReal gradPx = 0.0;
@@ -793,7 +793,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 			   ////////
 			  // LBMReal divAfterSource=
-			  //( mfcbb + 3.0 * (0.5 * forcingTerm[E]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
+			  //( mfcbb + 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF)  *(vvyF)  +(vvzF)  *(vvzF)-1)+
 			  //( mfbcb + 3.0 * (0.5 * forcingTerm[N]) / rho	) *((vvxF)  *(vvxF)  +(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
 			  //( mfbbc + 3.0 * (0.5 * forcingTerm[T]) / rho	) *((vvxF)  *(vvxF)  +(vvyF)  *(vvyF)  +(vvzF-1)*(vvzF-1)-1)+
 			  //( mfccb + 3.0 * (0.5 * forcingTerm[NE]) / rho	) *((vvxF-1)*(vvxF-1)+(vvyF-1)*(vvyF-1)+(vvzF)  *(vvzF)-1)+
@@ -856,7 +856,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   //if (fabs(divAfterSource - divBeforeSource)/(fabs(divAfterSource) + fabs(divBeforeSource)+1e-10) > 1e-5) {
 				  // LBMReal scaleDiv =0.95+(1-0.95)* (divBeforeSource) / (divBeforeSource - divAfterSource);
 
-				  // forcingTerm[E]	 *=scaleDiv;
+				  // forcingTerm[DIR_P00]	 *=scaleDiv;
 				  // forcingTerm[N]	 *=scaleDiv;
 				  // forcingTerm[T]	 *=scaleDiv;
 				  // forcingTerm[NE]	 *=scaleDiv;
@@ -887,7 +887,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   ////////
 
 
-			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -1230,7 +1230,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 			   LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
 			//    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
 			   LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
-			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+			   //FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' )
 			   LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 
 
@@ -1642,7 +1642,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
 			   /////classical source term 8.4.2021
 
-			   //mfcbb += 3.0 * (0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+			   //mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 			   //mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 			   //mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 			   //mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -1784,7 +1784,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 //
 //                        //--------------------------------------------------------
 //
-//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
+//                        mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
 //                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
 //                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
 //                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
@@ -2492,7 +2492,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 //                        }
 //#endif
 //
-//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[E];
+//                        mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
 //                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
 //                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
 //                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
@@ -3189,7 +3189,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 
                         /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 
-                        //h[E]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
+                        //h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
                         //h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
                         //h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
                         //h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
@@ -3281,9 +3281,9 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step)
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
-	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
-		+WEIGTH[N] * (phi[E] - phi[W]));
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
+		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -3294,8 +3294,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi()
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
-		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
 		+WEIGTH[N] * (phi[N] - phi[S]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3307,8 +3307,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi()
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
-		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
 		+WEIGTH[N] * (phi[T] - phi[B]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3320,9 +3320,9 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi()
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
-		+WEIGTH[N] * (phi2[E] - phi2[W]));
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
+		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3333,8 +3333,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi2()
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
-		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
+		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
 		+WEIGTH[N] * (phi2[N] - phi2[S]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3346,8 +3346,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi2()
 LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
-	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
-		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
 		+WEIGTH[N] * (phi2[T] - phi2[B]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
@@ -3364,17 +3364,17 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::nabla2_phi()
 {
     using namespace D3Q27System;
     LBMReal sum = 0.0;
-	sum += WEIGTH[TNE] * ((((phi[TNE] - phi[DIR_000]) + (phi[BSW] - phi[DIR_000])) + ((phi[TSW] - phi[DIR_000]) + (phi[BNE] - phi[DIR_000])))
-		+ (((phi[TNW] - phi[DIR_000]) + (phi[BSE] - phi[DIR_000])) + ((phi[TSE] - phi[DIR_000]) + (phi[BNW] - phi[DIR_000]))));
-	sum += WEIGTH[TN] * (
-			(((phi[TN] - phi[DIR_000]) + (phi[BS] - phi[DIR_000])) + ((phi[TS] - phi[DIR_000]) + (phi[BN] - phi[DIR_000])))
-		+	(((phi[TE] - phi[DIR_000]) + (phi[BW] - phi[DIR_000])) + ((phi[TW] - phi[DIR_000]) + (phi[BE] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[SW] - phi[DIR_000])) + ((phi[NW] - phi[DIR_000]) + (phi[SE] - phi[DIR_000])))
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
 	sum += WEIGTH[T] * (
 			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
 		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[E] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3404,33 +3404,33 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::computePhasefield()
                     int x2p = x2 + 1;
                     int x3p = x3 + 1;
 
-                    h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+                    h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
                     h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
                     h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
                     h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
-                    h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
-                    h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
-                    h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
-                    h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
-                    h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
-                    h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
-                    h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
-                    h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
-                    h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+                    h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+                    h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+                    h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+                    h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+                    h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+                    h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+                    h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+                    h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+                    h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
                     h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
                     h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
                     h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
-                    h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
-                    h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
-                    h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
-                    h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
-                    h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
-                    h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
-                    h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
-                    h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
-                    h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
-                    h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+                    h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+                    h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+                    h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+                    h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+                    h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+                    h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+                    h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+                    h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+                    h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+                    h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
 
                     h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
                 }
diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
index fee069a10..30b9c875a 100644
--- a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
@@ -121,11 +121,11 @@ void RheologyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal
 
    press = rho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[D3Q27System::BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[NE])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))-(vx2*vx3));
+   kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[NE])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
 }
 //////////////////////////////////////////////////////////////////////////
 void RheologyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell,
@@ -443,32 +443,32 @@ void RheologyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMReal
    LBMReal feq[ENDF+1];
    D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
 
-   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
+   f[DIR_P00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_P00];
    f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
    f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
    f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
    f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
    f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
    f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
-   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
-   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
-   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
-   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
-   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
-   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
-   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
-   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
-   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
-   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
-   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
-   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
-   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
-   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
-   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
-   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
-   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
-   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
-   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
+   f[DIR_MM0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_PPP];
+   f[DIR_MMP]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_MMP];
+   f[DIR_PMP]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_PMP];
+   f[DIR_MPP]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_MPP];
+   f[DIR_PPM]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[DIR_PPM];
+   f[DIR_MMM]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[DIR_MMM];
+   f[DIR_PMM]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[DIR_PMM];
+   f[DIR_MPM]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[DIR_MPM];
    f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
@@ -632,32 +632,32 @@ void RheologyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal
    f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
    f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
 
-   f[E]    = f_E    + feq[E];
+   f[DIR_P00]    = f_E    + feq[DIR_P00];
    f[W]    = f_E    + feq[W];
    f[N]    = f_N    + feq[N];
    f[S]    = f_N    + feq[S];
    f[T]    = f_T    + feq[T];
    f[B]    = f_T    + feq[B];
    f[NE]   = f_NE   + feq[NE];
-   f[SW]   = f_NE   + feq[SW];
-   f[SE]   = f_SE   + feq[SE];
-   f[NW]   = f_SE   + feq[NW];
-   f[TE]   = f_TE   + feq[TE];
-   f[BW]   = f_TE   + feq[BW];
-   f[BE]   = f_BE   + feq[BE];
-   f[TW]   = f_BE   + feq[TW];
-   f[TN]   = f_TN   + feq[TN];
-   f[BS]   = f_TN   + feq[BS];
-   f[BN]   = f_BN   + feq[BN];
-   f[TS]   = f_BN   + feq[TS];
-   f[TNE]  = f_TNE  + feq[TNE];
-   f[TNW]  = f_TNW  + feq[TNW];
-   f[TSE]  = f_TSE  + feq[TSE];
-   f[TSW]  = f_TSW  + feq[TSW];
-   f[BNE]  = f_TSW  + feq[BNE];
-   f[BNW]  = f_TSE  + feq[BNW];
-   f[BSE]  = f_TNW  + feq[BSE];
-   f[BSW]  = f_TNE  + feq[BSW];
+   f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
+   f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
+   f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
+   f[DIR_P0P]   = f_TE   + feq[DIR_P0P];
+   f[DIR_M0M]   = f_TE   + feq[DIR_M0M];
+   f[DIR_P0M]   = f_BE   + feq[DIR_P0M];
+   f[DIR_M0P]   = f_BE   + feq[DIR_M0P];
+   f[DIR_0PP]   = f_TN   + feq[DIR_0PP];
+   f[DIR_0MM]   = f_TN   + feq[DIR_0MM];
+   f[DIR_0PM]   = f_BN   + feq[DIR_0PM];
+   f[DIR_0MP]   = f_BN   + feq[DIR_0MP];
+   f[DIR_PPP]  = f_TNE  + feq[DIR_PPP];
+   f[DIR_MPP]  = f_TNW  + feq[DIR_MPP];
+   f[DIR_PMP]  = f_TSE  + feq[DIR_PMP];
+   f[DIR_MMP]  = f_TSW  + feq[DIR_MMP];
+   f[DIR_PPM]  = f_TSW  + feq[DIR_PPM];
+   f[DIR_MPM]  = f_TSE  + feq[DIR_MPM];
+   f[DIR_PMM]  = f_TNW  + feq[DIR_PMM];
+   f[DIR_MMM]  = f_TNE  + feq[DIR_MMM];
    f[DIR_000] = f_ZERO + feq[DIR_000];
 }
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
index fd0b68655..358c61516 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
@@ -247,32 +247,32 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D>
                double f_TNW  = - eps_new *((bz + cy)/(36.*o)) - f_TNE;
 
 
-               f[E]    = f_E    + feq[E];
+               f[DIR_P00]    = f_E    + feq[DIR_P00];
                f[W]    = f_E    + feq[W];
                f[N]    = f_N    + feq[N];
                f[S]    = f_N    + feq[S];
                f[T]    = f_T    + feq[T];
                f[B]    = f_T    + feq[B];
                f[NE]   = f_NE   + feq[NE];
-               f[SW]   = f_NE   + feq[SW];
-               f[SE]   = f_SE   + feq[SE];
-               f[NW]   = f_SE   + feq[NW];
-               f[TE]   = f_TE   + feq[TE];
-               f[BW]   = f_TE   + feq[BW];
-               f[BE]   = f_BE   + feq[BE];
-               f[TW]   = f_BE   + feq[TW];
-               f[TN]   = f_TN   + feq[TN];
-               f[BS]   = f_TN   + feq[BS];
-               f[BN]   = f_BN   + feq[BN];
-               f[TS]   = f_BN   + feq[TS];
-               f[TNE]  = f_TNE  + feq[TNE];
-               f[TNW]  = f_TNW  + feq[TNW];
-               f[TSE]  = f_TSE  + feq[TSE];
-               f[TSW]  = f_TSW  + feq[TSW];
-               f[BNE]  = f_TSW  + feq[BNE];
-               f[BNW]  = f_TSE  + feq[BNW];
-               f[BSE]  = f_TNW  + feq[BSE];
-               f[BSW]  = f_TNE  + feq[BSW];
+               f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
+               f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
+               f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
+               f[DIR_P0P]   = f_TE   + feq[DIR_P0P];
+               f[DIR_M0M]   = f_TE   + feq[DIR_M0M];
+               f[DIR_P0M]   = f_BE   + feq[DIR_P0M];
+               f[DIR_M0P]   = f_BE   + feq[DIR_M0P];
+               f[DIR_0PP]   = f_TN   + feq[DIR_0PP];
+               f[DIR_0MM]   = f_TN   + feq[DIR_0MM];
+               f[DIR_0PM]   = f_BN   + feq[DIR_0PM];
+               f[DIR_0MP]   = f_BN   + feq[DIR_0MP];
+               f[DIR_PPP]  = f_TNE  + feq[DIR_PPP];
+               f[DIR_MPP]  = f_TNW  + feq[DIR_MPP];
+               f[DIR_PMP]  = f_TSE  + feq[DIR_PMP];
+               f[DIR_MMP]  = f_TSW  + feq[DIR_MMP];
+               f[DIR_PPM]  = f_TSW  + feq[DIR_PPM];
+               f[DIR_MPM]  = f_TSE  + feq[DIR_MPM];
+               f[DIR_PMM]  = f_TNW  + feq[DIR_PMM];
+               f[DIR_MMM]  = f_TNE  + feq[DIR_MMM];
                f[DIR_000] = f_ZERO + feq[DIR_000];
 
                //calcFeqsFct(f,rho,vx1,vx2,vx3);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
index c20cccdf6..1bcb6057f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp
@@ -202,7 +202,7 @@ void InitDistributionsFromFileBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<
                     // f_TSW = -eps_new *((ay + bx) / (36.*o)) - f_TNE; double f_TSE = -eps_new *((az + cx) / (36.*o)) -
                     // f_TNE; double f_TNW = -eps_new *((bz + cy) / (36.*o)) - f_TNE;
 
-                    // f[E] = f_E + feq[E];
+                    // f[DIR_P00] = f_E + feq[DIR_P00];
                     // f[W] = f_E + feq[W];
                     // f[N] = f_N + feq[N];
                     // f[S] = f_N + feq[S];
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
index d35b9d18f..9c8c05bab 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp
@@ -426,7 +426,7 @@ void InitThixotropyBlockVisitor::checkFunction(mu::Parser fct)
 //   double f_TNW = -eps_new * ((bz + cy) / (36. * o)) - f_TNE;
 //
 //
-//   f[E] = f_E + feq[E];
+//   f[DIR_P00] = f_E + feq[DIR_P00];
 //   f[W] = f_E + feq[W];
 //   f[N] = f_N + feq[N];
 //   f[S] = f_N + feq[S];
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
index 412e9347d..451ccfc1f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
@@ -258,9 +258,9 @@ int MetisPartitioningGridVisitor::getEdgeWeight(int dir)
     using namespace D3Q27System;
     if (dir <= B) {
         return 100;
-    } else if (dir >= NE && dir <= TS) {
+    } else if (dir >= NE && dir <= DIR_0MP) {
         return 10;
-    } else if (dir >= TNE) {
+    } else if (dir >= DIR_PPP) {
         return 1;
     }
 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index a6ae293a6..e321725b6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -227,63 +227,63 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					}
 
 
-					f[E]    =  geq[E]    ;
+					f[DIR_P00]    =  geq[DIR_P00]    ;
 					f[W]    =  geq[W]    ;
 					f[N]    =  geq[N]    ;
 					f[S]    =  geq[S]    ;
 					f[T]    =  geq[T]    ;
 					f[B]    =  geq[B]    ;
 					f[NE]   =  geq[NE]   ;
-					f[SW]   =  geq[SW]   ;
-					f[SE]   =  geq[SE]   ;
-					f[NW]   =  geq[NW]   ;
-					f[TE]   =  geq[TE]   ;
-					f[BW]   =  geq[BW]   ;
-					f[BE]   =  geq[BE]   ;
-					f[TW]   =  geq[TW]   ;
-					f[TN]   =  geq[TN]   ;
-					f[BS]   =  geq[BS]   ;
-					f[BN]   =  geq[BN]   ;
-					f[TS]   =  geq[TS]   ;
-					f[TNE]  =  geq[TNE]  ;
-					f[TNW]  =  geq[TNW]  ;
-					f[TSE]  =  geq[TSE]  ;
-					f[TSW]  =  geq[TSW]  ;
-					f[BNE]  =  geq[BNE]  ;
-					f[BNW]  =  geq[BNW]  ;
-					f[BSE]  =  geq[BSE]  ;
-					f[BSW]  =  geq[BSW]  ;
+					f[DIR_MM0]   =  geq[DIR_MM0]   ;
+					f[DIR_PM0]   =  geq[DIR_PM0]   ;
+					f[DIR_MP0]   =  geq[DIR_MP0]   ;
+					f[DIR_P0P]   =  geq[DIR_P0P]   ;
+					f[DIR_M0M]   =  geq[DIR_M0M]   ;
+					f[DIR_P0M]   =  geq[DIR_P0M]   ;
+					f[DIR_M0P]   =  geq[DIR_M0P]   ;
+					f[DIR_0PP]   =  geq[DIR_0PP]   ;
+					f[DIR_0MM]   =  geq[DIR_0MM]   ;
+					f[DIR_0PM]   =  geq[DIR_0PM]   ;
+					f[DIR_0MP]   =  geq[DIR_0MP]   ;
+					f[DIR_PPP]  =  geq[DIR_PPP]  ;
+					f[DIR_MPP]  =  geq[DIR_MPP]  ;
+					f[DIR_PMP]  =  geq[DIR_PMP]  ;
+					f[DIR_MMP]  =  geq[DIR_MMP]  ;
+					f[DIR_PPM]  =  geq[DIR_PPM]  ;
+					f[DIR_MPM]  =  geq[DIR_MPM]  ;
+					f[DIR_PMM]  =  geq[DIR_PMM]  ;
+					f[DIR_MMM]  =  geq[DIR_MMM]  ;
 					f[DIR_000] =  geq[DIR_000] ;
 
 					distributionsF->setDistribution(f, ix1, ix2, ix3);
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
 
-					f[E]    =  phi * feq[E]    / rho;
+					f[DIR_P00]    =  phi * feq[DIR_P00]    / rho;
 					f[W]    =  phi * feq[W]    / rho;
 					f[N]    =  phi * feq[N]    / rho;
 					f[S]    =  phi * feq[S]    / rho;
 					f[T]    =  phi * feq[T]    / rho;
 					f[B]    =  phi * feq[B]    / rho;
 					f[NE]   =  phi * feq[NE]   / rho;
-					f[SW]   =  phi * feq[SW]   / rho;
-					f[SE]   =  phi * feq[SE]   / rho;
-					f[NW]   =  phi * feq[NW]   / rho;
-					f[TE]   =  phi * feq[TE]   / rho;
-					f[BW]   =  phi * feq[BW]   / rho;
-					f[BE]   =  phi * feq[BE]   / rho;
-					f[TW]   =  phi * feq[TW]   / rho;
-					f[TN]   =  phi * feq[TN]   / rho;
-					f[BS]   =  phi * feq[BS]   / rho;
-					f[BN]   =  phi * feq[BN]   / rho;
-					f[TS]   =  phi * feq[TS]   / rho;
-					f[TNE]  =  phi * feq[TNE]  / rho;
-					f[TNW]  =  phi * feq[TNW]  / rho;
-					f[TSE]  =  phi * feq[TSE]  / rho;
-					f[TSW]  =  phi * feq[TSW]  / rho;
-					f[BNE]  =  phi * feq[BNE]  / rho;
-					f[BNW]  =  phi * feq[BNW]  / rho;
-					f[BSE]  =  phi * feq[BSE]  / rho;
-					f[BSW]  =  phi * feq[BSW]  / rho;
+					f[DIR_MM0]   =  phi * feq[DIR_MM0]   / rho;
+					f[DIR_PM0]   =  phi * feq[DIR_PM0]   / rho;
+					f[DIR_MP0]   =  phi * feq[DIR_MP0]   / rho;
+					f[DIR_P0P]   =  phi * feq[DIR_P0P]   / rho;
+					f[DIR_M0M]   =  phi * feq[DIR_M0M]   / rho;
+					f[DIR_P0M]   =  phi * feq[DIR_P0M]   / rho;
+					f[DIR_M0P]   =  phi * feq[DIR_M0P]   / rho;
+					f[DIR_0PP]   =  phi * feq[DIR_0PP]   / rho;
+					f[DIR_0MM]   =  phi * feq[DIR_0MM]   / rho;
+					f[DIR_0PM]   =  phi * feq[DIR_0PM]   / rho;
+					f[DIR_0MP]   =  phi * feq[DIR_0MP]   / rho;
+					f[DIR_PPP]  =  phi * feq[DIR_PPP]  / rho;
+					f[DIR_MPP]  =  phi * feq[DIR_MPP]  / rho;
+					f[DIR_PMP]  =  phi * feq[DIR_PMP]  / rho;
+					f[DIR_MMP]  =  phi * feq[DIR_MMP]  / rho;
+					f[DIR_PPM]  =  phi * feq[DIR_PPM]  / rho;
+					f[DIR_MPM]  =  phi * feq[DIR_MPM]  / rho;
+					f[DIR_PMM]  =  phi * feq[DIR_PMM]  / rho;
+					f[DIR_MMM]  =  phi * feq[DIR_MMM]  / rho;
 					f[DIR_000] =  phi * feq[DIR_000] / rho;
 
 					distributionsH->setDistribution(f, ix1, ix2, ix3);
@@ -291,32 +291,32 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 
 					if (distributionsH2) {
 
-						f[E]    = (1.-phi) * feq[E] / rho;
+						f[DIR_P00]    = (1.-phi) * feq[DIR_P00] / rho;
 						f[W]    = (1.-phi) * feq[W] / rho;
 						f[N]    = (1.-phi) * feq[N] / rho;
 						f[S]    = (1.-phi) * feq[S] / rho;
 						f[T]    = (1.-phi) * feq[T] / rho;
 						f[B]    = (1.-phi) * feq[B] / rho;
 						f[NE]   = (1.-phi) * feq[NE] / rho;
-						f[SW]   = (1.-phi) * feq[SW] / rho;
-						f[SE]   = (1.-phi) * feq[SE] / rho;
-						f[NW]   = (1.-phi) * feq[NW] / rho;
-						f[TE]   = (1.-phi) * feq[TE] / rho;
-						f[BW]   = (1.-phi) * feq[BW] / rho;
-						f[BE]   = (1.-phi) * feq[BE] / rho;
-						f[TW]   = (1.-phi) * feq[TW] / rho;
-						f[TN]   = (1.-phi) * feq[TN] / rho;
-						f[BS]   = (1.-phi) * feq[BS] / rho;
-						f[BN]   = (1.-phi) * feq[BN] / rho;
-						f[TS]   = (1.-phi) * feq[TS] / rho;
-						f[TNE]  = (1.-phi) * feq[TNE] / rho;
-						f[TNW]  = (1.-phi) * feq[TNW] / rho;
-						f[TSE]  = (1.-phi) * feq[TSE] / rho;
-						f[TSW]  = (1.-phi) * feq[TSW] / rho;
-						f[BNE]  = (1.-phi) * feq[BNE] / rho;
-						f[BNW]  = (1.-phi) * feq[BNW] / rho;
-						f[BSE]  = (1.-phi) * feq[BSE] / rho;
-						f[BSW]  = (1.-phi) * feq[BSW] / rho;
+						f[DIR_MM0]   = (1.-phi) * feq[DIR_MM0] / rho;
+						f[DIR_PM0]   = (1.-phi) * feq[DIR_PM0] / rho;
+						f[DIR_MP0]   = (1.-phi) * feq[DIR_MP0] / rho;
+						f[DIR_P0P]   = (1.-phi) * feq[DIR_P0P] / rho;
+						f[DIR_M0M]   = (1.-phi) * feq[DIR_M0M] / rho;
+						f[DIR_P0M]   = (1.-phi) * feq[DIR_P0M] / rho;
+						f[DIR_M0P]   = (1.-phi) * feq[DIR_M0P] / rho;
+						f[DIR_0PP]   = (1.-phi) * feq[DIR_0PP] / rho;
+						f[DIR_0MM]   = (1.-phi) * feq[DIR_0MM] / rho;
+						f[DIR_0PM]   = (1.-phi) * feq[DIR_0PM] / rho;
+						f[DIR_0MP]   = (1.-phi) * feq[DIR_0MP] / rho;
+						f[DIR_PPP]  = (1.-phi) * feq[DIR_PPP] / rho;
+						f[DIR_MPP]  = (1.-phi) * feq[DIR_MPP] / rho;
+						f[DIR_PMP]  = (1.-phi) * feq[DIR_PMP] / rho;
+						f[DIR_MMP]  = (1.-phi) * feq[DIR_MMP] / rho;
+						f[DIR_PPM]  = (1.-phi) * feq[DIR_PPM] / rho;
+						f[DIR_MPM]  = (1.-phi) * feq[DIR_MPM] / rho;
+						f[DIR_PMM]  = (1.-phi) * feq[DIR_PMM] / rho;
+						f[DIR_MMM]  = (1.-phi) * feq[DIR_MMM] / rho;
 						f[DIR_000] = (1.-phi) * feq[DIR_000] / rho;
 
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
index e10a9774d..dd9fb72af 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
@@ -219,63 +219,63 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					}
 
 
-					f[E]    =  geq[E]    ;
+					f[DIR_P00]    =  geq[DIR_P00]    ;
 					f[W]    =  geq[W]    ;
 					f[N]    =  geq[N]    ;
 					f[S]    =  geq[S]    ;
 					f[T]    =  geq[T]    ;
 					f[B]    =  geq[B]    ;
 					f[NE]   =  geq[NE]   ;
-					f[SW]   =  geq[SW]   ;
-					f[SE]   =  geq[SE]   ;
-					f[NW]   =  geq[NW]   ;
-					f[TE]   =  geq[TE]   ;
-					f[BW]   =  geq[BW]   ;
-					f[BE]   =  geq[BE]   ;
-					f[TW]   =  geq[TW]   ;
-					f[TN]   =  geq[TN]   ;
-					f[BS]   =  geq[BS]   ;
-					f[BN]   =  geq[BN]   ;
-					f[TS]   =  geq[TS]   ;
-					f[TNE]  =  geq[TNE]  ;
-					f[TNW]  =  geq[TNW]  ;
-					f[TSE]  =  geq[TSE]  ;
-					f[TSW]  =  geq[TSW]  ;
-					f[BNE]  =  geq[BNE]  ;
-					f[BNW]  =  geq[BNW]  ;
-					f[BSE]  =  geq[BSE]  ;
-					f[BSW]  =  geq[BSW]  ;
+					f[DIR_MM0]   =  geq[DIR_MM0]   ;
+					f[DIR_PM0]   =  geq[DIR_PM0]   ;
+					f[DIR_MP0]   =  geq[DIR_MP0]   ;
+					f[DIR_P0P]   =  geq[DIR_P0P]   ;
+					f[DIR_M0M]   =  geq[DIR_M0M]   ;
+					f[DIR_P0M]   =  geq[DIR_P0M]   ;
+					f[DIR_M0P]   =  geq[DIR_M0P]   ;
+					f[DIR_0PP]   =  geq[DIR_0PP]   ;
+					f[DIR_0MM]   =  geq[DIR_0MM]   ;
+					f[DIR_0PM]   =  geq[DIR_0PM]   ;
+					f[DIR_0MP]   =  geq[DIR_0MP]   ;
+					f[DIR_PPP]  =  geq[DIR_PPP]  ;
+					f[DIR_MPP]  =  geq[DIR_MPP]  ;
+					f[DIR_PMP]  =  geq[DIR_PMP]  ;
+					f[DIR_MMP]  =  geq[DIR_MMP]  ;
+					f[DIR_PPM]  =  geq[DIR_PPM]  ;
+					f[DIR_MPM]  =  geq[DIR_MPM]  ;
+					f[DIR_PMM]  =  geq[DIR_PMM]  ;
+					f[DIR_MMM]  =  geq[DIR_MMM]  ;
 					f[DIR_000] =  geq[DIR_000] ;
 
 					distributionsF->setDistribution(f, ix1, ix2, ix3);
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
 
-					f[E]    =  phi * feq[E]    ;// / rho;
+					f[DIR_P00]    =  phi * feq[DIR_P00]    ;// / rho;
 					f[W]    =  phi * feq[W]    ;// / rho;
 					f[N]    =  phi * feq[N]    ;// / rho;
 					f[S]    =  phi * feq[S]    ;// / rho;
 					f[T]    =  phi * feq[T]    ;// / rho;
 					f[B]    =  phi * feq[B]    ;// / rho;
 					f[NE]   =  phi * feq[NE]   ;// / rho;
-					f[SW]   =  phi * feq[SW]   ;// / rho;
-					f[SE]   =  phi * feq[SE]   ;// / rho;
-					f[NW]   =  phi * feq[NW]   ;// / rho;
-					f[TE]   =  phi * feq[TE]   ;// / rho;
-					f[BW]   =  phi * feq[BW]   ;// / rho;
-					f[BE]   =  phi * feq[BE]   ;// / rho;
-					f[TW]   =  phi * feq[TW]   ;// / rho;
-					f[TN]   =  phi * feq[TN]   ;// / rho;
-					f[BS]   =  phi * feq[BS]   ;// / rho;
-					f[BN]   =  phi * feq[BN]   ;// / rho;
-					f[TS]   =  phi * feq[TS]   ;// / rho;
-					f[TNE]  =  phi * feq[TNE]  ;// / rho;
-					f[TNW]  =  phi * feq[TNW]  ;// / rho;
-					f[TSE]  =  phi * feq[TSE]  ;// / rho;
-					f[TSW]  =  phi * feq[TSW]  ;// / rho;
-					f[BNE]  =  phi * feq[BNE]  ;// / rho;
-					f[BNW]  =  phi * feq[BNW]  ;// / rho;
-					f[BSE]  =  phi * feq[BSE]  ;// / rho;
-					f[BSW]  =  phi * feq[BSW]  ;// / rho;
+					f[DIR_MM0]   =  phi * feq[DIR_MM0]   ;// / rho;
+					f[DIR_PM0]   =  phi * feq[DIR_PM0]   ;// / rho;
+					f[DIR_MP0]   =  phi * feq[DIR_MP0]   ;// / rho;
+					f[DIR_P0P]   =  phi * feq[DIR_P0P]   ;// / rho;
+					f[DIR_M0M]   =  phi * feq[DIR_M0M]   ;// / rho;
+					f[DIR_P0M]   =  phi * feq[DIR_P0M]   ;// / rho;
+					f[DIR_M0P]   =  phi * feq[DIR_M0P]   ;// / rho;
+					f[DIR_0PP]   =  phi * feq[DIR_0PP]   ;// / rho;
+					f[DIR_0MM]   =  phi * feq[DIR_0MM]   ;// / rho;
+					f[DIR_0PM]   =  phi * feq[DIR_0PM]   ;// / rho;
+					f[DIR_0MP]   =  phi * feq[DIR_0MP]   ;// / rho;
+					f[DIR_PPP]  =  phi * feq[DIR_PPP]  ;// / rho;
+					f[DIR_MPP]  =  phi * feq[DIR_MPP]  ;// / rho;
+					f[DIR_PMP]  =  phi * feq[DIR_PMP]  ;// / rho;
+					f[DIR_MMP]  =  phi * feq[DIR_MMP]  ;// / rho;
+					f[DIR_PPM]  =  phi * feq[DIR_PPM]  ;// / rho;
+					f[DIR_MPM]  =  phi * feq[DIR_MPM]  ;// / rho;
+					f[DIR_PMM]  =  phi * feq[DIR_PMM]  ;// / rho;
+					f[DIR_MMM]  =  phi * feq[DIR_MMM]  ;// / rho;
 					f[DIR_000] =  phi * feq[DIR_000] ;// / rho;
 
 					distributionsH->setDistribution(f, ix1, ix2, ix3);
@@ -283,32 +283,32 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 
 					if (distributionsH2) {
 
-						f[E]    = (1.-phi) * feq[E]   ;// / rho;
+						f[DIR_P00]    = (1.-phi) * feq[DIR_P00]   ;// / rho;
 						f[W]    = (1.-phi) * feq[W]   ;// / rho;
 						f[N]    = (1.-phi) * feq[N]   ;// / rho;
 						f[S]    = (1.-phi) * feq[S]   ;// / rho;
 						f[T]    = (1.-phi) * feq[T]   ;// / rho;
 						f[B]    = (1.-phi) * feq[B]   ;// / rho;
 						f[NE]   = (1.-phi) * feq[NE]  ;// / rho;
-						f[SW]   = (1.-phi) * feq[SW]  ;// / rho;
-						f[SE]   = (1.-phi) * feq[SE]  ;// / rho;
-						f[NW]   = (1.-phi) * feq[NW]  ;// / rho;
-						f[TE]   = (1.-phi) * feq[TE]  ;// / rho;
-						f[BW]   = (1.-phi) * feq[BW]  ;// / rho;
-						f[BE]   = (1.-phi) * feq[BE]  ;// / rho;
-						f[TW]   = (1.-phi) * feq[TW]  ;// / rho;
-						f[TN]   = (1.-phi) * feq[TN]  ;// / rho;
-						f[BS]   = (1.-phi) * feq[BS]  ;// / rho;
-						f[BN]   = (1.-phi) * feq[BN]  ;// / rho;
-						f[TS]   = (1.-phi) * feq[TS]  ;// / rho;
-						f[TNE]  = (1.-phi) * feq[TNE] ;// / rho;
-						f[TNW]  = (1.-phi) * feq[TNW] ;// / rho;
-						f[TSE]  = (1.-phi) * feq[TSE] ;// / rho;
-						f[TSW]  = (1.-phi) * feq[TSW] ;// / rho;
-						f[BNE]  = (1.-phi) * feq[BNE] ;// / rho;
-						f[BNW]  = (1.-phi) * feq[BNW] ;// / rho;
-						f[BSE]  = (1.-phi) * feq[BSE] ;// / rho;
-						f[BSW]  = (1.-phi) * feq[BSW] ;// / rho;
+						f[DIR_MM0]   = (1.-phi) * feq[DIR_MM0]  ;// / rho;
+						f[DIR_PM0]   = (1.-phi) * feq[DIR_PM0]  ;// / rho;
+						f[DIR_MP0]   = (1.-phi) * feq[DIR_MP0]  ;// / rho;
+						f[DIR_P0P]   = (1.-phi) * feq[DIR_P0P]  ;// / rho;
+						f[DIR_M0M]   = (1.-phi) * feq[DIR_M0M]  ;// / rho;
+						f[DIR_P0M]   = (1.-phi) * feq[DIR_P0M]  ;// / rho;
+						f[DIR_M0P]   = (1.-phi) * feq[DIR_M0P]  ;// / rho;
+						f[DIR_0PP]   = (1.-phi) * feq[DIR_0PP]  ;// / rho;
+						f[DIR_0MM]   = (1.-phi) * feq[DIR_0MM]  ;// / rho;
+						f[DIR_0PM]   = (1.-phi) * feq[DIR_0PM]  ;// / rho;
+						f[DIR_0MP]   = (1.-phi) * feq[DIR_0MP]  ;// / rho;
+						f[DIR_PPP]  = (1.-phi) * feq[DIR_PPP] ;// / rho;
+						f[DIR_MPP]  = (1.-phi) * feq[DIR_MPP] ;// / rho;
+						f[DIR_PMP]  = (1.-phi) * feq[DIR_PMP] ;// / rho;
+						f[DIR_MMP]  = (1.-phi) * feq[DIR_MMP] ;// / rho;
+						f[DIR_PPM]  = (1.-phi) * feq[DIR_PPM] ;// / rho;
+						f[DIR_MPM]  = (1.-phi) * feq[DIR_MPM] ;// / rho;
+						f[DIR_PMM]  = (1.-phi) * feq[DIR_PMM] ;// / rho;
+						f[DIR_MMM]  = (1.-phi) * feq[DIR_MMM] ;// / rho;
 						f[DIR_000] = (1.-phi) * feq[DIR_000];//  / rho;
 
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
index c151ac904..b0b0cf774 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
@@ -38,7 +38,7 @@ void RefineAroundGbObjectHelper::refine()
     grid->accept(overlapVisitor);
 
     std::vector<int> dirs;
-    for (int i = D3Q27System::E; i <= D3Q27System::TS; i++) {
+    for (int i = D3Q27System::DIR_P00; i <= D3Q27System::DIR_0MP; i++) {
         dirs.push_back(i);
     }
     SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
index 656457c05..0b8b631e6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
@@ -55,7 +55,7 @@ void RefineCrossAndInsideGbObjectHelper::refine()
 
     std::vector<int> dirs;
 
-    for (int i = D3Q27System::E; i < D3Q27System::ENDDIR; i++) {
+    for (int i = D3Q27System::DIR_P00; i < D3Q27System::ENDDIR; i++) {
         dirs.push_back(i);
     }
     SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
index 4badec1f4..54f46c811 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
@@ -82,110 +82,110 @@ void SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Gri
 		int fbx3 = block->getX3() << 1;
 		int level = block->getLevel() + 1;
 
-		if( block->hasInterpolationFlagCF(D3Q27System::E))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_P00))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_P00);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::W))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_M00))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_M00);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::N))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0P0))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0P0);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::S))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0M0);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::T))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_00P))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_00P);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::B))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_00M))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_00M);
 		}
 
 		//////NE-NW-SE-SW
-		if( block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_PP0)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_P00))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NE);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PP0);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_MM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SW);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MM0);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_PM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SE);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PM0);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_MP0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_M00))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NW);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MP0);
 		}
 
 		/////////TE-BW-BE-TW 1-0
-		if( block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00P))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TE);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_P0P);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_M0M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00M))
 		{
 
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level);
@@ -193,140 +193,140 @@ void SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Gri
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BW);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_M0M);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_P0M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00M))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BE);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_P0M);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_M0P)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00P))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TW);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_M0P);
 		}
 
 		//////TN-BS-BN-TS
-		if( block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0PP)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00P))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TN);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0PP);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0MM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00M))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BS);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0MM);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0PM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00M))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BN);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0PM);
 		}
-		if( block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		if( block->hasInterpolationFlagCF(D3Q27System::DIR_0MP)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_00P))
 		{
 			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level);
 			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
 
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TS);
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_0MP);
 		}
 
 
 
 
       //////corners
-      if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_PPP)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0PP)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_PP0)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_00P)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_P00))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNE);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PPP);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_MMP)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_M0P)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0MP)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_MM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00P)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSW);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MMP);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_PMP)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_P0P)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0MP)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_PM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00P)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSE);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PMP);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_MPP)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_M0P)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0PP)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_MP0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00P)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_M00))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNW);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MPP);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_PPM)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_P0M)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0PM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_PP0)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_00M)&&!block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_P00))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNE);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PPM);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_MMM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0MM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M0M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_MM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSW);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MMM);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_PMM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0MM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P0M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_PM0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_P00) && !block->hasInterpolationFlagCF(D3Q27System::DIR_0M0))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSE);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_PMM);
       }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      if (block->hasInterpolationFlagCF(D3Q27System::DIR_MPM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0PM)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_M0M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_MP0)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_00M)&& !block->hasInterpolationFlagCF(D3Q27System::DIR_0P0) && !block->hasInterpolationFlagCF(D3Q27System::DIR_M00))
       {
          SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level);
          SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
          SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
          SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
 
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNW);
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::DIR_MPM);
       }
 
 	}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
index c4b542f1c..07aec29ef 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
@@ -37,97 +37,97 @@ void SetInterpolationDirsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bl
                         if (!flagDir)
                             continue;
                         break;
-                    case SW:
+                    case DIR_MM0:
                         checkFlagDir(grid, W, S, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case SE:
+                    case DIR_PM0:
                         checkFlagDir(grid, E, S, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case NW:
+                    case DIR_MP0:
                         checkFlagDir(grid, W, N, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TE:
+                    case DIR_P0P:
                         checkFlagDir(grid, E, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BW:
+                    case DIR_M0M:
                         checkFlagDir(grid, W, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BE:
+                    case DIR_P0M:
                         checkFlagDir(grid, E, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TW:
+                    case DIR_M0P:
                         checkFlagDir(grid, W, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TN:
+                    case DIR_0PP:
                         checkFlagDir(grid, N, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BS:
+                    case DIR_0MM:
                         checkFlagDir(grid, S, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BN:
+                    case DIR_0PM:
                         checkFlagDir(grid, N, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TS:
+                    case DIR_0MP:
                         checkFlagDir(grid, S, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TNE:
+                    case DIR_PPP:
                         checkFlagDir(grid, E, N, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TSW:
+                    case DIR_MMP:
                         checkFlagDir(grid, W, S, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TSE:
+                    case DIR_PMP:
                         checkFlagDir(grid, E, S, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case TNW:
+                    case DIR_MPP:
                         checkFlagDir(grid, W, N, T, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BNE:
+                    case DIR_PPM:
                         checkFlagDir(grid, E, N, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BSW:
+                    case DIR_MMM:
                         checkFlagDir(grid, W, S, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BSE:
+                    case DIR_PMM:
                         checkFlagDir(grid, E, S, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-                    case BNW:
+                    case DIR_MPM:
                         checkFlagDir(grid, W, N, B, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
index 6e3e6823d..3b9eb9493 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
@@ -40,7 +40,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
     // int offset = 2;
     int offset = 3;
 
-    if (block->hasInterpolationFlag(D3Q27System::E)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_P00)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -51,7 +51,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::W)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_M00)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -62,7 +62,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::N)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0P0)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2;
@@ -73,7 +73,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::S)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0M0)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -84,7 +84,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::T)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_00P)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -95,7 +95,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::B)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_00M)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -106,7 +106,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::NE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PP0)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -119,7 +119,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::SW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MM0)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -132,7 +132,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::SE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PM0)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -145,7 +145,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::NW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MP0)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -158,7 +158,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_P0P)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -171,7 +171,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_M0M)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -184,7 +184,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_P0M)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -197,7 +197,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_M0P)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -210,7 +210,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TN)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0PP)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2;
@@ -223,7 +223,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BS)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0MM)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -236,7 +236,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BN)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0PM)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2;
@@ -249,7 +249,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TS)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_0MP)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -262,7 +262,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TNE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PPP)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -277,7 +277,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TNW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MPP)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -292,7 +292,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TSE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PMP)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -307,7 +307,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::TSW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MMP)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -322,7 +322,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             startix3 = startix3 - offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BNE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PPM)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -337,7 +337,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BNW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MPM)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -352,7 +352,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BSE)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_PMM)) {
         int startix1 = maxX1;
         int endix1   = maxX1;
         if (block->hasInterpolationFlagCF())
@@ -367,7 +367,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
             endix3 = endix3 + offset;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlag(D3Q27System::BSW)) {
+    if (block->hasInterpolationFlag(D3Q27System::DIR_MMM)) {
         int startix1 = minX1;
         int endix1   = minX1;
         if (block->hasInterpolationFlagCF())
@@ -395,7 +395,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
     maxX2 = static_cast<int>(bcMatrix->getNX2()) - 1 - ll;
     maxX3 = static_cast<int>(bcMatrix->getNX3()) - 1 - ll;
 
-    if (block->hasInterpolationFlagFC(D3Q27System::E)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_P00)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -404,7 +404,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::W)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_M00)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -413,7 +413,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::N)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0P0)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -422,7 +422,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::S)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0M0)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -431,7 +431,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::T)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_00P)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -440,7 +440,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::B)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_00M)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -449,7 +449,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::NE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PP0)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -458,7 +458,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::SW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MM0)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -467,7 +467,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::SE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PM0)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -476,7 +476,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::NW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MP0)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = maxX2 - offset2;
@@ -485,7 +485,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_P0P)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -494,7 +494,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_M0M)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -503,7 +503,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_P0M)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -512,7 +512,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_M0P)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -521,7 +521,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TN)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0PP)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -530,7 +530,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BS)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0MM)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -539,7 +539,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BN)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0PM)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -548,7 +548,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TS)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_0MP)) {
         int startix1 = minX1;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -557,7 +557,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TNE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PPP)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -566,7 +566,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TNW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MPP)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = maxX2 - offset2;
@@ -575,7 +575,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TSE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PMP)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -584,7 +584,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::TSW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MMP)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -593,7 +593,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = maxX3;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BNE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PPM)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = maxX2 - offset2;
@@ -602,7 +602,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BNW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MPM)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = maxX2 - offset2;
@@ -611,7 +611,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BSE)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_PMM)) {
         int startix1 = maxX1 - offset2;
         int endix1   = maxX1;
         int startix2 = minX2;
@@ -620,7 +620,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
         int endix3   = minX3 + offset2;
         this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
     }
-    if (block->hasInterpolationFlagFC(D3Q27System::BSW)) {
+    if (block->hasInterpolationFlagFC(D3Q27System::DIR_MMM)) {
         int startix1 = minX1;
         int endix1   = minX1 + offset2;
         int startix2 = minX2;
@@ -633,10 +633,10 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block
     // invert scaleCF blocks
     if (block->hasInterpolationFlagCF()) {
         if (block->hasInterpolationFlagFC() && twoTypeOfConnectorsCheck) {
-            for (int i = D3Q27System::E; i <= D3Q27System::BSW; i++) {
+            for (int i = D3Q27System::DIR_P00; i <= D3Q27System::DIR_MMM; i++) {
                 UBLOG(logINFO, "FC in dir=" << i << " " << block->hasInterpolationFlagFC(i));
             }
-            for (int i = D3Q27System::E; i <= D3Q27System::BSW; i++) {
+            for (int i = D3Q27System::DIR_P00; i <= D3Q27System::DIR_MMM; i++) {
                 UBLOG(logINFO, "CF in dir=" << i << " " << block->hasInterpolationFlagCF(i));
             }
             throw UbException(UB_EXARGS, "block " + block->toString() + " has CF and FC");
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
index d763fe680..1ef34e0e8 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
@@ -72,22 +72,22 @@ void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
 
             double newCollFactor;
 
-            if (dir == D3Q27System::E) {
+            if (dir == D3Q27System::DIR_P00) {
                 int ibX1      = block->getX1();
                 int ibMax     = val<1>(ixMax) - val<1>(ixMin) + 1;
                 double index  = (double)(ibX1 - val<1>(ixMin) + 1);
                 newCollFactor = oldCollFactor - (oldCollFactor - 1.0) / (double)(ibMax)*index;
-            } else if (dir == D3Q27System::W) {
+            } else if (dir == D3Q27System::DIR_M00) {
                 int ibX1      = block->getX1();
                 int ibMax     = val<1>(ixMax) - val<1>(ixMin) + 1;
                 double index  = (double)(ibX1 - val<1>(ixMin) + 1);
                 newCollFactor = (oldCollFactor - 1.0) / (double)(ibMax)*index;
-            } else if (dir == D3Q27System::T) {
+            } else if (dir == D3Q27System::DIR_00P) {
                 int ibX3      = block->getX3();
                 int ibMax     = val<3>(ixMax) - val<3>(ixMin) + 1;
                 double index  = (double)(ibX3 - val<3>(ixMin) + 1);
                 newCollFactor = oldCollFactor - (oldCollFactor - 1.0) / (double)(ibMax)*index;
-            } else if (dir == D3Q27System::B) {
+            } else if (dir == D3Q27System::DIR_00M) {
                 int ibX3      = block->getX3();
                 int ibMax     = val<3>(ixMax) - val<3>(ixMin) + 1;
                 double index  = (double)(ibX3 - val<3>(ixMin) + 1);
-- 
GitLab


From 7031961c5d8a6bf7b53b36a03df8d37198df5e2c Mon Sep 17 00:00:00 2001
From: alena <akaranchuk@list.ru>
Date: Thu, 18 Aug 2022 16:33:24 +0200
Subject: [PATCH 085/179] Changing N, S, E, W, T, B,... constans to DIR_00P,
 DIR_00M,... values.

---
 ...tiphaseNonReflectingOutflowBCAlgorithm.cpp |  30 ++---
 .../NonReflectingOutflowBCAlgorithm.cpp       |  70 ++++++------
 ...xotropyNonReflectingOutflowBCAlgorithm.cpp | 104 +++++++++---------
 .../CoProcessors/ShearStressCoProcessor.cpp   |  14 +--
 .../TurbulenceIntensityCoProcessor.cpp        |   6 +-
 .../WriteMultiphaseQuantitiesCoProcessor.cpp  |  60 +++++-----
 ...mpressibleOffsetInterpolationProcessor.cpp |  30 ++---
 .../LBM/InitDensityLBMKernel.cpp              |  42 +++----
 .../LBM/LBMKernelETD3Q27BGK.cpp               |  60 +++++-----
 .../LBM/MultiphaseCumulantLBMKernel.cpp       |  48 ++++----
 ...PressureFilterCompressibleAirLBMKernel.cpp |  46 ++++----
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |  34 +++---
 .../MultiphaseScratchCumulantLBMKernel.cpp    |  58 +++++-----
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp |  70 ++++++------
 ...eTwoPhaseFieldsPressureFilterLBMKernel.cpp |  46 ++++----
 ...woPhaseFieldsVelocityCumulantLBMKernel.cpp |  46 ++++----
 .../LBM/RheologyInterpolationProcessor.cpp    |  30 ++---
 .../InitDistributionsBlockVisitor.cpp         |  12 +-
 .../Visitors/MetisPartitioningGridVisitor.cpp |   4 +-
 ...ultiphaseInitDistributionsBlockVisitor.cpp |  36 +++---
 ...ocityFormInitDistributionsBlockVisitor.cpp |  36 +++---
 .../SetInterpolationDirsBlockVisitor.cpp      |  42 +++----
 22 files changed, 462 insertions(+), 462 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
index bc9a73dee..fc6019244 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
@@ -82,7 +82,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
    else if (bcPtr->hasDensityBoundaryFlag(DIR_0P0)) { nx2 += 1; direction = DIR_0P0; }
    else if (bcPtr->hasDensityBoundaryFlag(DIR_0M0)) { nx2 -= 1; direction = DIR_0M0; }
    else if (bcPtr->hasDensityBoundaryFlag(DIR_00P)) { nx3 += 1; direction = DIR_00P; }
-   else if (bcPtr->hasDensityBoundaryFlag(B)) { nx3 -= 1; direction = B; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_00M)) { nx3 -= 1; direction = DIR_00M; }
    else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
 
    distributions->getDistribution(f, x1, x2, x3);
@@ -182,8 +182,8 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
       break;
-   case N:
-      f[N]   = ftemp[N]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[N]   ;
+   case DIR_0P0:
+      f[DIR_0P0]   = ftemp[DIR_0P0]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_0P0]   ;
       f[DIR_PP0]  = ftemp[DIR_PP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_PP0]  ;
       f[DIR_MP0]  = ftemp[DIR_MP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_MP0]  ;
       f[DIR_0PP]  = ftemp[DIR_0PP]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_0PP]  ;
@@ -193,7 +193,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_PPM] ;
       f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_MPM] ;
 
-      distributions->setDistributionInvForDirection(f[N],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
+      distributions->setDistributionInvForDirection(f[DIR_0P0],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
       distributions->setDistributionInvForDirection(f[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],   DIR_MM0);
       distributions->setDistributionInvForDirection(f[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
       distributions->setDistributionInvForDirection(f[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -203,7 +203,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
       distributions->setDistributionInvForDirection(f[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
 
-	  h[N]   = htemp[N]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[N]   ;
+	  h[DIR_0P0]   = htemp[DIR_0P0]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_0P0]   ;
 	  h[DIR_PP0]  = htemp[DIR_PP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_PP0]  ;
 	  h[DIR_MP0]  = htemp[DIR_MP0]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_MP0]  ;
 	  h[DIR_0PP]  = htemp[DIR_0PP]  * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_0PP]  ;
@@ -213,7 +213,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_PPM] ;
 	  h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*h[DIR_MPM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[N],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0P0],   x1+DX1[DIR_0M0],   x2+DX2[DIR_0M0],   x3+DX3[DIR_0M0],     DIR_0M0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],   DIR_MM0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -235,7 +235,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_PMM] ;
       f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_MMM] ;
 
-      distributions->setDistributionInvForDirection(f[DIR_0M0],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
+      distributions->setDistributionInvForDirection(f[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0], DIR_0P0);
       distributions->setDistributionInvForDirection(f[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
       distributions->setDistributionInvForDirection(f[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
       distributions->setDistributionInvForDirection(f[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
@@ -255,7 +255,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_PMM] ;
 	  h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_MMM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[DIR_0M0],   x1+DX1[N],   x2+DX2[N],   x3+DX3[N],     N);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0], DIR_0P0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
@@ -277,7 +277,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_PMP] ;
       f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_MMP] ;
 
-      distributions->setDistributionInvForDirection(f[DIR_00P],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
+      distributions->setDistributionInvForDirection(f[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M], DIR_00M);
       distributions->setDistributionInvForDirection(f[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
       distributions->setDistributionInvForDirection(f[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
       distributions->setDistributionInvForDirection(f[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -297,7 +297,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_PMP] ;
 	  h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_MMP] ;
 
-	  distributionsH->setDistributionInvForDirection(h[DIR_00P],   x1+DX1[B],   x2+DX2[B],   x3+DX3[B],     B);
+	  distributionsH->setDistributionInvForDirection(h[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M], DIR_00M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -308,8 +308,8 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
 
       break;
-   case B:
-      f[B]   = ftemp[B]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[B]   ;
+   case DIR_00M:
+      f[DIR_00M]   = ftemp[DIR_00M]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_00M]   ;
       f[DIR_P0M]  = ftemp[DIR_P0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_P0M]  ;
       f[DIR_M0M]  = ftemp[DIR_M0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_M0M]  ;
       f[DIR_0PM]  = ftemp[DIR_0PM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_0PM]  ;
@@ -319,7 +319,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_PMM] ;
       f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_MMM] ;
 
-      distributions->setDistributionInvForDirection(f[B],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
+      distributions->setDistributionInvForDirection(f[DIR_00M],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
       distributions->setDistributionInvForDirection(f[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],   DIR_M0P);
       distributions->setDistributionInvForDirection(f[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
       distributions->setDistributionInvForDirection(f[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
@@ -329,7 +329,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
       distributions->setDistributionInvForDirection(f[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
-	  h[B]   = htemp[B]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[B]   ;
+	  h[DIR_00M]   = htemp[DIR_00M]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_00M]   ;
 	  h[DIR_P0M]  = htemp[DIR_P0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_P0M]  ;
 	  h[DIR_M0M]  = htemp[DIR_M0M]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_M0M]  ;
 	  h[DIR_0PM]  = htemp[DIR_0PM]  * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_0PM]  ;
@@ -339,7 +339,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_PMM] ;
 	  h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*h[DIR_MMM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[B],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
+	  distributionsH->setDistributionInvForDirection(h[DIR_00M],   x1+DX1[DIR_00P],   x2+DX2[DIR_00P],   x3+DX3[DIR_00P],     DIR_00P);
 	  distributionsH->setDistributionInvForDirection(h[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],   DIR_M0P);
 	  distributionsH->setDistributionInvForDirection(h[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0PM],  x1+DX1[DIR_0MP],  x2+DX2[DIR_0MP],  x3+DX3[DIR_0MP],   DIR_0MP);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
index f92357cdb..6fa4c7b5d 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp
@@ -69,24 +69,24 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
     int direction = -1;
 
     // flag points in direction of fluid
-    if (bcPtr->hasDensityBoundaryFlag(E)) {
+    if (bcPtr->hasDensityBoundaryFlag(DIR_P00)) {
         nx1 += 1;
-        direction = E;
-    } else if (bcPtr->hasDensityBoundaryFlag(W)) {
+        direction = DIR_P00;
+    } else if (bcPtr->hasDensityBoundaryFlag(DIR_M00)) {
         nx1 -= 1;
-        direction = W;
-    } else if (bcPtr->hasDensityBoundaryFlag(N)) {
+        direction = DIR_M00;
+    } else if (bcPtr->hasDensityBoundaryFlag(DIR_0P0)) {
         nx2 += 1;
-        direction = N;
-    } else if (bcPtr->hasDensityBoundaryFlag(S)) {
+        direction = DIR_0P0;
+    } else if (bcPtr->hasDensityBoundaryFlag(DIR_0M0)) {
         nx2 -= 1;
-        direction = S;
-    } else if (bcPtr->hasDensityBoundaryFlag(T)) {
+        direction = DIR_0M0;
+    } else if (bcPtr->hasDensityBoundaryFlag(DIR_00P)) {
         nx3 += 1;
-        direction = T;
-    } else if (bcPtr->hasDensityBoundaryFlag(B)) {
+        direction = DIR_00P;
+    } else if (bcPtr->hasDensityBoundaryFlag(DIR_00M)) {
         nx3 -= 1;
-        direction = B;
+        direction = DIR_00M;
     } else
         UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
 
@@ -97,9 +97,9 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
     calcMacrosFct(f, rho, vx1, vx2, vx3);
 
     switch (direction) {
-        case E:
+        case DIR_P00:
             f[DIR_P00]   = ftemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P00];
-            f[NE]  = ftemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[NE];
+            f[DIR_PP0]  = ftemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PP0];
             f[DIR_PM0]  = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PM0];
             f[DIR_P0P]  = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0P];
             f[DIR_P0M]  = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0M];
@@ -108,8 +108,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPM];
             f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMM];
 
-            distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+            distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[DIR_M00], x2 + DX2[DIR_M00], x3 + DX3[DIR_M00], DIR_M00);
+            distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
             distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
             distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
             distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
@@ -118,8 +118,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
             distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
             break;
-        case W:
-            f[W]   = ftemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[W];
+        case DIR_M00:
+            f[DIR_M00]   = ftemp[DIR_M00] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M00];
             f[DIR_MP0]  = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MP0];
             f[DIR_MM0]  = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MM0];
             f[DIR_M0P]  = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0P];
@@ -129,9 +129,9 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPM];
             f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMM];
 
-            distributions->setDistributionInvForDirection(f[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+            distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
             distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
-            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
             distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
             distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
             distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
@@ -139,9 +139,9 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
             distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
             break;
-        case N:
-            f[N]   = ftemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[N];
-            f[NE]  = ftemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NE];
+        case DIR_0P0:
+            f[DIR_0P0]   = ftemp[DIR_0P0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0P0];
+            f[DIR_PP0]  = ftemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PP0];
             f[DIR_MP0]  = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MP0];
             f[DIR_0PP]  = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PP];
             f[DIR_0PM]  = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PM];
@@ -150,8 +150,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPM];
             f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPM];
 
-            distributions->setDistributionInvForDirection(f[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-            distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+            distributions->setDistributionInvForDirection(f[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0);
+            distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
             distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
             distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
             distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
@@ -160,8 +160,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
             distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
             break;
-        case S:
-            f[S]   = ftemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[S];
+        case DIR_0M0:
+            f[DIR_0M0]   = ftemp[DIR_0M0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0M0];
             f[DIR_PM0]  = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PM0];
             f[DIR_MM0]  = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MM0];
             f[DIR_0MP]  = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MP];
@@ -171,9 +171,9 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMM];
             f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMM];
 
-            distributions->setDistributionInvForDirection(f[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
+            distributions->setDistributionInvForDirection(f[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0);
             distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
-            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+            distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
             distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
             distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
             distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
@@ -181,8 +181,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
             distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
             break;
-        case T:
-            f[T]   = ftemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[T];
+        case DIR_00P:
+            f[DIR_00P]   = ftemp[DIR_00P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_00P];
             f[DIR_P0P]  = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_P0P];
             f[DIR_M0P]  = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_M0P];
             f[DIR_0PP]  = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0PP];
@@ -192,7 +192,7 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PMP];
             f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MMP];
 
-            distributions->setDistributionInvForDirection(f[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
+            distributions->setDistributionInvForDirection(f[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M);
             distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
             distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
             distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
@@ -202,8 +202,8 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
             distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
             break;
-        case B:
-            f[B]   = ftemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[B];
+        case DIR_00M:
+            f[DIR_00M]   = ftemp[DIR_00M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_00M];
             f[DIR_P0M]  = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_P0M];
             f[DIR_M0M]  = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_M0M];
             f[DIR_0PM]  = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0PM];
@@ -213,7 +213,7 @@ void NonReflectingOutflowBCAlgorithm::applyBC()
             f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PMM];
             f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MMM];
 
-            distributions->setDistributionInvForDirection(f[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
+            distributions->setDistributionInvForDirection(f[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P);
             distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
             distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
             distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
index 27d9bd363..ed90cc759 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp
@@ -79,12 +79,12 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
    int direction = -1;
 
    //flag points in direction of fluid
-   if (bcPtr->hasDensityBoundaryFlag(E)) { nx1 += 1; direction = E; }
-   else if (bcPtr->hasDensityBoundaryFlag(W)) { nx1 -= 1; direction = W; }
-   else if (bcPtr->hasDensityBoundaryFlag(N)) { nx2 += 1; direction = N; }
-   else if (bcPtr->hasDensityBoundaryFlag(S)) { nx2 -= 1; direction = S; }
-   else if (bcPtr->hasDensityBoundaryFlag(T)) { nx3 += 1; direction = T; }
-   else if (bcPtr->hasDensityBoundaryFlag(B)) { nx3 -= 1; direction = B; }
+   if (bcPtr->hasDensityBoundaryFlag(DIR_P00)) { nx1 += 1; direction = DIR_P00; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_M00)) { nx1 -= 1; direction = DIR_M00; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_0P0)) { nx2 += 1; direction = DIR_0P0; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_0M0)) { nx2 -= 1; direction = DIR_0M0; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_00P)) { nx3 += 1; direction = DIR_00P; }
+   else if (bcPtr->hasDensityBoundaryFlag(DIR_00M)) { nx3 -= 1; direction = DIR_00M; }
    else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on density boundary..."));
 
    distributions->getDistribution(f, x1, x2, x3);
@@ -95,9 +95,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
 
    switch (direction)
    {
-   case E:
+   case DIR_P00:
       f[DIR_P00] = ftemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P00];
-      f[NE] = ftemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[NE];
+      f[DIR_PP0] = ftemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PP0];
       f[DIR_PM0] = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PM0];
       f[DIR_P0P] = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0P];
       f[DIR_P0M] = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_P0M];
@@ -106,8 +106,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PPM];
       f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * f[DIR_PMM];
 
-      distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[DIR_M00], x2 + DX2[DIR_M00], x3 + DX3[DIR_M00], DIR_M00);
+      distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
       distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
       distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
       distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
@@ -116,8 +116,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
       distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       break;
-   case W:
-      f[W] = ftemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[W];
+   case DIR_M00:
+      f[DIR_M00] = ftemp[DIR_M00] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M00];
       f[DIR_MP0] = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MP0];
       f[DIR_MM0] = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MM0];
       f[DIR_M0P] = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_M0P];
@@ -127,9 +127,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MPM];
       f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * f[DIR_MMM];
 
-      distributions->setDistributionInvForDirection(f[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+      distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
       distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
-      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
       distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
       distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
       distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
@@ -137,9 +137,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
-   case N:
-      f[N] = ftemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[N];
-      f[NE] = ftemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[NE];
+   case DIR_0P0:
+      f[DIR_0P0] = ftemp[DIR_0P0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0P0];
+      f[DIR_PP0] = ftemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PP0];
       f[DIR_MP0] = ftemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MP0];
       f[DIR_0PP] = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PP];
       f[DIR_0PM] = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_0PM];
@@ -148,8 +148,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PPM] = ftemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_PPM];
       f[DIR_MPM] = ftemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * f[DIR_MPM];
 
-      distributions->setDistributionInvForDirection(f[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-      distributions->setDistributionInvForDirection(f[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0);
+      distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
       distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
       distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
       distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
@@ -158,8 +158,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
       distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       break;
-   case S:
-      f[S] = ftemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[S];
+   case DIR_0M0:
+      f[DIR_0M0] = ftemp[DIR_0M0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0M0];
       f[DIR_PM0] = ftemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PM0];
       f[DIR_MM0] = ftemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MM0];
       f[DIR_0MP] = ftemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_0MP];
@@ -169,9 +169,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_PMM];
       f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * f[DIR_MMM];
 
-      distributions->setDistributionInvForDirection(f[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
+      distributions->setDistributionInvForDirection(f[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0);
       distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
-      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
       distributions->setDistributionInvForDirection(f[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
       distributions->setDistributionInvForDirection(f[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
       distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
@@ -179,8 +179,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
-   case T:
-      f[T] = ftemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[T];
+   case DIR_00P:
+      f[DIR_00P] = ftemp[DIR_00P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_00P];
       f[DIR_P0P] = ftemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_P0P];
       f[DIR_M0P] = ftemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_M0P];
       f[DIR_0PP] = ftemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_0PP];
@@ -190,7 +190,7 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMP] = ftemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_PMP];
       f[DIR_MMP] = ftemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * f[DIR_MMP];
 
-      distributions->setDistributionInvForDirection(f[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
+      distributions->setDistributionInvForDirection(f[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M);
       distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
       distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
       distributions->setDistributionInvForDirection(f[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
@@ -200,8 +200,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributions->setDistributionInvForDirection(f[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
       distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
       break;
-   case B:
-      f[B] = ftemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[B];
+   case DIR_00M:
+      f[DIR_00M] = ftemp[DIR_00M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_00M];
       f[DIR_P0M] = ftemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_P0M];
       f[DIR_M0M] = ftemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_M0M];
       f[DIR_0PM] = ftemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_0PM];
@@ -211,7 +211,7 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMM] = ftemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_PMM];
       f[DIR_MMM] = ftemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * f[DIR_MMM];
 
-      distributions->setDistributionInvForDirection(f[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
+      distributions->setDistributionInvForDirection(f[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P);
       distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
       distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
       distributions->setDistributionInvForDirection(f[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
@@ -239,9 +239,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
 
    switch (direction)
    {
-   case E:
+   case DIR_P00:
       h[DIR_P00]  = htemp[DIR_P00] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P00];
-      h[NE] = htemp[NE] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[NE];
+      h[DIR_PP0] = htemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PP0];
       h[DIR_PM0] = htemp[DIR_PM0] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PM0];
       h[DIR_P0P] = htemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P0P];
       h[DIR_P0M] = htemp[DIR_P0M] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_P0M];
@@ -250,8 +250,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_PPM] = htemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PPM];
       h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 + vx1) + (1.0 - UbMath::one_over_sqrt3 - vx1) * h[DIR_PMM];
 
-      distributionsH->setDistributionInvForDirection(h[DIR_P00], x1 + DX1[W], x2 + DX2[W], x3 + DX3[W], W);
-      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_P00], x1 + DX1[DIR_M00], x2 + DX2[DIR_M00], x3 + DX3[DIR_M00], DIR_M00);
+      distributionsH->setDistributionInvForDirection(h[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
       distributionsH->setDistributionInvForDirection(h[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
       distributionsH->setDistributionInvForDirection(h[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
       distributionsH->setDistributionInvForDirection(h[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
@@ -260,8 +260,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
       distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       break;
-   case W:
-      h[W] = htemp[W] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[W];
+   case DIR_M00:
+      h[DIR_M00] = htemp[DIR_M00] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_M00];
       h[DIR_MP0] = htemp[DIR_MP0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MP0];
       h[DIR_MM0] = htemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MM0];
       h[DIR_M0P] = htemp[DIR_M0P] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_M0P];
@@ -271,9 +271,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_MPM] = htemp[DIR_MPM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MPM];
       h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx1) + (1.0 - UbMath::one_over_sqrt3 + vx1) * h[DIR_MMM];
 
-      distributionsH->setDistributionInvForDirection(h[W], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], E);
+      distributionsH->setDistributionInvForDirection(h[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
       distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
-      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
       distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
       distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
       distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
@@ -281,9 +281,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
-   case N:
-      h[N] = htemp[N] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[N];
-      h[NE] = htemp[NE] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[NE];
+   case DIR_0P0:
+      h[DIR_0P0] = htemp[DIR_0P0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_0P0];
+      h[DIR_PP0] = htemp[DIR_PP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_PP0];
       h[DIR_MP0] = htemp[DIR_MP0] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_MP0];
       h[DIR_0PP] = htemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_0PP];
       h[DIR_0PM] = htemp[DIR_0PM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_0PM];
@@ -292,8 +292,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_PPM] = htemp[DIR_PPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_PPM];
       h[DIR_MPM] = htemp[DIR_MPM] * (UbMath::one_over_sqrt3 + vx2) + (1.0 - UbMath::one_over_sqrt3 - vx2) * h[DIR_MPM];
 
-      distributionsH->setDistributionInvForDirection(h[N], x1 + DX1[S], x2 + DX2[S], x3 + DX3[S], S);
-      distributionsH->setDistributionInvForDirection(h[NE], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH->setDistributionInvForDirection(h[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0);
+      distributionsH->setDistributionInvForDirection(h[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
       distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
       distributionsH->setDistributionInvForDirection(h[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
       distributionsH->setDistributionInvForDirection(h[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
@@ -302,8 +302,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
       distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
       break;
-   case S:
-      h[S] = htemp[S] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[S];
+   case DIR_0M0:
+      h[DIR_0M0] = htemp[DIR_0M0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_0M0];
       h[DIR_PM0] = htemp[DIR_PM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_PM0];
       h[DIR_MM0] = htemp[DIR_MM0] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_MM0];
       h[DIR_0MP] = htemp[DIR_0MP] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_0MP];
@@ -313,9 +313,9 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_PMM];
       h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx2) + (1.0 - UbMath::one_over_sqrt3 + vx2) * h[DIR_MMM];
 
-      distributionsH->setDistributionInvForDirection(h[S], x1 + DX1[N], x2 + DX2[N], x3 + DX3[N], N);
+      distributionsH->setDistributionInvForDirection(h[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0);
       distributionsH->setDistributionInvForDirection(h[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
-      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[NE], x2 + DX2[NE], x3 + DX3[NE], NE);
+      distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
       distributionsH->setDistributionInvForDirection(h[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
       distributionsH->setDistributionInvForDirection(h[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
       distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
@@ -323,8 +323,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
       distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
       break;
-   case T:
-      h[T] = htemp[T] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[T];
+   case DIR_00P:
+      h[DIR_00P] = htemp[DIR_00P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_00P];
       h[DIR_P0P] = htemp[DIR_P0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_P0P];
       h[DIR_M0P] = htemp[DIR_M0P] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_M0P];
       h[DIR_0PP] = htemp[DIR_0PP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_0PP];
@@ -334,7 +334,7 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_PMP] = htemp[DIR_PMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_PMP];
       h[DIR_MMP] = htemp[DIR_MMP] * (UbMath::one_over_sqrt3 + vx3) + (1.0 - UbMath::one_over_sqrt3 - vx3) * h[DIR_MMP];
 
-      distributionsH->setDistributionInvForDirection(h[T], x1 + DX1[B], x2 + DX2[B], x3 + DX3[B], B);
+      distributionsH->setDistributionInvForDirection(h[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M);
       distributionsH->setDistributionInvForDirection(h[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
       distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
       distributionsH->setDistributionInvForDirection(h[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
@@ -344,8 +344,8 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
       distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
       break;
-   case B:
-      h[B] = htemp[B] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[B];
+   case DIR_00M:
+      h[DIR_00M] = htemp[DIR_00M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_00M];
       h[DIR_P0M] = htemp[DIR_P0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_P0M];
       h[DIR_M0M] = htemp[DIR_M0M] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_M0M];
       h[DIR_0PM] = htemp[DIR_0PM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_0PM];
@@ -355,7 +355,7 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC()
       h[DIR_PMM] = htemp[DIR_PMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_PMM];
       h[DIR_MMM] = htemp[DIR_MMM] * (UbMath::one_over_sqrt3 - vx3) + (1.0 - UbMath::one_over_sqrt3 + vx3) * h[DIR_MMM];
 
-      distributionsH->setDistributionInvForDirection(h[B], x1 + DX1[T], x2 + DX2[T], x3 + DX3[T], T);
+      distributionsH->setDistributionInvForDirection(h[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P);
       distributionsH->setDistributionInvForDirection(h[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
       distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
       distributionsH->setDistributionInvForDirection(h[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
index 9d865e22b..64ecc177f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp
@@ -173,17 +173,17 @@ void ShearStressCoProcessor::calculateShearStress(double timeStep)
                     // compute velocity
                     //////////////////////////////////////////////////////////////////////////
                     vx = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                          (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W]));
+                          (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00]));
 
                     vy = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                          (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S]));
+                          (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0]));
 
                     vz = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
-                          (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B]));
+                          (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M]));
 
                     sxy = 3.0 * collFactor / (collFactor - 1.0) *
                           (((f[DIR_PPP] + f[DIR_MMM]) - (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
-                           (((f[NE] + f[DIR_MM0]) - (f[DIR_PM0] + f[DIR_MP0]))) - vx * vy);
+                           (((f[DIR_PP0] + f[DIR_MM0]) - (f[DIR_PM0] + f[DIR_MP0]))) - vx * vy);
 
                     sxz = 3.0 * collFactor / (collFactor - 1.0) *
                           (((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) - (f[DIR_MMP] + f[DIR_PPM])) +
@@ -195,11 +195,11 @@ void ShearStressCoProcessor::calculateShearStress(double timeStep)
 
                     LBMReal dxxMyy = 3.0 / 2.0 * collFactor / (collFactor - 1.0) *
                                      (((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM])) +
-                                      ((f[DIR_P00] + f[W]) - (f[N] + f[S])) - vx * vx + vy * vy);
+                                      ((f[DIR_P00] + f[DIR_M00]) - (f[DIR_0P0] + f[DIR_0M0])) - vx * vx + vy * vy);
 
                     LBMReal dxxMzz = 3.0 / 2.0 * collFactor / (collFactor - 1.0) *
-                                     ((((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
-                                      ((f[DIR_P00] + f[W]) - (f[T] + f[B])) - vx * vx + vz * vz);
+                                     ((((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
+                                      ((f[DIR_P00] + f[DIR_M00]) - (f[DIR_00P] + f[DIR_00M])) - vx * vx + vz * vz);
 
                     // LBMReal dyyMzz =3.0/2.0 *collFactor/(collFactor-1.0)*((((f[NE] + f[SW]) + (f[SE] +
                     // f[NW]))-((f[TE] + f[BW])+(f[BE]+ f[TW])))
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
index 5de46c899..6a06a20d4 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp
@@ -215,13 +215,13 @@ void TurbulenceIntensityCoProcessor::calculateAverageValues(double timeStep)
                                 //////////////////////////////////////////////////////////////////////////
                                 // compute velocity
                                 //////////////////////////////////////////////////////////////////////////
-                                vx = f[DIR_P00] - f[W] + f[NE] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M] + f[DIR_P0M] - f[DIR_M0P] +
+                                vx = f[DIR_P00] - f[DIR_M00] + f[DIR_PP0] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M] + f[DIR_P0M] - f[DIR_M0P] +
                                      f[DIR_PPP] - f[DIR_MMP] + f[DIR_PMP] - f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] + f[DIR_PMM] - f[DIR_MPM];
 
-                                vy = f[N] - f[S] + f[NE] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM] - f[DIR_0MP] +
+                                vy = f[DIR_0P0] - f[DIR_0M0] + f[DIR_PP0] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM] - f[DIR_0MP] +
                                      f[DIR_PPP] - f[DIR_MMP] - f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] + f[DIR_MPM];
 
-                                vz = f[T] - f[B] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] + f[DIR_0MP] +
+                                vz = f[DIR_00P] - f[DIR_00M] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] + f[DIR_0MP] +
                                      f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] - f[DIR_MPM];
                                 //////////////////////////////////////////////////////////////////////////
                                 // compute average values
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
index 73bc94c73..0298c1dbe 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp
@@ -226,16 +226,16 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     distributionsH->getDistribution(f, ix1, ix2, ix3);
                     (*phaseField)(ix1, ix2, ix3) =
                         ((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
-                        (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                        (((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
                         ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
-                            ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
+                            ((f[DIR_P00] + f[DIR_M00]) + (f[DIR_0P0] + f[DIR_0M0]) + (f[DIR_00P] + f[DIR_00M])) + f[DIR_000];
                     if (distributionsH2) {
                     distributionsH2->getDistribution(f, ix1, ix2, ix3);
                     (*phaseField2)(ix1, ix2, ix3) =
                         ((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
-                        (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                        (((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
                         ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
-                            ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000];
+                            ((f[DIR_P00] + f[DIR_M00]) + (f[DIR_0P0] + f[DIR_0M0]) + (f[DIR_00P] + f[DIR_00M])) + f[DIR_000];
                 }
                     else { (*phaseField2)(ix1, ix2, ix3) = 999.0; }
                     
@@ -285,24 +285,24 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                         // vx2 = 0.0;
                         // vx3 = 0.0;
                     } else {
-                        phi[DIR_P00]   = (*phaseField)(ix1 + DX1[DIR_P00], ix2 + DX2[DIR_P00], ix3 + DX3[DIR_P00]);
-                        phi[N]   = (*phaseField)(ix1 + DX1[N], ix2 + DX2[N], ix3 + DX3[N]);
-                        phi[T]   = (*phaseField)(ix1 + DX1[T], ix2 + DX2[T], ix3 + DX3[T]);
-                        phi[W]   = (*phaseField)(ix1 + DX1[W], ix2 + DX2[W], ix3 + DX3[W]);
-                        phi[S]   = (*phaseField)(ix1 + DX1[S], ix2 + DX2[S], ix3 + DX3[S]);
-                        phi[B]   = (*phaseField)(ix1 + DX1[B], ix2 + DX2[B], ix3 + DX3[B]);
-                        phi[NE]  = (*phaseField)(ix1 + DX1[NE], ix2 + DX2[NE], ix3 + DX3[NE]);
-                        phi[DIR_MP0]  = (*phaseField)(ix1 + DX1[DIR_MP0], ix2 + DX2[DIR_MP0], ix3 + DX3[DIR_MP0]);
-                        phi[DIR_P0P]  = (*phaseField)(ix1 + DX1[DIR_P0P], ix2 + DX2[DIR_P0P], ix3 + DX3[DIR_P0P]);
-                        phi[DIR_M0P]  = (*phaseField)(ix1 + DX1[DIR_M0P], ix2 + DX2[DIR_M0P], ix3 + DX3[DIR_M0P]);
-                        phi[DIR_0PP]  = (*phaseField)(ix1 + DX1[DIR_0PP], ix2 + DX2[DIR_0PP], ix3 + DX3[DIR_0PP]);
-                        phi[DIR_0MP]  = (*phaseField)(ix1 + DX1[DIR_0MP], ix2 + DX2[DIR_0MP], ix3 + DX3[DIR_0MP]);
-                        phi[DIR_MM0]  = (*phaseField)(ix1 + DX1[DIR_MM0], ix2 + DX2[DIR_MM0], ix3 + DX3[DIR_MM0]);
-                        phi[DIR_PM0]  = (*phaseField)(ix1 + DX1[DIR_PM0], ix2 + DX2[DIR_PM0], ix3 + DX3[DIR_PM0]);
-                        phi[DIR_M0M]  = (*phaseField)(ix1 + DX1[DIR_M0M], ix2 + DX2[DIR_M0M], ix3 + DX3[DIR_M0M]);
-                        phi[DIR_P0M]  = (*phaseField)(ix1 + DX1[DIR_P0M], ix2 + DX2[DIR_P0M], ix3 + DX3[DIR_P0M]);
-                        phi[DIR_0MM]  = (*phaseField)(ix1 + DX1[DIR_0MM], ix2 + DX2[DIR_0MM], ix3 + DX3[DIR_0MM]);
-                        phi[DIR_0PM]  = (*phaseField)(ix1 + DX1[DIR_0PM], ix2 + DX2[DIR_0PM], ix3 + DX3[DIR_0PM]);
+                        phi[DIR_P00] = (*phaseField)(ix1 + DX1[DIR_P00], ix2 + DX2[DIR_P00], ix3 + DX3[DIR_P00]);
+                        phi[DIR_0P0] = (*phaseField)(ix1 + DX1[DIR_0P0], ix2 + DX2[DIR_0P0], ix3 + DX3[DIR_0P0]);
+                        phi[DIR_00P] = (*phaseField)(ix1 + DX1[DIR_00P], ix2 + DX2[DIR_00P], ix3 + DX3[DIR_00P]);
+                        phi[DIR_M00] = (*phaseField)(ix1 + DX1[DIR_M00], ix2 + DX2[DIR_M00], ix3 + DX3[DIR_M00]);
+                        phi[DIR_0M0] = (*phaseField)(ix1 + DX1[DIR_0M0], ix2 + DX2[DIR_0M0], ix3 + DX3[DIR_0M0]);
+                        phi[DIR_00M] = (*phaseField)(ix1 + DX1[DIR_00M], ix2 + DX2[DIR_00M], ix3 + DX3[DIR_00M]);
+                        phi[DIR_PP0] = (*phaseField)(ix1 + DX1[DIR_PP0], ix2 + DX2[DIR_PP0], ix3 + DX3[DIR_PP0]);
+                        phi[DIR_MP0] = (*phaseField)(ix1 + DX1[DIR_MP0], ix2 + DX2[DIR_MP0], ix3 + DX3[DIR_MP0]);
+                        phi[DIR_P0P] = (*phaseField)(ix1 + DX1[DIR_P0P], ix2 + DX2[DIR_P0P], ix3 + DX3[DIR_P0P]);
+                        phi[DIR_M0P] = (*phaseField)(ix1 + DX1[DIR_M0P], ix2 + DX2[DIR_M0P], ix3 + DX3[DIR_M0P]);
+                        phi[DIR_0PP] = (*phaseField)(ix1 + DX1[DIR_0PP], ix2 + DX2[DIR_0PP], ix3 + DX3[DIR_0PP]);
+                        phi[DIR_0MP] = (*phaseField)(ix1 + DX1[DIR_0MP], ix2 + DX2[DIR_0MP], ix3 + DX3[DIR_0MP]);
+                        phi[DIR_MM0] = (*phaseField)(ix1 + DX1[DIR_MM0], ix2 + DX2[DIR_MM0], ix3 + DX3[DIR_MM0]);
+                        phi[DIR_PM0] = (*phaseField)(ix1 + DX1[DIR_PM0], ix2 + DX2[DIR_PM0], ix3 + DX3[DIR_PM0]);
+                        phi[DIR_M0M] = (*phaseField)(ix1 + DX1[DIR_M0M], ix2 + DX2[DIR_M0M], ix3 + DX3[DIR_M0M]);
+                        phi[DIR_P0M] = (*phaseField)(ix1 + DX1[DIR_P0M], ix2 + DX2[DIR_P0M], ix3 + DX3[DIR_P0M]);
+                        phi[DIR_0MM] = (*phaseField)(ix1 + DX1[DIR_0MM], ix2 + DX2[DIR_0MM], ix3 + DX3[DIR_0MM]);
+                        phi[DIR_0PM] = (*phaseField)(ix1 + DX1[DIR_0PM], ix2 + DX2[DIR_0PM], ix3 + DX3[DIR_0PM]);
                         phi[DIR_MMM] = (*phaseField)(ix1 + DX1[DIR_MMM], ix2 + DX2[DIR_MMM], ix3 + DX3[DIR_MMM]);
                         phi[DIR_PMM] = (*phaseField)(ix1 + DX1[DIR_PMM], ix2 + DX2[DIR_PMM], ix3 + DX3[DIR_PMM]);
                         phi[DIR_MPM] = (*phaseField)(ix1 + DX1[DIR_MPM], ix2 + DX2[DIR_MPM], ix3 + DX3[DIR_MPM]);
@@ -363,42 +363,42 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
                     if (pressure) {
                         vx1 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W])) ;
+                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00])) ;
 
                         vx2 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S])) ;
+                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0])) ;
 
                         vx3 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
-                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B]));
+                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M]));
 
                     }
                     else {
                         vx1 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_PMM] - f[DIR_MPP]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[NE] - f[DIR_MM0]))) + (f[DIR_P00] - f[W])) /
+                            (((f[DIR_P0M] - f[DIR_M0P]) + (f[DIR_P0P] - f[DIR_M0M])) + ((f[DIR_PM0] - f[DIR_MP0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_P00] - f[DIR_M00])) /
                                 (rho * c1o3) +
                             mu * dX1_phi / (2 * rho);
 
                         vx2 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_MPM] - f[DIR_PMP])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_PPM] - f[DIR_MMP]))) +
-                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[NE] - f[DIR_MM0]))) + (f[N] - f[S])) /
+                            (((f[DIR_0PM] - f[DIR_0MP]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_MP0] - f[DIR_PM0]) + (f[DIR_PP0] - f[DIR_MM0]))) + (f[DIR_0P0] - f[DIR_0M0])) /
                                 (rho * c1o3) +
                             mu * dX2_phi / (2 * rho);
 
                         vx3 =
                             ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) +
-                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[T] - f[B])) /
+                            (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M])) /
                                 (rho * c1o3) +
                             mu * dX3_phi / (2 * rho);
 
                     }
 
                     p1 = (((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) +
-                          (((f[NE] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
+                          (((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) + ((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) +
                            ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) +
-                          ((f[DIR_P00] + f[W]) + (f[N] + f[S]) + (f[T] + f[B])) + f[DIR_000]) +
+                          ((f[DIR_P00] + f[DIR_M00]) + (f[DIR_0P0] + f[DIR_0M0]) + (f[DIR_00P] + f[DIR_00M])) + f[DIR_000]) +
                          (vx1 * rhoToPhi * dX1_phi * c1o3 + vx2 * rhoToPhi * dX2_phi * c1o3 +
                           vx3 * rhoToPhi * dX3_phi * c1o3) /
                              2.0;
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
index 2d8f71843..39b83f72a 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
@@ -82,11 +82,11 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* cons
    //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
    press = rho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[NE])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
    kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))-(vx2*vx3));
    kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[NE])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
+   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))-(vx1*vx1-vx3*vx3));
    //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[DIR_P00])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3));
 
    //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[DIR_P00])-(f[B]+f[T])));
@@ -544,12 +544,12 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f
    D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
 
    f[DIR_P00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_P00];
-   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
-   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
-   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
-   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
-   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
-   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
+   f[DIR_M00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_PP0];
    f[DIR_MM0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_MM0];
    f[DIR_PM0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_PM0];
    f[DIR_MP0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_MP0];
@@ -738,12 +738,12 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal*
    f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
 
    f[DIR_P00]    = f_E    + feq[DIR_P00];
-   f[W]    = f_E    + feq[W];
-   f[N]    = f_N    + feq[N];
-   f[S]    = f_N    + feq[S];
-   f[T]    = f_T    + feq[T];
-   f[B]    = f_T    + feq[B];
-   f[NE]   = f_NE   + feq[NE];
+   f[DIR_M00]    = f_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + feq[DIR_PP0];
    f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
    f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
    f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
index 9a5396636..c37571337 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp
@@ -897,9 +897,9 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                f[DIR_000] = (*this->zeroDistributions)(x1, x2, x3);
 
                f[DIR_P00] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-               f[N] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-               f[T] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-               f[NE] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+               f[DIR_0P0] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+               f[DIR_00P] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+               f[DIR_PP0] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
                f[DIR_MP0] = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3);
                f[DIR_P0P] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
                f[DIR_M0P] = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -910,9 +910,9 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                f[DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3);
                f[DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-               f[W] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
-               f[S] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
-               f[B] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
+               f[DIR_M00] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3);
+               f[DIR_0M0] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3);
+               f[DIR_00M] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p);
                f[DIR_MM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3);
                f[DIR_PM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3);
                f[DIR_M0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p);
@@ -926,9 +926,9 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                //////////////////////////////////////////////////////////////////////////
 
                drho = ((f[DIR_PPP]+f[DIR_MMM])+(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])+(f[DIR_MMP]+f[DIR_PPM]))
-                  +(((f[NE]+f[DIR_MM0])+(f[DIR_PM0]+f[DIR_MP0]))+((f[DIR_P0P]+f[DIR_M0M])+(f[DIR_P0M]+f[DIR_M0P]))
-                     +((f[DIR_0PM]+f[DIR_0MP])+(f[DIR_0PP]+f[DIR_0MM])))+((f[DIR_P00]+f[W])+(f[N]+f[S])
-                        +(f[T]+f[B]))+f[DIR_000];
+                  +(((f[DIR_PP0]+f[DIR_MM0])+(f[DIR_PM0]+f[DIR_MP0]))+((f[DIR_P0P]+f[DIR_M0M])+(f[DIR_P0M]+f[DIR_M0P]))
+                     +((f[DIR_0PM]+f[DIR_0MP])+(f[DIR_0PP]+f[DIR_0MM])))+((f[DIR_P00]+f[DIR_M00])+(f[DIR_0P0]+f[DIR_0M0])
+                        +(f[DIR_00P]+f[DIR_00M]))+f[DIR_000];
 
                //vx1 = ((((f[TNE]-f[BSW])+(f[TSE]-f[BNW]))+((f[BSE]-f[TNW])+(f[BNE]-f[TSW])))+
                //   (((f[BE]-f[TW])+(f[TE]-f[BW]))+((f[SE]-f[NW])+(f[NE]-f[SW])))+
@@ -958,12 +958,12 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
 
                feq[DIR_000] = c8o27*(drho-cu_sq);
                feq[DIR_P00] = c2o27*(drho+3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq);
-               feq[W] = c2o27*(drho+3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq);
-               feq[N] = c2o27*(drho+3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq);
-               feq[S] = c2o27*(drho+3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq);
-               feq[T] = c2o27*(drho+3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq);
-               feq[B] = c2o27*(drho+3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq);
-               feq[NE] = c1o54*(drho+3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq);
+               feq[DIR_M00] = c2o27*(drho+3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq);
+               feq[DIR_0P0] = c2o27*(drho+3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq);
+               feq[DIR_0M0] = c2o27*(drho+3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq);
+               feq[DIR_00P] = c2o27*(drho+3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq);
+               feq[DIR_00M] = c2o27*(drho+3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq);
+               feq[DIR_PP0] = c1o54*(drho+3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq);
                feq[DIR_MM0] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
                feq[DIR_PM0] = c1o54*(drho+3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq);
                feq[DIR_MP0] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
@@ -987,12 +987,12 @@ void InitDensityLBMKernel::calculate(int  /*step*/)
                //Relaxation
                f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
                f[DIR_P00] += (feq[DIR_P00]-f[DIR_P00])*collFactor;
-               f[W] += (feq[W]-f[W])*collFactor;
-               f[N] += (feq[N]-f[N])*collFactor;
-               f[S] += (feq[S]-f[S])*collFactor;
-               f[T] += (feq[T]-f[T])*collFactor;
-               f[B] += (feq[B]-f[B])*collFactor;
-               f[NE] += (feq[NE]-f[NE])*collFactor;
+               f[DIR_M00] += (feq[DIR_M00]-f[DIR_M00])*collFactor;
+               f[DIR_0P0] += (feq[DIR_0P0]-f[DIR_0P0])*collFactor;
+               f[DIR_0M0] += (feq[DIR_0M0]-f[DIR_0M0])*collFactor;
+               f[DIR_00P] += (feq[DIR_00P]-f[DIR_00P])*collFactor;
+               f[DIR_00M] += (feq[DIR_00M]-f[DIR_00M])*collFactor;
+               f[DIR_PP0] += (feq[DIR_PP0]-f[DIR_PP0])*collFactor;
                f[DIR_MM0] += (feq[DIR_MM0]-f[DIR_MM0])*collFactor;
                f[DIR_PM0] += (feq[DIR_PM0]-f[DIR_PM0])*collFactor;
                f[DIR_MP0] += (feq[DIR_MP0]-f[DIR_MP0])*collFactor;
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
index 5a4034ec0..1fcdf118f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp
@@ -91,9 +91,9 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                f[DIR_000] = (*this->zeroDistributions)(x1,x2,x3);
 
                f[DIR_P00] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
-               f[N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
-               f[T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
-               f[NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
+               f[DIR_0P0] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);
+               f[DIR_00P] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
+               f[DIR_PP0] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
                f[DIR_MP0] = (*this->localDistributions)(D3Q27System::ET_NW,x1p,x2,x3);
                f[DIR_P0P] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
                f[DIR_M0P] = (*this->localDistributions)(D3Q27System::ET_TW, x1p,x2,x3);
@@ -104,9 +104,9 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                f[DIR_PMP] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2p,x3);
                f[DIR_MMP] = (*this->localDistributions)(D3Q27System::ET_TSW,x1p,x2p,x3);
 
-               f[W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,x3  );
-               f[S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2p,x3  );
-               f[B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3p  );
+               f[DIR_M00] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1p,x2,x3  );
+               f[DIR_0M0] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2p,x3  );
+               f[DIR_00M] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3p  );
                f[DIR_MM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1p,x2p,x3 );
                f[DIR_PM0] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2p,x3 );
                f[DIR_M0M] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1p,x2,x3p );
@@ -119,20 +119,20 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                f[DIR_PPM] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3p);
                //////////////////////////////////////////////////////////////////////////
 
-               drho = f[DIR_000] + f[DIR_P00] + f[W] + f[N] + f[S] + f[T] + f[B] 
-               + f[NE] + f[DIR_MM0] + f[DIR_PM0] + f[DIR_MP0] + f[DIR_P0P] + f[DIR_M0M] + f[DIR_P0M]
+               drho = f[DIR_000] + f[DIR_P00] + f[DIR_M00] + f[DIR_0P0] + f[DIR_0M0] + f[DIR_00P] + f[DIR_00M]
+               + f[DIR_PP0] + f[DIR_MM0] + f[DIR_PM0] + f[DIR_MP0] + f[DIR_P0P] + f[DIR_M0M] + f[DIR_P0M]
                + f[DIR_M0P] + f[DIR_0PP] + f[DIR_0MM] + f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP]
                + f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] + f[DIR_MMM] + f[DIR_PMM] + f[DIR_MPM];
 
-               vx1 = f[DIR_P00] - f[W] + f[NE] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M]
+               vx1 = f[DIR_P00] - f[DIR_M00] + f[DIR_PP0] - f[DIR_MM0] + f[DIR_PM0] - f[DIR_MP0] + f[DIR_P0P] - f[DIR_M0M]
                + f[DIR_P0M] - f[DIR_M0P] + f[DIR_PPP] - f[DIR_MMP] + f[DIR_PMP] - f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM]
                + f[DIR_PMM] - f[DIR_MPM]; 
 
-               vx2 = f[N] - f[S] + f[NE] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM]
+               vx2 = f[DIR_0P0] - f[DIR_0M0] + f[DIR_PP0] - f[DIR_MM0] - f[DIR_PM0] + f[DIR_MP0] + f[DIR_0PP] - f[DIR_0MM] + f[DIR_0PM]
                - f[DIR_0MP] + f[DIR_PPP] - f[DIR_MMP] - f[DIR_PMP] + f[DIR_MPP] + f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] 
                + f[DIR_MPM]; 
 
-               vx3 = f[T] - f[B] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] 
+               vx3 = f[DIR_00P] - f[DIR_00M] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM]
                + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] 
                - f[DIR_MPM];
 
@@ -140,12 +140,12 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
 
                feq[DIR_000] =  c8o27*(drho-cu_sq);
                feq[DIR_P00] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
-               feq[W] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
-               feq[N] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
-               feq[S] =  c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq);
-               feq[T] =  c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq);
-               feq[B] =  c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq);
-               feq[NE] = c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq);
+               feq[DIR_M00] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
+               feq[DIR_0P0] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
+               feq[DIR_0M0] =  c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq);
+               feq[DIR_00P] =  c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq);
+               feq[DIR_00M] =  c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq);
+               feq[DIR_PP0] = c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq);
                feq[DIR_MM0] = c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
                feq[DIR_PM0] = c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq);
                feq[DIR_MP0] = c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
@@ -169,12 +169,12 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                //Relaxation
                f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor;
                f[DIR_P00] += (feq[DIR_P00]-f[DIR_P00])*collFactor;
-               f[W] += (feq[W]-f[W])*collFactor;
-               f[N] += (feq[N]-f[N])*collFactor;
-               f[S] += (feq[S]-f[S])*collFactor;
-               f[T] += (feq[T]-f[T])*collFactor;
-               f[B] += (feq[B]-f[B])*collFactor;
-               f[NE] += (feq[NE]-f[NE])*collFactor;
+               f[DIR_M00] += (feq[DIR_M00]-f[DIR_M00])*collFactor;
+               f[DIR_0P0] += (feq[DIR_0P0]-f[DIR_0P0])*collFactor;
+               f[DIR_0M0] += (feq[DIR_0M0]-f[DIR_0M0])*collFactor;
+               f[DIR_00P] += (feq[DIR_00P]-f[DIR_00P])*collFactor;
+               f[DIR_00M] += (feq[DIR_00M]-f[DIR_00M])*collFactor;
+               f[DIR_PP0] += (feq[DIR_PP0]-f[DIR_PP0])*collFactor;
                f[DIR_MM0] += (feq[DIR_MM0]-f[DIR_MM0])*collFactor;
                f[DIR_PM0] += (feq[DIR_PM0]-f[DIR_PM0])*collFactor;
                f[DIR_MP0] += (feq[DIR_MP0]-f[DIR_MP0])*collFactor;
@@ -209,13 +209,13 @@ void LBMKernelETD3Q27BGK::calculate(int  /*step*/)
                   forcingX3 = muForcingX3.Eval();
 
                   f[DIR_000] +=                   0.0                        ;
-                  f[E  ] +=  3.0*c2o27  *  (forcingX1)                    ;
-                  f[W  ] +=  3.0*c2o27  *  (-forcingX1)                   ;
-                  f[N  ] +=  3.0*c2o27  *             (forcingX2)         ;
-                  f[S  ] +=  3.0*c2o27  *             (-forcingX2)        ;
-                  f[T  ] +=  3.0*c2o27  *                     (forcingX3) ;
-                  f[B  ] +=  3.0*c2o27  *                     (-forcingX3);
-                  f[NE ] +=  3.0*c1o54 * ( forcingX1+forcingX2          ) ;
+                  f[DIR_P00] +=  3.0*c2o27  *  (forcingX1)                    ;
+                  f[DIR_M00] +=  3.0*c2o27  *  (-forcingX1)                   ;
+                  f[DIR_0P0] +=  3.0*c2o27  *             (forcingX2)         ;
+                  f[DIR_0M0] +=  3.0*c2o27  *             (-forcingX2)        ;
+                  f[DIR_00P] +=  3.0*c2o27  *                     (forcingX3) ;
+                  f[DIR_00M] +=  3.0*c2o27  *                     (-forcingX3);
+                  f[DIR_PP0] +=  3.0*c1o54 * ( forcingX1+forcingX2          ) ;
                   f[DIR_MM0 ] +=  3.0*c1o54 * (-forcingX1-forcingX2          ) ;
                   f[DIR_PM0 ] +=  3.0*c1o54 * ( forcingX1-forcingX2          ) ;
                   f[DIR_MP0 ] +=  3.0*c1o54 * (-forcingX1+forcingX2          ) ;
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
index b1270904a..10f1e395d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
@@ -317,9 +317,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         //--------------------------------------------------------
 
                         mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+                        mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[DIR_0P0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+                        mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[DIR_00P]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+                        mfccb = 3.0 * (mfccb + 0.5 * forcingTerm[DIR_PP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
                         mfacb = 3.0 * (mfacb + 0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
                         mfcbc = 3.0 * (mfcbc + 0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
                         mfabc = 3.0 * (mfabc + 0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
@@ -329,9 +329,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         mfacc = 3.0 * (mfacc + 0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
                         mfcac = 3.0 * (mfcac + 0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
                         mfaac = 3.0 * (mfaac + 0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-                        mfabb = 3.0 * (mfabb + 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-                        mfbab = 3.0 * (mfbab + 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-                        mfbba = 3.0 * (mfbba + 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+                        mfabb = 3.0 * (mfabb + 0.5 * forcingTerm[DIR_M00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+                        mfbab = 3.0 * (mfbab + 0.5 * forcingTerm[DIR_0M0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+                        mfbba = 3.0 * (mfbba + 0.5 * forcingTerm[DIR_00M]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
                         mfaab = 3.0 * (mfaab + 0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
                         mfcab = 3.0 * (mfcab + 0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
                         mfaba = 3.0 * (mfaba + 0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
@@ -1025,9 +1025,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
 #endif
 
                         mfcbb = rho * c1o3 * (mfcbb) + 0.5 * forcingTerm[DIR_P00];
-                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[N];
-                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[T];
-                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[NE];
+                        mfbcb = rho * c1o3 * (mfbcb) + 0.5 * forcingTerm[DIR_0P0];
+                        mfbbc = rho * c1o3 * (mfbbc) + 0.5 * forcingTerm[DIR_00P];
+                        mfccb = rho * c1o3 * (mfccb) + 0.5 * forcingTerm[DIR_PP0];
                         mfacb = rho * c1o3 * (mfacb) + 0.5 * forcingTerm[DIR_MP0];
                         mfcbc = rho * c1o3 * (mfcbc) + 0.5 * forcingTerm[DIR_P0P];
                         mfabc = rho * c1o3 * (mfabc) + 0.5 * forcingTerm[DIR_M0P];
@@ -1037,9 +1037,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         mfacc = rho * c1o3 * (mfacc) + 0.5 * forcingTerm[DIR_MPP];
                         mfcac = rho * c1o3 * (mfcac) + 0.5 * forcingTerm[DIR_PMP];
                         mfaac = rho * c1o3 * (mfaac) + 0.5 * forcingTerm[DIR_MMP];
-                        mfabb = rho * c1o3 * (mfabb) + 0.5 * forcingTerm[W];
-                        mfbab = rho * c1o3 * (mfbab) + 0.5 * forcingTerm[S];
-                        mfbba = rho * c1o3 * (mfbba) + 0.5 * forcingTerm[B];
+                        mfabb = rho * c1o3 * (mfabb) + 0.5 * forcingTerm[DIR_M00];
+                        mfbab = rho * c1o3 * (mfbab) + 0.5 * forcingTerm[DIR_0M0];
+                        mfbba = rho * c1o3 * (mfbba) + 0.5 * forcingTerm[DIR_00M];
                         mfaab = rho * c1o3 * (mfaab) + 0.5 * forcingTerm[DIR_MM0];
                         mfcab = rho * c1o3 * (mfcab) + 0.5 * forcingTerm[DIR_PM0];
                         mfaba = rho * c1o3 * (mfaba) + 0.5 * forcingTerm[DIR_M0M];
@@ -1092,9 +1092,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         /////////////////////   PHASE-FIELD BGK SOLVER ///////////////////////////////
 
                         h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
-                        h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
-                        h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
-                        h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
+                        h[DIR_0P0]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
+                        h[DIR_00P]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
+                        h[DIR_PP0]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
                         h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
                         h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
                         h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -1105,9 +1105,9 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
                         h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                        h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
-                        h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
-                        h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
+                        h[DIR_M00]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
+                        h[DIR_0M0]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
+                        h[DIR_00M]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
                         h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
                         h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
                         h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
@@ -1243,9 +1243,9 @@ void MultiphaseCumulantLBMKernel::computePhasefield()
                     int x3p = x3 + 1;
 
                     h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
-                    h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
-                    h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
-                    h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[DIR_0P0]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
+                    h[DIR_00P]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
+                    h[DIR_PP0]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
                     h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
                     h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
                     h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -1256,9 +1256,9 @@ void MultiphaseCumulantLBMKernel::computePhasefield()
                     h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
                     h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
-                    h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
-                    h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[DIR_M00]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[DIR_0M0]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[DIR_00M]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
                     h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
                     h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
                     h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
index 04cfbdf2d..bd4df8aea 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp
@@ -1476,48 +1476,48 @@ LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi()
 {
 	using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
-		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
-		+WEIGTH[N] * (phi2[N] - phi2[S]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
-		+WEIGTH[N] * (phi2[T] - phi2[B]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
 }
 
 LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::nabla2_phi()
@@ -1529,12 +1529,12 @@ LBMReal MultiphasePressureFilterCompressibleAirLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 		(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+		((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1563,9 +1563,9 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::computePhasefield()
 					int x3p = x3 + 1;
 
 					h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
-					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
-					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
-					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
 					h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
 					h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
 					h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -1576,9 +1576,9 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::computePhasefield()
 					h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
 					h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
-					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
-					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
 					h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
 					h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
 					h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index e5fcc71d8..918a162e3 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -1625,24 +1625,24 @@ LBMReal MultiphasePressureFilterLBMKernel::gradX1_phi()
 {
 	using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
 }
 
 LBMReal MultiphasePressureFilterLBMKernel::gradX2_phi()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
 }
 
 LBMReal MultiphasePressureFilterLBMKernel::gradX3_phi()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
 }
 
 LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
@@ -1654,12 +1654,12 @@ LBMReal MultiphasePressureFilterLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 		(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-		((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+		((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
 
 	return 6.0 * sum;
@@ -1688,9 +1688,9 @@ void MultiphasePressureFilterLBMKernel::computePhasefield()
 					int x3p = x3 + 1;
 
 					h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
-					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
-					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
-					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
 					h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
 					h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
 					h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -1701,9 +1701,9 @@ void MultiphasePressureFilterLBMKernel::computePhasefield()
 					h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
 					h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
-					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
-					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
 					h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
 					h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
 					h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
index caa9272f5..c1c2010e1 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
@@ -749,9 +749,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 
 
 			   mfcbb +=3.0 * ( 0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-			   mfbcb +=3.0 * ( 0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-			   mfbbc +=3.0 * ( 0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-			   mfccb +=3.0 * ( 0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfbcb +=3.0 * ( 0.5 * forcingTerm[DIR_0P0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc +=3.0 * ( 0.5 * forcingTerm[DIR_00P]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb +=3.0 * ( 0.5 * forcingTerm[DIR_PP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
 			   mfacb +=3.0 * ( 0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
 			   mfcbc +=3.0 * ( 0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
 			   mfabc +=3.0 * ( 0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
@@ -761,9 +761,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   mfacc +=3.0 * ( 0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
 			   mfcac +=3.0 * ( 0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
 			   mfaac +=3.0 * ( 0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-			   mfabb +=3.0 * ( 0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-			   mfbab +=3.0 * ( 0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-			   mfbba +=3.0 * ( 0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfabb +=3.0 * ( 0.5 * forcingTerm[DIR_M00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab +=3.0 * ( 0.5 * forcingTerm[DIR_0M0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba +=3.0 * ( 0.5 * forcingTerm[DIR_00M]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
 			   mfaab +=3.0 * ( 0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
 			   mfcab +=3.0 * ( 0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
 			   mfaba +=3.0 * ( 0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
@@ -1620,9 +1620,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   /////classical source term 8.4.2021
 
 			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfbcb += 3.0 * (0.5 * forcingTerm[DIR_0P0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc += 3.0 * (0.5 * forcingTerm[DIR_00P]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb += 3.0 * (0.5 * forcingTerm[DIR_PP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
 			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
 			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
 			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
@@ -1632,9 +1632,9 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
 			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
 			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfabb += 3.0 * (0.5 * forcingTerm[DIR_M00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab += 3.0 * (0.5 * forcingTerm[DIR_0M0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba += 3.0 * (0.5 * forcingTerm[DIR_00M]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
 			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
 			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
 			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
@@ -2922,8 +2922,8 @@ LBMReal MultiphaseScratchCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -2935,8 +2935,8 @@ LBMReal MultiphaseScratchCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX2[k] * phi[k];
@@ -2948,8 +2948,8 @@ LBMReal MultiphaseScratchCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX3[k] * phi[k];
@@ -2966,12 +2966,12 @@ LBMReal MultiphaseScratchCumulantLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3002,9 +3002,9 @@ void MultiphaseScratchCumulantLBMKernel::computePhasefield()
                     int x3p = x3 + 1;
 
                     h[DIR_P00]   = (*this->localDistributionsH)(D3Q27System::ET_E, x1, x2, x3);
-                    h[N]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
-                    h[T]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
-                    h[NE]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[DIR_0P0]   = (*this->localDistributionsH)(D3Q27System::ET_N, x1, x2, x3);
+                    h[DIR_00P]   = (*this->localDistributionsH)(D3Q27System::ET_T, x1, x2, x3);
+                    h[DIR_PP0]  = (*this->localDistributionsH)(D3Q27System::ET_NE, x1, x2, x3);
                     h[DIR_MP0]  = (*this->localDistributionsH)(D3Q27System::ET_NW, x1p, x2, x3);
                     h[DIR_P0P]  = (*this->localDistributionsH)(D3Q27System::ET_TE, x1, x2, x3);
                     h[DIR_M0P]  = (*this->localDistributionsH)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -3015,9 +3015,9 @@ void MultiphaseScratchCumulantLBMKernel::computePhasefield()
                     h[DIR_PMP] = (*this->localDistributionsH)(D3Q27System::ET_TSE, x1, x2p, x3);
                     h[DIR_MMP] = (*this->localDistributionsH)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    h[W]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
-                    h[S]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
-                    h[B]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[DIR_M00]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[DIR_0M0]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[DIR_00M]   = (*this->nonLocalDistributionsH)(D3Q27System::ET_B, x1, x2, x3p);
                     h[DIR_MM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SW, x1p, x2p, x3);
                     h[DIR_PM0]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_SE, x1, x2p, x3);
                     h[DIR_M0M]  = (*this->nonLocalDistributionsH)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index 08c196105..229ff921a 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -601,9 +601,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 
 
 			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfbcb += 3.0 * (0.5 * forcingTerm[DIR_0P0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc += 3.0 * (0.5 * forcingTerm[DIR_00P]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb += 3.0 * (0.5 * forcingTerm[DIR_PP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
 			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
 			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
 			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
@@ -613,9 +613,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
 			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
 			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfabb += 3.0 * (0.5 * forcingTerm[DIR_M00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab += 3.0 * (0.5 * forcingTerm[DIR_0M0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba += 3.0 * (0.5 * forcingTerm[DIR_00M]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
 			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
 			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
 			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
@@ -1345,9 +1345,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   /////classical source term 8.4.2021
 
 			   mfcbb += 3.0 * (0.5 * forcingTerm[DIR_P00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[E  ];
-			   mfbcb += 3.0 * (0.5 * forcingTerm[N]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
-			   mfbbc += 3.0 * (0.5 * forcingTerm[T]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
-			   mfccb += 3.0 * (0.5 * forcingTerm[NE]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
+			   mfbcb += 3.0 * (0.5 * forcingTerm[DIR_0P0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[N  ];
+			   mfbbc += 3.0 * (0.5 * forcingTerm[DIR_00P]) / rho;    //-(3.0*p1 - rho)*WEIGTH[T  ];
+			   mfccb += 3.0 * (0.5 * forcingTerm[DIR_PP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NE ];
 			   mfacb += 3.0 * (0.5 * forcingTerm[DIR_MP0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[NW ];
 			   mfcbc += 3.0 * (0.5 * forcingTerm[DIR_P0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TE ];
 			   mfabc += 3.0 * (0.5 * forcingTerm[DIR_M0P]) / rho;   //-(3.0*p1 - rho)*WEIGTH[TW ];
@@ -1357,9 +1357,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   mfacc += 3.0 * (0.5 * forcingTerm[DIR_MPP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TNW];
 			   mfcac += 3.0 * (0.5 * forcingTerm[DIR_PMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSE];
 			   mfaac += 3.0 * (0.5 * forcingTerm[DIR_MMP]) / rho;  //-(3.0*p1 - rho)*WEIGTH[TSW];
-			   mfabb += 3.0 * (0.5 * forcingTerm[W]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
-			   mfbab += 3.0 * (0.5 * forcingTerm[S]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
-			   mfbba += 3.0 * (0.5 * forcingTerm[B]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
+			   mfabb += 3.0 * (0.5 * forcingTerm[DIR_M00]) / rho;    //-(3.0*p1 - rho)*WEIGTH[W  ];
+			   mfbab += 3.0 * (0.5 * forcingTerm[DIR_0M0]) / rho;    //-(3.0*p1 - rho)*WEIGTH[S  ];
+			   mfbba += 3.0 * (0.5 * forcingTerm[DIR_00M]) / rho;    //-(3.0*p1 - rho)*WEIGTH[B  ];
 			   mfaab += 3.0 * (0.5 * forcingTerm[DIR_MM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SW ];
 			   mfcab += 3.0 * (0.5 * forcingTerm[DIR_PM0]) / rho;   //-(3.0*p1 - rho)*WEIGTH[SE ];
 			   mfaba += 3.0 * (0.5 * forcingTerm[DIR_M0M]) / rho;   //-(3.0*p1 - rho)*WEIGTH[BW ];
@@ -2985,8 +2985,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -2998,8 +2998,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX2[k] * phi[k];
@@ -3011,8 +3011,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX3[k] * phi[k];
@@ -3024,8 +3024,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
-		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3037,8 +3037,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
-		+WEIGTH[N] * (phi2[N] - phi2[S]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
@@ -3050,8 +3050,8 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
-		+WEIGTH[N] * (phi2[T] - phi2[B]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
@@ -3072,12 +3072,12 @@ LBMReal MultiphaseTwoPhaseFieldsCumulantLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3108,9 +3108,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::computePhasefield()
                     int x3p = x3 + 1;
 
                     h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
-                    h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
-                    h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
-                    h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                    h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                    h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
                     h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
                     h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
                     h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -3121,9 +3121,9 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::computePhasefield()
                     h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
                     h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
-                    h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
-                    h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
                     h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
                     h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
                     h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
index 2f9d1d394..3baddc4fe 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp
@@ -3350,8 +3350,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -3363,8 +3363,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX2[k] * phi[k];
@@ -3376,8 +3376,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX3[k] * phi[k];
@@ -3389,8 +3389,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
-		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3402,8 +3402,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
-		+WEIGTH[N] * (phi2[N] - phi2[S]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
@@ -3415,8 +3415,8 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
-		+WEIGTH[N] * (phi2[T] - phi2[B]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
@@ -3437,12 +3437,12 @@ LBMReal MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3473,9 +3473,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::computePhasefield()
                     int x3p = x3 + 1;
 
                     h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
-                    h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
-                    h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
-                    h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                    h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                    h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
                     h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
                     h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
                     h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -3486,9 +3486,9 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::computePhasefield()
                     h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
                     h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
-                    h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
-                    h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
                     h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
                     h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
                     h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
index 7fdd5f2ee..ffed1483c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp
@@ -3282,8 +3282,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi()
 {
     using namespace D3Q27System;
 	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[NE] - phi[DIR_MM0])))) +
-		+WEIGTH[N] * (phi[DIR_P00] - phi[W]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX1[k] * phi[k];
@@ -3295,8 +3295,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[NE] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
-		+WEIGTH[N] * (phi[N] - phi[S]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX2[k] * phi[k];
@@ -3308,8 +3308,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi()
 {
     using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
-		+WEIGTH[N] * (phi[T] - phi[B]));
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
     //LBMReal sum = 0.0;
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * DX3[k] * phi[k];
@@ -3321,8 +3321,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX1_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[NE] - phi2[DIR_MM0])))) +
-		+WEIGTH[N] * (phi2[DIR_P00] - phi2[W]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX1[k] * phi2[k];
@@ -3334,8 +3334,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX2_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
-		+ WEIGTH[NE] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[NE] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
-		+WEIGTH[N] * (phi2[N] - phi2[S]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX2[k] * phi2[k];
@@ -3347,8 +3347,8 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::gradX3_phi2()
 {
 	using namespace D3Q27System;
 	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
-		+ WEIGTH[NE] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
-		+WEIGTH[N] * (phi2[T] - phi2[B]));
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
 	//LBMReal sum = 0.0;
 	//for (int k = FSTARTDIR; k <= FENDDIR; k++) {
 	//    sum += WEIGTH[k] * DX3[k] * phi2[k];
@@ -3369,12 +3369,12 @@ LBMReal MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::nabla2_phi()
 	sum += WEIGTH[DIR_0PP] * (
 			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
 		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
-		+	(((phi[NE] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
 		);
-	sum += WEIGTH[T] * (
-			((phi[T] - phi[DIR_000]) + (phi[B] - phi[DIR_000]))
-		+	((phi[N] - phi[DIR_000]) + (phi[S] - phi[DIR_000]))
-		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[W] - phi[DIR_000]))
+	sum += WEIGTH[DIR_00P] * (
+			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
 		);
     //for (int k = FSTARTDIR; k <= FENDDIR; k++) {
     //    sum += WEIGTH[k] * (phi[k] - phi[REST]);
@@ -3405,9 +3405,9 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::computePhasefield()
                     int x3p = x3 + 1;
 
                     h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
-                    h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
-                    h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
-                    h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+                    h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+                    h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+                    h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
                     h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
                     h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
                     h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
@@ -3418,9 +3418,9 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::computePhasefield()
                     h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
                     h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
 
-                    h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
-                    h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
-                    h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+                    h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+                    h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+                    h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
                     h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
                     h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
                     h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
index 30b9c875a..09cd40c8e 100644
--- a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp
@@ -121,11 +121,11 @@ void RheologyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal
 
    press = rho; //interpolate rho!
 
-   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[NE])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
+   kxy   = -3.*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))-(vx1*vx2));// might not be optimal MG 25.2.13
    kyz   = -3.*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))-(vx2*vx3));
    kxz   = -3.*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[NE])-(f[DIR_0MP]+f[DIR_0PM])))+((f[W]+f[DIR_P00])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
+   kxxMyy = -3./2.*omega*((((f[D3Q27System::DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))-(vx1*vx1-vx3*vx3));
 }
 //////////////////////////////////////////////////////////////////////////
 void RheologyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell,
@@ -444,12 +444,12 @@ void RheologyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMReal
    D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
 
    f[DIR_P00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_P00];
-   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
-   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
-   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
-   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
-   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
-   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
+   f[DIR_M00]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_PP0];
    f[DIR_MM0]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[DIR_MM0];
    f[DIR_PM0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_PM0];
    f[DIR_MP0]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[DIR_MP0];
@@ -633,12 +633,12 @@ void RheologyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal
    f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
 
    f[DIR_P00]    = f_E    + feq[DIR_P00];
-   f[W]    = f_E    + feq[W];
-   f[N]    = f_N    + feq[N];
-   f[S]    = f_N    + feq[S];
-   f[T]    = f_T    + feq[T];
-   f[B]    = f_T    + feq[B];
-   f[NE]   = f_NE   + feq[NE];
+   f[DIR_M00]    = f_E    + feq[DIR_M00];
+   f[DIR_0P0]    = f_N    + feq[DIR_0P0];
+   f[DIR_0M0]    = f_N    + feq[DIR_0M0];
+   f[DIR_00P]    = f_T    + feq[DIR_00P];
+   f[DIR_00M]    = f_T    + feq[DIR_00M];
+   f[DIR_PP0]   = f_NE   + feq[DIR_PP0];
    f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
    f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
    f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
index 358c61516..0ba49c1a0 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp
@@ -248,12 +248,12 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D>
 
 
                f[DIR_P00]    = f_E    + feq[DIR_P00];
-               f[W]    = f_E    + feq[W];
-               f[N]    = f_N    + feq[N];
-               f[S]    = f_N    + feq[S];
-               f[T]    = f_T    + feq[T];
-               f[B]    = f_T    + feq[B];
-               f[NE]   = f_NE   + feq[NE];
+               f[DIR_M00]    = f_E    + feq[DIR_M00];
+               f[DIR_0P0]    = f_N    + feq[DIR_0P0];
+               f[DIR_0M0]    = f_N    + feq[DIR_0M0];
+               f[DIR_00P]    = f_T    + feq[DIR_00P];
+               f[DIR_00M]    = f_T    + feq[DIR_00M];
+               f[DIR_PP0]   = f_NE   + feq[DIR_PP0];
                f[DIR_MM0]   = f_NE   + feq[DIR_MM0];
                f[DIR_PM0]   = f_SE   + feq[DIR_PM0];
                f[DIR_MP0]   = f_SE   + feq[DIR_MP0];
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
index 451ccfc1f..8cd256a9b 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
@@ -256,9 +256,9 @@ void MetisPartitioningGridVisitor::clear()
 int MetisPartitioningGridVisitor::getEdgeWeight(int dir)
 {
     using namespace D3Q27System;
-    if (dir <= B) {
+    if (dir <= DIR_00M) {
         return 100;
-    } else if (dir >= NE && dir <= DIR_0MP) {
+    } else if (dir >= DIR_PP0 && dir <= DIR_0MP) {
         return 10;
     } else if (dir >= DIR_PPP) {
         return 1;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
index e321725b6..a35fc289b 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp
@@ -228,12 +228,12 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 
 
 					f[DIR_P00]    =  geq[DIR_P00]    ;
-					f[W]    =  geq[W]    ;
-					f[N]    =  geq[N]    ;
-					f[S]    =  geq[S]    ;
-					f[T]    =  geq[T]    ;
-					f[B]    =  geq[B]    ;
-					f[NE]   =  geq[NE]   ;
+					f[DIR_M00]    =  geq[DIR_M00]    ;
+					f[DIR_0P0]    =  geq[DIR_0P0]    ;
+					f[DIR_0M0]    =  geq[DIR_0M0]    ;
+					f[DIR_00P]    =  geq[DIR_00P]    ;
+					f[DIR_00M]    =  geq[DIR_00M]    ;
+					f[DIR_PP0]   =  geq[DIR_PP0]   ;
 					f[DIR_MM0]   =  geq[DIR_MM0]   ;
 					f[DIR_PM0]   =  geq[DIR_PM0]   ;
 					f[DIR_MP0]   =  geq[DIR_MP0]   ;
@@ -259,12 +259,12 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
 
 					f[DIR_P00]    =  phi * feq[DIR_P00]    / rho;
-					f[W]    =  phi * feq[W]    / rho;
-					f[N]    =  phi * feq[N]    / rho;
-					f[S]    =  phi * feq[S]    / rho;
-					f[T]    =  phi * feq[T]    / rho;
-					f[B]    =  phi * feq[B]    / rho;
-					f[NE]   =  phi * feq[NE]   / rho;
+					f[DIR_M00]    =  phi * feq[DIR_M00]    / rho;
+					f[DIR_0P0]    =  phi * feq[DIR_0P0]    / rho;
+					f[DIR_0M0]    =  phi * feq[DIR_0M0]    / rho;
+					f[DIR_00P]    =  phi * feq[DIR_00P]    / rho;
+					f[DIR_00M]    =  phi * feq[DIR_00M]    / rho;
+					f[DIR_PP0]   =  phi * feq[DIR_PP0]   / rho;
 					f[DIR_MM0]   =  phi * feq[DIR_MM0]   / rho;
 					f[DIR_PM0]   =  phi * feq[DIR_PM0]   / rho;
 					f[DIR_MP0]   =  phi * feq[DIR_MP0]   / rho;
@@ -292,12 +292,12 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt
 					if (distributionsH2) {
 
 						f[DIR_P00]    = (1.-phi) * feq[DIR_P00] / rho;
-						f[W]    = (1.-phi) * feq[W] / rho;
-						f[N]    = (1.-phi) * feq[N] / rho;
-						f[S]    = (1.-phi) * feq[S] / rho;
-						f[T]    = (1.-phi) * feq[T] / rho;
-						f[B]    = (1.-phi) * feq[B] / rho;
-						f[NE]   = (1.-phi) * feq[NE] / rho;
+						f[DIR_M00]    = (1.-phi) * feq[DIR_M00] / rho;
+						f[DIR_0P0]    = (1.-phi) * feq[DIR_0P0] / rho;
+						f[DIR_0M0]    = (1.-phi) * feq[DIR_0M0] / rho;
+						f[DIR_00P]    = (1.-phi) * feq[DIR_00P] / rho;
+						f[DIR_00M]    = (1.-phi) * feq[DIR_00M] / rho;
+						f[DIR_PP0]   = (1.-phi) * feq[DIR_PP0] / rho;
 						f[DIR_MM0]   = (1.-phi) * feq[DIR_MM0] / rho;
 						f[DIR_PM0]   = (1.-phi) * feq[DIR_PM0] / rho;
 						f[DIR_MP0]   = (1.-phi) * feq[DIR_MP0] / rho;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
index dd9fb72af..623fcade6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
@@ -220,12 +220,12 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 
 
 					f[DIR_P00]    =  geq[DIR_P00]    ;
-					f[W]    =  geq[W]    ;
-					f[N]    =  geq[N]    ;
-					f[S]    =  geq[S]    ;
-					f[T]    =  geq[T]    ;
-					f[B]    =  geq[B]    ;
-					f[NE]   =  geq[NE]   ;
+					f[DIR_00M]    =  geq[DIR_00M]    ;
+					f[DIR_0P0]    =  geq[DIR_0P0]    ;
+					f[DIR_0M0]    =  geq[DIR_0M0]    ;
+					f[DIR_00P]    =  geq[DIR_00P]    ;
+					f[DIR_00M]    =  geq[DIR_00M]    ;
+					f[DIR_PP0]   =  geq[DIR_PP0]   ;
 					f[DIR_MM0]   =  geq[DIR_MM0]   ;
 					f[DIR_PM0]   =  geq[DIR_PM0]   ;
 					f[DIR_MP0]   =  geq[DIR_MP0]   ;
@@ -251,12 +251,12 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
 
 					f[DIR_P00]    =  phi * feq[DIR_P00]    ;// / rho;
-					f[W]    =  phi * feq[W]    ;// / rho;
-					f[N]    =  phi * feq[N]    ;// / rho;
-					f[S]    =  phi * feq[S]    ;// / rho;
-					f[T]    =  phi * feq[T]    ;// / rho;
-					f[B]    =  phi * feq[B]    ;// / rho;
-					f[NE]   =  phi * feq[NE]   ;// / rho;
+					f[DIR_M00]    =  phi * feq[DIR_M00]    ;// / rho;
+					f[DIR_0P0]    =  phi * feq[DIR_0P0]    ;// / rho;
+					f[DIR_0M0]    =  phi * feq[DIR_0M0]    ;// / rho;
+					f[DIR_00P]    =  phi * feq[DIR_00P]    ;// / rho;
+					f[DIR_00M]    =  phi * feq[DIR_00M]    ;// / rho;
+					f[DIR_PP0]   =  phi * feq[DIR_PP0]   ;// / rho;
 					f[DIR_MM0]   =  phi * feq[DIR_MM0]   ;// / rho;
 					f[DIR_PM0]   =  phi * feq[DIR_PM0]   ;// / rho;
 					f[DIR_MP0]   =  phi * feq[DIR_MP0]   ;// / rho;
@@ -284,12 +284,12 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					if (distributionsH2) {
 
 						f[DIR_P00]    = (1.-phi) * feq[DIR_P00]   ;// / rho;
-						f[W]    = (1.-phi) * feq[W]   ;// / rho;
-						f[N]    = (1.-phi) * feq[N]   ;// / rho;
-						f[S]    = (1.-phi) * feq[S]   ;// / rho;
-						f[T]    = (1.-phi) * feq[T]   ;// / rho;
-						f[B]    = (1.-phi) * feq[B]   ;// / rho;
-						f[NE]   = (1.-phi) * feq[NE]  ;// / rho;
+						f[DIR_M00]    = (1.-phi) * feq[DIR_M00]   ;// / rho;
+						f[DIR_0P0]    = (1.-phi) * feq[DIR_0P0]   ;// / rho;
+						f[DIR_0M0]    = (1.-phi) * feq[DIR_0M0]   ;// / rho;
+						f[DIR_00P]    = (1.-phi) * feq[DIR_00P]   ;// / rho;
+						f[DIR_00M]    = (1.-phi) * feq[DIR_00M]   ;// / rho;
+						f[DIR_PP0]   = (1.-phi) * feq[DIR_PP0]  ;// / rho;
 						f[DIR_MM0]   = (1.-phi) * feq[DIR_MM0]  ;// / rho;
 						f[DIR_PM0]   = (1.-phi) * feq[DIR_PM0]  ;// / rho;
 						f[DIR_MP0]   = (1.-phi) * feq[DIR_MP0]  ;// / rho;
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
index 07aec29ef..689d84d07 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
@@ -32,103 +32,103 @@ void SetInterpolationDirsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bl
             if (p_nblock) {
                 bool flagDir;
                 switch (dir) {
-                    case NE:
-                        checkFlagDir(grid, E, N, flagDir, ix1, ix2, ix3, level);
+                    case DIR_PP0:
+                        checkFlagDir(grid, DIR_P00, DIR_0P0, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MM0:
-                        checkFlagDir(grid, W, S, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0M0, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_PM0:
-                        checkFlagDir(grid, E, S, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_0M0, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MP0:
-                        checkFlagDir(grid, W, N, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0P0, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_P0P:
-                        checkFlagDir(grid, E, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_M0M:
-                        checkFlagDir(grid, W, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_P0M:
-                        checkFlagDir(grid, E, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_M0P:
-                        checkFlagDir(grid, W, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_0PP:
-                        checkFlagDir(grid, N, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_0P0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_0MM:
-                        checkFlagDir(grid, S, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_0M0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_0PM:
-                        checkFlagDir(grid, N, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_0P0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_0MP:
-                        checkFlagDir(grid, S, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_0M0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_PPP:
-                        checkFlagDir(grid, E, N, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_0P0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MMP:
-                        checkFlagDir(grid, W, S, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0M0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_PMP:
-                        checkFlagDir(grid, E, S, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_0M0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MPP:
-                        checkFlagDir(grid, W, N, T, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0P0, DIR_00P, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_PPM:
-                        checkFlagDir(grid, E, N, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_0P0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MMM:
-                        checkFlagDir(grid, W, S, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0M0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_PMM:
-                        checkFlagDir(grid, E, S, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_P00, DIR_0M0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
                     case DIR_MPM:
-                        checkFlagDir(grid, W, N, B, flagDir, ix1, ix2, ix3, level);
+                        checkFlagDir(grid, DIR_M00, DIR_0P0, DIR_00M, flagDir, ix1, ix2, ix3, level);
                         if (!flagDir)
                             continue;
                         break;
-- 
GitLab


From 3a2b0d33041860de577f542370f8e1e775e96170 Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Oct 2022 13:57:13 +0200
Subject: [PATCH 086/179] adds apps: Falling Sphere, Nozzle

---
 apps/cpu/Applications.cmake                   |   2 +
 apps/cpu/FallingSphere/CMakeLists.txt         |   3 +
 apps/cpu/FallingSphere/FallingSphere.cpp      | 175 ++++++++++++
 apps/cpu/FallingSphere/in.lbdem               |  75 +++++
 apps/cpu/FallingSphere/in2.lbdem              |  25 ++
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          |  35 ++-
 apps/cpu/LiggghtsApp/in.lbdem                 |   8 +-
 apps/cpu/LiggghtsApp/in2.lbdem                |   8 +-
 apps/cpu/Nozzle/CMakeLists.txt                |   3 +
 apps/cpu/Nozzle/in.nozzle                     | 125 ++++++++
 apps/cpu/Nozzle/nozzle.cpp                    | 268 ++++++++++++++++++
 apps/cpu/ViskomatXL/viskomat.cfg              |   3 +-
 apps/cpu/ViskomatXL/viskomat.cpp              |   2 +-
 .../LiggghtsCouplingCoProcessor.cpp           |   8 -
 .../VirtualFluidsCore/Utilities/MemoryUtil.h  |  45 +++
 .../Visitors/SetKernelBlockVisitor.cpp        |   4 +-
 .../Visitors/SetKernelBlockVisitor.h          |   2 +-
 17 files changed, 757 insertions(+), 34 deletions(-)
 create mode 100644 apps/cpu/FallingSphere/CMakeLists.txt
 create mode 100644 apps/cpu/FallingSphere/FallingSphere.cpp
 create mode 100644 apps/cpu/FallingSphere/in.lbdem
 create mode 100644 apps/cpu/FallingSphere/in2.lbdem
 create mode 100644 apps/cpu/Nozzle/CMakeLists.txt
 create mode 100644 apps/cpu/Nozzle/in.nozzle
 create mode 100644 apps/cpu/Nozzle/nozzle.cpp

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index 37fc4de29..143f20a9e 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -10,6 +10,8 @@ add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
 add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
 add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
 add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
+add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
+add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
 
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
diff --git a/apps/cpu/FallingSphere/CMakeLists.txt b/apps/cpu/FallingSphere/CMakeLists.txt
new file mode 100644
index 000000000..94eab3ae0
--- /dev/null
+++ b/apps/cpu/FallingSphere/CMakeLists.txt
@@ -0,0 +1,3 @@
+PROJECT(FallingSphere)
+
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling FILES FallingSphere.cpp )
diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp
new file mode 100644
index 000000000..88b5373c9
--- /dev/null
+++ b/apps/cpu/FallingSphere/FallingSphere.cpp
@@ -0,0 +1,175 @@
+#include <iostream>
+#include <string>
+#include <memory>
+
+#include "VirtualFluids.h"
+
+#include "LiggghtsCouplingCoProcessor.h"
+#include "LiggghtsCouplingWrapper.h"
+#include "IBcumulantK17LBMKernel.h"
+
+using namespace std;
+
+
+int main(int argc, char *argv[])
+{
+    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    int myid                                        = comm->getProcessID();
+
+
+    // bounding box
+    double g_minX1 = 0;
+    double g_minX2 = 0;
+    double g_minX3 = 0;
+
+    double g_maxX1 = 1;
+    double g_maxX2 = 1;
+    double g_maxX3 = 2;
+
+    //int blockNX[3] = { 16, 16, 16 };
+    //double dx = 1./32.;
+
+    double d_part = 0.1;
+    double r_p    = d_part / 2.0;
+
+    int blockNX[3] = { 10, 10, 10 };
+    double dx      = 0.05;
+
+
+    double nuLB = 1e-2;
+
+    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
+    SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
+    kernel->setBCProcessor(bcProc);
+
+    SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+    noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+    //////////////////////////////////////////////////////////////////////////////////
+    // BC visitor
+    BoundaryConditionsBlockVisitor bcVisitor;
+    bcVisitor.addBC(noSlipBCAdapter);
+
+    SPtr<Grid3D> grid = make_shared<Grid3D>(comm);
+    grid->setPeriodicX1(true);
+    grid->setPeriodicX2(true);
+    grid->setPeriodicX3(false);
+    grid->setDeltaX(dx);
+    grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
+
+    string outputPath = "d:/temp/FallingSpheres";
+
+    UbSystem::makeDirectory(outputPath);
+    UbSystem::makeDirectory(outputPath + "/liggghts");
+
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
+                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+    
+    SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
+    if (myid == 0)
+        GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+    GenBlocksGridVisitor genBlocks(gridCube);
+    grid->accept(genBlocks);
+
+    SPtr<CoProcessor> ppblocks =
+        make_shared <WriteBlocksCoProcessor>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath,
+                                                          WbWriterVtkXmlBinary::getInstance(), comm);
+    ppblocks->process(0);
+    ppblocks.reset();
+
+    double dx2 = 2.0 * dx;
+    GbCuboid3DPtr wallZmin(
+        new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_minX3));
+    GbSystem3D::writeGeoObject(wallZmin.get(), outputPath + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance());
+    GbCuboid3DPtr wallZmax(
+        new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_maxX3, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2));
+    GbSystem3D::writeGeoObject(wallZmax.get(), outputPath + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance());
+
+    SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+    SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+    InteractorsHelper intHelper(grid, metisVisitor, true);
+    intHelper.addInteractor(wallZminInt);
+    intHelper.addInteractor(wallZmaxInt);
+    intHelper.selectBlocks();
+
+    SetKernelBlockVisitor kernelVisitor(kernel, nuLB, 1e9, 1e9);
+    grid->accept(kernelVisitor);
+
+    intHelper.setBC();
+
+    InitDistributionsBlockVisitor initVisitor;
+    grid->accept(initVisitor);
+
+    SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1);
+    string inFile1 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/FallingSphere/in.lbdem";
+    string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/FallingSphere/in2.lbdem";
+    MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator());
+    LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
+
+
+ 
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01);
+    std::cout << units->toString() << std::endl;
+
+    double v_frac = 0.1;
+    double dt_phys   = units->getFactorTimeLbToW();
+    int demSubsteps = 10;
+    double dt_dem   = dt_phys / (double)demSubsteps;
+    int vtkSteps    = 100;
+    string demOutDir = outputPath; 
+
+    wrapper.execCommand("echo none");
+
+    //wrapper.setVariable("d_part", d_part);
+    wrapper.setVariable("r_part", d_part/2.);
+    wrapper.setVariable("v_frac", v_frac);
+
+    //wrapper.execFile((char*)inFile1.c_str());
+
+    //// set timestep and output directory
+    wrapper.setVariable("t_step", dt_dem);
+    wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
+    wrapper.setVariable("dmp_dir", demOutDir);
+
+    wrapper.execFile((char *)inFile1.c_str());
+    wrapper.runUpto(demSubsteps - 1);
+  
+    SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
+        make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps, units);
+
+    // boundary conditions grid
+    {
+        SPtr<UbScheduler> geoSch(new UbScheduler(1));
+        SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+            grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
+        ppgeo->process(0);
+        ppgeo.reset();
+    }
+
+    grid->accept(bcVisitor);
+
+    OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+    grid->accept(setConnsVisitor);
+
+
+    // write data for visualization of macroscopic quantities
+    SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
+    SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
+        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
+                                                  SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+
+    int endTime = 3000; //20;
+    SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
+    calculator->addCoProcessor(lcCoProcessor);
+    calculator->addCoProcessor(writeMQCoProcessor);
+
+    if (myid == 0) UBLOG(logINFO, "Simulation-start");
+    calculator->calculate();
+    if (myid == 0) UBLOG(logINFO, "Simulation-end");
+
+
+    return 0;
+}
diff --git a/apps/cpu/FallingSphere/in.lbdem b/apps/cpu/FallingSphere/in.lbdem
new file mode 100644
index 000000000..b47a85c99
--- /dev/null
+++ b/apps/cpu/FallingSphere/in.lbdem
@@ -0,0 +1,75 @@
+echo none
+
+units		si
+atom_style	granular
+atom_modify	map array
+
+
+
+communicate	single vel yes
+
+boundary	f f f
+newton		off
+
+processors * * 1
+region		box block 0. 1. 0. 1. 0. 10. units box
+create_box	1 box
+
+variable	skin equal 0.01
+neighbor	${skin} bin
+neigh_modify	delay 0 binsize 0.01 one 1000
+
+fix grav all gravity 0.981 vector 0 0 -1
+
+
+fix 		m1 all property/global youngsModulus peratomtype 1e8
+fix 		m2 all property/global poissonsRatio peratomtype 0.4
+fix 		m3 all property/global coefficientRestitution peratomtypepair 1 0.95
+fix 		m4 all property/global coefficientFriction peratomtypepair 1 0.45
+fix 		m5 all property/global coefficientRollingFriction peratomtypepair 1 0.020
+
+# lb coupling fix
+fix lbcoupling all couple/lb/onetoone
+
+
+pair_style	gran model hertz tangential history rolling_friction cdt
+pair_coeff	* *
+
+fix		1 all nve/sphere
+
+fix xwalls1 all wall/gran model hertz tangential history primitive type 1 xplane 0.
+fix xwalls2 all wall/gran model hertz tangential history primitive type 1 xplane 1.
+fix ywalls1 all wall/gran model hertz tangential history primitive type 1 yplane 0.
+fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane 1.
+fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
+fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
+
+create_atoms 1 single 0.5 0.5 9.75
+#create_atoms 1 single 0.38 0.05 0.05
+
+set group all diameter ${d_part} density 2400
+
+atom_modify sort 0 0.0
+
+#fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.015 
+#fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.01 
+#fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1100 radius constant ${r_part} 
+
+# fix pdd1 all particledistribution/discrete 6778  1 pts1 1.0
+# #fix pdd2 all particledistribution/discrete 6778  2 pts2 0.2 pts3 0.8
+
+# # region  insreg block 0.1 0.9 0.1 0.9 1.3 1.9 units box
+
+
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+# #                         overlapcheck yes particles_in_region 350 region insreg ntry_mc 10000 
+# fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+                        # overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd2 insert_every once &
+# #                        overlapcheck yes volumefraction_region 0.05 region insreg ntry_mc 10000 
+# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+# #                        overlapcheck yes particles_in_region 1 region insreg ntry_mc 10000 
+
+echo none
+
+run 1
diff --git a/apps/cpu/FallingSphere/in2.lbdem b/apps/cpu/FallingSphere/in2.lbdem
new file mode 100644
index 000000000..f11767f12
--- /dev/null
+++ b/apps/cpu/FallingSphere/in2.lbdem
@@ -0,0 +1,25 @@
+
+echo none
+
+timestep        ${t_step}      
+
+# thermo settings
+fix		ts all check/timestep/gran 10000 0.1 0.1
+compute		1 all erotate/sphere
+thermo_style	custom step atoms ke c_1 f_ts[1] f_ts[2] cpu
+thermo		10000
+thermo_modify	lost ignore norm no flush yes
+compute_modify	thermo_temp dynamic yes
+
+# particle dump
+variable dmp_fname string ${dmp_dir}d_*.liggghts
+
+# dump		dmp all custom ${dmp_stp} ${dmp_fname} & 
+#		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+
+# dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
+# 		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+	
+dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/liggghts/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
+
+echo none
\ No newline at end of file
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 978ae376f..6eb27d6dc 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -30,14 +30,25 @@ int main(int argc, char *argv[])
 
     double g_maxX1 = 1;
     double g_maxX2 = 1;
-    double g_maxX3 = 2;
+    double g_maxX3 = 10;
 
     int blockNX[3] = { 16, 16, 16 };
 
     double dx = 1./32.;
 
-    double Re   = 300;
-    double nuLB = 5e-5;
+
+    double d_part = 0.25;
+    double r_p    = d_part / 2.0;
+
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01);
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01);
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::OIL, r_p / dx);
+    std::cout << units->toString() << std::endl;
+
+    //double Re   = 300;
+    double nuLB = 1e-2; // 5e-5;
 
     SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
     SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
@@ -60,7 +71,7 @@ int main(int argc, char *argv[])
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
 
-    string outputPath = "d:/temp/lll4";
+    string outputPath = "d:/temp/lll8";
 
     SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
                                                                       D3Q27System::BSW, MetisPartitioner::RECURSIVE));
@@ -110,13 +121,9 @@ int main(int argc, char *argv[])
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
 
-    double d_part = 0.25;
-    double r_p       = d_part / 2.0;
- 
-    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
-    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
-    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01);
-    std::cout << units->toString() << std::endl;
+
+
+
 
     //return 0;
 
@@ -124,10 +131,10 @@ int main(int argc, char *argv[])
     double dt_phys   = units->getFactorTimeLbToW();
     int demSubsteps = 10;
     double dt_dem   = dt_phys / (double)demSubsteps;
-    int vtkSteps    = 1;
+    int vtkSteps    = 100;
     string demOutDir = outputPath; //    "d:/temp/lll2/";
 
-    wrapper.execCommand("echo log");
+    //wrapper.execCommand("echo none");
 
     wrapper.setVariable("r_part", d_part / 2);
     wrapper.setVariable("v_frac", v_frac);
@@ -167,7 +174,7 @@ int main(int argc, char *argv[])
         new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
                                                   SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
 
-    int endTime = 1000; //20;
+    int endTime = 3000; //20;
     SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
     calculator->addCoProcessor(lcCoProcessor);
     calculator->addCoProcessor(writeMQCoProcessor);
diff --git a/apps/cpu/LiggghtsApp/in.lbdem b/apps/cpu/LiggghtsApp/in.lbdem
index ae2baa373..c356a2f6b 100644
--- a/apps/cpu/LiggghtsApp/in.lbdem
+++ b/apps/cpu/LiggghtsApp/in.lbdem
@@ -1,4 +1,4 @@
-echo none
+#verbose no
 
 units		si
 atom_style	granular
@@ -12,7 +12,7 @@ boundary	f f f
 newton		off
 
 processors * * 1
-region		box block 0. 1. 0. 1. 0. 2. units box
+region		box block 0. 1. 0. 1. 0. 10. units box
 create_box	1 box
 
 variable	skin equal 0.01
@@ -44,7 +44,7 @@ fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane
 fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
 fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
 
-create_atoms 1 single 0.5 0.5 1.75
+create_atoms 1 single 0.5 0.5 9.75
 #create_atoms 1 single 0.38 0.05 0.05
 
 set group all diameter 0.25 density 2400
@@ -64,7 +64,7 @@ atom_modify sort 0 0.0
 # #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
 # #                         overlapcheck yes particles_in_region 350 region insreg ntry_mc 10000 
 # fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
-                        # overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
+#                         overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
 # #fix ins all insert/pack seed 1001 distributiontemplate pdd2 insert_every once &
 # #                        overlapcheck yes volumefraction_region 0.05 region insreg ntry_mc 10000 
 # #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
diff --git a/apps/cpu/LiggghtsApp/in2.lbdem b/apps/cpu/LiggghtsApp/in2.lbdem
index 8d6a0748b..229fe747f 100644
--- a/apps/cpu/LiggghtsApp/in2.lbdem
+++ b/apps/cpu/LiggghtsApp/in2.lbdem
@@ -14,11 +14,13 @@ compute_modify	thermo_temp dynamic yes
 # particle dump
 variable dmp_fname string ${dmp_dir}d_*.liggghts
 
-# dump		dmp all custom ${dmp_stp} ${dmp_fname} & 
-		# id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+#dump		dmp all custom ${dmp_stp} ${dmp_fname} & 
+#		 id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
 
-# dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
+#dump		dmp all custom ${dmp_stp} ${dmp_dir}d_*.liggghts & 
 # 		id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+
+
 	
 dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
 
diff --git a/apps/cpu/Nozzle/CMakeLists.txt b/apps/cpu/Nozzle/CMakeLists.txt
new file mode 100644
index 000000000..b653be79c
--- /dev/null
+++ b/apps/cpu/Nozzle/CMakeLists.txt
@@ -0,0 +1,3 @@
+PROJECT(Nozzle)
+
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling FILES nozzle.cpp )
diff --git a/apps/cpu/Nozzle/in.nozzle b/apps/cpu/Nozzle/in.nozzle
new file mode 100644
index 000000000..4479b5e3c
--- /dev/null
+++ b/apps/cpu/Nozzle/in.nozzle
@@ -0,0 +1,125 @@
+# shotcrete nozzle simulation
+
+atom_style    granular
+atom_modify   map array
+boundary      f f f
+newton        off
+
+communicate   single vel yes
+
+units         si
+
+#region        domain block -1.35 -1.25 0.34 0.44 -0.25 0.25 units box
+region        domain block -1.35 -1.25 0.34 0.44 -0.4 0.25 units box
+create_box    1 domain
+
+neighbor      0.002 bin
+neigh_modify  delay 0
+
+
+#Material properties required for new pair styles
+
+fix  m1 all property/global youngsModulus peratomtype 5.e6
+fix  m2 all property/global poissonsRatio peratomtype 0.45
+fix  m3 all property/global coefficientRestitution peratomtypepair 1 0.3
+fix  m4 all property/global coefficientFriction peratomtypepair 1 0.5
+fix  m5 all property/global k_finnie peratomtypepair 1 1.0
+
+# lb coupling fix
+fix lbcoupling all couple/lb/onetoone
+
+#New pair style
+pair_style  gran model hertz tangential history #Hertzian without cohesion
+pair_coeff  * *
+
+timestep    ${t_step}
+
+fix  gravi all gravity 9.81 vector 0.0 0.0 -1.0
+
+#the chute
+#variable meshes_dir string d:/Projects/TRR277/Project/WP4/Liggghts/
+variable meshes_dir string d:/Projects/TRR277/Project/WP4/Liggghts/A04/
+
+fix  cad1 all mesh/surface file ${meshes_dir}Duese_Acc_Einlass.stl type 1 scale 0.001
+fix  cad2 all mesh/surface file ${meshes_dir}Duese_Acc_Verteiler.stl type 1 scale 0.001
+fix  cad3 all mesh/surface file ${meshes_dir}Duese_Air_Einlass.stl type 1 scale 0.001
+fix  cad4 all mesh/surface file ${meshes_dir}Duese_Air_Verteiler.stl type 1 scale 0.001
+fix  cad5 all mesh/surface file ${meshes_dir}Duese_Volcan_Duese.stl type 1 scale 0.001
+fix  cad6 all mesh/surface file ${meshes_dir}Duese_Zwischenstueck.stl type 1 element_exclusion_list read list.file scale 0.001 curvature_tolerant yes
+
+fix  inface all mesh/surface file ${meshes_dir}InsertDisk2.stl type 1 scale 0.001
+fix  wallTop all mesh/surface file ${meshes_dir}InsertDisk3.stl type 1 scale 0.001
+
+#fix  granwalls all wall/gran model hertz tangential history mesh n_meshes 7 meshes cad1 cad2 cad3 cad4 cad5 cad6 wallTop
+fix  granwalls all wall/gran model hertz tangential history mesh n_meshes 8 meshes cad1 cad2 cad3 cad4 cad5 cad6 wallTop inface
+
+#distributions for insertion
+
+fix  pts1 all particletemplate/sphere 15485863 atom_type 1 density constant 2500 radius constant 0.001
+fix  pts2 all particletemplate/sphere 15485867 atom_type 1 density constant 2500 radius constant 0.002
+fix  pdd1 all particledistribution/discrete 32452843  2 pts1 0.3 pts2 0.7
+
+#region and insertion
+group  nve_group region domain
+#region bc cylinder z 0.0 0.0 0.015 0.201 0.23 units box
+#region bc cylinder z 0.0 0.0 10 213 220 units box
+
+region bc cylinder z -1.3013105 0.388582 0.01275005 0.18055 0.20105 units box
+
+#particle insertion
+# fix    ins nve_group insert/stream seed 32452867 distributiontemplate pdd1 &
+       # nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
+       # insertion_face inface 
+
+
+# fix    ins nve_group insert/stream seed 32452867 distributiontemplate pdd1 &
+       # nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
+       # insertion_face inface 
+       
+# fix    ins nve_group insert/stream seed 32452867 distributiontemplate pdd1 &
+       # nparticles 6000 massrate 0.1 insert_every ones overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
+       # insertion_face inface 
+
+fix ins nve_group insert/pack seed 32452867 distributiontemplate pdd1 insert_every 1000 &
+                        overlapcheck yes volumefraction_region 0.1 region bc ntry_mc 1001
+   
+       
+# fix    ins all insert/stream seed 32452867 distributiontemplate pdd1 &
+       # nparticles INF massrate 0.1 overlapcheck yes all_in yes vel constant 0.0 0.0 -1.0 &
+       # insertion_face inface extrude_length 0.25   
+	   
+   
+
+#apply nve integration to all particles that are inserted as single particles
+fix    integr nve_group nve/sphere
+
+#output settings, include total thermal energy
+compute       1 all erotate/sphere
+thermo_style  custom step atoms ke c_1 vol
+thermo        1000
+thermo_modify lost ignore norm no
+
+variable dmp_time_cad equal 100000000
+
+dump   dumpcad1 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad1_*.stl cad1
+dump   dumpcad2 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad2_*.stl cad2
+dump   dumpcad3 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad3_*.stl cad3
+dump   dumpcad4 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad4_*.stl cad4
+dump   dumpcad5 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad5_*.stl cad5
+dump   dumpcad6 all mesh/stl ${dmp_time_cad} ${dmp_dir}/cad6_*.stl cad6
+dump   dumpinface all mesh/stl ${dmp_time_cad} ${dmp_dir}/inface_*.stl inface
+dump   dumpwallTop all mesh/stl ${dmp_time_cad} ${dmp_dir}/wallTop_*.stl wallTop
+
+#insert the first particles so that dump is not empty
+run    1
+dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/particles_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 
+
+
+#run 1
+#run 1
+
+#insert particles
+#run    100000 upto
+#unfix  ins
+
+ 
diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp
new file mode 100644
index 000000000..ea3616be7
--- /dev/null
+++ b/apps/cpu/Nozzle/nozzle.cpp
@@ -0,0 +1,268 @@
+#include <iostream>
+#include <string>
+#include <memory>
+
+#include "VirtualFluids.h"
+
+#include "LiggghtsCouplingCoProcessor.h"
+#include "LiggghtsCouplingWrapper.h"
+#include "IBcumulantK17LBMKernel.h"
+
+using namespace std;
+
+
+int main(int argc, char *argv[])
+{
+    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    int myid = comm->getProcessID();
+
+
+    // bounding box
+    //double g_minX1 = -1341.81e-3;
+    //double g_minX2 =  348.087e-3;
+    //double g_minX3 = -210e-3;
+
+    //double g_maxX1 = -1260.81e-3;
+    //double g_maxX2 =  429.087e-3;
+    //double g_maxX3 =  214.5e-3;
+
+    double g_minX1 = -1341.81e-3 + 10e-3;
+    double g_minX2 =  0.360872;
+    double g_minX3 = -210e-3;
+
+    double g_maxX1 = -1260.81e-3 - 10e-3;
+    double g_maxX2 =  0.416302;
+    double g_maxX3 =  210e-3;
+
+    int blockNX[3] = { 10, 10, 10 };
+
+    double dx = 1e-3;
+
+    double nuLB = 1e-3;
+    double uLB  = -0.01;
+    double rhoLB = 0.0;
+
+    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
+    //SPtr<LBMKernel> kernel   = make_shared<CumulantK17LBMKernel>();
+    SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
+    kernel->setBCProcessor(bcProc);
+
+    SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+    noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+    mu::Parser fct;
+    fct.SetExpr("U");
+    fct.DefineConst("U", uLB);
+    SPtr<BCAdapter> inflowBCAdapter(new VelocityBCAdapter(false, false, true, fct, 0, BCFunction::INFCONST));
+    inflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+    SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+    outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+    //////////////////////////////////////////////////////////////////////////////////
+    // BC visitor
+    BoundaryConditionsBlockVisitor bcVisitor;
+    bcVisitor.addBC(noSlipBCAdapter);
+    bcVisitor.addBC(inflowBCAdapter);
+    bcVisitor.addBC(outflowBCAdapter);
+
+    SPtr<Grid3D> grid = make_shared<Grid3D>(comm);
+    grid->setPeriodicX1(true);
+    grid->setPeriodicX2(true);
+    grid->setPeriodicX3(false);
+    grid->setDeltaX(dx);
+    grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
+
+    string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo";
+
+    string outputPath = "d:/temp/NozzleFlow";
+    UbSystem::makeDirectory(outputPath);
+    UbSystem::makeDirectory(outputPath + "/liggghts");
+
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
+                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+    
+    SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
+    if (myid == 0)
+        GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+    GenBlocksGridVisitor genBlocks(gridCube);
+    grid->accept(genBlocks);
+
+    //geo
+    //////////////////////////////////////////////////////////
+    int accuracy = Interactor3D::EDGES;
+    ///////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleAirDistributor = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:start");
+    meshNozzleAirDistributor->readMeshFromSTLFileASCII(geoPath + "/01_Nozzle_Air_Distributor.stl", false);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirDistributor.get(), outputPath + "/geo/meshNozzleAirDistributor", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleAirDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirDistributor, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleAirInlet = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:start");
+    meshNozzleAirInlet->readMeshFromSTLFileASCII(geoPath + "/02_Nozzle_Air_Inlet.stl", false);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirInlet.get(), outputPath + "/geo/meshNozzleAirInlet", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirInlet, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleSpacer = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:start");
+    meshNozzleSpacer->readMeshFromSTLFileASCII(geoPath + "/03_Nozzle_Spacer.stl", true);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleSpacer.get(), outputPath + "/geo/meshNozzleSpacer", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleSpacer = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleSpacer, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleAccDistributor = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:start");
+    meshNozzleAccDistributor->readMeshFromSTLFileASCII(geoPath + "/04_Nozzle_Acc_Distributor.stl", false);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccDistributor.get(), outputPath + "/geo/meshNozzleAccDistributor", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleAccDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccDistributor, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleAccInlet = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:start");
+    meshNozzleAccInlet->readMeshFromSTLFileASCII(geoPath + "/05_Nozzle_Acc_Inlet.stl", false);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccInlet.get(), outputPath + "/geo/meshNozzleAccInlet", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleAccInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccInlet, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle1 = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:start");
+    meshNozzleVolcanNozzle1->readMeshFromSTLFileBinary(geoPath + "/06_1_Nozzle_Volcan_Nozzle.stl", true);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle1.get(), outputPath + "/geo/meshNozzleVolcanNozzle1", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleVolcanNozzle1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES);
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle2 = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:start");
+    meshNozzleVolcanNozzle2->readMeshFromSTLFileBinary(geoPath + "/06_2_Nozzle_Volcan_Nozzle.stl", true);
+    if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle2.get(), outputPath + "/geo/meshNozzleVolcanNozzle2", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrNozzleVolcanNozzle2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES);
+    ///////////////////////////////////////////////////////////
+    //box
+    SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
+    ///////////////////////////////////////////////////////////
+    //inflow
+    GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, 0.20105, -1.30181+0.0005, 0.390872-0.00229, 0.23, 0.013));
+    if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+    SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowBCAdapter, Interactor3D::SOLID));
+    ///////////////////////////////////////////////////////////
+    //outflow
+    GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, -0.22, -1.30181+0.0005, 0.390872-0.00229, -0.21, 0.013));
+    if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+    SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, inflowBCAdapter, Interactor3D::SOLID));
+    ///////////////////////////////////////////////////////////
+
+    InteractorsHelper intHelper(grid, metisVisitor, true);
+    intHelper.addInteractor(intrBox);
+    intHelper.addInteractor(intrInflow);
+    intHelper.addInteractor(intrOutflow);
+    intHelper.addInteractor(intrNozzleAirDistributor);
+    intHelper.addInteractor(intrNozzleAirInlet);
+    intHelper.addInteractor(intrNozzleSpacer);
+    intHelper.addInteractor(intrNozzleAccDistributor);
+    intHelper.addInteractor(intrNozzleAccInlet);
+    intHelper.addInteractor(intrNozzleVolcanNozzle1);
+    intHelper.addInteractor(intrNozzleVolcanNozzle2);
+
+
+    intHelper.selectBlocks();
+
+    SPtr<CoProcessor> ppblocks = make_shared<WriteBlocksCoProcessor>(
+         grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm);
+     ppblocks->process(0);
+     ppblocks.reset();
+
+     if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses()));
+
+
+    SetKernelBlockVisitor kernelVisitor(kernel, nuLB, comm->getNumberOfProcesses());
+    grid->accept(kernelVisitor);
+
+    intHelper.setBC();
+
+    InitDistributionsBlockVisitor initVisitor;
+    grid->accept(initVisitor);
+
+  
+    string inFile1 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/Nozzle/in.nozzle";
+    //string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem";
+    MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator());
+    LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
+
+
+    double d_part = 1e-3;
+ 
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, 0.01);
+    std::cout << units->toString() << std::endl;
+
+    //return 0;
+
+    double v_frac = 0.1;
+    double dt_phys   = units->getFactorTimeLbToW();
+    int demSubsteps = 10;
+    double dt_dem   = dt_phys / (double)demSubsteps;
+    int vtkSteps    = 100;
+    string demOutDir = outputPath + "/liggghts";
+
+    //wrapper.execCommand("echo none");
+
+    //wrapper.execFile((char*)inFile1.c_str());
+
+    //// set timestep and output directory
+    wrapper.setVariable("t_step", dt_dem);
+    wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
+    wrapper.setVariable("dmp_dir", demOutDir);
+
+    wrapper.execFile((char *)inFile1.c_str());
+    wrapper.runUpto(demSubsteps - 1);
+    //wrapper.runUpto(1000);
+
+    SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); 
+    SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
+        make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps, units);
+
+    // boundary conditions grid
+    {
+        SPtr<UbScheduler> geoSch(new UbScheduler(1));
+        SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+            grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
+        ppgeo->process(0);
+        ppgeo.reset();
+    }
+
+    grid->accept(bcVisitor);
+
+    OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+    grid->accept(setConnsVisitor);
+
+    int numOfThreads          = 18;
+    omp_set_num_threads(numOfThreads);
+
+    SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100);
+    SPtr<NUPSCounterCoProcessor> nupsCoProcessor = make_shared<NUPSCounterCoProcessor>(grid, nupsSch, numOfThreads, comm);
+
+    //// write data for visualization of macroscopic quantities
+    SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
+    SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
+        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
+                                                  SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+    writeMQCoProcessor->process(0);
+
+    int endTime = 1000000; //20;
+    SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
+    calculator->addCoProcessor(nupsCoProcessor);
+    calculator->addCoProcessor(lcCoProcessor);
+    calculator->addCoProcessor(writeMQCoProcessor);
+
+    if (myid == 0) UBLOG(logINFO, "Simulation-start");
+    calculator->calculate();
+    if (myid == 0) UBLOG(logINFO, "Simulation-end");
+
+
+    return 0;
+}
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index 4227ba9f8..575c244ee 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -2,7 +2,7 @@ outputPath = d:/temp/viskomatCylinderRestartTest3_Migration
 geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
 geoFile = fishbone.stl
 
-numOfThreads = 4
+numOfThreads = 18
 availMem = 8e9
 logToFile = false
 
@@ -36,6 +36,7 @@ refineLevel = 0
 #nuLB = 1.5e-4
 OmegaLB = 1e-4
 tau0 = 20e-7
+N = 30
 
 resolution = 32
 scaleFactor = 1
diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp
index 3cbc797f8..fa75c3a97 100644
--- a/apps/cpu/ViskomatXL/viskomat.cpp
+++ b/apps/cpu/ViskomatXL/viskomat.cpp
@@ -366,7 +366,7 @@ void bflow(string configname)
          wallXminInt->initInteractor();
       }
       
-      omp_set_num_threads(numOfThreads);
+      //omp_set_num_threads(numOfThreads);
 
       //set connectors
       //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor());
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index da8c93296..e6588e766 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -16,15 +16,7 @@ LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr
                                                          SPtr<Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units)
     : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units)
 {
-    //gridRank     = comm->getProcessID();
-    //minInitLevel = this->grid->getCoarsestInitializedLevel();
-    //maxInitLevel = this->grid->getFinestInitializedLevel();
 
-    //blockVector.resize(maxInitLevel + 1);
-
-    //for (int level = minInitLevel; level <= maxInitLevel; level++) {
-    //    grid->getBlocks(level, gridRank, true, blockVector[level]);
-    //}
 }
 
 LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
diff --git a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
index 670a597cb..3466d9730 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
+++ b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
@@ -60,6 +60,14 @@
 #if defined(__CYGWIN__)
 #define MEMORYUTIL_CYGWIN
 #endif
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+#include "Grid3D.h"
+#include "Communicator.h"
+
 //////////////////////////////////////////////////////////////////////////
 // MemoryUtil
 //////////////////////////////////////////////////////////////////////////
@@ -159,6 +167,43 @@ static long long getPhysMemUsedByMe()
 }
 //////////////////////////////////////////////////////////////////////////
 
+static std::string toString(SPtr<Grid3D> grid, int numberOfProcesses)
+{
+    unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+    int ghostLayer = grid->getGhostLayerWidth()*2+1;
+    UbTupleInt3 blockNx = grid->getBlockNX();
+
+    unsigned long long numberOfNodesPerBlock = (unsigned long long)(val<1>(blockNx)) *
+                                               (unsigned long long)(val<2>(blockNx)) *
+                                               (unsigned long long)(val<3>(blockNx));
+    unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+    unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (val<1>(blockNx) + ghostLayer) *
+                                                             (val<2>(blockNx) + ghostLayer) *
+                                                             (val<3>(blockNx) + ghostLayer);
+    double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+    double needMem = needMemAll / double(numberOfProcesses);
+    
+    std::ostringstream out;
+    out << "Grid information:" << std::endl;
+    out << "###################################################" << std::endl;
+    out << "# Number of blocks = " << numberOfBlocks << std::endl;
+    out << "# Number of nodes  = " << numberOfNodes << std::endl;
+    int minInitLevel = grid->getCoarsestInitializedLevel();
+    int maxInitLevel = grid->getFinestInitializedLevel();
+    for (int level = minInitLevel; level<=maxInitLevel; level++)
+    {
+        int nobl = grid->getNumberOfBlocks(level);
+        out << "# Number of blocks for level " << level << " = " << nobl << std::endl;
+        out << "# Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock << std::endl;
+    }
+    out << "# Necessary memory  = " << needMemAll << " bytes" << std::endl;
+    out << "# Necessary memory per process = " << needMem << " bytes" << std::endl;
+    out << "# Available memory per process = " << (double)getTotalPhysMem() << " bytes" << std::endl;
+    out << "###################################################" << std::endl;
+
+    return out.str();
+}
+
 } // namespace Utilities
 
 #endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
index 5c813d289..b55c405d6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
@@ -53,7 +53,7 @@ SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue
     }
 }
 
-SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int &numberOfProcesses,
+SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int numberOfProcesses,
                                              SetKernelBlockVisitor::Action action)
     : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(std::move(kernel)), nue(nue), action(action), dataSetFlag(true),
       numberOfProcesses(numberOfProcesses)
@@ -127,7 +127,7 @@ double SetKernelBlockVisitor::getRequiredPhysicalMemory(const SPtr<Grid3D> &grid
     unsigned long long numberOfNodesPerBlockWithGhostLayer;
     auto numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
     auto blockNx        = grid->getBlockNX();
-    int ghostLayer      = 3;
+    int ghostLayer      = grid->getGhostLayerWidth() * 2 + 1;
 
     numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (val<1>(blockNx) + ghostLayer) *
                                           (val<2>(blockNx) + ghostLayer) * (val<3>(blockNx) + ghostLayer);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
index 51cbc256c..1e0621f22 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
@@ -52,7 +52,7 @@ public:
     SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
                           SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
 
-    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int &numberOfProcesses,
+    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int numberOfProcesses,
                           SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
 
     ~SetKernelBlockVisitor() override = default;
-- 
GitLab


From a4625747561a48bef659b8bc755e39a7a744755d Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Oct 2022 14:29:44 +0200
Subject: [PATCH 087/179] Merge branch 'LIGGGHTS_coupling' into develop

# Conflicts:
# apps/cpu/Applications.cmake
# apps/cpu/ViskomatXL/viskomat.cfg
---
 apps/cpu/Applications.cmake      | 4 ----
 apps/cpu/ViskomatXL/viskomat.cfg | 5 -----
 2 files changed, 9 deletions(-)

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index 52e0cb066..b63689a9d 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -14,10 +14,6 @@ add_subdirectory(${APPS_ROOT_CPU}/JetBreakup)
 add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
 add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
 add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
-<<<<<<< HEAD
-=======
-
->>>>>>> LIGGGHTS_coupling
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
 #add_subdirectory(Applications/greenvortex)
diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg
index d24424634..626948407 100644
--- a/apps/cpu/ViskomatXL/viskomat.cfg
+++ b/apps/cpu/ViskomatXL/viskomat.cfg
@@ -4,13 +4,8 @@ geoPath = d:/Projects/TRR277/Project/WP1/Rheometer/Aileen
 geoFile = fishboneT.stl
 #geoFile = cylinder.stl
 
-<<<<<<< HEAD
 numOfThreads = 1
 availMem = 15e9
-=======
-numOfThreads = 18
-availMem = 8e9
->>>>>>> LIGGGHTS_coupling
 logToFile = false
 
 blocknx = 14 14 14
-- 
GitLab


From 493d69a6f5730f25e8e2f478313868481d7bb24c Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Fri, 14 Oct 2022 15:02:10 +0200
Subject: [PATCH 088/179] fixe conflicts after merge of branch
 'LIGGGHTS_coupling' into develop

---
 apps/cpu/FallingSphere/FallingSphere.cpp                 | 2 +-
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp                     | 2 +-
 apps/cpu/Nozzle/nozzle.cpp                               | 2 +-
 src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp | 6 ++++--
 src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h   | 6 +++---
 src/cpu/VirtualFluidsCore/CMakeLists.txt                 | 4 +---
 src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h         | 1 -
 7 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp
index 88b5373c9..54ab56cfa 100644
--- a/apps/cpu/FallingSphere/FallingSphere.cpp
+++ b/apps/cpu/FallingSphere/FallingSphere.cpp
@@ -13,7 +13,7 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
-    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
     int myid                                        = comm->getProcessID();
 
 
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 6eb27d6dc..36c0d880a 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -19,7 +19,7 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
-    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
     int myid                                        = comm->getProcessID();
 
 
diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp
index ea3616be7..c8026ec13 100644
--- a/apps/cpu/Nozzle/nozzle.cpp
+++ b/apps/cpu/Nozzle/nozzle.cpp
@@ -13,7 +13,7 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
-    SPtr<Communicator> comm = MPICommunicator::getInstance();
+    std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
     int myid = comm->getProcessID();
 
 
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index e6588e766..db29726c9 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -1,6 +1,6 @@
 #include "LiggghtsCouplingCoProcessor.h"
 #include "GbSphere3D.h"
-#include "MPICommunicator.h"
+#include "mpi/MPICommunicator.h"
 #include "CoProcessor.h"
 #include "LiggghtsCouplingWrapper.h"
 #include "Grid3D.h"
@@ -13,7 +13,9 @@
 #include "fix_lb_coupling_onetoone.h"
 
 LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                                         SPtr<Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units)
+                                                         SPtr<vf::mpi::Communicator> comm,
+                                                         LiggghtsCouplingWrapper &wrapper, int demSteps,
+                                                         SPtr<LBMUnitConverter> units)
     : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units)
 {
 
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
index dcaa6e16c..4788e892a 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
@@ -46,7 +46,7 @@
 
 
 class CoProcessor;
-class Communicator;
+namespace vf::mpi {class Communicator;}
 class LiggghtsCouplingWrapper;
 class Grid3D;
 class Block3D;
@@ -61,7 +61,7 @@ struct ParticleData {
 class LiggghtsCouplingCoProcessor : public CoProcessor
 {
 public:
-    LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Communicator> comm,
+    LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::mpi::Communicator> comm,
                                 LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units);
     virtual ~LiggghtsCouplingCoProcessor();
 
@@ -88,7 +88,7 @@ protected:
     void addTorque(int const partId, int const coord, double const value, double *torque);
 
 private:
-    SPtr<Communicator> comm;
+    SPtr<vf::mpi::Communicator> comm;
     LiggghtsCouplingWrapper &wrapper;
     SPtr<LBMUnitConverter> units;
     int demSteps;
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index 5abe76be9..f9f97ed58 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -24,13 +24,11 @@ if(BUILD_USE_OPENMP)
    list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX)
 endif()
 
-vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger)
-
 IF(${USE_LIGGGHTS})
    list(APPEND VF_LIBRARIES optimized ${LIGGGHTS_RELEASE_LIBRARY} debug ${LIGGGHTS_DEBUG_LIBRARY})
 ENDIF()
 
-vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser MPI::MPI_CXX ${VF_LIBRARIES})
+vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger)
 
 vf_get_library_name(library_name)
 
diff --git a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
index 3466d9730..4c9f30a90 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
+++ b/src/cpu/VirtualFluidsCore/Utilities/MemoryUtil.h
@@ -66,7 +66,6 @@
 #include <string>
 #include <vector>
 #include "Grid3D.h"
-#include "Communicator.h"
 
 //////////////////////////////////////////////////////////////////////////
 // MemoryUtil
-- 
GitLab


From 06e0bbde5adfeedebbcc38c5223b152c09336b7e Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Wed, 26 Oct 2022 12:00:06 +0200
Subject: [PATCH 089/179] fix merge of NewDirectionNaming

---
 apps/cpu/FallingSphere/FallingSphere.cpp      |  19 +-
 apps/cpu/FallingSphere/in.lbdem               |   2 +-
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          |   3 +-
 apps/cpu/Nozzle/nozzle.cpp                    |   3 +-
 .../IBcumulantK17LBMKernel.cpp                | 232 +++++++++---------
 5 files changed, 128 insertions(+), 131 deletions(-)

diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp
index 54ab56cfa..1135f7c2c 100644
--- a/apps/cpu/FallingSphere/FallingSphere.cpp
+++ b/apps/cpu/FallingSphere/FallingSphere.cpp
@@ -56,13 +56,12 @@ int main(int argc, char *argv[])
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
 
-    string outputPath = "d:/temp/FallingSpheres";
+    string outputPath = "d:/temp/FallingSpheres2";
 
     UbSystem::makeDirectory(outputPath);
     UbSystem::makeDirectory(outputPath + "/liggghts");
 
-    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
-                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
     SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
     if (myid == 0)
@@ -102,8 +101,8 @@ int main(int argc, char *argv[])
     grid->accept(initVisitor);
 
     SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1);
-    string inFile1 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/FallingSphere/in.lbdem";
-    string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/FallingSphere/in2.lbdem";
+    string inFile1 = "d:/Projects/VirtualFluids_Develop/apps/cpu/FallingSphere/in.lbdem";
+    string inFile2 = "d:/Projects/VirtualFluids_Develop/apps/cpu/FallingSphere/in2.lbdem";
     MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
@@ -124,17 +123,17 @@ int main(int argc, char *argv[])
     wrapper.execCommand("echo none");
 
     //wrapper.setVariable("d_part", d_part);
-    wrapper.setVariable("r_part", d_part/2.);
-    wrapper.setVariable("v_frac", v_frac);
-
-    //wrapper.execFile((char*)inFile1.c_str());
+    //wrapper.setVariable("r_part", d_part/2.);
+    //wrapper.setVariable("v_frac", v_frac);
 
+    wrapper.execFile((char*)inFile1.c_str());
+ 
     //// set timestep and output directory
     wrapper.setVariable("t_step", dt_dem);
     wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
     wrapper.setVariable("dmp_dir", demOutDir);
 
-    wrapper.execFile((char *)inFile1.c_str());
+    wrapper.execFile((char *)inFile2.c_str());
     wrapper.runUpto(demSubsteps - 1);
   
     SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor =
diff --git a/apps/cpu/FallingSphere/in.lbdem b/apps/cpu/FallingSphere/in.lbdem
index b47a85c99..180f136b8 100644
--- a/apps/cpu/FallingSphere/in.lbdem
+++ b/apps/cpu/FallingSphere/in.lbdem
@@ -47,7 +47,7 @@ fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane
 create_atoms 1 single 0.5 0.5 9.75
 #create_atoms 1 single 0.38 0.05 0.05
 
-set group all diameter ${d_part} density 2400
+#set group all diameter ${d_part} density 2400
 
 atom_modify sort 0 0.0
 
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 36c0d880a..0f3d2ca13 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -73,8 +73,7 @@ int main(int argc, char *argv[])
 
     string outputPath = "d:/temp/lll8";
 
-    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
-                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
     SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
     if (myid == 0)
diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp
index c8026ec13..17b806e91 100644
--- a/apps/cpu/Nozzle/nozzle.cpp
+++ b/apps/cpu/Nozzle/nozzle.cpp
@@ -78,8 +78,7 @@ int main(int argc, char *argv[])
     UbSystem::makeDirectory(outputPath);
     UbSystem::makeDirectory(outputPath + "/liggghts");
 
-    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased,
-                                                                      D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+    SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
     SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
     if (myid == 0)
diff --git a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
index ac0bc3584..0ab0f8a67 100644
--- a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
+++ b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
@@ -223,66 +223,66 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     LBMReal fEqSolid[D3Q27System::ENDF + 1];
                     LBMReal fPre[D3Q27System::ENDF + 1];
 
-                    f[D3Q27System::REST] = mfbbb;
-
-                    f[D3Q27System::E]   = mfcbb;
-                    f[D3Q27System::N]   = mfbcb;
-                    f[D3Q27System::T]   = mfbbc;
-                    f[D3Q27System::NE]  = mfccb;
-                    f[D3Q27System::NW]  = mfacb;
-                    f[D3Q27System::TE]  = mfcbc;
-                    f[D3Q27System::TW]  = mfabc;
-                    f[D3Q27System::TN]  = mfbcc;
-                    f[D3Q27System::TS]  = mfbac;
-                    f[D3Q27System::TNE] = mfccc;
-                    f[D3Q27System::TNW] = mfacc;
-                    f[D3Q27System::TSE] = mfcac;
-                    f[D3Q27System::TSW] = mfaac;
-
-                    f[D3Q27System::W]   = mfabb;
-                    f[D3Q27System::S]   = mfbab;
-                    f[D3Q27System::B]   = mfbba;
-                    f[D3Q27System::SW]  = mfaab;
-                    f[D3Q27System::SE]  = mfcab;
-                    f[D3Q27System::BW]  = mfaba;
-                    f[D3Q27System::BE]  = mfcba;
-                    f[D3Q27System::BS]  = mfbaa;
-                    f[D3Q27System::BN]  = mfbca;
-                    f[D3Q27System::BSW] = mfaaa;
-                    f[D3Q27System::BSE] = mfcaa;
-                    f[D3Q27System::BNW] = mfaca;
-                    f[D3Q27System::BNE] = mfcca;
+                    f[D3Q27System::DIR_000] = mfbbb;
+
+                    f[D3Q27System::DIR_P00] = mfcbb;
+                    f[D3Q27System::DIR_0P0] = mfbcb;
+                    f[D3Q27System::DIR_00P] = mfbbc;
+                    f[D3Q27System::DIR_PP0] = mfccb;
+                    f[D3Q27System::DIR_MP0] = mfacb;
+                    f[D3Q27System::DIR_P0P] = mfcbc;
+                    f[D3Q27System::DIR_M0P] = mfabc;
+                    f[D3Q27System::DIR_0PP] = mfbcc;
+                    f[D3Q27System::DIR_0MP] = mfbac;
+                    f[D3Q27System::DIR_PPP] = mfccc;
+                    f[D3Q27System::DIR_MPP] = mfacc;
+                    f[D3Q27System::DIR_PMP] = mfcac;
+                    f[D3Q27System::DIR_MMP] = mfaac;
+
+                    f[D3Q27System::DIR_M00] = mfabb;
+                    f[D3Q27System::DIR_0M0] = mfbab;
+                    f[D3Q27System::DIR_00M] = mfbba;
+                    f[D3Q27System::DIR_MM0] = mfaab;
+                    f[D3Q27System::DIR_PM0] = mfcab;
+                    f[D3Q27System::DIR_M0M] = mfaba;
+                    f[D3Q27System::DIR_P0M] = mfcba;
+                    f[D3Q27System::DIR_0MM] = mfbaa;
+                    f[D3Q27System::DIR_0PM] = mfbca;
+                    f[D3Q27System::DIR_MMM] = mfaaa;
+                    f[D3Q27System::DIR_PMM] = mfcaa;
+                    f[D3Q27System::DIR_MPM] = mfaca;
+                    f[D3Q27System::DIR_PPM] = mfcca;
 
                     if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MIN) {
-                        fPre[D3Q27System::REST] = mfbbb;
-
-                        fPre[D3Q27System::E]   = mfcbb;
-                        fPre[D3Q27System::N]   = mfbcb;
-                        fPre[D3Q27System::T]   = mfbbc;
-                        fPre[D3Q27System::NE]  = mfccb;
-                        fPre[D3Q27System::NW]  = mfacb;
-                        fPre[D3Q27System::TE]  = mfcbc;
-                        fPre[D3Q27System::TW]  = mfabc;
-                        fPre[D3Q27System::TN]  = mfbcc;
-                        fPre[D3Q27System::TS]  = mfbac;
-                        fPre[D3Q27System::TNE] = mfccc;
-                        fPre[D3Q27System::TNW] = mfacc;
-                        fPre[D3Q27System::TSE] = mfcac;
-                        fPre[D3Q27System::TSW] = mfaac;
-
-                        fPre[D3Q27System::W]   = mfabb;
-                        fPre[D3Q27System::S]   = mfbab;
-                        fPre[D3Q27System::B]   = mfbba;
-                        fPre[D3Q27System::SW]  = mfaab;
-                        fPre[D3Q27System::SE]  = mfcab;
-                        fPre[D3Q27System::BW]  = mfaba;
-                        fPre[D3Q27System::BE]  = mfcba;
-                        fPre[D3Q27System::BS]  = mfbaa;
-                        fPre[D3Q27System::BN]  = mfbca;
-                        fPre[D3Q27System::BSW] = mfaaa;
-                        fPre[D3Q27System::BSE] = mfcaa;
-                        fPre[D3Q27System::BNW] = mfaca;
-                        fPre[D3Q27System::BNE] = mfcca;
+                        fPre[D3Q27System::DIR_000] = mfbbb;
+
+                        fPre[D3Q27System::DIR_P00] = mfcbb;
+                        fPre[D3Q27System::DIR_0P0] = mfbcb;
+                        fPre[D3Q27System::DIR_00P] = mfbbc;
+                        fPre[D3Q27System::DIR_PP0] = mfccb;
+                        fPre[D3Q27System::DIR_MP0] = mfacb;
+                        fPre[D3Q27System::DIR_P0P] = mfcbc;
+                        fPre[D3Q27System::DIR_M0P] = mfabc;
+                        fPre[D3Q27System::DIR_0PP] = mfbcc;
+                        fPre[D3Q27System::DIR_0MP] = mfbac;
+                        fPre[D3Q27System::DIR_PPP] = mfccc;
+                        fPre[D3Q27System::DIR_MPP] = mfacc;
+                        fPre[D3Q27System::DIR_PMP] = mfcac;
+                        fPre[D3Q27System::DIR_MMP] = mfaac;
+
+                        fPre[D3Q27System::DIR_M00] = mfabb;
+                        fPre[D3Q27System::DIR_0M0] = mfbab;
+                        fPre[D3Q27System::DIR_00M] = mfbba;
+                        fPre[D3Q27System::DIR_MM0] = mfaab;
+                        fPre[D3Q27System::DIR_PM0] = mfcab;
+                        fPre[D3Q27System::DIR_M0M] = mfaba;
+                        fPre[D3Q27System::DIR_P0M] = mfcba;
+                        fPre[D3Q27System::DIR_0MM] = mfbaa;
+                        fPre[D3Q27System::DIR_0PM] = mfbca;
+                        fPre[D3Q27System::DIR_MMM] = mfaaa;
+                        fPre[D3Q27System::DIR_PMM] = mfcaa;
+                        fPre[D3Q27System::DIR_MPM] = mfaca;
+                        fPre[D3Q27System::DIR_PPM] = mfcca;
                     }
 
                     (*particleData)(x1, x2, x3)->hydrodynamicForce.fill(0.0);
@@ -789,35 +789,35 @@ void IBcumulantK17LBMKernel::calculate(int step)
 
                     (*this->restDistributions)(x1, x2, x3) = mfbbb;
                     //////////////////////////////////////////////////////////////////////////
-                    f[D3Q27System::REST] = mfbbb;
+                    f[D3Q27System::DIR_000] = mfbbb;
                      
-                    f[D3Q27System::E]    = mfcbb;
-                    f[D3Q27System::N]    = mfbcb;
-                    f[D3Q27System::T]    = mfbbc;
-                    f[D3Q27System::NE]   = mfccb;
-                    f[D3Q27System::NW]   = mfacb;
-                    f[D3Q27System::TE]   = mfcbc;
-                    f[D3Q27System::TW]   = mfabc;
-                    f[D3Q27System::TN]   = mfbcc;
-                    f[D3Q27System::TS]   = mfbac;
-                    f[D3Q27System::TNE]  = mfccc;
-                    f[D3Q27System::TNW]  = mfacc;
-                    f[D3Q27System::TSE]  = mfcac;
-                    f[D3Q27System::TSW]  = mfaac;
+                    f[D3Q27System::DIR_P00]  = mfcbb;
+                    f[D3Q27System::DIR_0P0]  = mfbcb;
+                    f[D3Q27System::DIR_00P]  = mfbbc;
+                    f[D3Q27System::DIR_PP0]  = mfccb;
+                    f[D3Q27System::DIR_MP0]  = mfacb;
+                    f[D3Q27System::DIR_P0P]  = mfcbc;
+                    f[D3Q27System::DIR_M0P]  = mfabc;
+                    f[D3Q27System::DIR_0PP]  = mfbcc;
+                    f[D3Q27System::DIR_0MP]  = mfbac;
+                    f[D3Q27System::DIR_PPP]  = mfccc;
+                    f[D3Q27System::DIR_MPP]  = mfacc;
+                    f[D3Q27System::DIR_PMP]  = mfcac;
+                    f[D3Q27System::DIR_MMP]  = mfaac;
                                      
-                    f[D3Q27System::W]    = mfabb;
-                    f[D3Q27System::S]    = mfbab;
-                    f[D3Q27System::B]    = mfbba;
-                    f[D3Q27System::SW]   = mfaab;
-                    f[D3Q27System::SE]   = mfcab;
-                    f[D3Q27System::BW]   = mfaba;
-                    f[D3Q27System::BE]   = mfcba;
-                    f[D3Q27System::BS]   = mfbaa;
-                    f[D3Q27System::BN]   = mfbca;
-                    f[D3Q27System::BSW]  = mfaaa;
-                    f[D3Q27System::BSE]  = mfcaa;
-                    f[D3Q27System::BNW]  = mfaca;
-                    f[D3Q27System::BNE]  = mfcca;
+                    f[D3Q27System::DIR_M00]  = mfabb;
+                    f[D3Q27System::DIR_0M0]  = mfbab;
+                    f[D3Q27System::DIR_00M]  = mfbba;
+                    f[D3Q27System::DIR_MM0]  = mfaab;
+                    f[D3Q27System::DIR_PM0]  = mfcab;
+                    f[D3Q27System::DIR_M0M]  = mfaba;
+                    f[D3Q27System::DIR_P0M]  = mfcba;
+                    f[D3Q27System::DIR_0MM]  = mfbaa;
+                    f[D3Q27System::DIR_0PM]  = mfbca;
+                    f[D3Q27System::DIR_MMM]  = mfaaa;
+                    f[D3Q27System::DIR_PMM]  = mfcaa;
+                    f[D3Q27System::DIR_MPM]  = mfaca;
+                    f[D3Q27System::DIR_PPM]  = mfcca;
                 }
                     if ((*particleData)(x1, x2, x3)->solidFraction < SOLFRAC_MIN)
                         continue;
@@ -834,8 +834,8 @@ void IBcumulantK17LBMKernel::calculate(int step)
                     D3Q27System::calcCompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]);
 
                     if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) {
-                        double const bb0     = fEq[D3Q27System::REST] - fEqSolid[D3Q27System::REST];
-                        f[D3Q27System::REST] = fPre[D3Q27System::REST] + bb0;
+                        double const bb0     = fEq[D3Q27System::DIR_000] - fEqSolid[D3Q27System::DIR_000];
+                        f[D3Q27System::DIR_000] = fPre[D3Q27System::DIR_000] + bb0;
                         for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) {
                             const int iOpp        = D3Q27System::INVDIR[iPop];
                             double const bb       = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop]));
@@ -858,8 +858,8 @@ void IBcumulantK17LBMKernel::calculate(int step)
 //#endif
                         double const oneMinB = 1. - B;
 
-                        double const bb0 = fEq[D3Q27System::REST] - fEqSolid[D3Q27System::REST];
-                        f[D3Q27System::REST] = fPre[D3Q27System::REST] + oneMinB * (f[D3Q27System::REST] - fPre[D3Q27System::REST]) + B * bb0;
+                        double const bb0 = fEq[D3Q27System::DIR_000] - fEqSolid[D3Q27System::DIR_000];
+                        f[D3Q27System::DIR_000] = fPre[D3Q27System::DIR_000] + oneMinB * (f[D3Q27System::DIR_000] - fPre[D3Q27System::DIR_000]) + B * bb0;
 
                         for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) {
                             int const iOpp = D3Q27System::INVDIR[iPop];
@@ -875,35 +875,35 @@ void IBcumulantK17LBMKernel::calculate(int step)
                         }
                     } /* if solidFraction > SOLFRAC_MAX */
 
-                    (*this->restDistributions)(x1, x2, x3)                             = f[D3Q27System::REST];
+                    (*this->restDistributions)(x1, x2, x3)                             = f[D3Q27System::DIR_000];
                                                                                           
-                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)         = f[D3Q27System::W]   ;
-                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)         = f[D3Q27System::S]   ;
-                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)         = f[D3Q27System::B]   ;
-                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)        = f[D3Q27System::SW]  ;
-                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)       = f[D3Q27System::SE]  ;
-                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)        = f[D3Q27System::BW]  ;
-                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)       = f[D3Q27System::BE]  ;
-                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)        = f[D3Q27System::BS]  ;
-                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)       = f[D3Q27System::BN]  ;
-                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)       = f[D3Q27System::BSW] ;
-                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)      = f[D3Q27System::BSE] ;
-                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)      = f[D3Q27System::BNW] ;
-                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3)     = f[D3Q27System::BNE] ;
+                    (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3)         = f[D3Q27System::DIR_M00];
+                    (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3)         = f[D3Q27System::DIR_0M0];
+                    (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3)         = f[D3Q27System::DIR_00M];
+                    (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3)        = f[D3Q27System::DIR_MM0];
+                    (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3)       = f[D3Q27System::DIR_PM0];
+                    (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3)        = f[D3Q27System::DIR_M0M];
+                    (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3)       = f[D3Q27System::DIR_P0M];
+                    (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3)        = f[D3Q27System::DIR_0MM];
+                    (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3)       = f[D3Q27System::DIR_0PM];
+                    (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3)       = f[D3Q27System::DIR_MMM];
+                    (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3)      = f[D3Q27System::DIR_PMM];
+                    (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3)      = f[D3Q27System::DIR_MPM];
+                    (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3)     = f[D3Q27System::DIR_PPM];
                                                                                                           
-                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     =  f[D3Q27System::E]  ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     =  f[D3Q27System::N]  ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     =  f[D3Q27System::T]  ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   =  f[D3Q27System::NE] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    =  f[D3Q27System::NW] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   =  f[D3Q27System::TE] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    =  f[D3Q27System::TW] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   =  f[D3Q27System::TN] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    =  f[D3Q27System::TS] ;
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) =  f[D3Q27System::TNE];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  =  f[D3Q27System::TNW];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  =  f[D3Q27System::TSE];
-                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   =  f[D3Q27System::TSW];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3)     =  f[D3Q27System::DIR_P00];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3)     =  f[D3Q27System::DIR_0P0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p)     =  f[D3Q27System::DIR_00P];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3)   =  f[D3Q27System::DIR_PP0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3)    =  f[D3Q27System::DIR_MP0];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p)   =  f[D3Q27System::DIR_P0P];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p)    =  f[D3Q27System::DIR_M0P];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p)   =  f[D3Q27System::DIR_0PP];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p)    =  f[D3Q27System::DIR_0MP];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) =  f[D3Q27System::DIR_PPP];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p)  =  f[D3Q27System::DIR_MPP];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p)  =  f[D3Q27System::DIR_PMP];
+                    (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p)   =  f[D3Q27System::DIR_MMP];
                 }
             }
         }
-- 
GitLab


From 944e2043d72323c3c85e7cfcf5ab05e0cf8ec37f Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Mon, 7 Nov 2022 12:41:43 +0100
Subject: [PATCH 090/179] fix some problems after renaming of directions

---
 apps/cpu/FallingSphere/FallingSphere.cpp      | 16 +++++-----
 apps/cpu/FallingSphere/in.lbdem               |  2 +-
 apps/cpu/LiggghtsApp/LiggghtsApp.cpp          | 19 ++++++------
 apps/cpu/LiggghtsApp/in.lbdem                 | 31 ++++++++++---------
 apps/cpu/LiggghtsApp/in2.lbdem                |  2 +-
 apps/cpu/Nozzle/nozzle.cpp                    | 20 +++++++++---
 .../IBcumulantK17LBMKernel.cpp                |  6 ++--
 .../LiggghtsCoupling/IBcumulantK17LBMKernel.h |  2 +-
 .../LiggghtsCoupling/IBdynamicsParticleData.h |  2 +-
 .../LiggghtsCouplingCoProcessor.cpp           | 16 +++++++---
 .../LiggghtsCouplingCoProcessor.h             |  2 +-
 src/cpu/VirtualFluidsCore/Grid/Block3D.cpp    | 19 ++++++------
 .../Visitors/MetisPartitioningGridVisitor.cpp |  4 +--
 .../Visitors/SetConnectorsBlockVisitor.h      |  2 +-
 14 files changed, 80 insertions(+), 63 deletions(-)

diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp
index 1135f7c2c..5f399c547 100644
--- a/apps/cpu/FallingSphere/FallingSphere.cpp
+++ b/apps/cpu/FallingSphere/FallingSphere.cpp
@@ -24,16 +24,16 @@ int main(int argc, char *argv[])
 
     double g_maxX1 = 1;
     double g_maxX2 = 1;
-    double g_maxX3 = 2;
+    double g_maxX3 = 10;
 
-    //int blockNX[3] = { 16, 16, 16 };
-    //double dx = 1./32.;
+    int blockNX[3] = { 16, 16, 16 };
+    double dx = 1./32.;
 
-    double d_part = 0.1;
+    double d_part = 0.25;
     double r_p    = d_part / 2.0;
 
-    int blockNX[3] = { 10, 10, 10 };
-    double dx      = 0.05;
+    //int blockNX[3] = { 10, 10, 10 };
+    //double dx      = 0.05;
 
 
     double nuLB = 1e-2;
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
 
-    string outputPath = "d:/temp/FallingSpheres2";
+    string outputPath = "f:/temp/FallingSpheresTest";
 
     UbSystem::makeDirectory(outputPath);
     UbSystem::makeDirectory(outputPath + "/liggghts");
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
 
     wrapper.execCommand("echo none");
 
-    //wrapper.setVariable("d_part", d_part);
+    wrapper.setVariable("d_part", d_part);
     //wrapper.setVariable("r_part", d_part/2.);
     //wrapper.setVariable("v_frac", v_frac);
 
diff --git a/apps/cpu/FallingSphere/in.lbdem b/apps/cpu/FallingSphere/in.lbdem
index 180f136b8..b47a85c99 100644
--- a/apps/cpu/FallingSphere/in.lbdem
+++ b/apps/cpu/FallingSphere/in.lbdem
@@ -47,7 +47,7 @@ fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane
 create_atoms 1 single 0.5 0.5 9.75
 #create_atoms 1 single 0.38 0.05 0.05
 
-#set group all diameter ${d_part} density 2400
+set group all diameter ${d_part} density 2400
 
 atom_modify sort 0 0.0
 
diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
index 0f3d2ca13..b3c49ccae 100644
--- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
+++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp
@@ -19,6 +19,8 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
+    //Sleep(30000);
+
     std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
     int myid                                        = comm->getProcessID();
 
@@ -30,7 +32,7 @@ int main(int argc, char *argv[])
 
     double g_maxX1 = 1;
     double g_maxX2 = 1;
-    double g_maxX3 = 10;
+    double g_maxX3 = 2;
 
     int blockNX[3] = { 16, 16, 16 };
 
@@ -71,7 +73,9 @@ int main(int argc, char *argv[])
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
 
-    string outputPath = "d:/temp/lll8";
+    string outputPath = "d:/temp/LiggghtsCoupling";
+    UbSystem::makeDirectory(outputPath);
+    UbSystem::makeDirectory(outputPath + "/liggghts");
 
     SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
@@ -113,19 +117,13 @@ int main(int argc, char *argv[])
     grid->accept(initVisitor);
 
     SPtr<UbScheduler> lScheduler                    = make_shared<UbScheduler>(1);
-    string inFile1                                   = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in.lbdem";
+    string inFile1                                   = "d:/Projects/VirtualFluids_Develop/apps/cpu/LiggghtsApp/in.lbdem";
     //string inFile1 = "d:/Tools/LIGGGHTS/examples/LIGGGHTS/Tutorials_public/chute_wear/in.chute_wear2";
-    string inFile2                                   = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem";
+    string inFile2                                   = "d:/Projects/VirtualFluids_Develop/apps/cpu/LiggghtsApp/in2.lbdem";
     MPI_Comm mpi_comm       = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
 
-
-
-
-
-    //return 0;
-
     double v_frac = 0.1;
     double dt_phys   = units->getFactorTimeLbToW();
     int demSubsteps = 10;
@@ -140,6 +138,7 @@ int main(int argc, char *argv[])
 
     wrapper.execFile((char*)inFile1.c_str());
 
+ 
     //// set timestep and output directory
     wrapper.setVariable("t_step", dt_dem);
     wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
diff --git a/apps/cpu/LiggghtsApp/in.lbdem b/apps/cpu/LiggghtsApp/in.lbdem
index c356a2f6b..4c38d7926 100644
--- a/apps/cpu/LiggghtsApp/in.lbdem
+++ b/apps/cpu/LiggghtsApp/in.lbdem
@@ -12,7 +12,7 @@ boundary	f f f
 newton		off
 
 processors * * 1
-region		box block 0. 1. 0. 1. 0. 10. units box
+region		box block 0. 1. 0. 1. 0. 2. units box
 create_box	1 box
 
 variable	skin equal 0.01
@@ -44,31 +44,32 @@ fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane
 fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0.
 fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2.
 
-create_atoms 1 single 0.5 0.5 9.75
+#create_atoms 1 single 0.5 0.5 9.75
 #create_atoms 1 single 0.38 0.05 0.05
 
-set group all diameter 0.25 density 2400
+#set group all diameter 0.25 density 2400
 
-atom_modify sort 0 0.0
+#atom_modify sort 0 0.0
 
 #fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.015 
 #fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 1000 radius constant 0.01 
 #fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1100 radius constant ${r_part} 
+fix  pts1 all particletemplate/sphere 15485863 atom_type 1 density constant 2500 radius constant 0.01
 
-# fix pdd1 all particledistribution/discrete 6778  1 pts1 1.0
-# #fix pdd2 all particledistribution/discrete 6778  2 pts2 0.2 pts3 0.8
+fix pdd1 all particledistribution/discrete 32452843  1 pts1 1.0
+#fix pdd2 all particledistribution/discrete 6778  2 pts2 0.2 pts3 0.8
 
-# # region  insreg block 0.1 0.9 0.1 0.9 1.3 1.9 units box
+region  insreg block 0.1 0.9 0.1 0.9 1.3 1.9 units box
 
 
-# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
-# #                         overlapcheck yes particles_in_region 350 region insreg ntry_mc 10000 
-# fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
-#                         overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
-# #fix ins all insert/pack seed 1001 distributiontemplate pdd2 insert_every once &
-# #                        overlapcheck yes volumefraction_region 0.05 region insreg ntry_mc 10000 
-# #fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
-# #                        overlapcheck yes particles_in_region 1 region insreg ntry_mc 10000 
+#fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+#                         overlapcheck yes particles_in_region 350 region insreg ntry_mc 10000 
+#fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+#                        overlapcheck yes volumefraction_region ${v_frac} region insreg ntry_mc 10000 
+fix ins all insert/pack seed 32452867 distributiontemplate pdd1 insert_every once &
+                        overlapcheck yes volumefraction_region 0.1 region insreg ntry_mc 1001 
+#fix ins all insert/pack seed 1001 distributiontemplate pdd1 insert_every once &
+#                        overlapcheck yes particles_in_region 1 region insreg ntry_mc 10000 
 
 echo none
 
diff --git a/apps/cpu/LiggghtsApp/in2.lbdem b/apps/cpu/LiggghtsApp/in2.lbdem
index 229fe747f..aee0cc8db 100644
--- a/apps/cpu/LiggghtsApp/in2.lbdem
+++ b/apps/cpu/LiggghtsApp/in2.lbdem
@@ -22,6 +22,6 @@ variable dmp_fname string ${dmp_dir}d_*.liggghts
 
 
 	
-dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/post/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
+dump   dmp all custom/vtk ${dmp_stp} ${dmp_dir}/liggghts/atom_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius 	
 
 echo none
\ No newline at end of file
diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp
index 17b806e91..81ab57a73 100644
--- a/apps/cpu/Nozzle/nozzle.cpp
+++ b/apps/cpu/Nozzle/nozzle.cpp
@@ -13,6 +13,8 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
+    //Sleep(30000);
+
     std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
     int myid = comm->getProcessID();
 
@@ -74,10 +76,16 @@ int main(int argc, char *argv[])
 
     string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo";
 
-    string outputPath = "d:/temp/NozzleFlow";
+    string outputPath = "f:/temp/NozzleFlowTestSerial";
     UbSystem::makeDirectory(outputPath);
     UbSystem::makeDirectory(outputPath + "/liggghts");
 
+    if (myid == 0) {
+        stringstream logFilename;
+        logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+        UbLog::output_policy::setStream(logFilename.str());
+    }
+
     SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
     SPtr<GbObject3D> gridCube = make_shared <GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3);
@@ -186,7 +194,7 @@ int main(int argc, char *argv[])
     grid->accept(initVisitor);
 
   
-    string inFile1 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/Nozzle/in.nozzle";
+    string inFile1 = "d:/Projects/VirtualFluids_Develop/apps/cpu/Nozzle/in.nozzle";
     //string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem";
     MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
@@ -197,7 +205,7 @@ int main(int argc, char *argv[])
     // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
     //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
     SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, 0.01);
-    std::cout << units->toString() << std::endl;
+    if (myid == 0) std::cout << units->toString() << std::endl;
 
     //return 0;
 
@@ -246,13 +254,15 @@ int main(int argc, char *argv[])
     SPtr<NUPSCounterCoProcessor> nupsCoProcessor = make_shared<NUPSCounterCoProcessor>(grid, nupsSch, numOfThreads, comm);
 
     //// write data for visualization of macroscopic quantities
-    SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps));
+    SPtr < UbScheduler> visSch(new UbScheduler(vtkSteps));
+    //SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800));
+    visSch->addSchedule(1, 8700, 8800);
     SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
         new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
                                                   SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
     writeMQCoProcessor->process(0);
 
-    int endTime = 1000000; //20;
+    int endTime = 10000000; //20;
     SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
     calculator->addCoProcessor(nupsCoProcessor);
     calculator->addCoProcessor(lcCoProcessor);
diff --git a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
index 0ab0f8a67..7e36c2b9c 100644
--- a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
+++ b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp
@@ -47,6 +47,9 @@ using namespace UbMath;
 IBcumulantK17LBMKernel::IBcumulantK17LBMKernel()
 {
     this->compressible = true;
+    forcingX1 = 0.0;
+    forcingX2 = 0.0;
+    forcingX3 = 0.0;
 }
 //////////////////////////////////////////////////////////////////////////
 void IBcumulantK17LBMKernel::initDataSet()
@@ -54,8 +57,7 @@ void IBcumulantK17LBMKernel::initDataSet()
     SPtr<DistributionArray3D> d(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.9));
     dataSet->setFdistributions(d);
 
-    particleData =
-        std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0] + 2, nx[1] + 2, nx[2] + 2);
+    particleData = std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0] + 2, nx[1] + 2, nx[2] + 2);
 
     int minX1 = 0;
     int minX2 = 0;
diff --git a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
index 503d19709..2d5216d36 100644
--- a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
+++ b/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h
@@ -27,7 +27,7 @@
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
 //! \file IBcumulantK17LBMKernel.h
-//! \ingroup LBM
+//! \ingroup LiggghtsCoupling
 //! \author Konstantin Kutscher, Martin Geier
 //=======================================================================================
 
diff --git a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
index 28f11bf2e..6593a9654 100644
--- a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
+++ b/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h
@@ -27,7 +27,7 @@
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
 //! \file DataSet3D.h
-//! \ingroup Data
+//! \ingroup LiggghtsCoupling
 //! \author Konstantin Kutscher
 //=======================================================================================
 
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
index db29726c9..51d451064 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp
@@ -27,13 +27,22 @@ LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor()
 
 void LiggghtsCouplingCoProcessor::process(double actualTimeStep)
 { 
-    std::cout << "step: " << actualTimeStep << "\n";
+    if (comm->getProcessID() == 0)
+        std::cout << "LiggghtsCouplingCoProcessor step: " << actualTimeStep << "\n";
     
+    //comm->barrier();
+
     getForcesFromLattice();
 
+    //comm->barrier();
+    
     wrapper.run(demSteps);
+
+    //comm->barrier();
     
     setSpheresOnLattice();
+
+    //comm->barrier();
 }
 
 void LiggghtsCouplingCoProcessor::setSpheresOnLattice()
@@ -88,9 +97,6 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double
     
     std::vector<SPtr<Block3D>> blocks;
     grid->getBlocksByCuboid(level, x[0] - r, x[1] - r, x[2] - r, x[0] + r, x[1] + r, x[2] + r, blocks);
-    
-
-
 
     for (SPtr<Block3D> block : blocks) {
         if (block) {
@@ -319,7 +325,7 @@ void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArr
 
     std::vector < SPtr < Block3D > > blocks;
     int level = 0;
-    grid->getBlocks(level, gridRank, true, blocks);
+    grid->getBlocks(level, grid->getRank(), true, blocks);
 
         
     for (SPtr<Block3D> block : blocks) {
diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
index 4788e892a..3e87c89d2 100644
--- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
+++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h
@@ -95,7 +95,7 @@ private:
     //std::vector<std::vector<SPtr<Block3D>>> blockVector;
     //int minInitLevel;
     //int maxInitLevel;
-    int gridRank;
+    //int gridRank;
 
     double *force, *torque;
 };
diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
index 3a55c6ad7..c6a751870 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
@@ -262,28 +262,27 @@ int Block3D::getNumberOfLocalConnectorsForSurfaces()
     if (connectors.size() < 6)
         return count;
 
-    for (int dir = 0; dir <= 5; dir++) // Hard coding. It works if you have 0...5 for E, N ... B
-    {
-        SPtr<Block3DConnector> connector = this->connectors[dir];
-        if (this->connectors[dir]) {
-            if (connector->isLocalConnector())
+    for (SPtr<Block3DConnector> c : connectors) {
+        if (c) {
+            if (c->getSendDir() >= D3Q27System::DIR_P00 && c->getSendDir() <= D3Q27System ::DIR_00M && c->isLocalConnector())
                 count++;
         }
     }
+
     return count;
 }
 //////////////////////////////////////////////////////////////////////////
 int Block3D::getNumberOfRemoteConnectorsForSurfaces()
 {
     int count = 0;
-    for (int dir = 0; dir <= 5; dir++) // Hard coding. It works if you have 0...5 for E, N ... B
-    {
-        SPtr<Block3DConnector> connector = this->connectors[dir];
-        if (this->connectors[dir]) {
-            if (connector->isRemoteConnector())
+
+    for (SPtr<Block3DConnector> c : connectors) {
+        if (c) {
+            if (c->getSendDir() >= D3Q27System::DIR_P00 && c->getSendDir() <= D3Q27System ::DIR_00M && c->isRemoteConnector())
                 count++;
         }
     }
+
     return count;
 }
 void Block3D::setCollectionOfInterpolationFlagCF(int flags) { interpolationFlagCF = flags; }
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
index 8cd256a9b..7546aa307 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
@@ -133,7 +133,7 @@ void MetisPartitioningGridVisitor::buildMetisGraphLevelIntersected(SPtr<Grid3D>
             // the weights of the vertices are 2^level of grid (1, 2, 4, 8 .....) 1<<level
             metis.vwgt.push_back((idx_t)(1 << block->getLevel()));
 
-            for (int dir = 0; dir <= numOfDirs; dir++) {
+            for (int dir = D3Q27System::DIR_P00; dir <= numOfDirs; dir++) {
                 SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
                 if (neighBlock) {
                     if (this->getPartitionCondition(neighBlock, level)) {
@@ -200,7 +200,7 @@ void MetisPartitioningGridVisitor::buildMetisGraphLevelBased(SPtr<Grid3D> grid,
             metis.xadj.push_back(edges);
             metis.vwgt.push_back(vertexWeight);
 
-            for (int dir = 0; dir <= numOfDirs; dir++) {
+            for (int dir = D3Q27System::DIR_P00; dir <= numOfDirs; dir++) {
                 SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
                 if (neighBlock) {
                     if (this->getPartitionCondition(neighBlock, level)) {
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index c47c275cf..53068df96 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -126,7 +126,7 @@ void SetConnectorsBlockVisitor<T1, T2>::setSameLevelConnectors(SPtr<Grid3D> grid
                 } else if (blockRank != neighBlockRank && neighBlock->isActive()) {
                     setRemoteConnectors(block, neighBlock, dir);
 
-                    if (dir >= 0 && dir <= 5) {
+                    if (dir >= D3Q27System::DIR_P00 && dir <= D3Q27System::DIR_00M) {
                         int weight = block->getWeight(neighBlockRank);
                         weight++;
                         block->setWeight(neighBlockRank, weight);
-- 
GitLab


From e58a88758ab4c4c99da9544098f9e78fc9a9cc74 Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 10:11:46 +0100
Subject: [PATCH 091/179] add
 MultiphaseSimpleVelocityBaseExternalPressureLBMKernel

---
 apps/cpu/Applications.cmake                   |    1 +
 apps/cpu/ConvectionOfVortex/CMakeLists.txt    |   17 +-
 apps/cpu/ConvectionOfVortex/cov.cpp           |   14 +-
 apps/cpu/JetBreakup/JetBreakup.cfg            |   12 +-
 apps/cpu/JetBreakup/JetBreakup.cpp            |   65 +-
 apps/cpu/JetBreakup/JetBreakup.cpp.new        |  638 ++++
 apps/cpu/Nozzle/in.nozzle                     |   16 +-
 apps/cpu/Nozzle/nozzle.cpp                    |  282 +-
 src/cpu/VirtualFluids.h                       |    1 +
 .../BoundaryConditions/BCAlgorithm.h          |    2 +
 .../BoundaryConditions/BoundaryConditions.cpp |    2 +-
 .../MultiphaseNoSlipBCAlgorithm.cpp           |   36 +-
 ...tiphaseNonReflectingOutflowBCAlgorithm.cpp |  328 +-
 ...ultiphaseNonReflectingOutflowBCAlgorithm.h |   13 +-
 .../MultiphaseVelocityBCAlgorithm.cpp         |   42 +-
 .../MultiphaseVelocityBCAlgorithm.cpp.new     |  151 +
 .../WriteMacroscopicQuantitiesCoProcessor.cpp |   14 +-
 src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp     |    1 -
 ...bleOffsetMomentsInterpolationProcessor.cpp |  106 +-
 src/cpu/VirtualFluidsCore/LBM/D3Q27System.h   |    8 +-
 .../LBM/MultiphaseCumulantLBMKernel.cpp       |    2 +-
 .../MultiphaseScratchCumulantLBMKernel.cpp    |    2 +-
 ...eVelocityBaseExternalPressureLBMKernel.cpp | 3024 +++++++++++++++++
 ...ocityBaseExternalPressureLBMKernel.cpp.old | 3024 +++++++++++++++++
 ...pleVelocityBaseExternalPressureLBMKernel.h |  125 +
 ...tiphaseTwoPhaseFieldsCumulantLBMKernel.cpp |    2 +-
 ...ocityFormInitDistributionsBlockVisitor.cpp |  140 +-
 ...elocityFormInitDistributionsBlockVisitor.h |    4 +
 .../RefineCrossAndInsideGbObjectHelper.cpp    |    2 +-
 .../Visitors/SetConnectorsBlockVisitor.h      |    2 +-
 utilities/DirRename.py                        |  181 +
 31 files changed, 7924 insertions(+), 333 deletions(-)
 create mode 100644 apps/cpu/JetBreakup/JetBreakup.cpp.new
 create mode 100644 src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old
 create mode 100644 src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h
 create mode 100644 utilities/DirRename.py

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index b63689a9d..71648d1fd 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -14,6 +14,7 @@ add_subdirectory(${APPS_ROOT_CPU}/JetBreakup)
 add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
 add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
 add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
+add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex)
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
 #add_subdirectory(Applications/greenvortex)
diff --git a/apps/cpu/ConvectionOfVortex/CMakeLists.txt b/apps/cpu/ConvectionOfVortex/CMakeLists.txt
index 671dfcfeb..b76c48282 100644
--- a/apps/cpu/ConvectionOfVortex/CMakeLists.txt
+++ b/apps/cpu/ConvectionOfVortex/CMakeLists.txt
@@ -5,21 +5,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 ########################################################
 PROJECT(ConvectionOfVortex)
 
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES cov.cpp )
 
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
 
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(cov BINARY)
diff --git a/apps/cpu/ConvectionOfVortex/cov.cpp b/apps/cpu/ConvectionOfVortex/cov.cpp
index 4e1f592b8..ba53075ca 100644
--- a/apps/cpu/ConvectionOfVortex/cov.cpp
+++ b/apps/cpu/ConvectionOfVortex/cov.cpp
@@ -56,7 +56,7 @@ void run()
       //LBMReal nuLB = 8.66025e-6*4.0;
       //double yFactor = 4.0;
 
-      string  pathname = "d:/temp/ConvectionOfVortex_0.00075_moments";
+      //string  pathname = "d:/temp/ConvectionOfVortex_0.00075_moments";
       //double  endTime = 160;
       //double  outTime = 160;
       //LBMReal dx =  0.00075;
@@ -150,7 +150,7 @@ void run()
       if (myid==0) GbSystem3D::writeGeoObject(geoOutflow4.get(), pathname+"/geo/geoOutflow4", WbWriterVtkXmlASCII::getInstance());
       SPtr<D3Q27Interactor> outflowIntr4 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow4, grid, outflowBCAdapter, Interactor3D::SOLID));
 
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M));
       InteractorsHelper intHelper(grid, metisVisitor);
       //intHelper.addInteractor(outflowIntr1);
       //intHelper.addInteractor(outflowIntr2);
@@ -163,10 +163,16 @@ void run()
 
       //set connectors  
       //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor());
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
       //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkOmegaToOmega(true);
       //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetSquarePressureInterpolationProcessor());
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+
+      OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+      grid->accept(setConnsVisitor);
+
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor);
+      grid->accept(setInterConnsVisitor);
 
       UBLOG(logINFO, "SetConnectorsBlockVisitor:start");
       grid->accept(setConnsVisitor);
diff --git a/apps/cpu/JetBreakup/JetBreakup.cfg b/apps/cpu/JetBreakup/JetBreakup.cfg
index 1b0638fdb..eef35c305 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cfg
+++ b/apps/cpu/JetBreakup/JetBreakup.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/JetBreakupBenchmark_D50_2
+pathname = f:/Multiphase/JetBreakupCaseCSThreeNonConservativePressShortCorrPhaseOutflow1
 #pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup
 pathGeo = d:/Projects/VirtualFluidsCombined/apps/cpu/Multiphase/backup
 #geoFile = JetBreakupR.ASCII.stl
 #geoFile = inlet1.stl
 geoFile = tubeTransformed.stl
 
-numOfThreads = 4
+numOfThreads = 16
 availMem = 10e9
 
 #Grid
-blocknx = 20 25 25
+blocknx = 25 25 25
 
 #Simulation
-case = 2
+case = 3
 U_LB = 0.01 #inlet velocity
 #uF2 = 0.0001
 #Re = 10
@@ -40,5 +40,5 @@ restartStep = 100000
 cpStart = 100000
 cpStep = 100000
 
-outTime = 100
-endTime = 36000
\ No newline at end of file
+outTime = 1 #205
+endTime = 100000#36000
\ No newline at end of file
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index 83cb83fd4..aabc3f4d0 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -21,8 +21,8 @@ void run(string configname)
         config.load(configname);
 
         string pathname = config.getValue<string>("pathname");
-        string pathGeo = config.getValue<string>("pathGeo");
-        string geoFile = config.getValue<string>("geoFile");
+        //string pathGeo = config.getValue<string>("pathGeo");
+        //string geoFile = config.getValue<string>("geoFile");
         int numOfThreads = config.getValue<int>("numOfThreads");
         vector<int> blocknx = config.getVector<int>("blocknx");
         //vector<double> boundingBox = config.getVector<double>("boundingBox");
@@ -89,11 +89,11 @@ void run(string configname)
                 rho_h = 848; 
                 //density of light fluid (kg/m^3)
                 rho_l = 34.5;
-                //density retio
+                //density ratio
                 r_rho = rho_h / rho_l;
-                //dynamic viscosity of heavy fluid (Pa · s)
+                //dynamic viscosity of heavy fluid (Pa � s)
                 mu_h = 2.87e-3;
-                //dynamic viscosity of light fluid (Pa · s)
+                //dynamic viscosity of light fluid (Pa � s)
                 mu_l = 1.97e-5;
                 //velocity (m/s)
                 Uo = 100;
@@ -107,11 +107,11 @@ void run(string configname)
                 rho_h = 848;
                 // density of light fluid (kg/m^3)
                 rho_l = 1.205;
-                // density retio
+                // density ratio
                 r_rho = rho_h / rho_l;
-                // dynamic viscosity of heavy fluid (Pa · s)
+                // dynamic viscosity of heavy fluid (Pa � s)
                 mu_h = 2.87e-3;
-                // dynamic viscosity of light fluid (Pa · s)
+                // dynamic viscosity of light fluid (Pa � s)
                 mu_l = 1.84e-5;
                 // velocity (m/s)
                 Uo = 200;
@@ -120,6 +120,24 @@ void run(string configname)
                 // surface tension (N/m)
                 sigma = 0.03;
                 break;
+            case 3:
+                // density of heavy fluid (kg/m^3)
+                rho_h = 1000;
+                // density of light fluid (kg/m^3)
+                rho_l = 1.0;
+                // density ratio
+                r_rho = rho_h / rho_l;
+                // dynamic viscosity of heavy fluid (Pa � s)
+                mu_h = 2.87e-3;
+                // dynamic viscosity of light fluid (Pa � s)
+                mu_l = 1.84e-5;
+                // velocity (m/s)
+                Uo = 200;
+                // diameter of jet (m)
+                D = 0.0001;
+                // surface tension (N/m)
+                sigma = 0.03;
+                break;                
         }
 
         double Re = rho_h * Uo * D / mu_h;
@@ -167,7 +185,8 @@ void run(string configname)
         // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
         // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
         // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
-        kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel());
 
         kernel->setWithForcing(true);
         kernel->setForcingX1(0.0);
@@ -186,7 +205,7 @@ void run(string configname)
         kernel->setMultiphaseModelParameters(beta, kappa);
         kernel->setContactAngle(theta);
         kernel->setInterfaceWidth(interfaceWidth);
-        dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0);
+        //dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0);
 
         SPtr<BCProcessor> bcProc(new BCProcessor());
         // BCProcessorPtr bcProc(new ThinWallBCProcessor());
@@ -232,7 +251,7 @@ void run(string configname)
         fctF2.SetExpr("vy1");
         fctF2.DefineConst("vy1", U_LB);
 
-        double startTime = 30;
+        double startTime = 1;
         SPtr<BCAdapter> velBCAdapterF1(
             new MultiphaseVelocityBCAdapter(true, false, false, fctF1, phiH, 0.0, startTime));
         SPtr<BCAdapter> velBCAdapterF2(
@@ -278,9 +297,13 @@ void run(string configname)
             double g_minX2 = 0;
             double g_minX3 = 0;
 
-            double g_maxX1 = 8.0*D;
-            double g_maxX2 = 2.5*D;
-            double g_maxX3 = 2.5*D;
+            //double g_maxX1 = 8.0*D;
+            //double g_maxX2 = 2.5*D;
+            //double g_maxX3 = 2.5*D;
+
+             double g_maxX1 = 1.0 * D; // 8.0 * D;
+             double g_maxX2 = 2.0 * D;
+             double g_maxX3 = 2.0 * D;
 
             // geometry
             SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
@@ -326,10 +349,8 @@ void run(string configname)
             // outflow
             // GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original)
             // GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2 - 40 * dx, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-            GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2, g_minX3, g_maxX1, g_maxX2 + dx, g_maxX3));
-            if (myid == 0)
-                GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow",
-                                           WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow",                                         WbWriterVtkXmlASCII::getInstance());
 
             // double blockLength = blocknx[0] * dx;
 
@@ -407,11 +428,11 @@ void run(string configname)
             InteractorsHelper intHelper(grid, metisVisitor, true);
             //intHelper.addInteractor(cylInt);
             //intHelper.addInteractor(tubes);
-            // intHelper.addInteractor(outflowInt);
+            intHelper.addInteractor(outflowInt);
             // intHelper.addInteractor(cyl2Int);
 
             intHelper.addInteractor(wallXminInt);
-            intHelper.addInteractor(wallXmaxInt);
+            //intHelper.addInteractor(wallXmaxInt);
             intHelper.addInteractor(wallZminInt);
             intHelper.addInteractor(wallZmaxInt);
             intHelper.addInteractor(wallYminInt);
@@ -548,8 +569,8 @@ void run(string configname)
 
         grid->accept(bcVisitor);
 
-        // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
-        TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
         grid->accept(setConnsVisitor);
 
         SPtr<UbScheduler> visSch(new UbScheduler(outTime));
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp.new b/apps/cpu/JetBreakup/JetBreakup.cpp.new
new file mode 100644
index 000000000..953a8dee8
--- /dev/null
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp.new
@@ -0,0 +1,638 @@
+#include <iostream>
+#include <memory>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+void setInflowBC(double x1, double x2, double x3, double radius, int dir)
+{
+
+}
+
+void run(string configname)
+{
+    try {
+
+        // Sleep(30000);
+
+        vf::basics::ConfigurationFile config;
+        config.load(configname);
+
+        string pathname = config.getValue<string>("pathname");
+        //string pathGeo = config.getValue<string>("pathGeo");
+        //string geoFile = config.getValue<string>("geoFile");
+        int numOfThreads = config.getValue<int>("numOfThreads");
+        vector<int> blocknx = config.getVector<int>("blocknx");
+        //vector<double> boundingBox = config.getVector<double>("boundingBox");
+        // vector<double>  length = config.getVector<double>("length");
+        double U_LB = config.getValue<double>("U_LB");
+        // double uF2                         = config.getValue<double>("uF2");
+        //double nuL = config.getValue<double>("nuL");
+        //double nuG = config.getValue<double>("nuG");
+        //double densityRatio = config.getValue<double>("densityRatio");
+        //double sigma = config.getValue<double>("sigma");
+        int interfaceWidth = config.getValue<int>("interfaceWidth");
+        //double D          = config.getValue<double>("D");
+        double theta = config.getValue<double>("contactAngle");
+        double D_LB = config.getValue<double>("D_LB");
+        double phiL = config.getValue<double>("phi_L");
+        double phiH = config.getValue<double>("phi_H");
+        double tauH = config.getValue<double>("Phase-field Relaxation");
+        double mob = config.getValue<double>("Mobility");
+
+        double endTime = config.getValue<double>("endTime");
+        double outTime = config.getValue<double>("outTime");
+        double availMem = config.getValue<double>("availMem");
+        //int refineLevel = config.getValue<int>("refineLevel");
+        //double Re = config.getValue<double>("Re");
+        
+        bool logToFile = config.getValue<bool>("logToFile");
+        double restartStep = config.getValue<double>("restartStep");
+        double cpStart = config.getValue<double>("cpStart");
+        double cpStep = config.getValue<double>("cpStep");
+        bool newStart = config.getValue<bool>("newStart");
+
+
+
+        int caseN = config.getValue<int>("case");
+
+        SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
+        int myid = comm->getProcessID();
+
+        if (myid == 0)
+            UBLOG(logINFO, "Jet Breakup: Start!");
+
+        if (logToFile) {
+#if defined(__unix__)
+            if (myid == 0) {
+                const char *str = pathname.c_str();
+                mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+            }
+#endif
+
+            if (myid == 0) {
+                stringstream logFilename;
+                logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+                UbLog::output_policy::setStream(logFilename.str());
+            }
+        }
+
+        // Sleep(30000);
+
+        double rho_h, rho_l, r_rho, mu_h, mu_l, Uo, D, sigma;
+
+        switch (caseN) {
+            case 1: 
+                //density of heavy fluid (kg/m^3)
+                rho_h = 848; 
+                //density of light fluid (kg/m^3)
+                rho_l =  34.5;
+                //density ratio
+                r_rho = rho_h / rho_l;
+                //dynamic viscosity of heavy fluid (Pa � s)
+                mu_h = 2.87e-3;
+                //dynamic viscosity of light fluid (Pa � s)
+                mu_l = 1.97e-5;
+                //velocity (m/s)
+                Uo = 100;
+                //diameter of jet (m)
+                D = 0.0001;
+                //surface tension (N/m)
+                sigma = 0.03;
+                break;
+            case 2:
+                // density of heavy fluid (kg/m^3)
+                rho_h = 848;
+                // density of light fluid (kg/m^3)
+                rho_l = 1.205;
+                // density ratio
+                r_rho = rho_h / rho_l;
+                // dynamic viscosity of heavy fluid (Pa � s)
+                mu_h = 2.87e-3;
+                // dynamic viscosity of light fluid (Pa � s)
+                mu_l = 1.84e-5;
+                // velocity (m/s)
+                Uo = 200;
+                // diameter of jet (m)
+                D = 0.0001;
+                // surface tension (N/m)
+                sigma = 0.03;
+                break;
+            case 3:
+                // density of heavy fluid (kg/m^3)
+                rho_h = 1000;
+                // density of light fluid (kg/m^3)
+                rho_l = 1.0;
+                // density ratio
+                r_rho = rho_h / rho_l;
+                // dynamic viscosity of heavy fluid (Pa � s)
+                mu_h = 2.87e-3;
+                // dynamic viscosity of light fluid (Pa � s)
+                mu_l = 1.84e-5;
+                // velocity (m/s)
+                Uo = 200;
+                // diameter of jet (m)
+                D = 0.0001;
+                // surface tension (N/m)
+                sigma = 0.03;
+                break;
+        }
+
+        double Re = rho_h * Uo * D / mu_h;
+        double We = rho_h * Uo * Uo * D / sigma;
+
+        double dx = D / D_LB;
+        double nu_h = U_LB * D_LB / Re;
+        double nu_l = nu_h;
+
+        double rho_h_LB = 1;
+        //surface tension
+        double sigma_LB = rho_h_LB * U_LB * U_LB * D_LB / We;
+
+        // LBMReal dLB = 0; // = length[1] / dx;
+        LBMReal rhoLB = 0.0;
+        LBMReal nuLB = nu_l; //(uLB*dLB) / Re;
+
+        double beta = 12.0 * sigma_LB / interfaceWidth;
+        double kappa = 1.5 * interfaceWidth * sigma_LB;
+
+        if (myid == 0) {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "U_LB = " << U_LB);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nu_l = " << nu_l);
+            UBLOG(logINFO, "nu_h = " << nu_h);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "We = " << We);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "sigma = " << sigma);
+            UBLOG(logINFO, "density ratio = " << r_rho);
+            // UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+        }
+
+        SPtr<LBMUnitConverter> conv(new LBMUnitConverter());
+
+        // const int baseLevel = 0;
+
+        SPtr<LBMKernel> kernel;
+
+        // kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel());
+        // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel());
+        kernel = SPtr<LBMKernel>(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphaseVelocityBaseSplitDistributionLBMKernel());
+        //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel());
+
+        kernel->setWithForcing(true);
+        kernel->setForcingX1(0.0);
+        kernel->setForcingX2(0.0);
+        kernel->setForcingX3(0.0);
+
+        kernel->setPhiL(phiL);
+        kernel->setPhiH(phiH);
+        kernel->setPhaseFieldRelaxation(tauH);
+        kernel->setMobility(mob);
+
+        // nuL, nuG, densityRatio, beta, kappa, theta,
+
+        kernel->setCollisionFactorMultiphase(nu_h, nu_l);
+        kernel->setDensityRatio(r_rho);
+        kernel->setMultiphaseModelParameters(beta, kappa);
+        kernel->setContactAngle(theta);
+        kernel->setInterfaceWidth(interfaceWidth);
+        //dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0);
+
+        SPtr<BCProcessor> bcProc(new BCProcessor());
+        // BCProcessorPtr bcProc(new ThinWallBCProcessor());
+
+        kernel->setBCProcessor(bcProc);
+
+        SPtr<Grid3D> grid(new Grid3D(comm));
+        // grid->setPeriodicX1(true);
+        // grid->setPeriodicX2(true);
+        // grid->setPeriodicX3(true);
+        grid->setGhostLayerWidth(2);
+
+        SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(
+            comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+
+        //////////////////////////////////////////////////////////////////////////
+        // restart
+        SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+        // SPtr<MPIIORestartCoProcessor> rcp(new MPIIORestartCoProcessor(grid, rSch, pathname, comm));
+        SPtr<MPIIOMigrationCoProcessor> rcp(new MPIIOMigrationCoProcessor(grid, rSch, metisVisitor, pathname, comm));
+        // SPtr<MPIIOMigrationBECoProcessor> rcp(new MPIIOMigrationBECoProcessor(grid, rSch, pathname, comm));
+        // rcp->setNu(nuLB);
+        // rcp->setNuLG(nuL, nuG);
+        // rcp->setDensityRatio(densityRatio);
+
+        rcp->setLBMKernel(kernel);
+        rcp->setBCProcessor(bcProc);
+        //////////////////////////////////////////////////////////////////////////
+        // BC Adapter
+        //////////////////////////////////////////////////////////////////////////////
+            // bounding box
+        double g_minX1 = 0;
+        double g_minX2 = 0;
+        double g_minX3 = 0;
+
+        double g_maxX1 = 8.0 * D;//8.0 * D;
+        double g_maxX2 = 5.0 * D;
+        double g_maxX3 = 5.0 * D;
+
+        //double g_maxX1 = 1.0 * D; // 8.0 * D;
+        //double g_maxX2 = 2.0 * D;
+        //double g_maxX3 = 2.0 * D;
+
+
+        LBMReal x1c = 0;  // (g_maxX1 - g_minX1-1)/2; //
+        LBMReal x2c = (g_maxX2 - g_minX2) / 2;
+        LBMReal x3c = (g_maxX3 - g_minX3) / 2;
+        
+        mu::Parser fctF1;
+        // fctF1.SetExpr("vy1*(1-((x1-x0)^2+(x3-z0)^2)/(R^2))");
+        // fctF1.SetExpr("vy1*(1-(sqrt((x1-x0)^2+(x3-z0)^2)/R))^0.1");
+        fctF1.SetExpr("vy1");
+        fctF1.DefineConst("vy1", 0.0);
+        fctF1.DefineConst("R", 8.0);
+        fctF1.DefineConst("x0", 0.0);
+        fctF1.DefineConst("z0", 0.0);
+        // SPtr<BCAdapter> velBCAdapterF1(
+        //    new MultiphaseVelocityBCAdapter(false, true, false, fctF1, phiH, 0.0, BCFunction::INFCONST));
+
+        mu::Parser fctF2;
+        fctF2.SetExpr("vy1");//*(1-(sqrt((x2-x2c)*(x2-x2c)+(x3-x3c)*(x3-x3c))/R))");
+        fctF2.DefineConst("vy1", U_LB);
+        fctF2.DefineConst("R", D*0.5);
+        fctF2.DefineConst("x1c", x1c);
+        fctF2.DefineConst("x2c", x2c);
+        fctF2.DefineConst("x3c", x3c);
+
+
+        double startTime = 1;
+        SPtr<BCAdapter> velBCAdapterF1(
+            new MultiphaseVelocityBCAdapter(true, false, false, fctF1, phiH, 0.0, startTime));
+        SPtr<BCAdapter> velBCAdapterF2(
+            new MultiphaseVelocityBCAdapter(true, false, false, fctF2, phiH, startTime, endTime));
+
+        SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+        noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+
+        SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+        denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm()));
+
+        mu::Parser fctPhi_F1;
+        fctPhi_F1.SetExpr("phiH");
+        fctPhi_F1.DefineConst("phiH", phiH);
+
+        mu::Parser fctPhi_F2;
+        fctPhi_F2.SetExpr("phiL");
+        fctPhi_F2.DefineConst("phiL", phiL);
+
+        mu::Parser fctvel_F2_init;
+        fctvel_F2_init.SetExpr("U");
+        fctvel_F2_init.DefineConst("U", 0);
+
+        velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
+        //////////////////////////////////////////////////////////////////////////////////
+        // BC visitor
+        MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
+        bcVisitor.addBC(noSlipBCAdapter);
+        bcVisitor.addBC(denBCAdapter); // Ohne das BB?
+        bcVisitor.addBC(velBCAdapterF1);
+
+        //SPtr<D3Q27Interactor> inflowF1Int;
+        //SPtr<D3Q27Interactor> cylInt;
+
+        SPtr<D3Q27Interactor> inflowInt;
+
+        if (newStart) {
+
+            //  if (newStart) {
+
+
+
+
+
+            // geometry
+            SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube",
+                                           WbWriterVtkXmlBinary::getInstance());
+
+            //if (myid == 0)
+            //    UBLOG(logINFO, "Read geoFile:start");
+            //SPtr<GbTriFaceMesh3D> cylinder = make_shared<GbTriFaceMesh3D>();
+            //cylinder->readMeshFromSTLFileBinary(pathGeo + "/" + geoFile, false);
+            //GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance());
+            //if (myid == 0)
+            //    UBLOG(logINFO, "Read geoFile:stop");
+            // inflow
+            // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2 - 0.5 * dx, g_minX3, g_maxX1, g_minX2 - 1.0 *
+            // dx, g_maxX3));
+            //GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1 * 0.5 - dx, g_minX2 - dx, g_minX3 * 0.5 - dx,
+            //                                         g_maxX1 * 0.5 + dx, g_minX2, g_maxX3 * 0.5 + dx));
+            //if (myid == 0)
+            //    GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1",
+            //                               WbWriterVtkXmlASCII::getInstance());
+
+            GbCylinder3DPtr geoInflow(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1,
+                                                       g_maxX2 / 2.0,
+                                                       g_maxX3 / 2.0, D / 2.0));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow",
+                                           WbWriterVtkXmlASCII::getInstance());
+
+            GbCylinder3DPtr geoSolid(new GbCylinder3D(g_minX1 - 2.0 * dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1-dx,
+                                                       g_maxX2 / 2.0, g_maxX3 / 2.0, 1.5*D / 2.0));
+            if (myid == 0)
+                GbSystem3D::writeGeoObject(geoSolid.get(), pathname + "/geo/geoSolid",
+                                           WbWriterVtkXmlASCII::getInstance());
+
+
+            // GbCylinder3DPtr cylinder2(
+            //    new GbCylinder3D(0.0, g_minX2 - 2.0 * dx / 2.0, 0.0, 0.0, g_minX2 + 4.0 * dx, 0.0, 8.0+2.0*dx));
+            // if (myid == 0)
+            //    GbSystem3D::writeGeoObject(cylinder2.get(), pathname + "/geo/cylinder2",
+            //                               WbWriterVtkXmlASCII::getInstance());
+            // outflow
+            // GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original)
+            // GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2 - 40 * dx, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+            GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow",                                         WbWriterVtkXmlASCII::getInstance());
+
+            // double blockLength = blocknx[0] * dx;
+
+            if (myid == 0) {
+                UBLOG(logINFO, "Preprocess - start");
+            }
+
+            grid->setDeltaX(dx);
+            grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+            grid->setPeriodicX1(false);
+            grid->setPeriodicX2(false);
+            grid->setPeriodicX3(false);
+
+            GenBlocksGridVisitor genBlocks(gridCube);
+            grid->accept(genBlocks);
+
+            SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor(
+                grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+            //SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBCAdapter,
+            //                                                        Interactor3D::SOLID, Interactor3D::POINTS));
+
+            // inflowF1Int =
+            //    SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            // inflowF1Int->addBCAdapter(velBCAdapterF2);
+
+            SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+            // Create boundary conditions geometry
+            GbCuboid3DPtr wallXmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_minX1, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallXmax(
+                new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallZmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_minX3));
+            GbSystem3D::writeGeoObject(wallZmin.get(), pathname + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallZmax(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_maxX3, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3 + 2.0*dx));
+            GbSystem3D::writeGeoObject(wallZmax.get(), pathname + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmin(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_minX2, g_maxX3));
+            GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance());
+            GbCuboid3DPtr wallYmax(
+                new GbCuboid3D(g_minX1 - 2.0*dx, g_maxX2, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3));
+            GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance());
+
+            // Add boundary conditions to grid generator
+            SPtr<D3Q27Interactor> wallXminInt(
+                new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallXmaxInt(
+                new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallZminInt(
+                new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallZmaxInt(
+                new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYminInt(
+                new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            SPtr<D3Q27Interactor> wallYmaxInt(
+                new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            //cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCAdapterF1, Interactor3D::SOLID));
+            //cylInt->addBCAdapter(velBCAdapterF2);
+            // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBCAdapter,
+            // Interactor3D::SOLID));
+
+            inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapterF1, Interactor3D::SOLID));
+            inflowInt->addBCAdapter(velBCAdapterF2);
+
+            SPtr<D3Q27Interactor> solidInt =
+                SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            InteractorsHelper intHelper(grid, metisVisitor, true);
+            //intHelper.addInteractor(cylInt);
+            //intHelper.addInteractor(tubes);
+            intHelper.addInteractor(outflowInt);
+            // intHelper.addInteractor(cyl2Int);
+
+            intHelper.addInteractor(wallXminInt);
+            //intHelper.addInteractor(wallXmaxInt);
+            intHelper.addInteractor(wallZminInt);
+            intHelper.addInteractor(wallZmaxInt);
+            intHelper.addInteractor(wallYminInt);
+            intHelper.addInteractor(wallYmaxInt);
+            intHelper.addInteractor(inflowInt);
+            //intHelper.addInteractor(solidInt);
+
+            intHelper.selectBlocks();
+
+            ppblocks->process(0);
+            ppblocks.reset();
+
+            unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+            int ghostLayer = 3;
+            unsigned long long numberOfNodesPerBlock =
+                (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]);
+            unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+            unsigned long long numberOfNodesPerBlockWithGhostLayer =
+                numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+            double needMemAll =
+                double(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+            if (myid == 0) {
+                UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+                UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+                int minInitLevel = grid->getCoarsestInitializedLevel();
+                int maxInitLevel = grid->getFinestInitializedLevel();
+                for (int level = minInitLevel; level <= maxInitLevel; level++) {
+                    int nobl = grid->getNumberOfBlocks(level);
+                    UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+                    UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock);
+                }
+                UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+                UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+                UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+            }
+
+            MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h, nu_l,0,0,0,0, availMem, needMem);
+
+            grid->accept(kernelVisitor);
+
+            //if (refineLevel > 0) {
+            //    SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            //    grid->accept(undefNodesVisitor);
+            //}
+
+            intHelper.setBC();
+
+            // initialization of distributions
+            //mu::Parser fct1;
+            //fct1.SetExpr("phiL");
+            //fct1.DefineConst("phiL", phiL);
+            
+            mu::Parser fct1;
+            fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)");
+            fct1.DefineConst("x1c", x1c);
+            fct1.DefineConst("x2c", x2c);
+            fct1.DefineConst("x3c", x3c);
+            fct1.DefineConst("radius", 0.5*D);
+            fct1.DefineConst("interfaceThickness", interfaceWidth*dx);
+
+            MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
+            initVisitor.setPhi(fct1);
+            grid->accept(initVisitor);
+            ///////////////////////////////////////////////////////////////////////////////////////////
+            //{
+            // std::vector<std::vector<SPtr<Block3D>>> blockVector;
+            // int gridRank = comm->getProcessID();
+            // int minInitLevel = grid->getCoarsestInitializedLevel();
+            // int maxInitLevel = grid->getFinestInitializedLevel();
+            // blockVector.resize(maxInitLevel + 1);
+            // for (int level = minInitLevel; level <= maxInitLevel; level++) {
+            //    grid->getBlocks(level, gridRank, true, blockVector[level]);
+            //}
+            //    for (int level = minInitLevel; level <= maxInitLevel; level++) {
+            //    for (SPtr<Block3D> block : blockVector[level]) {
+            //        if (block) {
+            //            int ix1 = block->getX1();
+            //            int ix2 = block->getX2();
+            //            int ix3 = block->getX3();
+            //            int level = block->getLevel();
+
+            //            for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) {
+            //                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+
+            //                if (!neighBlock) {
+
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
+            //    SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0);
+            //    SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+            //    SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+
+            //    for (int ix3 = 0; ix3 <= 13; ix3++) {
+            //        for (int ix2 = 0; ix2 <= 13; ix2++) {
+            //            for (int ix1 = 0; ix1 <= 13; ix1++) {
+            //                if (ix1 == 0 || ix2 == 0 || ix3 == 0 || ix1 == 13 || ix2 == 13 || ix3 == 13)
+            //                    bcArray->setUndefined(ix1, ix2, ix3);
+            //            }
+            //        }
+            //    }
+            //}
+            ////////////////////////////////////////////////////////////////////////////////////////////
+            // boundary conditions grid
+            {
+                SPtr<UbScheduler> geoSch(new UbScheduler(1));
+                SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
+                    grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+                ppgeo->process(0);
+                ppgeo.reset();
+            }
+
+            if (myid == 0)
+                UBLOG(logINFO, "Preprocess - end");
+        } else {
+            rcp->restart((int)restartStep);
+            grid->setTimeStep(restartStep);
+
+            if (myid == 0)
+                UBLOG(logINFO, "Restart - end");
+        }
+        
+        //  TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //  grid->accept(setConnsVisitor);
+
+        // ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm);
+
+        grid->accept(bcVisitor);
+
+         ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+        grid->accept(setConnsVisitor);
+
+        SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+        double t_ast, t;
+        t_ast = 7.19;
+        t = (int)(t_ast/(U_LB/(D_LB)));
+        visSch->addSchedule(t,t,t); //t=7.19
+        SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor(
+            grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+        pp->process(0);
+
+        SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+        SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+        SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime));
+        auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch));
+        timeDepBC->addInteractor(inflowInt);
+
+#ifdef _OPENMP
+        omp_set_num_threads(numOfThreads);
+#endif
+
+        SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+        SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+        calculator->addCoProcessor(npr);
+        calculator->addCoProcessor(pp);
+        calculator->addCoProcessor(timeDepBC);
+        calculator->addCoProcessor(rcp);
+
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-start");
+        calculator->calculate();
+        if (myid == 0)
+            UBLOG(logINFO, "Simulation-end");
+    } catch (std::exception &e) {
+        cerr << e.what() << endl << flush;
+    } catch (std::string &s) {
+        cerr << s << endl;
+    } catch (...) {
+        cerr << "unknown exception" << endl;
+    }
+}
+int main(int argc, char *argv[])
+{
+    // Sleep(30000);
+    if (argv != NULL) {
+        if (argv[1] != NULL) {
+            run(string(argv[1]));
+        } else {
+            cout << "Configuration file is missing!" << endl;
+        }
+    }
+}
diff --git a/apps/cpu/Nozzle/in.nozzle b/apps/cpu/Nozzle/in.nozzle
index 4479b5e3c..7b633f553 100644
--- a/apps/cpu/Nozzle/in.nozzle
+++ b/apps/cpu/Nozzle/in.nozzle
@@ -76,13 +76,15 @@ region bc cylinder z -1.3013105 0.388582 0.01275005 0.18055 0.20105 units box
        # nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
        # insertion_face inface 
        
-# fix    ins nve_group insert/stream seed 32452867 distributiontemplate pdd1 &
-       # nparticles 6000 massrate 0.1 insert_every ones overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
-       # insertion_face inface 
-
-fix ins nve_group insert/pack seed 32452867 distributiontemplate pdd1 insert_every 1000 &
-                        overlapcheck yes volumefraction_region 0.1 region bc ntry_mc 1001
-   
+ # fix    ins nve_group insert/stream seed 32452867 distributiontemplate pdd1 &
+        # nparticles 6000 massrate 0.1 insert_every ones overlapcheck yes all_in no vel constant 0.0 0.0 -1.0 &
+        # insertion_face inface 
+
+#working setup
+# fix ins nve_group insert/pack seed 32452867 distributiontemplate pdd1 insert_every 1000 &
+                       # overlapcheck yes vel constant 0.0 0.0 -1.0 volumefraction_region 0.1 region bc ntry_mc 1001
+fix ins nve_group insert/pack seed 32452867 distributiontemplate pdd1 insert_every 10 &
+                       overlapcheck yes vel constant 0.0 0.0 -1.0 volumefraction_region 0.1 region bc ntry_mc 1001   
        
 # fix    ins all insert/stream seed 32452867 distributiontemplate pdd1 &
        # nparticles INF massrate 0.1 overlapcheck yes all_in yes vel constant 0.0 0.0 -1.0 &
diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp
index 81ab57a73..ab07f1f91 100644
--- a/apps/cpu/Nozzle/nozzle.cpp
+++ b/apps/cpu/Nozzle/nozzle.cpp
@@ -1,4 +1,4 @@
-#include <iostream>
+#include <iostream>
 #include <string>
 #include <memory>
 
@@ -30,61 +30,229 @@ int main(int argc, char *argv[])
 
     double g_minX1 = -1341.81e-3 + 10e-3;
     double g_minX2 =  0.360872;
-    double g_minX3 = -210e-3;
+    double g_minX3 = 0;//-210e-3;
 
     double g_maxX1 = -1260.81e-3 - 10e-3;
     double g_maxX2 =  0.416302;
-    double g_maxX3 =  210e-3;
+    double g_maxX3 = 0.20105; //210e-3;
 
     int blockNX[3] = { 10, 10, 10 };
 
     double dx = 1e-3;
 
-    double nuLB = 1e-3;
-    double uLB  = -0.01;
-    double rhoLB = 0.0;
+    double uLB  = 0.0001;
+    //double rhoLB = 0.0;
 
-    SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
+    // concrete 
+    double d_part = 1e-3;
+    double V = 0.4;     // flow rate [m^3/h]
+    double D = 0.026;   // shotcrete inlet diameter [m]
+    double R = D / 2.0; // radius [m]
+    double A = UbMath::PI * R * R;
+    double u = V / 3600 / A;
+    double muConcrete = 2.1133054011798826; // [Pa s]
+    double tau0 = 715.218181094648; //
+    double rhoConcrete = 2400; // [kg/m^3]
+    double nu = muConcrete / rhoConcrete;
+    double rhoAir = 1.2041; // [kg/m^3]
+    //double Re_D = d_part * u / nu;
+    //if (myid == 0) UBLOG(logINFO, "Re_D = " << Re_D);
+    //
+    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uLB);
+    //double nuLB = D*units->getFactorLentghWToLb() * u*units->getFactorVelocityWToLb() / Re_D;
+    //if (myid == 0) UBLOG(logINFO, "nuLB = " << nuLB);
+
+    double interfaceThickness = 4.096;
+    double sigma = 0.03;
+    double Re = rhoConcrete * u * d_part / muConcrete;
+    double We = rhoConcrete * u * u * d_part / sigma;
+
+    double nu_h_LB = uLB * d_part / Re;
+    double nu_l_LB = nu_h_LB;
+    if (myid == 0) UBLOG(logINFO, "nu_h = " << nu_h_LB << " nu_l = " << nu_l_LB);
+
+    double rho_h_LB = 1;
+
+    // surface tension
+    double sigma_LB = rho_h_LB * uLB * uLB * d_part / We;
+    if (myid == 0) UBLOG(logINFO, "sigma_LB = " << sigma_LB);
+
+    // LBMReal dLB = 0; // = length[1] / dx;
+    LBMReal rhoLB = 0.0;
+    //LBMReal nuLB = nu_l; //(uLB*dLB) / Re;
+
+    double beta = 12.0 * sigma_LB / interfaceThickness;
+    double kappa = 1.5 * interfaceThickness * sigma_LB;
+
+    double phiL = 0.0;
+    double phiH = 1.0;
+    double tauH = 0.6; // Phase - field Relaxation
+    double mob = 0.02; // Mobility
+    //double nuL = 1e-2;
+    //double nuG = 0.015811388300841892;
+    double densityRatio =  rhoConcrete / rhoAir;
+    //double sigma_old = 1.0850694444444444e-06;
+    //
+    //double beta_old = 12.0 * sigma / interfaceThickness;
+    //double kappa_old = 1.5 * interfaceThickness * sigma;
+    
+    double theta = 110; //contact angle
+
+    //https://civilsir.com/density-of-cement-sand-and-aggregate-in-kg-m3-list-of-material-density/
+
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
+    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB));
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB));
+    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uRef);
+    if (myid == 0) std::cout << units->toString() << std::endl;
+
+    //SPtr<LBMKernel> kernel   = make_shared<IBcumulantK17LBMKernel>();
     //SPtr<LBMKernel> kernel   = make_shared<CumulantK17LBMKernel>();
+    //SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>();
+    SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>();
+
+    kernel->setWithForcing(true);
+    kernel->setForcingX1(0.0);
+    kernel->setForcingX2(0.0);
+    kernel->setForcingX3(0.0);
+
+    kernel->setPhiL(phiL);
+    kernel->setPhiH(phiH);
+    kernel->setPhaseFieldRelaxation(tauH);
+    kernel->setMobility(mob);
+    kernel->setInterfaceWidth(interfaceThickness);
+
+    kernel->setCollisionFactorMultiphase(nu_h_LB, nu_l_LB);
+    kernel->setDensityRatio(densityRatio);
+    kernel->setMultiphaseModelParameters(beta, kappa);
+    kernel->setContactAngle(theta);
+ 
     SPtr<BCProcessor> bcProc = make_shared<BCProcessor>();
     kernel->setBCProcessor(bcProc);
 
+    //SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+    //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
     SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-    noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+    noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm()));
+
 
     mu::Parser fct;
-    fct.SetExpr("U");
-    fct.DefineConst("U", uLB);
-    SPtr<BCAdapter> inflowBCAdapter(new VelocityBCAdapter(false, false, true, fct, 0, BCFunction::INFCONST));
-    inflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+    {
+        // concrete inflow boundary condition
+        fct.SetExpr("U");
+        fct.DefineConst("U", -u*units->getFactorVelocityWToLb());
+        if (myid == 0) UBLOG(logINFO, "Concrete inflow velocity = " << u << " m/s");
+        if (myid == 0) UBLOG(logINFO, "Concrete inflow velocity = " << u*units->getFactorVelocityWToLb() << " dx/dt");
+    //    // Å tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering
+    //    // Mechanics, 21(6), 371-379.
+    //    double cx1 = -1.31431 + R;
+    //    double cx2 = 0.375582 + R;
+    //    //double cx3 = 0.20105 + R;
+    //    double L = g_maxX1 - g_minX1;
+    //    double p_concrete = 7e5; // Pa = 7 Bar
+    //    double p1 = p_concrete * units->getFactorPressureWToLb();
+    //    double p2 = 0.0;
+    //    double drhoLB = 1.0 + rhoLB;
+    //    double muLB = drhoLB * nuLB;
+    //    double N = R * R / 2 * muLB * uLB * (p1 - p2) / L - 3;
+
+    //    // mu::Parser fct;
+    //    fct.SetExpr("U*(1-(((((x2-y0)^2+(x1-x0)^2)^0.5)/R)^NplusOne))");
+    //    fct.DefineConst("x0", cx1);
+    //    fct.DefineConst("y0", cx2);
+    //    //fct.DefineConst("z0", cx3);
+    //    fct.DefineConst("R", R);
+    //    fct.DefineConst("U", uLB * ((N + 3) / (N + 1)));
+    //    fct.DefineConst("NplusOne", N + 1.0);
+    }
+
+    //SPtr<BCAdapter> inflowConcreteBCAdapter(new VelocityBCAdapter(false, false, true, fct, 0, BCFunction::INFCONST));
+    //inflowConcreteBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+    SPtr<BCAdapter> inflowConcreteBCAdapter(new MultiphaseVelocityBCAdapter(false, false, true, fct, phiH, 0, BCFunction::INFCONST));
+    inflowConcreteBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
+
+    {
+        //air inflow boundary condition
+        // Å tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering
+        // Mechanics, 21(6), 371-379.
+        //SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx);
+        SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB);
+        double V = 40;     // flow rate [m^3/h]
+        double D = 0.0166;  // air inlet diameter [m]
+        double R = D / 2.0; // radius [m]
+        double A = UbMath::PI * R * R;
+        double u = V / 3600 / A;
+        double uLB = u * unitsAir->getFactorVelocityWToLb();
+        //double cx1 = -1.2788 + R;
+        double cx2 = 0.3803 + R;
+        double cx3 = 0.1517 + R;
+        double L = g_maxX1 - g_minX1;
+        double p_air = 7e5; // Pa = 7 Bar
+        double p1 = p_air;
+        double p2 = 0.0;
+        double mu = 17.2e-6; //Pa s, air 20° C
+        double N = R * R / 2 * mu * u * (p1 - p2) / L - 3;
+        if (myid == 0) UBLOG(logINFO, "Air inflow velocity = " << u << " m/s");
+        if (myid == 0) UBLOG(logINFO, "Air inflow velocity = " << uLB << " dx/dt");
+
+        double nu = mu / rhoConcrete;
+        double Re = D * u / nu;
+        if (myid == 0) UBLOG(logINFO, "Re_air = " << Re);
+
+        double nuLB = D * unitsAir->getFactorLentghWToLb() * uLB * unitsAir->getFactorVelocityWToLb() / Re;
+        if (myid == 0) UBLOG(logINFO, "nuLB_air = " << nuLB);
+
+        // mu::Parser fct;
+        fct.SetExpr("U");
+        fct.DefineConst("U", -uLB);
+        //fct.SetExpr("U*(1-(((((x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))");
+        ////fct.DefineConst("x0", cx1);
+        //fct.DefineConst("y0", cx2);
+        //fct.DefineConst("z0", cx3);
+        //fct.DefineConst("R", R);
+        //fct.DefineConst("U", -uLB * ((N + 3) / (N + 1)));
+        //fct.DefineConst("NplusOne", N + 1.0);
+    }
+
+    //SPtr<BCAdapter> inflowAirBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+    //inflowAirBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+    SPtr<BCAdapter> inflowAirBCAdapter(new MultiphaseVelocityBCAdapter(true, false, false, fct, phiL, 0, BCFunction::INFCONST));
+    inflowAirBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm()));
 
     SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
-    outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+    //outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+    //SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+    outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm()));
     //////////////////////////////////////////////////////////////////////////////////
     // BC visitor
-    BoundaryConditionsBlockVisitor bcVisitor;
+    //BoundaryConditionsBlockVisitor bcVisitor;♣
+    MultiphaseBoundaryConditionsBlockVisitor bcVisitor;
     bcVisitor.addBC(noSlipBCAdapter);
-    bcVisitor.addBC(inflowBCAdapter);
+    bcVisitor.addBC(inflowConcreteBCAdapter);
+    bcVisitor.addBC(inflowAirBCAdapter);
     bcVisitor.addBC(outflowBCAdapter);
 
     SPtr<Grid3D> grid = make_shared<Grid3D>(comm);
-    grid->setPeriodicX1(true);
-    grid->setPeriodicX2(true);
+    grid->setPeriodicX1(false);
+    grid->setPeriodicX2(false);
     grid->setPeriodicX3(false);
     grid->setDeltaX(dx);
     grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]);
+    grid->setGhostLayerWidth(2);
 
     string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo";
 
-    string outputPath = "f:/temp/NozzleFlowTestSerial";
+    string outputPath = "d:/temp/NozzleFlowTest_Multiphase";
     UbSystem::makeDirectory(outputPath);
     UbSystem::makeDirectory(outputPath + "/liggghts");
 
-    if (myid == 0) {
-        stringstream logFilename;
-        logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-        UbLog::output_policy::setStream(logFilename.str());
-    }
+    //if (myid == 0) {
+    //    stringstream logFilename;
+    //    logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+    //    UbLog::output_policy::setStream(logFilename.str());
+    //}
 
     SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE));
     
@@ -154,17 +322,26 @@ int main(int argc, char *argv[])
     //inflow
     GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, 0.20105, -1.30181+0.0005, 0.390872-0.00229, 0.23, 0.013));
     if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-    SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowBCAdapter, Interactor3D::SOLID));
+    SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBCAdapter, Interactor3D::SOLID));
     ///////////////////////////////////////////////////////////
     //outflow
     GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, -0.22, -1.30181+0.0005, 0.390872-0.00229, -0.21, 0.013));
     if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-    SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, inflowBCAdapter, Interactor3D::SOLID));
+    SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
+    ///////////////////////////////////////////////////////////
+    SPtr<GbTriFaceMesh3D> geoAirInlet = std::make_shared<GbTriFaceMesh3D>();
+    if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:start");
+    geoAirInlet->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet.stl", true);
+    if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:end");
+    if (myid == 0) GbSystem3D::writeGeoObject(geoAirInlet.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance());
+    SPtr<Interactor3D> intrAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(
+        geoAirInlet, grid, inflowAirBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES);
     ///////////////////////////////////////////////////////////
 
     InteractorsHelper intHelper(grid, metisVisitor, true);
     intHelper.addInteractor(intrBox);
     intHelper.addInteractor(intrInflow);
+    intHelper.addInteractor(intrAirInlet);
     intHelper.addInteractor(intrOutflow);
     intHelper.addInteractor(intrNozzleAirDistributor);
     intHelper.addInteractor(intrNozzleAirInlet);
@@ -185,12 +362,30 @@ int main(int argc, char *argv[])
      if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses()));
 
 
-    SetKernelBlockVisitor kernelVisitor(kernel, nuLB, comm->getNumberOfProcesses());
+    //SetKernelBlockVisitor kernelVisitor(kernel, nuLB, comm->getNumberOfProcesses());
+     MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1);
     grid->accept(kernelVisitor);
 
     intHelper.setBC();
 
-    InitDistributionsBlockVisitor initVisitor;
+    //InitDistributionsBlockVisitor initVisitor;
+    //grid->accept(initVisitor);
+
+    double x1c = -1.31431 + R;
+    double x2c = 0.375582 + R;
+    double x3c = 0.20105;
+
+    mu::Parser fct1;
+    //fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)");
+    fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)");
+    fct1.DefineConst("x1c", x1c);
+    fct1.DefineConst("x2c", x2c);
+    fct1.DefineConst("x3c", x3c);
+    fct1.DefineConst("radius", R);
+    fct1.DefineConst("interfaceThickness", interfaceThickness * dx);
+
+    MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor;
+    initVisitor.setPhi(fct1);
     grid->accept(initVisitor);
 
   
@@ -199,21 +394,11 @@ int main(int argc, char *argv[])
     MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator());
     LiggghtsCouplingWrapper wrapper(argv, mpi_comm);
 
-
-    double d_part = 1e-3;
- 
-    // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx);
-    //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx);
-    SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, 0.01);
-    if (myid == 0) std::cout << units->toString() << std::endl;
-
-    //return 0;
-
     double v_frac = 0.1;
     double dt_phys   = units->getFactorTimeLbToW();
     int demSubsteps = 10;
     double dt_dem   = dt_phys / (double)demSubsteps;
-    int vtkSteps    = 100;
+    int vtkSteps    = 1000;
     string demOutDir = outputPath + "/liggghts";
 
     //wrapper.execCommand("echo none");
@@ -225,8 +410,8 @@ int main(int argc, char *argv[])
     wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps);
     wrapper.setVariable("dmp_dir", demOutDir);
 
-    wrapper.execFile((char *)inFile1.c_str());
-    wrapper.runUpto(demSubsteps - 1);
+    //wrapper.execFile((char *)inFile1.c_str());
+    //wrapper.runUpto(demSubsteps - 1);
     //wrapper.runUpto(1000);
 
     SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); 
@@ -236,15 +421,16 @@ int main(int argc, char *argv[])
     // boundary conditions grid
     {
         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-        SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(
-            grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
+        SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm));
         ppgeo->process(0);
         ppgeo.reset();
     }
 
     grid->accept(bcVisitor);
 
-    OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+    //OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
+    //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
+    ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm);
     grid->accept(setConnsVisitor);
 
     int numOfThreads          = 18;
@@ -256,16 +442,16 @@ int main(int argc, char *argv[])
     //// write data for visualization of macroscopic quantities
     SPtr < UbScheduler> visSch(new UbScheduler(vtkSteps));
     //SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800));
-    visSch->addSchedule(1, 8700, 8800);
-    SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(
-        new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(),
+   // visSch->addSchedule(1, 8700, 8800);
+    SPtr<WriteMultiphaseQuantitiesCoProcessor> writeMQCoProcessor(
+        new WriteMultiphaseQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(),
                                                   SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
     writeMQCoProcessor->process(0);
 
-    int endTime = 10000000; //20;
+    int endTime = 1000000;
     SPtr<Calculator> calculator(new BasicCalculator(grid, lScheduler, endTime));
     calculator->addCoProcessor(nupsCoProcessor);
-    calculator->addCoProcessor(lcCoProcessor);
+   // calculator->addCoProcessor(lcCoProcessor);
     calculator->addCoProcessor(writeMQCoProcessor);
 
     if (myid == 0) UBLOG(logINFO, "Simulation-start");
diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h
index a9181e228..ade31e5fd 100644
--- a/src/cpu/VirtualFluids.h
+++ b/src/cpu/VirtualFluids.h
@@ -256,6 +256,7 @@
 #include <LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h>
 #include <LBM/MultiphasePressureFilterLBMKernel.h>
 #include <LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h>
+#include <MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h>
 
 
 
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h
index 67a3620c0..f8e77af6d 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h
@@ -69,6 +69,8 @@ public:
     static const char RheologyPowellEyringModelNoSlipBCAlgorithm           = 18;
     static const char RheologyBinghamModelVelocityBCAlgorithm              = 19;
     static const char MultiphaseNoSlipBCAlgorithm                  = 20;
+    static const char MultiphaseVelocityBCAlgorithm = 21;
+
 
 
 public:
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
index d66094dcc..abaf54808 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
@@ -33,4 +33,4 @@
 
 #include "BoundaryConditions.h"
 
-const long long BoundaryConditions::maxOptionVal = (1 << optionDigits) - 1; // 2^3-1 -> 7
+const long long BoundaryConditions::maxOptionVal = (1 << optionDigits) - 1; // 2^2-1 -> 3
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
index 76128e0e7..aafa0da55 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp
@@ -66,17 +66,20 @@ void MultiphaseNoSlipBCAlgorithm::applyBC()
 {
    LBMReal f[D3Q27System::ENDF+1];
    LBMReal h[D3Q27System::ENDF+1];
-   LBMReal feq[D3Q27System::ENDF+1];
-   LBMReal heq[D3Q27System::ENDF+1];
+   LBMReal h2[D3Q27System::ENDF + 1];
+   //LBMReal feq[D3Q27System::ENDF+1];
+   //LBMReal heq[D3Q27System::ENDF+1];
    distributions ->getDistributionInv(f, x1, x2, x3);
+   if (distributionsH2)
+       distributionsH2->getDistributionInv(h2, x1, x2, x3);
    distributionsH->getDistributionInv(h, x1, x2, x3);
-   LBMReal phi, vx1, vx2, vx3, p1;
+  // LBMReal phi, vx1, vx2, vx3, p1;
    
-   D3Q27System::calcDensity(h, phi);
+ //  D3Q27System::calcDensity(h, phi);
    
-   calcMacrosFct(f, p1, vx1, vx2, vx3);
-   D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3);
-   D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3); 
+ //  calcMacrosFct(f, p1, vx1, vx2, vx3);
+ //  D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3);
+ //  D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3); 
 
    for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
    {
@@ -85,13 +88,18 @@ void MultiphaseNoSlipBCAlgorithm::applyBC()
          //quadratic bounce back
          const int invDir = D3Q27System::INVDIR[fdir];
 		 LBMReal fReturn = f[invDir];
-         //if (UbMath::isNaN(fReturn))
-             //UBLOG(logINFO, "fReturn: " << fReturn);
-         distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
-		 LBMReal hReturn = h[invDir];
-         //if (UbMath::isNaN(hReturn))
-             //UBLOG(logINFO, "hReturn: " << hReturn);
-		 distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
+         //distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
+         distributions->setDistributionForDirection(fReturn, x1, x2, x3, invDir);//delay BB 
+         LBMReal hReturn = h[invDir];
+		// distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
+         distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, invDir);//delay BB  
+         if (distributionsH2)
+         {
+             LBMReal h2Return = h2[invDir];
+             distributionsH2->setDistributionForDirection(h2Return, x1, x2, x3, invDir);//delay BB
+            // distributionsH2->setDistributionForDirection(h2Return, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir);
+
+         }
       }
    }
 }
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
index fc6019244..054227ecd 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp
@@ -62,6 +62,11 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributionsH(SPtr<Distribut
 	this->distributionsH = distributionsH;
 }
 //////////////////////////////////////////////////////////////////////////
+void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributionsH2(SPtr<DistributionArray3D> distributionsH2)
+{
+    this->distributionsH2 = distributionsH2;
+}
+//////////////////////////////////////////////////////////////////////////
 void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 {
    using namespace D3Q27System;
@@ -70,6 +75,8 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
    LBMReal ftemp[ENDF+1];
    LBMReal h[D3Q27System::ENDF+1];
    LBMReal htemp[ENDF+1];
+   LBMReal h2[D3Q27System::ENDF + 1];
+   LBMReal h2temp[ENDF + 1];
 
    int nx1 = x1;
    int nx2 = x2;
@@ -89,45 +96,47 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
    distributions->getDistribution(ftemp, nx1, nx2, nx3);
    distributionsH->getDistribution(h, x1, x2, x3);
    distributionsH->getDistribution(htemp, nx1, nx2, nx3);
+   distributionsH2->getDistribution(h2, x1, x2, x3);
+   distributionsH2->getDistribution(h2temp, nx1, nx2, nx3);
 
-   LBMReal phi, p1, vx1, vx2, vx3;
+   LBMReal /* phi,*/ p1, vx1, vx2, vx3;
    
-   D3Q27System::calcDensity(h, phi);
+   //D3Q27System::calcDensity(h, phi);
    
    calcMacrosFct(f, p1, vx1, vx2, vx3);
 
    switch (direction)
    {
    case DIR_P00:
-      f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P00];
-      f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PP0];
-      f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PM0];
-      f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0P];
-      f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0M];
-      f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPP];
-      f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMP];
-      f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPM];
-      f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMM];
-
-      distributions->setDistributionInvForDirection(f[DIR_P00], x1+DX1[DIR_M00], x2+DX2[DIR_M00], x3+DX3[DIR_M00], DIR_M00);
-      distributions->setDistributionInvForDirection(f[DIR_PP0], x1+DX1[DIR_MM0], x2+DX2[DIR_MM0], x3+DX3[DIR_MM0], DIR_MM0);
-      distributions->setDistributionInvForDirection(f[DIR_PM0], x1+DX1[DIR_MP0], x2+DX2[DIR_MP0], x3+DX3[DIR_MP0], DIR_MP0);
-      distributions->setDistributionInvForDirection(f[DIR_P0P], x1+DX1[DIR_M0M], x2+DX2[DIR_M0M], x3+DX3[DIR_M0M], DIR_M0M);
-      distributions->setDistributionInvForDirection(f[DIR_P0M], x1+DX1[DIR_M0P], x2+DX2[DIR_M0P], x3+DX3[DIR_M0P], DIR_M0P);
+      f[DIR_P00]   = ftemp[DIR_P00]   * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P00]   ;
+      f[DIR_PP0]  = ftemp[DIR_PP0]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PP0]  ;
+      f[DIR_PM0]  = ftemp[DIR_PM0]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PM0]  ;
+      f[DIR_P0P]  = ftemp[DIR_P0P]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0P]  ;
+      f[DIR_P0M]  = ftemp[DIR_P0M]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_P0M]  ;
+      f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPP] ;
+      f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMP] ;
+      f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PPM] ;
+      f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*f[DIR_PMM] ;
+
+      distributions->setDistributionInvForDirection(f[DIR_P00],   x1+DX1[DIR_M00],   x2+DX2[DIR_M00],   x3+DX3[DIR_M00],   DIR_M00);
+      distributions->setDistributionInvForDirection(f[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],  DIR_MM0);
+      distributions->setDistributionInvForDirection(f[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],  DIR_MP0);
+      distributions->setDistributionInvForDirection(f[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],  DIR_M0M);
+      distributions->setDistributionInvForDirection(f[DIR_P0M],  x1+DX1[DIR_M0P],  x2+DX2[DIR_M0P],  x3+DX3[DIR_M0P],  DIR_M0P);
       distributions->setDistributionInvForDirection(f[DIR_PPP], x1+DX1[DIR_MMM], x2+DX2[DIR_MMM], x3+DX3[DIR_MMM], DIR_MMM);
       distributions->setDistributionInvForDirection(f[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
       distributions->setDistributionInvForDirection(f[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
       distributions->setDistributionInvForDirection(f[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
       
-	  h[DIR_P00] = htemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P00];
-	  h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PP0];
-	  h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PM0];
-	  h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0P];
-	  h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0M];
-	  h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPP];
-	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMP];
-	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPM];
-	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMM];
+	  h[DIR_P00]   = htemp[DIR_P00]   * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P00]   ;
+	  h[DIR_PP0]  = htemp[DIR_PP0]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PP0]  ;
+	  h[DIR_PM0]  = htemp[DIR_PM0]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PM0]  ;
+	  h[DIR_P0P]  = htemp[DIR_P0P]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0P]  ;
+	  h[DIR_P0M]  = htemp[DIR_P0M]  * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_P0M]  ;
+	  h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPP] ;
+	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMP] ;
+	  h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PPM] ;
+	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1)*h[DIR_PMM] ;
 
 	  distributionsH->setDistributionInvForDirection(h[DIR_P00],   x1+DX1[DIR_M00],   x2+DX2[DIR_M00],   x3+DX3[DIR_M00],   DIR_M00);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PP0],  x1+DX1[DIR_MM0],  x2+DX2[DIR_MM0],  x3+DX3[DIR_MM0],  DIR_MM0);
@@ -138,49 +147,152 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
+
+	  h2[DIR_P00] = h2temp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P00];
+      h2[DIR_PP0] = h2temp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PP0];
+      h2[DIR_PM0] = h2temp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PM0];
+      h2[DIR_P0P] = h2temp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P0P];
+      h2[DIR_P0M] = h2temp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P0M];
+      h2[DIR_PPP] = h2temp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PPP];
+      h2[DIR_PMP] = h2temp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PMP];
+      h2[DIR_PPM] = h2temp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PPM];
+      h2[DIR_PMM] = h2temp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PMM];
+
+      distributionsH2->setDistributionInvForDirection(h2[DIR_P00], x1 + DX1[DIR_M00], x2 + DX2[DIR_M00], x3 + DX3[DIR_M00], DIR_M00);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
 	  
 	  break;
    case DIR_M00:
-      f[DIR_M00]   = ftemp[DIR_M00]   * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M00]  ;
-      f[DIR_MP0]  = ftemp[DIR_MP0]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MP0] ;
-      f[DIR_MM0]  = ftemp[DIR_MM0]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MM0] ;
-      f[DIR_M0P]  = ftemp[DIR_M0P]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M0P] ;
-      f[DIR_M0M]  = ftemp[DIR_M0M]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_M0M] ;
-      f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MPP];
-      f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MMP];
-      f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MPM];
-      f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*f[DIR_MMM];
-
-      distributions->setDistributionInvForDirection(f[DIR_M00],   x1+DX1[DIR_P00],   x2+DX2[DIR_P00],   x3+DX3[DIR_P00],     DIR_P00);
-      distributions->setDistributionInvForDirection(f[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
-      distributions->setDistributionInvForDirection(f[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
-      distributions->setDistributionInvForDirection(f[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
-      distributions->setDistributionInvForDirection(f[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
-      distributions->setDistributionInvForDirection(f[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
-      distributions->setDistributionInvForDirection(f[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
-      distributions->setDistributionInvForDirection(f[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
-      distributions->setDistributionInvForDirection(f[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
+      if (false /* vx1 >= 0*/) {
 
-	  h[DIR_M00]   = htemp[DIR_M00]  * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M00]  ;
-	  h[DIR_MP0]  = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MP0] ;
-	  h[DIR_MM0]  = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MM0] ;
-	  h[DIR_M0P]  = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M0P] ;
-	  h[DIR_M0M]  = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_M0M] ;
-	  h[DIR_MPP] = htemp[DIR_MPP]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MPP];
-	  h[DIR_MMP] = htemp[DIR_MMP]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MMP];
-	  h[DIR_MPM] = htemp[DIR_MPM]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MPM];
-	  h[DIR_MMM] = htemp[DIR_MMM]* (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)*h[DIR_MMM];
-
-	  distributionsH->setDistributionInvForDirection(h[DIR_M00],   x1+DX1[DIR_P00],   x2+DX2[DIR_P00],   x3+DX3[DIR_P00],     DIR_P00);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MP0],  x1+DX1[DIR_PM0],  x2+DX2[DIR_PM0],  x3+DX3[DIR_PM0],   DIR_PM0);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
-	  distributionsH->setDistributionInvForDirection(h[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
-	  distributionsH->setDistributionInvForDirection(h[DIR_M0M],  x1+DX1[DIR_P0P],  x2+DX2[DIR_P0P],  x3+DX3[DIR_P0P],   DIR_P0P);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1+DX1[DIR_PMM], x2+DX2[DIR_PMM], x3+DX3[DIR_PMM], DIR_PMM);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
-	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
+          f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M00];
+          f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MP0];
+          f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MM0];
+          f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0P];
+          f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0M];
+          f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPP];
+          f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMP];
+          f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPM];
+          f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMM];
+
+          distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
+          h[DIR_M00] = htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M00];
+          h[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MP0];
+          h[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MM0];
+          h[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M0P];
+          h[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M0M];
+          h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MPP];
+          h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MMP];
+          h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MPM];
+          h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MMM];
+
+          distributionsH->setDistributionInvForDirection(h[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
+          h2[DIR_M00] = htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M00];
+          h2[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MP0];
+          h2[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MM0];
+          h2[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M0P];
+          h2[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M0M];
+          h2[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPP];
+          h2[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMP];
+          h2[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPM];
+          h2[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMM];
+
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+      } else {
+
+          f[DIR_M00]   = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M00];
+          f[DIR_MP0]  = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MP0];
+          f[DIR_MM0]  = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MM0];
+          f[DIR_M0P]  = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0P];
+          f[DIR_M0M]  = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0M];
+          f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPP];
+          f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMP];
+          f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPM];
+          f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMM];
+
+          distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributions->setDistributionInvForDirection(f[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributions->setDistributionInvForDirection(f[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributions->setDistributionInvForDirection(f[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributions->setDistributionInvForDirection(f[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
+          h[DIR_M00]   = htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M00];
+          h[DIR_MP0]  = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MP0];
+          h[DIR_MM0]  = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MM0];
+          h[DIR_M0P]  = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M0P];
+          h[DIR_M0M]  = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_M0M];
+          h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MPP];
+          h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MMP];
+          h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MPM];
+          h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h[DIR_MMM];
 
+          distributionsH->setDistributionInvForDirection(h[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributionsH->setDistributionInvForDirection(h[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributionsH->setDistributionInvForDirection(h[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributionsH->setDistributionInvForDirection(h[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributionsH->setDistributionInvForDirection(h[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributionsH->setDistributionInvForDirection(h[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
+          h2[DIR_M00]   = 0.5 * (htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)   * h2[DIR_M00]);
+          h2[DIR_MP0]  = 0.5 * (htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)  * h2[DIR_MP0]);
+          h2[DIR_MM0]  = 0.5 * (htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)  * h2[DIR_MM0]);
+          h2[DIR_M0P]  = 0.5 * (htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)  * h2[DIR_M0P]);
+          h2[DIR_M0M]  = 0.5 * (htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1)  * h2[DIR_M0M]);
+          h2[DIR_MPP] = 0.5 * (htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPP]);
+          h2[DIR_MMP] = 0.5 * (htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMP]);
+          h2[DIR_MPM] = 0.5 * (htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPM]);
+          h2[DIR_MMM] = 0.5 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMM]);
+
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+          distributionsH2->setDistributionInvForDirection(h2[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);      
+      }
       break;
    case DIR_0P0:
       f[DIR_0P0]   = ftemp[DIR_0P0]   * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2)*f[DIR_0P0]   ;
@@ -223,6 +335,26 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_PPM], x1+DX1[DIR_MMP], x2+DX2[DIR_MMP], x3+DX3[DIR_MMP], DIR_MMP);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1+DX1[DIR_PMP], x2+DX2[DIR_PMP], x3+DX3[DIR_PMP], DIR_PMP);
 
+	  h2[DIR_0P0] = htemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0P0];
+      h2[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PP0];
+      h2[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MP0];
+      h2[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0PP];
+      h2[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0PM];
+      h2[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PPP];
+      h2[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MPP];
+      h2[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PPM];
+      h2[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MPM];
+
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+
       break;
    case DIR_0M0:
       f[DIR_0M0]   = ftemp[DIR_0M0]   * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_0M0]   ;
@@ -235,7 +367,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_PMM] ;
       f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*f[DIR_MMM] ;
 
-      distributions->setDistributionInvForDirection(f[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0], DIR_0P0);
+      distributions->setDistributionInvForDirection(f[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0],     DIR_0P0);
       distributions->setDistributionInvForDirection(f[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
       distributions->setDistributionInvForDirection(f[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
       distributions->setDistributionInvForDirection(f[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
@@ -255,7 +387,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_PMM] ;
 	  h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2)*h[DIR_MMM] ;
 
-	  distributionsH->setDistributionInvForDirection(h[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0], DIR_0P0);
+	  distributionsH->setDistributionInvForDirection(h[DIR_0M0],   x1+DX1[DIR_0P0],   x2+DX2[DIR_0P0],   x3+DX3[DIR_0P0],     DIR_0P0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_PM0],  x1+DX1[DIR_MP0],  x2+DX2[DIR_MP0],  x3+DX3[DIR_MP0],   DIR_MP0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MM0],  x1+DX1[DIR_PP0],  x2+DX2[DIR_PP0],  x3+DX3[DIR_PP0],   DIR_PP0);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0MP],  x1+DX1[DIR_0PM],  x2+DX2[DIR_0PM],  x3+DX3[DIR_0PM],   DIR_0PM);
@@ -265,6 +397,26 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
+	  h2[DIR_0M0] = htemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0M0];
+      h2[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PM0];
+      h2[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MM0];
+      h2[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0MP];
+      h2[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0MM];
+      h2[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PMP];
+      h2[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MMP];
+      h2[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PMM];
+      h2[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MMM];
+
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MM0], x1 + DX1[DIR_PP0], x2 + DX2[DIR_PP0], x3 + DX3[DIR_PP0], DIR_PP0);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
       break;
    case DIR_00P:
       f[DIR_00P]   = ftemp[DIR_00P]   * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_00P]   ;
@@ -277,7 +429,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
       f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_PMP] ;
       f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*f[DIR_MMP] ;
 
-      distributions->setDistributionInvForDirection(f[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M], DIR_00M);
+      distributions->setDistributionInvForDirection(f[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M],     DIR_00M);
       distributions->setDistributionInvForDirection(f[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
       distributions->setDistributionInvForDirection(f[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
       distributions->setDistributionInvForDirection(f[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -297,7 +449,7 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_PMP] ;
 	  h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3)*h[DIR_MMP] ;
 
-	  distributionsH->setDistributionInvForDirection(h[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M], DIR_00M);
+	  distributionsH->setDistributionInvForDirection(h[DIR_00P],   x1+DX1[DIR_00M],   x2+DX2[DIR_00M],   x3+DX3[DIR_00M],     DIR_00M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_P0P],  x1+DX1[DIR_M0M],  x2+DX2[DIR_M0M],  x3+DX3[DIR_M0M],   DIR_M0M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_M0P],  x1+DX1[DIR_P0M],  x2+DX2[DIR_P0M],  x3+DX3[DIR_P0M],   DIR_P0M);
 	  distributionsH->setDistributionInvForDirection(h[DIR_0PP],  x1+DX1[DIR_0MM],  x2+DX2[DIR_0MM],  x3+DX3[DIR_0MM],   DIR_0MM);
@@ -307,6 +459,26 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_PMP], x1+DX1[DIR_MPM], x2+DX2[DIR_MPM], x3+DX3[DIR_MPM], DIR_MPM);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1+DX1[DIR_PPM], x2+DX2[DIR_PPM], x3+DX3[DIR_PPM], DIR_PPM);
 
+	  h2[DIR_00P] = htemp[DIR_00P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_00P];
+      h2[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_P0P];
+      h2[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_M0P];
+      h2[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_0PP];
+      h2[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_0MP];
+      h2[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_PPP];
+      h2[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_MPP];
+      h2[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_PMP];
+      h2[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_MMP];
+
+      distributionsH2->setDistributionInvForDirection(h2[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_M0P], x1 + DX1[DIR_P0M], x2 + DX2[DIR_P0M], x3 + DX3[DIR_P0M], DIR_P0M);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0PP], x1 + DX1[DIR_0MM], x2 + DX2[DIR_0MM], x3 + DX3[DIR_0MM], DIR_0MM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0MP], x1 + DX1[DIR_0PM], x2 + DX2[DIR_0PM], x3 + DX3[DIR_0PM], DIR_0PM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPP], x1 + DX1[DIR_MMM], x2 + DX2[DIR_MMM], x3 + DX3[DIR_MMM], DIR_MMM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MPP], x1 + DX1[DIR_PMM], x2 + DX2[DIR_PMM], x3 + DX3[DIR_PMM], DIR_PMM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMP], x1 + DX1[DIR_MPM], x2 + DX2[DIR_MPM], x3 + DX3[DIR_MPM], DIR_MPM);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM);
+
       break;
    case DIR_00M:
       f[DIR_00M]   = ftemp[DIR_00M]   * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3)*f[DIR_00M]   ;
@@ -349,6 +521,26 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC()
 	  distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1+DX1[DIR_MPP], x2+DX2[DIR_MPP], x3+DX3[DIR_MPP], DIR_MPP);
 	  distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1+DX1[DIR_PPP], x2+DX2[DIR_PPP], x3+DX3[DIR_PPP], DIR_PPP);
 
+	  h2[DIR_00M] = htemp[DIR_00M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_00M];
+      h2[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_P0M];
+      h2[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_M0M];
+      h2[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_0PM];
+      h2[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_0MM];
+      h2[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_PPM];
+      h2[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_MPM];
+      h2[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_PMM];
+      h2[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_MMM];
+
+      distributionsH2->setDistributionInvForDirection(h2[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_M0M], x1 + DX1[DIR_P0P], x2 + DX2[DIR_P0P], x3 + DX3[DIR_P0P], DIR_P0P);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0PM], x1 + DX1[DIR_0MP], x2 + DX2[DIR_0MP], x3 + DX3[DIR_0MP], DIR_0MP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_0MM], x1 + DX1[DIR_0PP], x2 + DX2[DIR_0PP], x3 + DX3[DIR_0PP], DIR_0PP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PPM], x1 + DX1[DIR_MMP], x2 + DX2[DIR_MMP], x3 + DX3[DIR_MMP], DIR_MMP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP);
+      distributionsH2->setDistributionInvForDirection(h2[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP);
+
       break;
    default:
       UB_THROW(UbException(UB_EXARGS, "It isn't implemented non reflecting density boundary for this direction!"));
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h
index ee472e166..3fa67b276 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h
@@ -39,11 +39,12 @@
 class MultiphaseNonReflectingOutflowBCAlgorithm : public BCAlgorithm
 {
 public:
-   MultiphaseNonReflectingOutflowBCAlgorithm();
-   ~MultiphaseNonReflectingOutflowBCAlgorithm();
-   SPtr<BCAlgorithm> clone();
-   void addDistributions(SPtr<DistributionArray3D> distributions);
-   void addDistributionsH(SPtr<DistributionArray3D> distributionsH);
-   void applyBC();
+    MultiphaseNonReflectingOutflowBCAlgorithm();
+    ~MultiphaseNonReflectingOutflowBCAlgorithm();
+    SPtr<BCAlgorithm> clone();
+    void addDistributions(SPtr<DistributionArray3D> distributions);
+    void addDistributionsH(SPtr<DistributionArray3D> distributionsH);
+    void addDistributionsH2(SPtr<DistributionArray3D> distributionsH2);
+    void applyBC();
 };
 #endif // MultiphaseNonReflectingOutflowBCAlgorithm_h__
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
index d43d1c534..e4aaeeeb2 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp
@@ -37,7 +37,7 @@
 
 MultiphaseVelocityBCAlgorithm::MultiphaseVelocityBCAlgorithm()
 {
-   BCAlgorithm::type = BCAlgorithm::VelocityBCAlgorithm;
+   BCAlgorithm::type = BCAlgorithm::MultiphaseVelocityBCAlgorithm;
    BCAlgorithm::preCollision = false;
 }
 //////////////////////////////////////////////////////////////////////////
@@ -84,6 +84,10 @@ void MultiphaseVelocityBCAlgorithm::applyBC()
    D3Q27System::calcDensity(h, phi);
 
    calcMacrosFct(f, p1, vx1, vx2, vx3);
+   vx1=bcPtr->getBoundaryVelocityX1();
+   vx2 = bcPtr->getBoundaryVelocityX2();
+   vx3 = bcPtr->getBoundaryVelocityX3();
+   p1 = 0.0;
    D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3);
    D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3);
 
@@ -106,18 +110,18 @@ void MultiphaseVelocityBCAlgorithm::applyBC()
    
    D3Q27System::calcMultiphaseHeq(htemp, phiBC, vx1, vx2, vx3);
    //D3Q27System::calcMultiphaseHeq(htemp, phiBC, bcPtr->getBoundaryVelocityX1(), bcPtr->getBoundaryVelocityX2(), bcPtr->getBoundaryVelocityX2());//30.03.2021 EQ phase field BC!
-   for (int fdir = D3Q27System::STARTF; fdir<=D3Q27System::ENDF; fdir++)
-   {
-	   if (bcPtr->hasVelocityBoundaryFlag(fdir))
-	   {
-		   LBMReal hReturn = htemp[fdir]+h[fdir]-heq[fdir];
-           //17.03.2021 Let us just set the plain eq
-           //LBMReal hReturn = htemp[fdir];
-		   distributionsH->setDistributionForDirection(hReturn, nx1, nx2, nx3, fdir);
-           if (distributionsH2)
-               distributionsH2->setDistributionForDirection(hReturn, nx1, nx2, nx3, fdir);
-	   }
-   }
+   //for (int fdir = D3Q27System::STARTF; fdir<=D3Q27System::ENDF; fdir++)
+   //{
+	  // if (bcPtr->hasVelocityBoundaryFlag(fdir))
+	  // {
+		 //  LBMReal hReturn = htemp[fdir]+h[fdir]-heq[fdir];
+   //        //17.03.2021 Let us just set the plain eq
+   //        //LBMReal hReturn = htemp[fdir];
+		 //  distributionsH->setDistributionForDirection(hReturn, nx1, nx2, nx3, fdir);
+   //      //  if (distributionsH2)
+   //      //      distributionsH2->setDistributionForDirection(0, nx1, nx2, nx3, fdir);
+	  // }
+   //}
    
    for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
    {
@@ -129,7 +133,17 @@ void MultiphaseVelocityBCAlgorithm::applyBC()
 		 //16.03.2021 quick fix for velocity BC
          LBMReal fReturn = f[invDir] - velocity;
          //LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity)/(1.0+q));
-         distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
+        // distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);//no delay BB
+         distributions->setDistributionForDirection(fReturn, x1, x2, x3, invDir);//delay BB  
+
+         LBMReal hReturn = htemp[invDir]+h[invDir] - heq[invDir];
+         distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, invDir);//delay BB  
+         if (distributionsH2) {
+             fReturn = h2[invDir] ;
+            // distributionsH2->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir);
+             distributionsH2->setDistributionForDirection(fReturn, x1, x2, x3, invDir);//delay BB 
+         }
+
       }
    }
 
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new
new file mode 100644
index 000000000..7c21b30c8
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new
@@ -0,0 +1,151 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseVelocityBCAlgorithm.cpp
+//! \ingroup BoundarConditions
+//! \author Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphaseVelocityBCAlgorithm.h"
+#include "DistributionArray3D.h"
+#include "BoundaryConditions.h"
+
+MultiphaseVelocityBCAlgorithm::MultiphaseVelocityBCAlgorithm()
+{
+    BCAlgorithm::type = BCAlgorithm::MultiphaseVelocityBCAlgorithm;
+   BCAlgorithm::preCollision = false;
+}
+//////////////////////////////////////////////////////////////////////////
+MultiphaseVelocityBCAlgorithm::~MultiphaseVelocityBCAlgorithm()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<BCAlgorithm> MultiphaseVelocityBCAlgorithm::clone()
+{
+   SPtr<BCAlgorithm> bc(new MultiphaseVelocityBCAlgorithm());
+   return bc;
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions)
+{
+   this->distributions = distributions;
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH)
+{
+	this->distributionsH = distributionsH;
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseVelocityBCAlgorithm::addDistributionsH2(SPtr<DistributionArray3D> distributionsH)
+{
+    this->distributionsH2 = distributionsH;
+}
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseVelocityBCAlgorithm::applyBC()
+{
+   LBMReal f[D3Q27System::ENDF+1];
+   LBMReal h[D3Q27System::ENDF+1];
+   LBMReal h2[D3Q27System::ENDF + 1];
+   LBMReal feq[D3Q27System::ENDF+1];
+   LBMReal heq[D3Q27System::ENDF+1];
+   LBMReal htemp[D3Q27System::ENDF+1];
+   
+   distributions->getDistributionInv(f, x1, x2, x3);
+   distributionsH->getDistributionInv(h, x1, x2, x3);
+   if (distributionsH2)
+       distributionsH2->getDistributionInv(h2, x1, x2, x3);
+   LBMReal phi, vx1, vx2, vx3, p1, phiBC;
+   
+   D3Q27System::calcDensity(h, phi);
+
+   calcMacrosFct(f, p1, vx1, vx2, vx3);
+   vx1=bcPtr->getBoundaryVelocityX1();
+   vx2 = bcPtr->getBoundaryVelocityX2();
+   vx3 = bcPtr->getBoundaryVelocityX3();
+   p1 = 0.0;
+   D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3);
+   D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3);
+
+   ///// added for phase field //////
+
+   int nx1 = x1;
+   int nx2 = x2;
+   int nx3 = x3;
+
+   //flag points in direction of fluid
+   if      (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; }
+   else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; }
+   //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary..."));
+   
+   phiBC = bcPtr->getBoundaryPhaseField();
+   
+   D3Q27System::calcMultiphaseHeq(htemp, phiBC, vx1, vx2, vx3);
+   //D3Q27System::calcMultiphaseHeq(htemp, phiBC, bcPtr->getBoundaryVelocityX1(), bcPtr->getBoundaryVelocityX2(), bcPtr->getBoundaryVelocityX2());//30.03.2021 EQ phase field BC!
+   //for (int fdir = D3Q27System::STARTF; fdir<=D3Q27System::ENDF; fdir++)
+   //{
+	  // if (bcPtr->hasVelocityBoundaryFlag(fdir))
+	  // {
+		 //  LBMReal hReturn = htemp[fdir]+h[fdir]-heq[fdir];
+   //        //17.03.2021 Let us just set the plain eq
+   //        //LBMReal hReturn = htemp[fdir];
+		 //  distributionsH->setDistributionForDirection(hReturn, nx1, nx2, nx3, fdir);
+   //      //  if (distributionsH2)
+   //      //      distributionsH2->setDistributionForDirection(0, nx1, nx2, nx3, fdir);
+	  // }
+   //}
+   
+   for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
+   {
+      if (bcPtr->hasVelocityBoundaryFlag(fdir))
+      {
+         const int invDir = D3Q27System::INVDIR[fdir];
+         //LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler
+         LBMReal velocity = bcPtr->getBoundaryVelocity(invDir);
+		 //16.03.2021 quick fix for velocity BC
+         LBMReal fReturn = f[invDir] - velocity;
+         //LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity)/(1.0+q));
+        // distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);//no delay BB
+         distributions->setDistributionForDirection(fReturn, x1, x2, x3, invDir);//delay BB  
+
+         LBMReal hReturn = htemp[invDir]+h[invDir] - heq[invDir];
+         distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, invDir);//delay BB  
+         if (distributionsH2) {
+             fReturn = h2[invDir] ;
+            // distributionsH2->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir);
+             distributionsH2->setDistributionForDirection(fReturn, x1, x2, x3, invDir);//delay BB 
+         }
+
+      }
+   }
+
+}
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp
index 4bf2b3037..b886271b7 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp
@@ -182,13 +182,13 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     int maxX2 = (int)(distributions->getNX2());
     int maxX3 = (int)(distributions->getNX3());
 
-    // int minX1 = 1;
-    // int minX2 = 1;
-    // int minX3 = 1;
+     //int minX1 = 1;
+     //int minX2 = 1;
+     //int minX3 = 1;
 
-    // int maxX1 = (int)(distributions->getNX1());
-    // int maxX2 = (int)(distributions->getNX2());
-    // int maxX3 = (int)(distributions->getNX3());
+     //int maxX1 = (int)(distributions->getNX1());
+     //int maxX2 = (int)(distributions->getNX2());
+     //int maxX3 = (int)(distributions->getNX3());
 
     // nummern vergeben und node vector erstellen + daten sammeln
     CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
@@ -202,7 +202,7 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block)
     for (int ix3 = minX3; ix3 <= maxX3; ix3++) {
         for (int ix2 = minX2; ix2 <= maxX2; ix2++) {
             for (int ix1 = minX1; ix1 <= maxX1; ix1++) {
-                if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3)) {
+                if (/* !bcArray->isUndefined(ix1, ix2, ix3) &&*/ !bcArray->isSolid(ix1, ix2, ix3)) {
                     int index                  = 0;
                     nodeNumbers(ix1, ix2, ix3) = nr++;
                     Vector3D worldCoordinates  = grid->getNodeCoordinates(block, ix1, ix2, ix3);
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
index c8e5c24d5..5dced5e47 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp
@@ -632,7 +632,6 @@ SPtr<Block3D> Grid3D::getNeighborBlock(int dir, SPtr<Block3D> block) const
 void Grid3D::getAllNeighbors(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks)
 {
     for (int dir = D3Q27System::STARTDIR; dir <= D3Q27System::ENDDIR; dir++)
-    // for (int dir = D3Q27System::STARTDIR; dir<=D3Q27System::DIR_0MP; dir++)
     {
         this->getNeighborBlocksForDirection(dir, ix1, ix2, ix3, level, levelDepth, blocks);
     }
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
index 3df8aa6bb..e6883626c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
@@ -785,33 +785,33 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBM
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[DIR_P00]    = mfcbb;
-   f[DIR_M00]    = mfabb;
-   f[DIR_0P0]    = mfbcb;
-   f[DIR_0M0]    = mfbab;
-   f[DIR_00P]    = mfbbc;
-   f[DIR_00M]    = mfbba;
-   f[DIR_PP0]   = mfccb;
-   f[DIR_MM0]   = mfaab;
-   f[DIR_PM0]   = mfcab;
-   f[DIR_MP0]   = mfacb;
-   f[DIR_P0P]   = mfcbc;
-   f[DIR_M0M]   = mfaba;
-   f[DIR_P0M]   = mfcba;
-   f[DIR_M0P]   = mfabc;
-   f[DIR_0PP]   = mfbcc;
-   f[DIR_0MM]   = mfbaa;
-   f[DIR_0PM]   = mfbca;
-   f[DIR_0MP]   = mfbac;
+   f[DIR_P00] = mfcbb;
+   f[DIR_M00] = mfabb;
+   f[DIR_0P0] = mfbcb;
+   f[DIR_0M0] = mfbab;
+   f[DIR_00P] = mfbbc;
+   f[DIR_00M] = mfbba;
+   f[DIR_PP0] = mfccb;
+   f[DIR_MM0] = mfaab;
+   f[DIR_PM0] = mfcab;
+   f[DIR_MP0] = mfacb;
+   f[DIR_P0P] = mfcbc;
+   f[DIR_M0M] = mfaba;
+   f[DIR_P0M] = mfcba;
+   f[DIR_M0P] = mfabc;
+   f[DIR_0PP] = mfbcc;
+   f[DIR_0MM] = mfbaa;
+   f[DIR_0PM] = mfbca;
+   f[DIR_0MP] = mfbac;
    f[DIR_000] = mfbbb;
-   f[DIR_PPP]  = mfccc;
-   f[DIR_PMP]  = mfcac;
-   f[DIR_PPM]  = mfcca;
-   f[DIR_PMM]  = mfcaa;
-   f[DIR_MPP]  = mfacc;
-   f[DIR_MMP]  = mfaac;
-   f[DIR_MPM]  = mfaca;
-   f[DIR_MMM]  = mfaaa;
+   f[DIR_PPP] = mfccc;
+   f[DIR_PMP] = mfcac;
+   f[DIR_PPM] = mfcca;
+   f[DIR_PMM] = mfcaa;
+   f[DIR_MPP] = mfacc;
+   f[DIR_MMP] = mfaac;
+   f[DIR_MPM] = mfaca;
+   f[DIR_MMM] = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 //Position SWB -0.25, -0.25, -0.25
@@ -1004,7 +1004,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBM
    LBMReal mxxyMyzz = zeroReal;
    LBMReal mxxzPyyz = zeroReal;
    LBMReal mxxzMyyz = zeroReal;
-   LBMReal mxyyPxzz =  zeroReal;
+   LBMReal mxyyPxzz = zeroReal;
    LBMReal mxyyMxzz = zeroReal;
 
    // linear combinations back
@@ -1233,33 +1233,33 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBM
    mfccc = m2;
    ////////////////////////////////////////////////////////////////////////////////////
 
-   f[DIR_P00]    = mfcbb;
-   f[DIR_M00]    = mfabb;
-   f[DIR_0P0]    = mfbcb;
-   f[DIR_0M0]    = mfbab;
-   f[DIR_00P]    = mfbbc;
-   f[DIR_00M]    = mfbba;
-   f[DIR_PP0]   = mfccb;
-   f[DIR_MM0]   = mfaab;
-   f[DIR_PM0]   = mfcab;
-   f[DIR_MP0]   = mfacb;
-   f[DIR_P0P]   = mfcbc;
-   f[DIR_M0M]   = mfaba;
-   f[DIR_P0M]   = mfcba;
-   f[DIR_M0P]   = mfabc;
-   f[DIR_0PP]   = mfbcc;
-   f[DIR_0MM]   = mfbaa;
-   f[DIR_0PM]   = mfbca;
-   f[DIR_0MP]   = mfbac;
+   f[DIR_P00] = mfcbb;
+   f[DIR_M00] = mfabb;
+   f[DIR_0P0] = mfbcb;
+   f[DIR_0M0] = mfbab;
+   f[DIR_00P] = mfbbc;
+   f[DIR_00M] = mfbba;
+   f[DIR_PP0] = mfccb;
+   f[DIR_MM0] = mfaab;
+   f[DIR_PM0] = mfcab;
+   f[DIR_MP0] = mfacb;
+   f[DIR_P0P] = mfcbc;
+   f[DIR_M0M] = mfaba;
+   f[DIR_P0M] = mfcba;
+   f[DIR_M0P] = mfabc;
+   f[DIR_0PP] = mfbcc;
+   f[DIR_0MM] = mfbaa;
+   f[DIR_0PM] = mfbca;
+   f[DIR_0MP] = mfbac;
    f[DIR_000] = mfbbb;
-   f[DIR_PPP]  = mfccc;
-   f[DIR_PMP]  = mfcac;
-   f[DIR_PPM]  = mfcca;
-   f[DIR_PMM]  = mfcaa;
-   f[DIR_MPP]  = mfacc;
-   f[DIR_MMP]  = mfaac;
-   f[DIR_MPM]  = mfaca;
-   f[DIR_MMM]  = mfaaa;
+   f[DIR_PPP] = mfccc;
+   f[DIR_PMP] = mfcac;
+   f[DIR_PPM] = mfcca;
+   f[DIR_PMM] = mfcaa;
+   f[DIR_MPP] = mfacc;
+   f[DIR_MMP] = mfaac;
+   f[DIR_MPM] = mfaca;
+   f[DIR_MMM] = mfaaa;
 }
 //////////////////////////////////////////////////////////////////////////
 void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
index 773e8b695..9d743195c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
@@ -55,7 +55,7 @@ static const int STARTF = 0;
 static const int ENDF   = 26; // D3Q27
 
 static const int STARTDIR = 1; //0
-static const int ENDDIR   = 27;//26 // all geometric directions
+static const int ENDDIR   = 26;//26 // all geometric directions
 
 extern const int DX1[ENDDIR + 1];
 extern const int DX2[ENDDIR + 1];
@@ -851,15 +851,15 @@ static std::vector<int> getEX(const int &exn)
     ex.resize(ENDDIR + 1);
     switch (exn) {
         case 1:
-            for (int dir = STARTDIR; dir < ENDDIR; ++dir)
+            for (int dir = STARTDIR; dir <= ENDDIR; ++dir)
                 ex[dir] = DX1[dir];
             break;
         case 2:
-            for (int dir = STARTDIR; dir < ENDDIR; ++dir)
+            for (int dir = STARTDIR; dir <= ENDDIR; ++dir)
                 ex[dir] = DX2[dir];
             break;
         case 3:
-            for (int dir = STARTDIR; dir < ENDDIR; ++dir)
+            for (int dir = STARTDIR; dir <= ENDDIR; ++dir)
                 ex[dir] = DX3[dir];
             break;
     }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
index 10f1e395d..ad80b3722 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp
@@ -293,7 +293,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step)
                         LBMReal uz2 = uz * uz;
 
                         //----------- Calculating Forcing Terms * -------------
-                        for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+                        for (int dir = FSTARTDIR; dir <= FENDDIR; dir++) {
                             LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz;
                             LBMReal velSq1  = velProd * velProd;
                             LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
index c1c2010e1..7424fdcbe 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp
@@ -610,7 +610,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step)
 			   uy2 = vvyF * vvyF;
 			   uz2 = vvzF * vvzF;
 			   LBMReal forcingTerm[D3Q27System::ENDF + 1];
-			   for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+			   for (int dir = FSTARTDIR; dir <= FENDDIR; dir++) {
 				   LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
 				   LBMReal velSq1 = velProd * velProd;
 				   LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
new file mode 100644
index 000000000..673ea2927
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
@@ -0,0 +1,3024 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#include "MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h"
+#include "BCArray3D.h"
+#include "Block3D.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "D3Q27System.h"
+#include "DataSet3D.h"
+#include "LBMKernel.h"
+#include <cmath>
+#include <iostream>
+#include <string>
+
+#define PROOF_CORRECTNESS
+
+//////////////////////////////////////////////////////////////////////////
+MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::MultiphaseSimpleVelocityBaseExternalPressureLBMKernel() { this->compressible = false; }
+//////////////////////////////////////////////////////////////////////////
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::initDataSet()
+{
+	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+	SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	p1Old = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+	dataSet->setFdistributions(f);
+	dataSet->setHdistributions(h); // For phase-field
+	dataSet->setH2distributions(h2);
+	dataSet->setPhaseField(divU1);
+	dataSet->setPressureField(pressure);
+
+	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+	phaseFieldOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 999.0));
+
+	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::clone()
+{
+	SPtr<LBMKernel> kernel(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel());
+	kernel->setNX(nx);
+	dynamicPointerCast<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(kernel)->initDataSet();
+	kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+	kernel->setDensityRatio(this->densityRatio);
+	kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+	kernel->setContactAngle(this->contactAngle);
+	kernel->setPhiL(this->phiL);
+	kernel->setPhiH(this->phiH);
+	kernel->setPhaseFieldRelaxation(this->tauH);
+	kernel->setMobility(this->mob);
+	kernel->setInterfaceWidth(this->interfaceWidth);
+
+	kernel->setBCProcessor(bcProcessor->clone(kernel));
+	kernel->setWithForcing(withForcing);
+	kernel->setForcingX1(muForcingX1);
+	kernel->setForcingX2(muForcingX2);
+	kernel->setForcingX3(muForcingX3);
+	kernel->setIndex(ix1, ix2, ix3);
+	kernel->setDeltaT(deltaT);
+	kernel->setGhostLayerWidth(2);
+	dynamicPointerCast<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(kernel)->initForcing();
+
+	return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m2 = mfa + mfc;
+	LBMReal m1 = mfc - mfa;
+	LBMReal m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += oneMinusRho;
+	mfb = (m1 * Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+	using namespace UbMath;
+	LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal m1 = (mfa + mfc) + mfb;
+	LBMReal m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+	mfb = m2 - vv * m1;
+	mfa = m1;
+}
+
+
+void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+	using namespace UbMath;
+	LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
+{
+	using namespace D3Q27System;
+	using namespace UbMath;
+
+	forcingX1 = 0.0;
+	forcingX2 = 0.0;
+	forcingX3 = 0.0;
+
+	LBMReal oneOverInterfaceScale = c4 / interfaceWidth; //1.0;//1.5;
+														 /////////////////////////////////////
+
+	localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+	nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+	zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+
+	localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+
+	localDistributionsH2    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getLocalDistributions();
+	nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions();
+	zeroDistributionsH2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions();
+
+
+	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	const int bcArrayMaxX1 = (int)bcArray->getNX1();
+	const int bcArrayMaxX2 = (int)bcArray->getNX2();
+	const int bcArrayMaxX3 = (int)bcArray->getNX3();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+	LBMReal omegaDRho = 1.0;// 1.25;// 1.3;
+
+	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
+		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
+			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+					(*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+						(((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+							((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+								(mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+					if ((*phaseField)(x1, x2, x3) > 1 ) {
+						(*phaseField)(x1, x2, x3) = c1;
+					}
+
+					if ((*phaseField)(x1, x2, x3) < 0) {
+						(*phaseField)(x1, x2, x3) = 0;
+					}
+					////// read F-distributions for velocity formalism
+
+					mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+					//LBMReal rhoH = 1.0;
+					//LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoH = 1.0*densityRatio;
+					LBMReal rhoL = 1.0;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal drho = (((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))   )
+						+ (((mfaab + mfccb) + (mfacb + mfcab) ) + ((mfaba + mfcbc) + (mfabc + mfcba) ) + ((mfbaa + mfbcc) + (mfbac + mfbca) )))
+						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+				
+					omegaDRho = 2.0;// 1.5;
+					drho *= omegaDRho;
+					LBMReal keepDrho = drho;
+					drho = ((*p1Old)(x1, x2, x3) + drho) * c1o2;
+				//	drho = ((*p1Old)(x1, x2, x3)*c2o3 + drho*c1o3) ;
+					(*p1Old)(x1, x2, x3) = keepDrho;
+					
+					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH); //Incompressible
+///Density correction
+					//LBMReal dX1_phi = gradX1_phi();
+					//LBMReal dX2_phi = gradX2_phi();
+					//LBMReal dX3_phi = gradX3_phi();
+					//LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+					//	(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+					//	(mfcbb - mfabb)) ;
+					//LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+					//	(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+					//	(mfbcb - mfbab)) ;
+					//LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+					//	(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+					//	(mfbbc - mfbba)) ;
+					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressure)(x1, x2, x3); //explicit Compressible
+					//(*pressureOld)(x1, x2, x3) = (((*pressure)(x1, x2, x3) + rho * c1o3 * drho-(rhoH-rhoL)*(vvx*dX1_phi+vvy*dX2_phi+vvz*dX3_phi)*c1o3)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+					
+					//(*pressureOld)(x1, x2, x3) = ((*pressure)(x1, x2, x3) - c1o3 * drho * ((*phaseField)(x1, x2, x3) * (rhoH - rhoL) + rhoL)) / (c1 - ((*phaseField)(x1, x2, x3) - c1) * drho);
+					//LBMReal rho=rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressureOld)(x1, x2, x3);
+					//LBMReal tempDrho = drho;
+					//drho = (drho*0.9 + (*pressureOld)(x1, x2, x3)*0.1) ;
+					//(*pressureOld)(x1, x2, x3) = tempDrho;
+
+					//Mathematica
+
+					LBMReal rho = ((*pressure)(x1, x2, x3) - (*phaseField)(x1, x2, x3) * (*pressure)(x1, x2, x3) + c1o3 * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (c1o3 + c1o3 * drho * (-1 + (*phaseField)(x1, x2, x3)));
+					(*pressureOld)(x1, x2, x3) = ((*pressure)(x1, x2, x3) + c1o3 * drho * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (1 + drho * (-1 + (*phaseField)(x1, x2, x3)));
+/////Full Filter
+					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH)+(one- (*phaseField)(x1, x2, x3))*three* (*pressure)(x1, x2, x3); //explicit Compressible
+					//(*pressureOld)(x1, x2, x3) = (((*pressure)(x1, x2, x3) + rho * c1o3 * drho)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+//// reduced Filter
+					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressureOld)(x1, x2, x3); //explicit Compressible
+					//(*pressure)(x1, x2, x3) = (((*pressureOld)(x1, x2, x3) + rho * c1o3 * drho)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+
+					//rho = (rho)/(one- (one - (*phaseField)(x1, x2, x3)) * drho); // now implicit Compressible
+					
+					//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
+					////!!!!!! relplace by pointer swap!
+					//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+				}
+			}
+		}
+	}
+
+	LBMReal collFactorM;
+
+	////Periodic Filter
+	//for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+	//	for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+	//		for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+	//			if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+
+	//				LBMReal sum = 0.;
+
+	//				///Version for boundaries
+	//				for (int xx = -1; xx <= 1; xx++) {
+	//					//int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+	//					int xxx = xx + x1;
+
+	//					for (int yy = -1; yy <= 1; yy++) {
+	//						//int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+	//						int yyy = yy + x2;
+
+	//						for (int zz = -1; zz <= 1; zz++) {
+	//							//int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+	//							int zzz = zz + x3;
+
+	//							if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+	//								sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressureOld)(xxx, yyy, zzz);
+	//							}
+	//							else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressureOld)(x1, x2, x3);
+	//							}
+
+
+	//						}
+	//					}
+	//				}
+	//				(*pressure)(x1, x2, x3) = sum;
+	//			}
+	//		}
+	//	}
+	//}
+
+	////!filter
+
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					//////////////////////////////////////////////////////////////////////////
+					// Read distributions and phase field
+					////////////////////////////////////////////////////////////////////////////
+					//////////////////////////////////////////////////////////////////////////
+
+					// E   N  T
+					// c   c  c
+					//////////
+					// W   S  B
+					// a   a  a
+
+					// Rest ist b
+
+					// mfxyz
+					// a - negative
+					// b - null
+					// c - positive
+
+					// a b c
+					//-1 0 1
+
+					findNeighbors(phaseField, x1, x2, x3);
+
+					LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+
+
+					LBMReal mfhcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+					LBMReal mfhbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+					LBMReal mfhbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+					LBMReal mfhccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+					LBMReal mfhacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+					LBMReal mfhcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+					LBMReal mfhabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+					LBMReal mfhbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+					LBMReal mfhbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+					LBMReal mfhccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+					LBMReal mfhacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+					LBMReal mfhcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+					LBMReal mfhaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+					LBMReal mfhabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+					LBMReal mfhbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+					LBMReal mfhbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+					LBMReal mfhaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+					LBMReal mfhcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+					LBMReal mfhaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+					LBMReal mfhcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+					LBMReal mfhbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+					LBMReal mfhbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+					LBMReal mfhaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					LBMReal mfhcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					LBMReal mfhaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					LBMReal mfhcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					LBMReal mfhbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+
+					//LBMReal rhoH = 1.0;
+					//LBMReal rhoL = 1.0 / densityRatio;
+
+					LBMReal rhoH = 1.0;
+					LBMReal rhoL = 1.0/ densityRatio;
+
+					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+
+					LBMReal dX1_phi = gradX1_phi();
+					LBMReal dX2_phi = gradX2_phi();
+					LBMReal dX3_phi = gradX3_phi();
+
+					LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9+1e-3;
+					// 01.09.2022: unclear what value we have to add to the normal: lager values better cut of in gas phase?
+					LBMReal normX1 = dX1_phi / denom;
+					LBMReal normX2 = dX2_phi / denom;
+					LBMReal normX3 = dX3_phi / denom;
+
+
+
+					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL);
+
+
+					LBMReal mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi();
+
+					//----------- Calculating Macroscopic Values -------------
+					LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH); //Incompressible
+
+																		///scaled phase field
+					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) / ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) + (c1 - (*phaseField)(x1, x2, x3)) * (c1 - (*phaseField)(x1, x2, x3))) - phiH);
+					///!scaled phase field
+					
+					//LBMReal rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH)+(one-phi[DIR_000])* (*pressure)(x1, x2, x3)*three; //compressible
+					//LBMReal rho = rhoL + (rhoH - rhoL) * phi[DIR_000] + (one - phi[DIR_000]) * (*pressure)(x1, x2, x3) * three; //compressible
+
+					LBMReal m0, m1, m2;
+					LBMReal rhoRef=c1;
+
+					LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+						(mfcbb - mfabb))/rhoRef;
+					LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+						(mfbcb - mfbab))/rhoRef;
+					LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+						(mfbbc - mfbba))/rhoRef;
+					////Filter&Gradient merged
+					LBMReal pressureHere = (*pressureOld)(x1, x2, x3);
+					//LBMReal pressureHere = (*pressure)(x1, x2, x3);
+
+					LBMReal arrayP[3][3][3] = { {{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}},
+												{{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}},
+												{ {pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}} };
+					//LBMReal LaplaceP = 0.0;
+					//LaplaceP += WEIGTH[DIR_PPP] * (((((*pressureOld)(x1+1,x2+1,x3+1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 + 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3 + 1) - pressureHere)))
+					//	+ ((((*pressureOld)(x1 + 1, x2 - 1, x3 + 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 - 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3 + 1) - pressureHere))));
+					//LaplaceP += WEIGTH[DIR_0PP] * (
+					//	((((*pressureOld)(x1 + 1, x2 + 1, x3) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 - 1, x3) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3) - pressureHere)))
+					//	+ ((((*pressureOld)(x1 + 1, x2, x3 + 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2, x3 -1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2, x3 + 1) - pressureHere)))
+					//	+ ((((*pressureOld)(x1, x2 + 1, x3 + 1) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1, x2 + 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3 + 1) - pressureHere)))
+					//	);
+					//LaplaceP += WEIGTH[DIR_00P] * (
+					//	(((*pressureOld)(x1 + 1, x2, x3) - pressureHere) + ((*pressureOld)(x1, x2-1, x3) - pressureHere))
+					//	+ (((*pressureOld)(x1, x2 + 1, x3) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3) - pressureHere))
+					//	+ (((*pressureOld)(x1, x2, x3 + 1) - pressureHere) + ((*pressureOld)(x1, x2, x3 - 1) - pressureHere))
+					//	);
+
+					//LaplaceP= 6.0 * LaplaceP;
+					
+					//LBMReal sum = 0.0;
+
+					for (int dir1 = -1; dir1 <= 1; dir1++) {
+						for (int dir2 = -1; dir2 <= 1; dir2++) {
+							for (int dir3 = -1; dir3 <= 1; dir3++){
+								int xxx = x1 + dir1;
+								int yyy = x2 + dir2;
+								int zzz = x3 + dir3;
+								if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) arrayP[dir1 + 1][dir2 + 1][dir3 + 1] = (*pressureOld)(xxx, yyy, zzz);
+								//if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) arrayP[dir1 + 1][dir2 + 1][dir3 + 1] = (*pressure)(xxx, yyy, zzz);
+							//	sum += 64.0 / (216.0 * (c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)) * (c1 + c3 * abs(dir3))) * arrayP[dir1 + 1][dir2 + 1][dir3 + 1];
+							}
+						}
+					}
+//					(*pressure)(x1, x2, x3) = sum;// *0.1 + (1.0 - 0.1) * (*pressureOld)(x1, x2, x3);
+
+
+					(*pressure)(x1, x2, x3) = (((((arrayP[0][0][0] + arrayP[2][2][2]) + (arrayP[0][2][0] + arrayP[2][0][2])) + ((arrayP[2][0][0] + arrayP[0][2][2]) + (arrayP[2][2][0] + arrayP[0][0][2]))) * c1o216
+						+ (((arrayP[0][0][1] + arrayP[2][2][1]) + (arrayP[0][1][0] + arrayP[2][1][2])) + ((arrayP[1][0][0] + arrayP[1][2][2]) + (arrayP[0][1][2] + arrayP[2][1][0])) + ((arrayP[1][0][2] + arrayP[1][2][0]) + (arrayP[0][2][1] + arrayP[2][0][1]))) * c1o54)
+						+ ((arrayP[0][1][1] + arrayP[2][1][1]) + (arrayP[1][0][1] + arrayP[1][2][1]) + (arrayP[1][1][0] + arrayP[1][1][2])) * c2o27)
+						+ arrayP[1][1][1] * c8o27;
+					//LBMReal gradPx = 0.0;
+					//LBMReal gradPy = 0.0;
+					//LBMReal gradPz = 0.0;
+					//for (int dir1 = -1; dir1 <= 1; dir1++) {
+					//	for (int dir2 = -1; dir2 <= 1; dir2++) {
+					//		gradPx -= arrayP[0][dir1+1][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		gradPx += arrayP[2][dir1+1][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+
+
+
+					//		gradPy -= arrayP[dir1+1][0][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		gradPy += arrayP[dir1+1][2][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		
+
+					//		gradPz -= arrayP[dir1+1][dir2+1][0] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		gradPz += arrayP[dir1+1][dir2+1][2] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//	}
+					//}
+
+					LBMReal gradPx = ((((arrayP[2][0][0] - arrayP[0][2][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+						+ (((arrayP[2][1][0] - arrayP[0][1][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[2][0][1] - arrayP[0][2][1]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+						+ (arrayP[2][1][1] - arrayP[0][1][1]) * c2o9;
+					LBMReal gradPy = ((((arrayP[0][2][0] - arrayP[2][0][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[0][2][2] - arrayP[2][0][0]))) * c1o72
+						+ (((arrayP[1][2][0] - arrayP[1][0][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[0][2][1] - arrayP[2][0][1]) + (arrayP[1][2][2] - arrayP[1][0][0]))) * c1o18)
+						+ (arrayP[1][2][1] - arrayP[1][0][1]) * c2o9;
+					LBMReal gradPz = ((((arrayP[0][0][2] - arrayP[2][2][0]) + (arrayP[0][2][2] - arrayP[2][0][0])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+						+ (((arrayP[0][1][2] - arrayP[2][1][0]) + (arrayP[1][2][2] - arrayP[1][0][0])) + ((arrayP[1][0][2] - arrayP[1][2][0]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+						+ (arrayP[1][1][2] - arrayP[1][1][0]) * c2o9;
+
+					//gradPx *=c1 - (*pressure)(x1, x2, x3)+pressureHere;
+					//gradPy *=c1 - (*pressure)(x1, x2, x3) + pressureHere;
+					//gradPz *=c1 - (*pressure)(x1, x2, x3) + pressureHere;
+
+					////!Filter&Gradient merged
+					//LBMReal gradPx = 0.0;
+					//LBMReal gradPy = 0.0;
+					//LBMReal gradPz = 0.0;
+					//for (int dir1 = -1; dir1 <= 1; dir1++) {
+					//	for (int dir2 = -1; dir2 <= 1; dir2++) {
+					//		int yyy = x2 + dir1;
+					//		int zzz = x3 + dir2;
+					//		if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+					//			gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) {
+					//			gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+
+					//		int xxx = x1 + dir1;
+					//		if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+					//			gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) {
+					//			gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+
+					//		yyy = x2 + dir2;
+					//		if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+					//			gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+					//			gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+					//		else {
+					//			gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+					//		}
+
+					//	}
+					//}
+
+					//Viscosity increase by phase field residuum
+					//LBMReal errPhi = (((1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale)- denom);
+					//LBMReal limVis = 0.01;// 0.0000001 * 10;//0.01;
+					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
+					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
+					//errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
+					//collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+
+					//3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+					//+WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+					//+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
+
+					muRho = rho;
+
+					////external pressure
+					//forcingX1 =/* muForcingX1.Eval()/rho */- gradPx/rho;
+					//forcingX2 =/* muForcingX2.Eval()/rho */- gradPy/rho;
+					//forcingX3 =/* muForcingX3.Eval()/rho */- gradPz/rho;
+
+					///////////////////////////////////////////////
+
+					//LBMReal pBefore = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+					//	+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+					//pBefore = -c1o3 * (-1.0e-10)/((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) );
+					////if (vvx * vvx + vvy * vvy + vvz * vvz > 1.0e-100) {
+					//	mfabb -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_P00] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbab -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0P0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbba -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_00P] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfaab -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PP0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcab -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MP0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfaba -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_P0P] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcba -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_M0P] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbaa -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0PP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbca -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0MP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfaaa -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PPP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcaa -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MPP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfaca -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PMP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcca -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MMP] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcbb -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_M00] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbcb -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0M0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbbc -= pBefore * c2o9 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_00M] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfccb -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MM0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfacb -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PM0] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcbc -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_M0M] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfabc -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_P0M] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbcc -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0MM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbac -= pBefore * c1o18 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_0PM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfccc -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MMM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfacc -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PMM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfcac -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_MPM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfaac -= pBefore * c1o72 * ((rhoL + phi[DIR_000] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[DIR_PPM] * (rhoH - rhoL) / (phiH - phiL)));
+					//	mfbbb -= pBefore * 8.0 / 9.0;
+					//}
+
+					///////////////////////////////////////////////
+
+					LBMReal pStarStart = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+
+					/////////////////////
+					//LBMReal vvxh = ((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
+					//	(((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
+					//	(mfhcbb - mfhabb)) / rhoRef;
+					//LBMReal vvyh = ((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
+					//	(((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
+					//	(mfhbcb - mfhbab)) / rhoRef;
+					//LBMReal vvzh = ((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
+					//	(((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
+					//	(mfhbbc - mfhbba)) / rhoRef;
+
+					//LBMReal deltaPP = 0*(vvxh * dX1_phi + vvyh * dX2_phi + vvzh * dX3_phi) * rhoToPhi / (rho);
+					//mfhbcb += c1o6* c2o9  * deltaPP;
+					//mfhbbc += c1o6* c2o9  * deltaPP;
+					//mfhcbb += c1o6* c2o9  * deltaPP;
+					//mfhccb += c1o6* c1o18 * deltaPP;
+					//mfhacb += c1o6* c1o18 * deltaPP;
+					//mfhcbc += c1o6* c1o18 * deltaPP;
+					//mfhabc += c1o6* c1o18 * deltaPP;
+					//mfhbcc += c1o6* c1o18 * deltaPP;
+					//mfhbac += c1o6* c1o18 * deltaPP;
+					//mfhccc += c1o6* c1o72 * deltaPP;
+					//mfhacc += c1o6* c1o72 * deltaPP;
+					//mfhcac += c1o6* c1o72 * deltaPP;
+					//mfhaac += c1o6* c1o72 * deltaPP;
+					//mfhabb += c1o6* c2o9  * deltaPP;
+					//mfhbab += c1o6* c2o9  * deltaPP;
+					//mfhbba += c1o6* c2o9  * deltaPP;
+					//mfhaab += c1o6* c1o18 * deltaPP;
+					//mfhcab += c1o6* c1o18 * deltaPP;
+					//mfhaba += c1o6* c1o18 * deltaPP;
+					//mfhcba += c1o6* c1o18 * deltaPP;
+					//mfhbaa += c1o6* c1o18 * deltaPP;
+					//mfhbca += c1o6* c1o18 * deltaPP;
+					//mfhaaa += c1o6* c1o72 * deltaPP;
+					//mfhcaa += c1o6* c1o72 * deltaPP;
+					//mfhaca += c1o6* c1o72 * deltaPP;
+					//mfhcca += c1o6* c1o72 * deltaPP;
+					//mfhbbb += c1o6* c4 * c2o9 * deltaPP;
+
+					//////////////////////
+
+					/////Recovering the origin distributions
+					//LBMReal mfStartcbb = mfcbb ;
+					//LBMReal mfStartbcb = mfbcb ;
+					//LBMReal mfStartbbc = mfbbc ;
+					//LBMReal mfStartccb = mfccb ;
+					//LBMReal mfStartacb = mfacb ;
+					//LBMReal mfStartcbc = mfcbc ;
+					//LBMReal mfStartabc = mfabc ;
+					//LBMReal mfStartbcc = mfbcc ;
+					//LBMReal mfStartbac = mfbac ;
+					//LBMReal mfStartccc = mfccc ;
+					//LBMReal mfStartacc = mfacc ;
+					//LBMReal mfStartcac = mfcac ;
+					//LBMReal mfStartaac = mfaac ;
+					//LBMReal mfStartabb = mfabb ;
+					//LBMReal mfStartbab = mfbab ;
+					//LBMReal mfStartbba = mfbba ;
+					//LBMReal mfStartaab = mfaab ;
+					//LBMReal mfStartcab = mfcab ;
+					//LBMReal mfStartaba = mfaba ;
+					//LBMReal mfStartcba = mfcba ;
+					//LBMReal mfStartbaa = mfbaa ;
+					//LBMReal mfStartbca = mfbca ;
+					//LBMReal mfStartaaa = mfaaa ;
+					//LBMReal mfStartcaa = mfcaa ;
+					//LBMReal mfStartaca = mfaca ;
+					//LBMReal mfStartcca = mfcca ;
+					//LBMReal mfStartbbb = mfbbb ;
+
+
+						mfcbb += mfhcbb /rho;
+						mfbcb += mfhbcb /rho;
+						mfbbc += mfhbbc /rho;
+						mfccb += mfhccb /rho;
+						mfacb += mfhacb /rho;
+						mfcbc += mfhcbc /rho;
+						mfabc += mfhabc /rho;
+						mfbcc += mfhbcc /rho;
+						mfbac += mfhbac /rho;
+						mfccc += mfhccc /rho;
+						mfacc += mfhacc /rho;
+						mfcac += mfhcac /rho;
+						mfaac += mfhaac /rho;
+						mfabb += mfhabb /rho;
+						mfbab += mfhbab /rho;
+						mfbba += mfhbba /rho;
+						mfaab += mfhaab /rho;
+						mfcab += mfhcab /rho;
+						mfaba += mfhaba /rho;
+						mfcba += mfhcba /rho;
+						mfbaa += mfhbaa /rho;
+						mfbca += mfhbca /rho;
+						mfaaa += mfhaaa /rho;
+						mfcaa += mfhcaa /rho;
+						mfaca += mfhaca /rho;
+						mfcca += mfhcca /rho;
+						mfbbb += mfhbbb /rho;
+
+
+
+					//Abbas
+					LBMReal pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+					//22.09.22 not yet in balance, repaire here
+					LBMReal ppStar = ((((((mfhaaa + mfhccc) + (mfhaac + mfhcca)) + ((mfhcac + mfhaca) + (mfhcaa + mfhacc)))*c3
+						+ (((mfhaab + mfhccb) + (mfhacb + mfhcab)) + ((mfhaba + mfhcbc) + (mfhabc + mfhcba)) + ((mfhbaa + mfhbcc) + (mfhbac + mfhbca))))*c2
+						+ ((mfhabb + mfhcbb) + (mfhbab + mfhbcb) + (mfhbba + mfhbbc))) ) * c1o3/rho;
+	
+					ppStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))) * c3
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca)))) * c2
+						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)))) * c1o3 ;
+
+					//(*phaseFieldOld)(x1, x2, x3) = ((*phaseFieldOld)(x1, x2, x3) > 99.0) ? phi[DIR_000] : (*phaseFieldOld)(x1, x2, x3);
+					//LBMReal dtPhi = phi[DIR_000] - (*phaseFieldOld)(x1, x2, x3);
+					//LBMReal deltaP = -pStar * (c1 - rho / (rho + c1o2 * rhoToPhi * dtPhi));// -pStar * pStar * pStar * 1.0e-4 * rho * rho * rho;
+					//LBMReal deltaP = pStar * (c1 - mfhbbb*rho) * c1o2;//Explicit
+					//LBMReal deltaP = pStar * (c1 - mfhbbb * rho) / (c1 + mfhbbb * rho);//Semi-Implicit
+					//(*phaseFieldOld)(x1, x2, x3) = phi[DIR_000];
+
+					//mfabb += c2o9 *deltaP;
+					//mfbab += c2o9 *deltaP;
+					//mfbba += c2o9 *deltaP;
+					//mfaab += c1o18*deltaP;
+					//mfcab += c1o18*deltaP;
+					//mfaba += c1o18*deltaP;
+					//mfcba += c1o18*deltaP;
+					//mfbaa += c1o18*deltaP;
+					//mfbca += c1o18*deltaP;
+					//mfaaa += c1o72*deltaP;
+					//mfcaa += c1o72*deltaP;
+					//mfaca += c1o72*deltaP;
+					//mfcca += c1o72*deltaP;
+					//mfcbb += c2o9 *deltaP;
+					//mfbcb += c2o9 *deltaP;
+					//mfbbc += c2o9 *deltaP;
+					//mfccb += c1o18*deltaP;
+					//mfacb += c1o18*deltaP;
+					//mfcbc += c1o18*deltaP;
+					//mfabc += c1o18*deltaP;
+					//mfbcc += c1o18*deltaP;
+					//mfbac += c1o18*deltaP;
+					//mfccc += c1o72*deltaP;
+					//mfacc += c1o72*deltaP;
+					//mfcac += c1o72*deltaP;
+					//mfaac += c1o72*deltaP;
+
+					//pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+					//	+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+
+
+
+
+					//mfabb -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_P00])*rhoToPhi/rho;
+					//mfbab -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_0P0])*rhoToPhi/rho;
+					//mfbba -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_00P])*rhoToPhi/rho;
+					//mfaab -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_PP0])*rhoToPhi/rho;
+					//mfcab -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_MP0])*rhoToPhi/rho;
+					//mfaba -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_P0P])*rhoToPhi/rho;
+					//mfcba -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_M0P])*rhoToPhi/rho;
+					//mfbaa -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_0PP])*rhoToPhi/rho;
+					//mfbca -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_0MP])*rhoToPhi/rho;
+					//mfaaa -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_PPP])*rhoToPhi/rho;
+					//mfcaa -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_MPP])*rhoToPhi/rho;
+					//mfaca -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_PMP])*rhoToPhi/rho;
+					//mfcca -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_MMP])*rhoToPhi/rho;
+					//mfcbb -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_M00])*rhoToPhi/rho;
+					//mfbcb -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_0M0])*rhoToPhi/rho;
+					//mfbbc -= c1o2 * c2o9 *pStar*(phi[DIR_000]-phi[DIR_00M])*rhoToPhi/rho;
+					//mfccb -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_MM0])*rhoToPhi/rho;
+					//mfacb -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_PM0])*rhoToPhi/rho;
+					//mfcbc -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_M0M])*rhoToPhi/rho;
+					//mfabc -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_P0M])*rhoToPhi/rho;
+					//mfbcc -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_0MM])*rhoToPhi/rho;
+					//mfbac -= c1o2 * c1o18*pStar*(phi[DIR_000]-phi[DIR_0PM])*rhoToPhi/rho;
+					//mfccc -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_MMM])*rhoToPhi/rho;
+					//mfacc -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_PMM])*rhoToPhi/rho;
+					//mfcac -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_MPM])*rhoToPhi/rho;
+					//mfaac -= c1o2 * c1o72*pStar*(phi[DIR_000]-phi[DIR_PPM])*rhoToPhi/rho;
+
+
+					//forcingX1 =/* muForcingX1.Eval() / rho*/ - pStar * dX1_phi * rhoToPhi / rho;
+					//forcingX2 =/* muForcingX2.Eval() / rho*/ - pStar * dX2_phi * rhoToPhi / rho;
+					//forcingX3 =/* muForcingX3.Eval() / rho*/ - pStar * dX3_phi * rhoToPhi / rho;
+
+
+					//mfabb += (-forcingX1) * c2o9;
+					//mfbab += (-forcingX2) * c2o9;
+					//mfbba += (-forcingX3) * c2o9;
+					//mfaab += (-forcingX1 - forcingX2) * c1o16;
+					//mfcab += (forcingX1 - forcingX2) * c1o16;
+					//mfaba += (-forcingX1 - forcingX3) * c1o16;
+					//mfcba += (forcingX1 - forcingX3) * c1o16;
+					//mfbaa += (-forcingX2 - forcingX3) * c1o16;
+					//mfbca += (forcingX2 - forcingX3) * c1o16;
+					//mfaaa += (-forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfcaa += (forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfaca += (-forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcca += (forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcbb += (forcingX1)*c2o9;
+					//mfbcb += (forcingX2)*c2o9;
+					//mfbbc += (forcingX3)*c2o9;
+					//mfccb += (forcingX1 + forcingX2) * c1o16;
+					//mfacb += (-forcingX1 + forcingX2) * c1o16;
+					//mfcbc += (forcingX1 + forcingX3) * c1o16;
+					//mfabc += (-forcingX1 + forcingX3) * c1o16;
+					//mfbcc += (forcingX2 + forcingX3) * c1o16;
+					//mfbac += (-forcingX2 + forcingX3) * c1o16;
+					//mfccc += (forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfacc += (-forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfcac += (forcingX1 - forcingX2 + forcingX3) * c1o72;
+					//mfaac += (-forcingX1 - forcingX2 + forcingX3) * c1o72;
+
+					LBMReal saveForceX1 = forcingX1;
+					LBMReal saveForceX2 = forcingX2;
+					LBMReal saveForceX3 = forcingX3;
+
+					 vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+						(mfcbb - mfabb)) / rhoRef;
+					 vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+						(mfbcb - mfbab)) / rhoRef;
+					 vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+						(mfbbc - mfbba)) / rhoRef;
+
+
+					 LBMReal dRhoInvX = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
+						 (((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
+						 (mfhcbb - mfhabb)));
+					 LBMReal dRhoInvY = -(((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
+						 (((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
+						 (mfhbcb - mfhbab)));
+					 LBMReal dRhoInvZ = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
+						 (((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
+						 (mfhbbc - mfhbba)));
+
+
+					 forcingX1 = 0.0;
+					 forcingX2 = 0.0;
+					 forcingX3 = 0.0;
+					//!Abbas
+					//LBMReal dX1_rhoInv = gradX1_rhoInv(rhoL, rhoH - rhoL);
+					//LBMReal dX2_rhoInv = gradX2_rhoInv(rhoL, rhoH - rhoL);
+					//LBMReal dX3_rhoInv = gradX3_rhoInv(rhoL, rhoH - rhoL);
+					//forcingX1 =/* muForcingX1.Eval() / rho*/ +pStar * dX1_rhoInv * rho;
+					//forcingX2 =/* muForcingX2.Eval() / rho*/ +pStar * dX2_rhoInv * rho;
+					//forcingX3 =/* muForcingX3.Eval() / rho*/ +pStar * dX3_rhoInv * rho;
+
+					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho + pStar * dX1_rhoInv * rho) *c1o2;
+					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho + pStar * dX2_rhoInv * rho) *c1o2;
+					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho + pStar * dX3_rhoInv * rho) *c1o2;
+					 LBMReal FdX1_phi = normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					 LBMReal FdX2_phi = normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					 LBMReal FdX3_phi = normX3 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+
+
+					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho ) ;
+					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho ) ;
+					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho ) ;
+
+					//forcingX1 = (pStar * dRhoInvX* rho *c3) ;
+					//forcingX2 = (pStar * dRhoInvY* rho *c3) ;
+					//forcingX3 = (pStar * dRhoInvZ* rho *c3) ;
+					//if (phi[DIR_000] > 0.1 && phi[DIR_000] < 0.9) std::cout << phi[DIR_000] << " " << dX1_phi * rhoToPhi / rho << " " << dRhoInvX * rho *3<< std::endl;
+					//LBMReal forcingX1ALTERNAT = ( pStar * dX1_rhoInv * rho) ;
+					//LBMReal forcingX2ALTERNAT = ( pStar * dX2_rhoInv * rho) ;
+					//LBMReal forcingX3ALTERNAT = ( pStar * dX3_rhoInv * rho) ;
+
+					//forcingX1 = (fabs(vvx + c1o2 * forcingX1) < fabs(vvx + c1o2 * forcingX1ALTERNAT)) ? forcingX1 : forcingX1ALTERNAT;
+					//forcingX2 = (fabs(vvy + c1o2 * forcingX2) < fabs(vvy + c1o2 * forcingX2ALTERNAT)) ? forcingX2 : forcingX2ALTERNAT;
+					//forcingX3 = (fabs(vvz + c1o2 * forcingX3) < fabs(vvz + c1o2 * forcingX3ALTERNAT)) ? forcingX3 : forcingX3ALTERNAT;
+
+					//	 forcingX1 = -pStar * rhoToPhi / rho * normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					//	 forcingX2 = -pStar * rhoToPhi / rho * normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					//	 forcingX3 = -pStar * rhoToPhi / rho * normX3 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+
+					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho *(c1- phi[DIR_000]) + pStar * dX1_rhoInv * rho*(phi[DIR_000]));
+					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho *(c1- phi[DIR_000]) + pStar * dX2_rhoInv * rho*(phi[DIR_000]));
+					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho *(c1- phi[DIR_000]) + pStar * dX3_rhoInv * rho*(phi[DIR_000]));
+						 //if (phi[DIR_000] > 0.3 && phi[DIR_000] < 0.7)
+						 //{
+							// int test = 1;
+							// std::cout << phi[DIR_000] <<" "<< dX1_phi <<" "<< normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale<<" "<< normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale/ dX1_phi<< std::endl;
+						 //}
+
+
+
+					 //LBMReal scaleGrad = c2 * phi[DIR_000] * (1.0 - phi[DIR_000]) / ((phi[DIR_000] * phi[DIR_000] + (1.0 - phi[DIR_000]) * (1.0 - phi[DIR_000])) * (phi[DIR_000] * phi[DIR_000] + (1.0 - phi[DIR_000]) * (1.0 - phi[DIR_000])));
+					 //dX1_phi *= scaleGrad;
+					 //dX2_phi *= scaleGrad;
+					 //dX3_phi *= scaleGrad;
+
+					 ///Experimental interface sharpening force 20.06.2022
+
+					 LBMReal scaleSharpener = 1.0;
+					 //forcingX1 += scaleSharpener * (FdX1_phi - dX1_phi) * fabsf(FdX1_phi - dX1_phi)  / rho;
+					 //forcingX2 += scaleSharpener * (FdX2_phi - dX2_phi) * fabsf(FdX2_phi - dX2_phi)  / rho;
+					 //forcingX3 += scaleSharpener * (FdX3_phi - dX3_phi) * fabsf(FdX3_phi - dX3_phi)  / rho;
+					///surface tension force
+					forcingX1 += mu * dX1_phi/rho;
+					forcingX2 += mu * dX2_phi/rho;
+					forcingX3 += mu * dX3_phi/rho;
+
+					LBMReal forcingBIAS = 0.5;
+					forcingX1 += muForcingX1.Eval() / rho;//*phi[DIR_000];
+					forcingX2 += muForcingX2.Eval() / rho;// * phi[DIR_000];
+					forcingX3 += muForcingX3.Eval() / rho;// * phi[DIR_000];
+
+				//	//19.08.2022
+					//vvx += vvxh / rho * c1o2;
+					//vvy += vvyh / rho * c1o2;
+					//vvz += vvzh / rho * c1o2;
+				//	//
+
+
+					vvx += (forcingX1) * deltaT * c1o2;
+					vvy += (forcingX2) * deltaT * c1o2;
+					vvz += (forcingX3) * deltaT * c1o2;
+
+					//vvx += (forcingX1 + muForcingX1.Eval() / rho) * deltaT *  c1o2; // X
+					//vvy += (forcingX2 + muForcingX2.Eval() / rho) * deltaT *  c1o2; // Y
+					//vvz += (forcingX3 + muForcingX3.Eval() / rho) * deltaT *  c1o2; // Z
+
+
+
+				//	vvx += (forcingX1 + muForcingX1.Eval() / rho) * deltaT * forcingBIAS; // X
+				//	vvy += (forcingX2 + muForcingX2.Eval() / rho) * deltaT * forcingBIAS; // Y
+				//	vvz += (forcingX3 + muForcingX3.Eval() / rho) * deltaT * forcingBIAS; // Z
+
+
+
+					//Abbas
+					LBMReal M200 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) ))
+						+ ((mfabb + mfcbb))) );
+					LBMReal M020 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ (((mfaab + mfccb) + (mfacb + mfcab))  + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ( (mfbab + mfbcb) )) );
+					LBMReal M002 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+						+ ( + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+						+ ( (mfbba + mfbbc))));
+
+					LBMReal M110 = ((((((mfaaa + mfccc) + (-mfcac - mfaca)) + ((mfaac + mfcca) + (-mfcaa -mfacc)))
+						+ (((mfaab + mfccb) + (-mfacb - mfcab))   ))
+						) );
+					LBMReal M101 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcac + mfaca) - (mfcaa + mfacc)))
+						+ (((mfaba + mfcbc) + (-mfabc - mfcba))))
+						));
+					LBMReal M011 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ( (mfcaa + mfacc)- (mfcac + mfaca)))
+						+ (((mfbaa + mfbcc) + (-mfbac - mfbca))))
+						));
+					LBMReal vvxI = vvx;
+					LBMReal vvyI = vvy;
+					LBMReal vvzI = vvz;
+
+					LBMReal collFactorStore=collFactorM;
+					LBMReal stress;
+					//for(int iter=0;iter<5;iter++)
+				 //{
+					//	LBMReal OxxPyyPzz = 1.0;
+					//	LBMReal mxxPyyPzz = (M200-vvxI*vvxI) + (M020-vvyI*vvyI) + (M002-vvzI*vvzI);
+					//	//pStar = mxxPyyPzz * c1o3;
+					//mxxPyyPzz -= c3 *pStar;
+
+					//LBMReal mxxMyy = (M200-vvxI*vvxI) - (M020-vvyI*vvyI);
+					//LBMReal mxxMzz = (M200-vvxI*vvxI) - (M002-vvzI*vvzI);
+					//LBMReal mxy = M110 - vvxI * vvyI;
+					//LBMReal mxz = M101 - vvxI * vvzI;
+					//LBMReal myz = M011 - vvyI * vvzI;
+
+
+					//mxxMyy *= c1 - collFactorM * c1o2;
+					//mxxMzz *= c1 - collFactorM * c1o2;
+					//mxy *= c1 - collFactorM * c1o2;
+					//mxz *= c1 - collFactorM * c1o2;
+					//myz *= c1 - collFactorM * c1o2;
+					//mxxPyyPzz *= c1 - OxxPyyPzz * c1o2;
+					////mxxPyyPzz = mxxPyyPzz*fabs(mxxPyyPzz)/(1.0e-6+fabs(mxxPyyPzz));
+					////mxxPyyPzz += c3 * pStar;
+					//LBMReal mxx = (mxxMyy + mxxMzz + mxxPyyPzz)*c1o3;
+					//LBMReal myy = (-c2*mxxMyy + mxxMzz + mxxPyyPzz)*c1o3;
+					//LBMReal mzz = (mxxMyy -c2* mxxMzz + mxxPyyPzz) * c1o3;
+					//vvxI = vvx - (mxx * dX1_phi + mxy * dX2_phi + mxz * dX3_phi) * rhoToPhi / (rho);
+					//vvyI = vvy - (mxy * dX1_phi + myy * dX2_phi + myz * dX3_phi) * rhoToPhi / (rho);
+					//vvzI = vvz - (mxz * dX1_phi + myz * dX2_phi + mzz * dX3_phi) * rhoToPhi / (rho);
+
+
+				////	vvzI = vvz + (mxz * dRhoInvX + myz * dRhoInvY + mzz * dRhoInvZ) *  (rho)*c3;
+				////	vvxI = vvx + (mxx * dRhoInvX + mxy * dRhoInvY + mxz * dRhoInvZ) *  (rho)*c3;
+				////	vvyI = vvy + (mxy * dRhoInvX + myy * dRhoInvY + myz * dRhoInvZ) *  (rho)*c3;
+
+
+				//	//LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+				//	//
+				//	//LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy;
+				//	//LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz;
+				//	//LBMReal Dxy = -three * collFactorM * mxy;
+				//	//LBMReal Dxz = -three * collFactorM * mxz;
+				//	//LBMReal Dyz = -three * collFactorM * myz;
+				//	////LBMReal stress = sqrt(sqrt((dyuy+dxux+dzuz)* (dyuy + dxux + dzuz))) * sqrt(forcingX1 * forcingX1 + forcingX2 * forcingX2 + forcingX3 * forcingX3);
+				//	// stress = sqrt(dyuy * dyuy + dxux * dxux + dzuz*dzuz + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz)*sqrt(forcingX1*forcingX1+forcingX2*forcingX2+forcingX3*forcingX3);
+				//	////collFactorM = collFactorStore + (1.75 - collFactorStore) * stress / (stress + 1.0e-8);
+				//	//
+				//	//LBMReal dX2_rho = (rhoToPhi)*dX2_phi;
+				//	//LBMReal dX1_rho = (rhoToPhi)*dX1_phi;
+				//	//LBMReal dX3_rho = (rhoToPhi)*dX3_phi;
+				//	////vvxI= vvx+ c1o6 * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+				//	////vvyI= vvy+ c1o6 * (c1 / collFactorM - c1o2) * (Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+				//	////vvzI= vvz+ c1o6 * (c1 / collFactorM - c1o2) * (Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+
+				//	//vvxI = vvx + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+				//	//vvyI = vvy + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+				//	//vvzI = vvz + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+
+				//	////vvxI = vvx - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rhoInv + Dxy * dX2_rhoInv + Dxz * dX3_rhoInv);
+				//	////vvyI = vvy - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (Dxy * dX1_rhoInv + 2 * dyuy * dX2_rhoInv + Dyz * dX3_rhoInv);
+				//	////vvzI = vvz - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (Dxz * dX1_rhoInv + Dyz * dX2_rhoInv + 2 * dyuy * dX3_rhoInv);
+
+
+					//}
+				//	//forcingX1+=(vvxI-vvx)/(deltaT* forcingBIAS) + muForcingX1.Eval() / rho;
+				//	//forcingX2 += (vvyI - vvy) / (deltaT * forcingBIAS) + muForcingX2.Eval() / rho;
+				//	//forcingX3 += (vvzI - vvz) / (deltaT * forcingBIAS) + muForcingX3.Eval() / rho;
+
+
+				////	forcingX1 += c2 * (vvxI - vvx);
+				////	forcingX2 += c2 * (vvyI - vvy);
+				////	forcingX3 += c2 * (vvzI - vvz);
+
+
+					//mfabb += c1o2*(-forcingX1) * c2o9;
+					//mfbab += c1o2*(-forcingX2) * c2o9;
+					//mfbba += c1o2*(-forcingX3) * c2o9;
+					//mfaab += c1o2*(-forcingX1 - forcingX2) * c1o18;
+					//mfcab += c1o2*( forcingX1 - forcingX2) * c1o18;
+					//mfaba += c1o2*(-forcingX1 - forcingX3) * c1o18;
+					//mfcba += c1o2*( forcingX1 - forcingX3) * c1o18;
+					//mfbaa += c1o2*(-forcingX2 - forcingX3) * c1o18;
+					//mfbca += c1o2*( forcingX2 - forcingX3) * c1o18;
+					//mfaaa += c1o2*(-forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfcaa += c1o2*(forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfaca += c1o2*(-forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcca += c1o2*(forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcbb += c1o2*(forcingX1)*c2o9;
+					//mfbcb += c1o2*(forcingX2)*c2o9;
+					//mfbbc += c1o2*(forcingX3)*c2o9;
+					//mfccb += c1o2*( forcingX1 + forcingX2) * c1o18;
+					//mfacb += c1o2*(-forcingX1 + forcingX2) * c1o18;
+					//mfcbc += c1o2*( forcingX1 + forcingX3) * c1o18;
+					//mfabc += c1o2*(-forcingX1 + forcingX3) * c1o18;
+					//mfbcc += c1o2*( forcingX2 + forcingX3) * c1o18;
+					//mfbac += c1o2*(-forcingX2 + forcingX3) * c1o18;
+					//mfccc += c1o2*(forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfacc += c1o2*(-forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfcac += c1o2*(forcingX1 - forcingX2 + forcingX3) * c1o72;
+					//mfaac += c1o2*(-forcingX1 - forcingX2 + forcingX3) * c1o72;
+
+
+					//forcingX1 = saveForceX1;
+					//forcingX2 = saveForceX2;
+					//forcingX3 = saveForceX3;
+					vvx = vvxI;
+					vvy = vvyI;
+					vvz = vvzI;
+
+
+
+					//!Abbas
+
+					LBMReal vx2;
+					LBMReal vy2;
+					LBMReal vz2;
+					vx2 = vvx * vvx;
+					vy2 = vvy * vvy;
+					vz2 = vvz * vvz;
+					//pStar =ppStar- (vx2 + vy2 + vz2)*pStar;
+				//	pStar = (pStar + ppStar)*c1o2;
+					///////////////////////////////////////////////////////////////////////////////////////////               
+					LBMReal oMdrho;
+					///////////////
+						//mfabb -= pStar * c2o9;
+						//mfbab -= pStar * c2o9;
+						//mfbba -= pStar * c2o9;
+						//mfaab -= pStar * c1o16;
+						//mfcab -= pStar * c1o16;
+						//mfaba -= pStar * c1o16;
+						//mfcba -= pStar * c1o16;
+						//mfbaa -= pStar * c1o16;
+						//mfbca -= pStar * c1o16;
+						//mfaaa -= pStar * c1o72;
+						//mfcaa -= pStar * c1o72;
+						//mfaca -= pStar * c1o72;
+						//mfcca -= pStar * c1o72;
+						//mfcbb -= pStar * c2o9;
+						//mfbcb -= pStar * c2o9;
+						//mfbbc -= pStar * c2o9;
+						//mfccb -= pStar * c1o16;
+						//mfacb -= pStar * c1o16;
+						//mfcbc -= pStar * c1o16;
+						//mfabc -= pStar * c1o16;
+						//mfbcc -= pStar * c1o16;
+						//mfbac -= pStar * c1o16;
+						//mfccc -= pStar * c1o72;
+						//mfacc -= pStar * c1o72;
+						//mfcac -= pStar * c1o72;
+						//mfaac -= pStar * c1o72;
+						//mfbbb -= pStar * 8.0/9.0;
+					///////////////////
+
+					oMdrho = mfccc + mfaaa;
+					m0 = mfaca + mfcac;
+					m1 = mfacc + mfcaa;
+					m2 = mfaac + mfcca;
+					oMdrho += m0;
+					m1 += m2;
+					oMdrho += m1;
+					m0 = mfbac + mfbca;
+					m1 = mfbaa + mfbcc;
+					m0 += m1;
+					m1 = mfabc + mfcba;
+					m2 = mfaba + mfcbc;
+					m1 += m2;
+					m0 += m1;
+					m1 = mfacb + mfcab;
+					m2 = mfaab + mfccb;
+					m1 += m2;
+					m0 += m1;
+					oMdrho += m0;
+					m0 = mfabb + mfcbb;
+					m1 = mfbab + mfbcb;
+					m2 = mfbba + mfbbc;
+					m0 += m1 + m2;
+					m0 += mfbbb; //hat gefehlt
+					oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+
+															 ////////////////////////////////////////////////////////////////////////////////////
+					LBMReal wadjust;
+					LBMReal qudricLimit = 0.01 / (c1 + 1.0e4 * phi[DIR_000] * (c1 - phi[DIR_000])); //LBMReal qudricLimit = 0.01;
+					////////////////////////////////////////////////////////////////////////////////////
+					//Hin
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m2 = mfaaa + mfaac;
+					m1 = mfaac - mfaaa;
+					m0 = m2 + mfaab;
+					mfaaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfaab = m1 - m0 * vvz;
+					mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfabc;
+					m1 = mfabc - mfaba;
+					m0 = m2 + mfabb;
+					mfaba = m0;
+					m0 += c1o9 * oMdrho;
+					mfabb = m1 - m0 * vvz;
+					mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfacc;
+					m1 = mfacc - mfaca;
+					m0 = m2 + mfacb;
+					mfaca = m0;
+					m0 += c1o36 * oMdrho;
+					mfacb = m1 - m0 * vvz;
+					mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbac;
+					m1 = mfbac - mfbaa;
+					m0 = m2 + mfbab;
+					mfbaa = m0;
+					m0 += c1o9 * oMdrho;
+					mfbab = m1 - m0 * vvz;
+					mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbba + mfbbc;
+					m1 = mfbbc - mfbba;
+					m0 = m2 + mfbbb;
+					mfbba = m0;
+					m0 += c4o9 * oMdrho;
+					mfbbb = m1 - m0 * vvz;
+					mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbca + mfbcc;
+					m1 = mfbcc - mfbca;
+					m0 = m2 + mfbcb;
+					mfbca = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcb = m1 - m0 * vvz;
+					mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcac;
+					m1 = mfcac - mfcaa;
+					m0 = m2 + mfcab;
+					mfcaa = m0;
+					m0 += c1o36 * oMdrho;
+					mfcab = m1 - m0 * vvz;
+					mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcba + mfcbc;
+					m1 = mfcbc - mfcba;
+					m0 = m2 + mfcbb;
+					mfcba = m0;
+					m0 += c1o9 * oMdrho;
+					mfcbb = m1 - m0 * vvz;
+					mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcca + mfccc;
+					m1 = mfccc - mfcca;
+					m0 = m2 + mfccb;
+					mfcca = m0;
+					m0 += c1o36 * oMdrho;
+					mfccb = m1 - m0 * vvz;
+					mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m2 = mfaaa + mfaca;
+					m1 = mfaca - mfaaa;
+					m0 = m2 + mfaba;
+					mfaaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfaba = m1 - m0 * vvy;
+					mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfacb;
+					m1 = mfacb - mfaab;
+					m0 = m2 + mfabb;
+					mfaab = m0;
+					mfabb = m1 - m0 * vvy;
+					mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfacc;
+					m1 = mfacc - mfaac;
+					m0 = m2 + mfabc;
+					mfaac = m0;
+					m0 += c1o18 * oMdrho;
+					mfabc = m1 - m0 * vvy;
+					mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbaa + mfbca;
+					m1 = mfbca - mfbaa;
+					m0 = m2 + mfbba;
+					mfbaa = m0;
+					m0 += c2o3 * oMdrho;
+					mfbba = m1 - m0 * vvy;
+					mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbab + mfbcb;
+					m1 = mfbcb - mfbab;
+					m0 = m2 + mfbbb;
+					mfbab = m0;
+					mfbbb = m1 - m0 * vvy;
+					mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfbac + mfbcc;
+					m1 = mfbcc - mfbac;
+					m0 = m2 + mfbbc;
+					mfbac = m0;
+					m0 += c2o9 * oMdrho;
+					mfbbc = m1 - m0 * vvy;
+					mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcaa + mfcca;
+					m1 = mfcca - mfcaa;
+					m0 = m2 + mfcba;
+					mfcaa = m0;
+					m0 += c1o6 * oMdrho;
+					mfcba = m1 - m0 * vvy;
+					mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcab + mfccb;
+					m1 = mfccb - mfcab;
+					m0 = m2 + mfcbb;
+					mfcab = m0;
+					mfcbb = m1 - m0 * vvy;
+					mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfcac + mfccc;
+					m1 = mfccc - mfcac;
+					m0 = m2 + mfcbc;
+					mfcac = m0;
+					m0 += c1o18 * oMdrho;
+					mfcbc = m1 - m0 * vvy;
+					mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					// mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m2 = mfaaa + mfcaa;
+					m1 = mfcaa - mfaaa;
+					m0 = m2 + mfbaa;
+					mfaaa = m0;
+					m0 += 1. * oMdrho;
+					mfbaa = m1 - m0 * vvx;
+					mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaba + mfcba;
+					m1 = mfcba - mfaba;
+					m0 = m2 + mfbba;
+					mfaba = m0;
+					mfbba = m1 - m0 * vvx;
+					mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaca + mfcca;
+					m1 = mfcca - mfaca;
+					m0 = m2 + mfbca;
+					mfaca = m0;
+					m0 += c1o3 * oMdrho;
+					mfbca = m1 - m0 * vvx;
+					mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaab + mfcab;
+					m1 = mfcab - mfaab;
+					m0 = m2 + mfbab;
+					mfaab = m0;
+					mfbab = m1 - m0 * vvx;
+					mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabb + mfcbb;
+					m1 = mfcbb - mfabb;
+					m0 = m2 + mfbbb;
+					mfabb = m0;
+					mfbbb = m1 - m0 * vvx;
+					mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacb + mfccb;
+					m1 = mfccb - mfacb;
+					m0 = m2 + mfbcb;
+					mfacb = m0;
+					mfbcb = m1 - m0 * vvx;
+					mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfaac + mfcac;
+					m1 = mfcac - mfaac;
+					m0 = m2 + mfbac;
+					mfaac = m0;
+					m0 += c1o3 * oMdrho;
+					mfbac = m1 - m0 * vvx;
+					mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfabc + mfcbc;
+					m1 = mfcbc - mfabc;
+					m0 = m2 + mfbbc;
+					mfabc = m0;
+					mfbbc = m1 - m0 * vvx;
+					mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					m2 = mfacc + mfccc;
+					m1 = mfccc - mfacc;
+					m0 = m2 + mfbcc;
+					mfacc = m0;
+					m0 += c1o9 * oMdrho;
+					mfbcc = m1 - m0 * vvx;
+					mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+					////////////////////////////////////////////////////////////////////////////////////
+					// Cumulants
+					////////////////////////////////////////////////////////////////////////////////////
+
+					// mfaaa = 0.0;
+					LBMReal OxxPyyPzz = 1.0; //omega2 or bulk viscosity
+											//  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+											//  LBMReal OxyyMxzz  = 1.;//2+s9;//
+					LBMReal O4 = 1.;
+					LBMReal O5 = 1.;
+					LBMReal O6 = 1.;
+
+					//collFactorM+= (1.7 - collFactorM) * fabs(mfaaa) / (fabs(mfaaa) + 0.001f);
+
+
+					/////fourth order parameters; here only for test. Move out of loop!
+
+					LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+				    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+					//LBMReal stress = 1.0;// stress / (stress + 1.0e-10);
+					stress = 1.0;
+					//OxyyPxzz += stress*(1.0-OxyyPxzz);
+					//OxyyPxzz = c3 * (collFactorM - c2) / (collFactorM - c3);
+					//OxyyMxzz += stress*(1.0-OxyyMxzz);
+					//Oxyz +=  stress*(1.0-Oxyz);
+					//A *= 1.0-stress;
+					//BB *= 1.0-stress;
+
+					//Cum 4.
+					//LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+					LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+
+					//Cum 5.
+					LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+					LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+					LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//Cum 6.
+					LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+
+					//2.
+					// linear combinations
+					LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+					//pStar = (mxxPyyPzz+vx2+vy2+vz2) * c1o3;//does not work
+					//pStar = (mxxPyyPzz) * c1o3;
+					//pStar = pStar + 1.5 * (mxxPyyPzz * c1o3 - pStar);
+					//mfaaa = mxxPyyPzz;
+					//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+					mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+										//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
+					LBMReal mxxMyy = mfcaa - mfaca;
+					LBMReal mxxMzz = mfcaa - mfaac;
+
+					///
+					LBMReal mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+					LBMReal mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+					LBMReal mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+					LBMReal mmfabb = mfabb;
+					LBMReal mmfbab = mfbab;
+					LBMReal mmfbba = mfbba;
+					///
+
+					LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz)*0;
+					//LBMReal dxux = -c1o2 * (mxxMyy + mxxMzz) * collFactorM - mfaaa * c1o3* omegaDRho;
+					LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+					LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+					LBMReal Dxy = -three * collFactorM * mfbba;
+					LBMReal Dxz = -three * collFactorM * mfbab;
+					LBMReal Dyz = -three * collFactorM * mfabb;
+//					// attempt to improve implicit  stress computation by fixed iteration
+//					LBMReal dX2_rho = (rhoToPhi)*dX2_phi;
+//					LBMReal dX1_rho = (rhoToPhi)*dX1_phi;
+//					LBMReal dX3_rho = (rhoToPhi)*dX3_phi;
+//
+//						LBMReal dfx= c1o3 * (c1 / collFactorM - c1o2) *(2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+//						LBMReal dfy = c1o3 * (c1 / collFactorM - c1o2) *(Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+//						LBMReal dfz = c1o3 * (c1 / collFactorM - c1o2) *(Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+//
+//						for (int iteration = 0; iteration < 5; iteration++) {
+//							mxxMyy = (mfcaa - dfx * dfx * c1o2) - (mfaca - dfy * dfy * c1o2);
+//							mxxMzz = (mfcaa - dfx * dfx * c1o2) - (mfaac - dfz * dfz * c1o2);
+//						}
+/////end fixed iteration
+//
+
+
+					//relax
+					mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+					mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+					mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+
+					mfabb += collFactorM * (-mfabb);
+					mfbab += collFactorM * (-mfbab);
+					mfbba += collFactorM * (-mfbba);
+
+					//if (fabsf(mfaaa + (dxux + dyuy + dzuz) > 1e-9)){
+					//	std::cout << mfaaa <<" "<< (dxux + dyuy + dzuz)<< std::endl;
+					//}
+
+
+					////updated pressure
+					//mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+					//mfaaa *= (one-omegaDRho);// (mfaaa + (dxux + dyuy + dzuz)) * .5; // Pressure elimination as in standard velocity model
+								 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
+				
+					mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+
+										// mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+										//mfaaa = mfaaaS;
+										// linear combinations back
+					mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+					mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+
+					//3.
+					// linear combinations
+					LBMReal mxxyPyzz = mfcba + mfabc;
+					LBMReal mxxyMyzz = mfcba - mfabc;
+
+					LBMReal mxxzPyyz = mfcab + mfacb;
+					LBMReal mxxzMyyz = mfcab - mfacb;
+
+					LBMReal mxyyPxzz = mfbca + mfbac;
+					LBMReal mxyyMxzz = mfbca - mfbac;
+
+					 mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa);
+					 mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa);
+					 mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa);
+					 mmfabb += mfabb;
+					 mmfbab += mfbab;
+					 mmfbba += mfbba;
+
+					//relax
+					wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+					mfbbb += wadjust * (-mfbbb);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+					mxxyPyzz += wadjust * (-mxxyPyzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+					mxxyMyzz += wadjust * (-mxxyMyzz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+					mxxzPyyz += wadjust * (-mxxzPyyz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+					mxxzMyyz += wadjust * (-mxxzMyyz);
+					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+					mxyyPxzz += wadjust * (-mxyyPxzz);
+					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+					mxyyMxzz += wadjust * (-mxyyMxzz);
+
+					// linear combinations back
+					mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+					mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+					mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+					mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+					mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+					mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+					//4.
+					CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+					CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+					CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+					CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+					CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+					CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+
+					//5.
+					CUMbcc += O5 * (-CUMbcc);
+					CUMcbc += O5 * (-CUMcbc);
+					CUMccb += O5 * (-CUMccb);
+
+					//6.
+					CUMccc += O6 * (-CUMccc);
+
+					//back cumulants to central moments
+					//4.
+					//mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+					//mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+					//mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+
+					mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+					mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+					mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+
+					mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+					mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+
+					//5.
+					mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+					mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+					mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+
+					//6.
+					mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+						- 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+							+ 2. * (mfcaa * mfaca * mfaac)
+							+ 16. * mfbba * mfbab * mfabb)
+						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+
+
+					////////
+
+
+					////////////////////////////////////////////////////////////////////////////////////
+					//forcing
+					mfbaa = -mfbaa;// *(c1 - forcingBIAS) / forcingBIAS;
+					mfaba = -mfaba;// *(c1 - forcingBIAS) / forcingBIAS;
+					mfaab = -mfaab;// *(c1 - forcingBIAS) / forcingBIAS;
+
+					//mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+					//mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+					//mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
+
+					mfbaa -= c1o2 * rhoToPhi * (mmfcaa* dX1_phi + mmfbba * dX2_phi + mmfbab * dX3_phi) / (rho);
+					mfaba -= c1o2 * rhoToPhi * (mmfbba* dX1_phi + mmfaca * dX2_phi + mmfabb * dX3_phi) / (rho);
+					mfaab -= c1o2 * rhoToPhi * (mmfbab* dX1_phi + mmfabb * dX2_phi + mmfaac * dX3_phi) / (rho);
+					
+					vvx -= c1o4 * rhoToPhi * (mmfcaa * dX1_phi + mmfbba * dX2_phi + mmfbab * dX3_phi) / (rho);
+					vvy -= c1o4 * rhoToPhi * (mmfbba * dX1_phi + mmfaca * dX2_phi + mmfabb * dX3_phi) / (rho);
+					vvz -= c1o4 * rhoToPhi * (mmfbab * dX1_phi + mmfabb * dX2_phi + mmfaac * dX3_phi) / (rho);
+
+					vx2 = vvx * vvx;
+					vy2 = vvy * vvy;
+					vz2 = vvz * vvz;
+
+					//mmfcaa =0;// c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz - mfaaa);
+					//mmfaca =0;// c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz - mfaaa);
+					//mmfaac =0;// c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz - mfaaa);
+					//mmfabb =0;// mfabb;
+					//mmfbab =0;// mfbab;
+					//mmfbba =0;// mfbba;
+
+
+					//////////////////////////////////////////////////////////////////////////////////////
+					//grad Rho
+					//LBMReal dX1_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX1_phi - phi[DIR_000] * three * gradPx;
+					//LBMReal dX2_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX2_phi - phi[DIR_000] * three * gradPy;
+					//LBMReal dX3_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX3_phi - phi[DIR_000] * three * gradPz;
+
+					//LBMReal dX2_rho = (rhoToPhi ) * dX2_phi ;
+					//LBMReal dX1_rho = (rhoToPhi ) * dX1_phi ;
+					//LBMReal dX3_rho = (rhoToPhi ) * dX3_phi ;
+					///////////////////////////////////////////////////////////////////////////////////////
+					//mfbaa += c1o3 * (c1 / collFactorM - c1o2) *(2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+					//mfaba += c1o3 * (c1 / collFactorM - c1o2) *(Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+					//mfaab += c1o3 * (c1 / collFactorM - c1o2) *(Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+					
+					///////Fakhari pressure correction
+					//mfbaa -= mfaaa / rho * dX1_rho*c1o3;
+					//mfaba -= mfaaa / rho * dX2_rho*c1o3;
+					//mfaab -= mfaaa / rho * dX3_rho*c1o3;
+					////////////////////////////////////////////////////////////////////////////////////
+					//back
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Z - Dir
+					m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+					m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaaa = m0;
+					mfaab = m1;
+					mfaac = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+					m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+					m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+					mfaba = m0;
+					mfabb = m1;
+					mfabc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfaca = m0;
+					mfacb = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+					m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+					m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+					mfbaa = m0;
+					mfbab = m1;
+					mfbac = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+					m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+					m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+					mfbba = m0;
+					mfbbb = m1;
+					mfbbc = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+					m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+					m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+					mfbca = m0;
+					mfbcb = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+					m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcaa = m0;
+					mfcab = m1;
+					mfcac = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+					m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+					m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+					mfcba = m0;
+					mfcbb = m1;
+					mfcbc = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+					m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+					m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+					mfcca = m0;
+					mfccb = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// Y - Dir
+					m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaaa = m0;
+					mfaba = m1;
+					mfaca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+					m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaab = m0;
+					mfabb = m1;
+					mfacb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+					m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfaac = m0;
+					mfabc = m1;
+					mfacc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+					m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+					m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+					mfbaa = m0;
+					mfbba = m1;
+					mfbca = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+					m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+					m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+					mfbab = m0;
+					mfbbb = m1;
+					mfbcb = m2;
+					/////////b//////////////////////////////////////////////////////////////////////////
+					m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+					m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+					m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+					mfbac = m0;
+					mfbbc = m1;
+					mfbcc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcaa = m0;
+					mfcba = m1;
+					mfcca = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+					m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcab = m0;
+					mfcbb = m1;
+					mfccb = m2;
+					/////////c//////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+					m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+					m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+					mfcac = m0;
+					mfcbc = m1;
+					mfccc = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					//mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+					////////////////////////////////////////////////////////////////////////////////////
+					// X - Dir
+					m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaaa = m0;
+					mfbaa = m1;
+					mfcaa = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaba = m0;
+					mfbba = m1;
+					mfcba = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaca = m0;
+					mfbca = m1;
+					mfcca = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaab = m0;
+					mfbab = m1;
+					mfcab = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+					m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabb = m0;
+					mfbbb = m1;
+					mfcbb = m2;
+					///////////b////////////////////////////////////////////////////////////////////////
+					m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacb = m0;
+					mfbcb = m1;
+					mfccb = m2;
+					////////////////////////////////////////////////////////////////////////////////////
+					////////////////////////////////////////////////////////////////////////////////////
+					m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfaac = m0;
+					mfbac = m1;
+					mfcac = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+					m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfabc = m0;
+					mfbbc = m1;
+					mfcbc = m2;
+					///////////c////////////////////////////////////////////////////////////////////////
+					m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+					m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+					m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+					mfacc = m0;
+					mfbcc = m1;
+					mfccc = m2;
+					/////SimpleForce
+
+					//mfabb += c2o9 * deltaP;
+					//mfbab += c2o9 * deltaP;
+					//mfbba += c2o9 * deltaP;
+					//mfaab += c1o18 * deltaP;
+					//mfcab += c1o18 * deltaP;
+					//mfaba += c1o18 * deltaP;
+					//mfcba += c1o18 * deltaP;
+					//mfbaa += c1o18 * deltaP;
+					//mfbca += c1o18 * deltaP;
+					//mfaaa += c1o72 * deltaP;
+					//mfcaa += c1o72 * deltaP;
+					//mfaca += c1o72 * deltaP;
+					//mfcca += c1o72 * deltaP;
+					//mfcbb += c2o9 * deltaP;
+					//mfbcb += c2o9 * deltaP;
+					//mfbbc += c2o9 * deltaP;
+					//mfccb += c1o18 * deltaP;
+					//mfacb += c1o18 * deltaP;
+					//mfcbc += c1o18 * deltaP;
+					//mfabc += c1o18 * deltaP;
+					//mfbcc += c1o18 * deltaP;
+					//mfbac += c1o18 * deltaP;
+					//mfccc += c1o72 * deltaP;
+					//mfacc += c1o72 * deltaP;
+					//mfcac += c1o72 * deltaP;
+					//mfaac += c1o72 * deltaP;
+
+					//mfabb += c1o2*(-forcingX1                        ) * c2o9;
+					//mfbab += c1o2*(           - forcingX2            ) * c2o9;
+					//mfbba += c1o2*(                       - forcingX3) * c2o9;
+					//mfaab += c1o2*(-forcingX1 - forcingX2            ) * c1o18;
+					//mfcab += c1o2*( forcingX1 - forcingX2            ) * c1o18;
+					//mfaba += c1o2*(-forcingX1             - forcingX3) * c1o18;
+					//mfcba += c1o2*( forcingX1             - forcingX3) * c1o18;
+					//mfbaa += c1o2*(           - forcingX2 - forcingX3) * c1o18;
+					//mfbca += c1o2*(             forcingX2 - forcingX3) * c1o18;
+					//mfaaa += c1o2*(-forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfcaa += c1o2*( forcingX1 - forcingX2 - forcingX3) * c1o72;
+					//mfaca += c1o2*(-forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcca += c1o2*( forcingX1 + forcingX2 - forcingX3) * c1o72;
+					//mfcbb += c1o2*( forcingX1                        ) * c2o9;
+					//mfbcb += c1o2*(             forcingX2            ) * c2o9;
+					//mfbbc += c1o2*(                         forcingX3) * c2o9;
+					//mfccb += c1o2*( forcingX1 + forcingX2            ) * c1o18;
+					//mfacb += c1o2*(-forcingX1 + forcingX2            ) * c1o18;
+					//mfcbc += c1o2*( forcingX1             + forcingX3) * c1o18;
+					//mfabc += c1o2*(-forcingX1             + forcingX3) * c1o18;
+					//mfbcc += c1o2*(             forcingX2 + forcingX3) * c1o18;
+					//mfbac += c1o2*(           - forcingX2 + forcingX3) * c1o18;
+					//mfccc += c1o2*( forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfacc += c1o2*(-forcingX1 + forcingX2 + forcingX3) * c1o72;
+					//mfcac += c1o2*( forcingX1 - forcingX2 + forcingX3) * c1o72;
+					//mfaac += c1o2*(-forcingX1 - forcingX2 + forcingX3) * c1o72;
+					//pStarStart -= (vx2 + vy2 + vz2) * c1o3;
+
+					///Take the diffusion part with out
+
+					//mfStartcbb -= D3Q27System::getIncompFeqForDirection(D3Q27System::E  , zeroReal, vvx, vvy, vvz);
+					//mfStartbcb -= D3Q27System::getIncompFeqForDirection(D3Q27System::N  , zeroReal, vvx, vvy, vvz);
+					//mfStartbbc -= D3Q27System::getIncompFeqForDirection(D3Q27System::T  , zeroReal, vvx, vvy, vvz);
+					//mfStartccb -= D3Q27System::getIncompFeqForDirection(D3Q27System::NE , zeroReal, vvx, vvy, vvz);
+					//mfStartacb -= D3Q27System::getIncompFeqForDirection(D3Q27System::NW , zeroReal, vvx, vvy, vvz);
+					//mfStartcbc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TE , zeroReal, vvx, vvy, vvz);
+					//mfStartabc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TW , zeroReal, vvx, vvy, vvz);
+					//mfStartbcc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TN , zeroReal, vvx, vvy, vvz);
+					//mfStartbac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TS , zeroReal, vvx, vvy, vvz);
+					//mfStartccc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TNE, zeroReal, vvx, vvy, vvz);
+					//mfStartacc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TNW, zeroReal, vvx, vvy, vvz);
+					//mfStartcac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TSE, zeroReal, vvx, vvy, vvz);
+					//mfStartaac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TSW, zeroReal, vvx, vvy, vvz);
+					//mfStartabb -= D3Q27System::getIncompFeqForDirection(D3Q27System::W  , zeroReal, vvx, vvy, vvz);
+					//mfStartbab -= D3Q27System::getIncompFeqForDirection(D3Q27System::S  , zeroReal, vvx, vvy, vvz);
+					//mfStartbba -= D3Q27System::getIncompFeqForDirection(D3Q27System::B  , zeroReal, vvx, vvy, vvz);
+					//mfStartaab -= D3Q27System::getIncompFeqForDirection(D3Q27System::SW , zeroReal, vvx, vvy, vvz);
+					//mfStartcab -= D3Q27System::getIncompFeqForDirection(D3Q27System::SE , zeroReal, vvx, vvy, vvz);
+					//mfStartaba -= D3Q27System::getIncompFeqForDirection(D3Q27System::BW , zeroReal, vvx, vvy, vvz);
+					//mfStartcba -= D3Q27System::getIncompFeqForDirection(D3Q27System::BE , zeroReal, vvx, vvy, vvz);
+					//mfStartbaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BS , zeroReal, vvx, vvy, vvz);
+					//mfStartbca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BN , zeroReal, vvx, vvy, vvz);
+					//mfStartaaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BSW, zeroReal, vvx, vvy, vvz);
+					//mfStartcaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BSE, zeroReal, vvx, vvy, vvz);
+					//mfStartaca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BNW, zeroReal, vvx, vvy, vvz);
+					//mfStartcca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BNE, zeroReal, vvx, vvy, vvz);
+					//mfStartbbb -= D3Q27System::getIncompFeqForDirection(D3Q27System::REST, zeroReal, vvx, vvy, vvz);
+					//
+					//pStar += pStarStart*(omegaDRho-c1);
+
+					//mfStartcbb = c2o9 * pStar;
+					//	mfStartbcb= c2o9 * pStar;
+					//	mfStartbbc= c2o9 * pStar;
+					//	mfStartccb= c1o18 * pStar;
+					//	mfStartacb= c1o18 * pStar;
+					//	mfStartcbc= c1o18 * pStar;
+					//	mfStartabc= c1o18 * pStar;
+					//	mfStartbcc= c1o18 * pStar;
+					//	mfStartbac= c1o18 * pStar;
+					//	mfStartccc= c1o72 * pStar;
+					//	mfStartacc= c1o72 * pStar;
+					//	mfStartcac= c1o72 * pStar;
+					//	mfStartaac= c1o72 * pStar;
+					//	mfStartabb= c2o9 * pStar;
+					//	mfStartbab= c2o9 * pStar;
+					//	mfStartbba= c2o9 * pStar;
+					//	mfStartaab= c1o18 * pStar;
+					//	mfStartcab= c1o18 * pStar;
+					//	mfStartaba= c1o18 * pStar;
+					//	mfStartcba= c1o18 * pStar;
+					//	mfStartbaa= c1o18 * pStar;
+					//	mfStartbca= c1o18 * pStar;
+					//	mfStartaaa= c1o72 * pStar;
+					//	mfStartcaa= c1o72 * pStar;
+					//	mfStartaca= c1o72 * pStar;
+					//	mfStartcca= c1o72 * pStar;
+					//	mfStartbbb= c4 * c2o9 * pStar;
+
+					//mfaaa -= c1o2 * (mfStartaaa + mfStartccc)+ c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa);
+					//mfaab -= c1o2 * (mfStartaab + mfStartccb)+c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa));
+					//mfaac -= c1o2 * (mfStartaac + mfStartcca)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa);
+					//mfaba -= c1o2 * (mfStartaba + mfStartcbc)+c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa);
+					//mfabb -= c1o2 * (mfStartabb + mfStartcbb)+c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa);
+					//mfabc -= c1o2 * (mfStartabc + mfStartcba)+c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa);
+					//mfaca -= c1o2 * (mfStartaca + mfStartcac)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa);
+					//mfacb -= c1o2 * (mfStartacb + mfStartcab)+c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa));
+					//mfacc -= c1o2 * (mfStartacc + mfStartcaa)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa);
+					//mfbaa -= c1o2 * (mfStartbaa + mfStartbcc)+c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa);
+					//mfbab -= c1o2 * (mfStartbab + mfStartbcb)+c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa);
+					//mfbac -= c1o2 * (mfStartbac + mfStartbca)+c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa);
+					//mfbba -= c1o2 * (mfStartbba + mfStartbbc)+c1o9 * (c2 * mmfaac - mmfaca - mmfcaa);
+					//mfbbb -=  (mfStartbbb)-(c4o9 * (mmfaac + mmfaca + mmfcaa));
+					//mfbbc -= c1o2 * (mfStartbbc + mfStartbba)+c1o9 * (c2 * mmfaac - mmfaca - mmfcaa);
+					//mfbca -= c1o2 * (mfStartbca + mfStartbac)+c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa);
+					//mfbcb -= c1o2 * (mfStartbcb + mfStartbab)+c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa);
+					//mfbcc -= c1o2 * (mfStartbcc + mfStartbaa)+c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa);
+					//mfcaa -= c1o2 * (mfStartcaa + mfStartacc)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa);
+					//mfcab -= c1o2 * (mfStartcab + mfStartacb)+c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa));
+					//mfcac -= c1o2 * (mfStartcac + mfStartaca)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa);
+					//mfcba -= c1o2 * (mfStartcba + mfStartabc)+c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa);
+					//mfcbb -= c1o2 * (mfStartcbb + mfStartabb)+c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa);
+					//mfcbc -= c1o2 * (mfStartcbc + mfStartaba)+c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa);
+					//mfcca -= c1o2 * (mfStartcca + mfStartaac)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa);
+					//mfccb -= c1o2 * (mfStartccb + mfStartaab)+c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa));
+					//mfccc -= c1o2 * (mfStartccc + mfStartaaa)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa);
+
+					//mfhaaa =rho*( c1o2 * (mfStartaaa + mfStartccc) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa));
+					//mfhaab =rho*( c1o2 * (mfStartaab + mfStartccb) + c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa)));
+					//mfhaac =rho*( c1o2 * (mfStartaac + mfStartcca) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa));
+					//mfhaba =rho*( c1o2 * (mfStartaba + mfStartcbc) + c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa));
+					//mfhabb =rho*( c1o2 * (mfStartabb + mfStartcbb) + c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa));
+					//mfhabc =rho*( c1o2 * (mfStartabc + mfStartcba) + c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa));
+					//mfhaca =rho*( c1o2 * (mfStartaca + mfStartcac) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa));
+					//mfhacb =rho*( c1o2 * (mfStartacb + mfStartcab) + c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa)));
+					//mfhacc =rho*( c1o2 * (mfStartacc + mfStartcaa) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa));
+					//mfhbaa =rho*( c1o2 * (mfStartbaa + mfStartbcc) + c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa));
+					//mfhbab =rho*( c1o2 * (mfStartbab + mfStartbcb) + c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa));
+					//mfhbac =rho*( c1o2 * (mfStartbac + mfStartbca) + c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa));
+					//mfhbba =rho*( c1o2 * (mfStartbba + mfStartbbc) + c1o9 * (c2 * mmfaac - mmfaca - mmfcaa));
+					//mfhbbb =rho*( (mfStartbbb)-(c4o9 * (mmfaac + mmfaca + mmfcaa)));
+					//mfhbbc =rho*( c1o2 * (mfStartbbc + mfStartbba) + c1o9 * (c2 * mmfaac - mmfaca - mmfcaa));
+					//mfhbca =rho*( c1o2 * (mfStartbca + mfStartbac) + c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa));
+					//mfhbcb =rho*( c1o2 * (mfStartbcb + mfStartbab) + c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa));
+					//mfhbcc =rho*( c1o2 * (mfStartbcc + mfStartbaa) + c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa));
+					//mfhcaa =rho*( c1o2 * (mfStartcaa + mfStartacc) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa));
+					//mfhcab =rho*( c1o2 * (mfStartcab + mfStartacb) + c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa)));
+					//mfhcac =rho*( c1o2 * (mfStartcac + mfStartaca) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa));
+					//mfhcba =rho*( c1o2 * (mfStartcba + mfStartabc) + c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa));
+					//mfhcbb =rho*( c1o2 * (mfStartcbb + mfStartabb) + c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa));
+					//mfhcbc =rho*( c1o2 * (mfStartcbc + mfStartaba) + c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa));
+					//mfhcca =rho*( c1o2 * (mfStartcca + mfStartaac) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa));
+					//mfhccb =rho*( c1o2 * (mfStartccb + mfStartaab) + c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa)));
+					//mfhccc =rho*( c1o2 * (mfStartccc + mfStartaaa) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa));
+
+
+
+
+					pStar += pStarStart*(omegaDRho-c1);
+
+					mfcbb -= c2o9*pStar;
+					mfbcb -= c2o9*pStar;
+					mfbbc -= c2o9*pStar;
+					mfccb -= c1o18*pStar;
+					mfacb -= c1o18*pStar;
+					mfcbc -= c1o18*pStar;
+					mfabc -= c1o18*pStar;
+					mfbcc -= c1o18*pStar;
+					mfbac -= c1o18*pStar;
+					mfccc -= c1o72*pStar;
+					mfacc -= c1o72*pStar;
+					mfcac -= c1o72*pStar;
+					mfaac -= c1o72*pStar;
+					mfabb -= c2o9*pStar;
+					mfbab -= c2o9*pStar;
+					mfbba -= c2o9*pStar;
+					mfaab -= c1o18*pStar;
+					mfcab -= c1o18*pStar;
+					mfaba -= c1o18*pStar;
+					mfcba -= c1o18*pStar;
+					mfbaa -= c1o18*pStar;
+					mfbca -= c1o18*pStar;
+					mfaaa -= c1o72*pStar;
+					mfcaa -= c1o72*pStar;
+					mfaca -= c1o72*pStar;
+					mfcca -= c1o72*pStar;
+					mfbbb -= c4*c2o9*pStar;
+
+					mfhbcb = rho*c2o9 * pStar;
+					mfhbbc = rho*c2o9 * pStar;
+					mfhcbb = rho*c2o9 * pStar;
+					mfhccb = rho*c1o18 * pStar;
+					mfhacb = rho*c1o18 * pStar;
+					mfhcbc = rho*c1o18 * pStar;
+					mfhabc = rho*c1o18 * pStar;
+					mfhbcc = rho*c1o18 * pStar;
+					mfhbac = rho*c1o18 * pStar;
+					mfhccc = rho*c1o72 * pStar;
+					mfhacc = rho*c1o72 * pStar;
+					mfhcac = rho*c1o72 * pStar;
+					mfhaac = rho*c1o72 * pStar;
+					mfhabb = rho*c2o9 * pStar;
+					mfhbab = rho*c2o9 * pStar;
+					mfhbba = rho*c2o9 * pStar;
+					mfhaab = rho*c1o18 * pStar;
+					mfhcab = rho*c1o18 * pStar;
+					mfhaba = rho*c1o18 * pStar;
+					mfhcba = rho*c1o18 * pStar;
+					mfhbaa = rho*c1o18 * pStar;
+					mfhbca = rho*c1o18 * pStar;
+					mfhaaa = rho*c1o72 * pStar;
+					mfhcaa = rho*c1o72 * pStar;
+					mfhaca = rho*c1o72 * pStar;
+					mfhcca = rho*c1o72 * pStar;
+					mfhbbb = rho*c4 * c2o9 * pStar;
+
+					//mfStartbcb =  c2o9  * pStarStart;
+					//mfStartbbc =  c2o9  * pStarStart;
+					//mfStartcbb =  c2o9  * pStarStart;
+					//mfStartccb =  c1o18 * pStarStart;
+					//mfStartacb =  c1o18 * pStarStart;
+					//mfStartcbc =  c1o18 * pStarStart;
+					//mfStartabc =  c1o18 * pStarStart;
+					//mfStartbcc =  c1o18 * pStarStart;
+					//mfStartbac =  c1o18 * pStarStart;
+					//mfStartccc =  c1o72 * pStarStart;
+					//mfStartacc =  c1o72 * pStarStart;
+					//mfStartcac =  c1o72 * pStarStart;
+					//mfStartaac =  c1o72 * pStarStart;
+					//mfStartabb =  c2o9  * pStarStart;
+					//mfStartbab =  c2o9  * pStarStart;
+					//mfStartbba =  c2o9  * pStarStart;
+					//mfStartaab =  c1o18 * pStarStart;
+					//mfStartcab =  c1o18 * pStarStart;
+					//mfStartaba =  c1o18 * pStarStart;
+					//mfStartcba =  c1o18 * pStarStart;
+					//mfStartbaa =  c1o18 * pStarStart;
+					//mfStartbca =  c1o18 * pStarStart;
+					//mfStartaaa =  c1o72 * pStarStart;
+					//mfStartcaa =  c1o72 * pStarStart;
+					//mfStartaca =  c1o72 * pStarStart;
+					//mfStartcca =  c1o72 * pStarStart;
+					//mfStartbbb =  c4 * c2o9 * pStarStart;
+
+					//LBMReal scaleSplit = 0.5;
+					//mfStartbcb = mfStartbcb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartbbc = mfStartbbc*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartcbb = mfStartcbb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartccb = mfStartccb*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartacb = mfStartacb*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartcbc = mfStartcbc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartabc = mfStartabc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartbcc = mfStartbcc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartbac = mfStartbac*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartccc = mfStartccc*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartacc = mfStartacc*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartcac = mfStartcac*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartaac = mfStartaac*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartabb = mfStartabb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartbab = mfStartbab*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartbba = mfStartbba*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+					//mfStartaab = mfStartaab*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartcab = mfStartcab*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartaba = mfStartaba*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartcba = mfStartcba*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartbaa = mfStartbaa*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartbca = mfStartbca*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+					//mfStartaaa = mfStartaaa*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartcaa = mfStartcaa*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartaca = mfStartaca*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartcca = mfStartcca*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+					//mfStartbbb = mfStartbbb*scaleSplit+(c1-scaleSplit)* c4 * c2o9 * pStarStart;
+
+
+					//mfaaa -= c1o2 * (mfStartaaa + mfStartccc);
+     //               mfaab -= c1o2 * (mfStartaab + mfStartccb);
+     //               mfaac -= c1o2 * (mfStartaac + mfStartcca);
+     //               mfaba -= c1o2 * (mfStartaba + mfStartcbc);
+     //               mfabb -= c1o2 * (mfStartabb + mfStartcbb);
+     //               mfabc -= c1o2 * (mfStartabc + mfStartcba);
+     //               mfaca -= c1o2 * (mfStartaca + mfStartcac);
+     //               mfacb -= c1o2 * (mfStartacb + mfStartcab);
+     //               mfacc -= c1o2 * (mfStartacc + mfStartcaa);
+     //               mfbaa -= c1o2 * (mfStartbaa + mfStartbcc);
+     //               mfbab -= c1o2 * (mfStartbab + mfStartbcb);
+     //               mfbac -= c1o2 * (mfStartbac + mfStartbca);
+     //               mfbba -= c1o2 * (mfStartbba + mfStartbbc);
+					//mfbbb -= (mfStartbbb);
+     //               mfbbc -= c1o2 * (mfStartbbc + mfStartbba);
+     //               mfbca -= c1o2 * (mfStartbca + mfStartbac);
+     //               mfbcb -= c1o2 * (mfStartbcb + mfStartbab);
+     //               mfbcc -= c1o2 * (mfStartbcc + mfStartbaa);
+     //               mfcaa -= c1o2 * (mfStartcaa + mfStartacc);
+     //               mfcab -= c1o2 * (mfStartcab + mfStartacb);
+     //               mfcac -= c1o2 * (mfStartcac + mfStartaca);
+     //               mfcba -= c1o2 * (mfStartcba + mfStartabc);
+     //               mfcbb -= c1o2 * (mfStartcbb + mfStartabb);
+     //               mfcbc -= c1o2 * (mfStartcbc + mfStartaba);
+     //               mfcca -= c1o2 * (mfStartcca + mfStartaac);
+     //               mfccb -= c1o2 * (mfStartccb + mfStartaab);
+     //               mfccc -= c1o2 * (mfStartccc + mfStartaaa);
+					//												
+					//mfhaaa += rho*c1o2 * (mfStartaaa + mfStartccc);
+					//mfhaab += rho*c1o2 * (mfStartaab + mfStartccb);
+					//mfhaac += rho*c1o2 * (mfStartaac + mfStartcca);
+					//mfhaba += rho*c1o2 * (mfStartaba + mfStartcbc);
+					//mfhabb += rho*c1o2 * (mfStartabb + mfStartcbb);
+					//mfhabc += rho*c1o2 * (mfStartabc + mfStartcba);
+					//mfhaca += rho*c1o2 * (mfStartaca + mfStartcac);
+					//mfhacb += rho*c1o2 * (mfStartacb + mfStartcab);
+					//mfhacc += rho*c1o2 * (mfStartacc + mfStartcaa);
+					//mfhbaa += rho*c1o2 * (mfStartbaa + mfStartbcc);
+					//mfhbab += rho*c1o2 * (mfStartbab + mfStartbcb);
+					//mfhbac += rho*c1o2 * (mfStartbac + mfStartbca);
+					//mfhbba += rho*c1o2 * (mfStartbba + mfStartbbc);
+					//mfhbbb += rho*(mfStartbbb);
+					//mfhbbc += rho*c1o2 * (mfStartbbc + mfStartbba);
+					//mfhbca += rho*c1o2 * (mfStartbca + mfStartbac);
+					//mfhbcb += rho*c1o2 * (mfStartbcb + mfStartbab);
+					//mfhbcc += rho*c1o2 * (mfStartbcc + mfStartbaa);
+					//mfhcaa += rho*c1o2 * (mfStartcaa + mfStartacc);
+					//mfhcab += rho*c1o2 * (mfStartcab + mfStartacb);
+					//mfhcac += rho*c1o2 * (mfStartcac + mfStartaca);
+					//mfhcba += rho*c1o2 * (mfStartcba + mfStartabc);
+					//mfhcbb += rho*c1o2 * (mfStartcbb + mfStartabb);
+					//mfhcbc += rho*c1o2 * (mfStartcbc + mfStartaba);
+					//mfhcca += rho*c1o2 * (mfStartcca + mfStartaac);
+					//mfhccb += rho*c1o2 * (mfStartccb + mfStartaab);
+					//mfhccc += rho*c1o2 * (mfStartccc + mfStartaaa);
+					//mfhbcb += c1o6 * c2o9 * deltaPP;
+					//mfhbbc += c1o6 * c2o9 * deltaPP;
+					//mfhcbb += c1o6 * c2o9 * deltaPP;
+					//mfhccb += c1o6 * c1o18 * deltaPP;
+					//mfhacb += c1o6 * c1o18 * deltaPP;
+					//mfhcbc += c1o6 * c1o18 * deltaPP;
+					//mfhabc += c1o6 * c1o18 * deltaPP;
+					//mfhbcc += c1o6 * c1o18 * deltaPP;
+					//mfhbac += c1o6 * c1o18 * deltaPP;
+					//mfhccc += c1o6 * c1o72 * deltaPP;
+					//mfhacc += c1o6 * c1o72 * deltaPP;
+					//mfhcac += c1o6 * c1o72 * deltaPP;
+					//mfhaac += c1o6 * c1o72 * deltaPP;
+					//mfhabb += c1o6 * c2o9 * deltaPP;
+					//mfhbab += c1o6 * c2o9 * deltaPP;
+					//mfhbba += c1o6 * c2o9 * deltaPP;
+					//mfhaab += c1o6 * c1o18 * deltaPP;
+					//mfhcab += c1o6 * c1o18 * deltaPP;
+					//mfhaba += c1o6 * c1o18 * deltaPP;
+					//mfhcba += c1o6 * c1o18 * deltaPP;
+					//mfhbaa += c1o6 * c1o18 * deltaPP;
+					//mfhbca += c1o6 * c1o18 * deltaPP;
+					//mfhaaa += c1o6 * c1o72 * deltaPP;
+					//mfhcaa += c1o6 * c1o72 * deltaPP;
+					//mfhaca += c1o6 * c1o72 * deltaPP;
+					//mfhcca += c1o6 * c1o72 * deltaPP;
+					//mfhbbb += c1o6 * c4 * c2o9 * deltaPP;
+
+
+					//mfhbcb = c1o3/rho * c2o9 ;
+					//mfhbbc = c1o3/rho * c2o9 ;
+					//mfhcbb = c1o3/rho * c2o9 ;
+					//mfhccb = c1o3/rho * c1o18 ;
+					//mfhacb = c1o3/rho * c1o18 ;
+					//mfhcbc = c1o3/rho * c1o18 ;
+					//mfhabc = c1o3/rho * c1o18 ;
+					//mfhbcc = c1o3/rho * c1o18 ;
+					//mfhbac = c1o3/rho * c1o18 ;
+					//mfhccc = c1o3/rho * c1o72 ;
+					//mfhacc = c1o3/rho * c1o72 ;
+					//mfhcac = c1o3/rho * c1o72 ;
+					//mfhaac = c1o3/rho * c1o72 ;
+					//mfhabb = c1o3/rho * c2o9 ;
+					//mfhbab = c1o3/rho * c2o9 ;
+					//mfhbba = c1o3/rho * c2o9 ;
+					//mfhaab = c1o3/rho * c1o18 ;
+					//mfhcab = c1o3/rho * c1o18 ;
+					//mfhaba = c1o3/rho * c1o18 ;
+					//mfhcba = c1o3/rho * c1o18 ;
+					//mfhbaa = c1o3/rho * c1o18 ;
+					//mfhbca = c1o3/rho * c1o18 ;
+					//mfhaaa = c1o3/rho * c1o72 ;
+					//mfhcaa = c1o3/rho * c1o72 ;
+					//mfhaca = c1o3/rho * c1o72 ;
+					//mfhcca = c1o3/rho * c1o72 ;
+					//mfhbbb = c1/rho;//c1o3/rho * c4 * c2o9 ;
+
+
+					
+					//mfabb += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_M00]) * rhoToPhi / rho;
+					//mfbab += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_0M0]) * rhoToPhi / rho;
+					//mfbba += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_00M]) * rhoToPhi / rho;
+					//mfaab += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_MM0]) * rhoToPhi / rho;
+					//mfcab += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_PM0]) * rhoToPhi / rho;
+					//mfaba += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_M0M]) * rhoToPhi / rho;
+					//mfcba += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_P0M]) * rhoToPhi / rho;
+					//mfbaa += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_0MM]) * rhoToPhi / rho;
+					//mfbca += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_0PM]) * rhoToPhi / rho;
+					//mfaaa += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_MMM]) * rhoToPhi / rho;
+					//mfcaa += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_PMM]) * rhoToPhi / rho;
+					//mfaca += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_MPM]) * rhoToPhi / rho;
+					//mfcca += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_PPM]) * rhoToPhi / rho;
+					//mfcbb += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_P00]) * rhoToPhi / rho;
+					//mfbcb += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_0P0]) * rhoToPhi / rho;
+					//mfbbc += c1o2 * c2o9 * pStar * (phi[DIR_000] - phi[DIR_00P]) * rhoToPhi / rho;
+					//mfccb += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_PP0]) * rhoToPhi / rho;
+					//mfacb += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_MP0]) * rhoToPhi / rho;
+					//mfcbc += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_P0P]) * rhoToPhi / rho;
+					//mfabc += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_M0P]) * rhoToPhi / rho;
+					//mfbcc += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_0PP]) * rhoToPhi / rho;
+					//mfbac += c1o2 * c1o18 * pStar * (phi[DIR_000] - phi[DIR_0MP]) * rhoToPhi / rho;
+					//mfccc += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_PPP]) * rhoToPhi / rho;
+					//mfacc += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_MPP]) * rhoToPhi / rho;
+					//mfcac += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_PMP]) * rhoToPhi / rho;
+					//mfaac += c1o2 * c1o72 * pStar * (phi[DIR_000] - phi[DIR_MMP]) * rhoToPhi / rho;
+					
+					///////////////
+					//mfabb += (pBefore-pStar) * c2o9  ;
+					//mfbab += (pBefore-pStar) * c2o9  ;
+					//mfbba += (pBefore-pStar) * c2o9  ;
+					//mfaab += (pBefore-pStar) * c1o18 ;
+					//mfcab += (pBefore-pStar) * c1o18 ;
+					//mfaba += (pBefore-pStar) * c1o18 ;
+					//mfcba += (pBefore-pStar) * c1o18 ;
+					//mfbaa += (pBefore-pStar) * c1o18 ;
+					//mfbca += (pBefore-pStar) * c1o18 ;
+					//mfaaa += (pBefore-pStar) * c1o72 ;
+					//mfcaa += (pBefore-pStar) * c1o72 ;
+					//mfaca += (pBefore-pStar) * c1o72 ;
+					//mfcca += (pBefore-pStar) * c1o72 ;
+					//mfcbb += (pBefore-pStar) * c2o9  ;
+					//mfbcb += (pBefore-pStar) * c2o9  ;
+					//mfbbc += (pBefore-pStar) * c2o9  ;
+					//mfccb += (pBefore-pStar) * c1o18 ;
+					//mfacb += (pBefore-pStar) * c1o18 ;
+					//mfcbc += (pBefore-pStar) * c1o18 ;
+					//mfabc += (pBefore-pStar) * c1o18 ;
+					//mfbcc += (pBefore-pStar) * c1o18 ;
+					//mfbac += (pBefore-pStar) * c1o18 ;
+					//mfccc += (pBefore-pStar) * c1o72 ;
+					//mfacc += (pBefore-pStar) * c1o72 ;
+					//mfcac += (pBefore-pStar) * c1o72 ;
+					//mfaac += (pBefore-pStar) * c1o72 ;
+					//mfbbb += (pBefore-pStar) * 8.0 / 9.0;
+
+					//mfabb = (pBefore ) * c2o9;
+					//mfbab = (pBefore ) * c2o9;
+					//mfbba = (pBefore ) * c2o9;
+					//mfaab = (pBefore ) * c1o16;
+					//mfcab = (pBefore ) * c1o16;
+					//mfaba = (pBefore ) * c1o16;
+					//mfcba = (pBefore ) * c1o16;
+					//mfbaa = (pBefore ) * c1o16;
+					//mfbca = (pBefore ) * c1o16;
+					//mfaaa = (pBefore ) * c1o72;
+					//mfcaa = (pBefore ) * c1o72;
+					//mfaca = (pBefore ) * c1o72;
+					//mfcca = (pBefore ) * c1o72;
+					//mfcbb = (pBefore ) * c2o9;
+					//mfbcb = (pBefore ) * c2o9;
+					//mfbbc = (pBefore ) * c2o9;
+					//mfccb = (pBefore ) * c1o16;
+					//mfacb = (pBefore ) * c1o16;
+					//mfcbc = (pBefore ) * c1o16;
+					//mfabc = (pBefore ) * c1o16;
+					//mfbcc = (pBefore ) * c1o16;
+					//mfbac = (pBefore ) * c1o16;
+					//mfccc = (pBefore ) * c1o72;
+					//mfacc = (pBefore ) * c1o72;
+					//mfcac = (pBefore ) * c1o72;
+					//mfaac = (pBefore ) * c1o72;
+					//mfbbb = (pBefore ) * 8.0 / 9.0;
+					///////////////////
+
+					//////////////////////////////////////////////////////////////////////////
+					//proof correctness
+					//////////////////////////////////////////////////////////////////////////
+					//#ifdef  PROOF_CORRECTNESS
+					LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+					//			   //LBMReal dif = fabs(drho - rho_post);
+					//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+					//#ifdef SINGLEPRECISION
+					//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+					//#else
+					//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+					//#endif
+					//			   {
+					//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+					//					   + " dif=" + UbSystem::toString(dif)
+					//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+					//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+					//				   //exit(EXIT_FAILURE);
+					//			   }
+					//#endif
+
+					if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post))
+						UB_THROW(UbException(
+							UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," +
+							UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+
+					//////////////////////////////////////////////////////////////////////////
+					//write distribution
+					//////////////////////////////////////////////////////////////////////////
+					(*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)         = mfabb         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)         = mfbab         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)         = mfbba         ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)        = mfaab        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)       = mfcab       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)        = mfaba        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)       = mfcba       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)        = mfbaa        ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)       = mfbca       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)       = mfaaa       ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)      = mfcaa      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)      = mfaca      ;//* rho * c1o3;
+					(*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3)     = mfcca     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     = mfcbb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     = mfbcb     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     = mfbbc     ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfccb   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    = mfacb    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfcbc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    = mfabc    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfbcc   ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    = mfbac    ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfacc  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfcac  ;//* rho * c1o3;
+					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfaac   ;//* rho * c1o3;
+
+					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+
+			
+					(*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3)         = mfhabb;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3)         = mfhbab;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3)         = mfhbba;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3)        = mfhaab;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3)       = mfhcab;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3)        = mfhaba;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3)       = mfhcba;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3)        = mfhbaa;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3)       = mfhbca;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3)       = mfhaaa;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3)      = mfhcaa;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3)      = mfhaca;//* rho * c1o3;
+					(*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3)     = mfhcca;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3)     = mfhcbb;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3)     = mfhbcb;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p)     = mfhbbc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfhccb;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3)    = mfhacb;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfhcbc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p)    = mfhabc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfhbcc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p)    = mfhbac;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfhccc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfhacc;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfhcac;//* rho * c1o3;
+					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfhaac;//* rho * c1o3;
+
+					(*this->zeroDistributionsH2)(x1, x2, x3) = mfhbbb;// *rho* c1o3;
+
+																	// !Old Kernel
+/////////////////////  P H A S E - F I E L D   S O L V E R
+////////////////////////////////////////////
+/////CUMULANT PHASE-FIELD
+					LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+					{
+						mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+						mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+						mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+						mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+						mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+						mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+						mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+						mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+						mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+						mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+						mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+						mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+						mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+						mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+						mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+						mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+						mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+						mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+						mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+						mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+						mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+						mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+						mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+						mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+						mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+						mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+						mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// second component
+						LBMReal concentration =
+							((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+								(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+								((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+						////////////////////////////////////////////////////////////////////////////////////
+						LBMReal oneMinusRho = c1- concentration;
+
+						LBMReal cx =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+								(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+								(mfcbb - mfabb));
+						LBMReal cy =
+							((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+								(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+								(mfbcb - mfbab));
+						LBMReal cz =
+							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+								(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+								(mfbbc - mfbba));
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// calculate the square of velocities for this lattice node
+						LBMReal cx2 = cx * cx;
+						LBMReal cy2 = cy * cy;
+						LBMReal cz2 = cz * cz;
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (6)-(14) in \ref
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - experimental Cumulant ... to be published ... hopefully
+						//!
+
+						// linearized orthogonalization of 3rd order central moments
+						LBMReal Mabc = mfabc - mfaba * c1o3;
+						LBMReal Mbca = mfbca - mfbaa * c1o3;
+						LBMReal Macb = mfacb - mfaab * c1o3;
+						LBMReal Mcba = mfcba - mfaba * c1o3;
+						LBMReal Mcab = mfcab - mfaab * c1o3;
+						LBMReal Mbac = mfbac - mfbaa * c1o3;
+						// linearized orthogonalization of 5th order central moments
+						LBMReal Mcbc = mfcbc - mfaba * c1o9;
+						LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+						LBMReal Mccb = mfccb - mfaab * c1o9;
+
+						//31.05.2022 addaptive mobility
+						//omegaD = c1 + (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) / (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration)) + fabs((1.0 - concentration) * (concentration)) * c1o6 * oneOverInterfaceScale+1.0e-200);
+						//omegaD = c2 * (concentration * (concentration - c1)) / (-c6 * (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) + (concentration * (concentration - c1))+1.0e-200);
+						// collision of 1st order moments
+						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+							normX1 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+							normX2 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+							normX3 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+
+						cx2 = cx * cx;
+						cy2 = cy * cy;
+						cz2 = cz * cz;
+
+						// equilibration of 2nd order moments
+						mfbba = zeroReal;
+						mfbab = zeroReal;
+						mfabb = zeroReal;
+
+						mfcaa = c1o3 * concentration;
+						mfaca = c1o3 * concentration;
+						mfaac = c1o3 * concentration;
+
+						// equilibration of 3rd order moments
+						Mabc = zeroReal;
+						Mbca = zeroReal;
+						Macb = zeroReal;
+						Mcba = zeroReal;
+						Mcab = zeroReal;
+						Mbac = zeroReal;
+						mfbbb = zeroReal;
+
+						// from linearized orthogonalization 3rd order central moments to central moments
+						mfabc = Mabc + mfaba * c1o3;
+						mfbca = Mbca + mfbaa * c1o3;
+						mfacb = Macb + mfaab * c1o3;
+						mfcba = Mcba + mfaba * c1o3;
+						mfcab = Mcab + mfaab * c1o3;
+						mfbac = Mbac + mfbaa * c1o3;
+
+						// equilibration of 4th order moments
+						mfacc = c1o9 * concentration;
+						mfcac = c1o9 * concentration;
+						mfcca = c1o9 * concentration;
+
+						mfcbb = zeroReal;
+						mfbcb = zeroReal;
+						mfbbc = zeroReal;
+
+						// equilibration of 5th order moments
+						Mcbc = zeroReal;
+						Mbcc = zeroReal;
+						Mccb = zeroReal;
+
+						// from linearized orthogonalization 5th order central moments to central moments
+						mfcbc = Mcbc + mfaba * c1o9;
+						mfbcc = Mbcc + mfbaa * c1o9;
+						mfccb = Mccb + mfaab * c1o9;
+
+						// equilibration of 6th order moment
+						mfccc = c1o27 * concentration;
+
+						////////////////////////////////////////////////////////////////////////////////////
+						//! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+						//! see also Eq. (88)-(96) in
+						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+						//!
+						////////////////////////////////////////////////////////////////////////////////////
+						// X - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+						backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+						backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+						backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+						backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+						backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Y - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+						backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+						backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+						backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+
+						////////////////////////////////////////////////////////////////////////////////////
+						// Z - Dir
+						backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+						backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+
+
+
+						(*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+						(*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+						(*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+						(*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+						(*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+						(*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+						(*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+						(*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+
+						(*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+
+
+
+
+					}
+				}
+			}
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_phi()
+{
+	using namespace D3Q27System;
+	return 3.0* ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP])- (phi[DIR_PMP] - phi[DIR_MPM])))
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0])- (phi[DIR_PM0] - phi[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_phi()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP])))
+		+ WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_rhoInv(LBMReal rhoL,LBMReal rhoDIV)
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0/(rhoL+rhoDIV*phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP]))))
+		+ WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_P0P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0M])) + (1.0 / (rhoL + rhoDIV * phi[DIR_P0M]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0P]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_PM0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MP0])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PP0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MM0]))))) +
+		+WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_P00]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M00])));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_rhoInv(LBMReal rhoL,LBMReal rhoDIV)
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0 / (rhoL + rhoDIV * phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM]))))
+		+ WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_0PP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_0PM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MP]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_PP0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MM0])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PM0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MP0]))))) +
+		+WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_0P0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0M0])));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_rhoInv(LBMReal rhoL, LBMReal rhoDIV)
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0 / (rhoL + rhoDIV * phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP]))))
+		+ WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_P0P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0M])) - (1.0 / (rhoL + rhoDIV * phi[DIR_P0M]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0P]))) + ((1.0 / (rhoL + rhoDIV * phi[DIR_0MP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0PM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_0PP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MM]))))) +
+		+WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_00P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_00M])));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM])))
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_phi2()
+{
+	using namespace D3Q27System;
+	return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP])))
+		+ WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) +
+		+WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M]));
+}
+
+LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::nabla2_phi()
+{
+	using namespace D3Q27System;
+	LBMReal sum = 0.0;
+	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+	sum += WEIGTH[DIR_0PP] * (
+			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+		);
+	sum += WEIGTH[DIR_00P] * (
+			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
+		);
+
+
+	return 6.0 * sum;
+}
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::computePhasefield()
+{
+	using namespace D3Q27System;
+	SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+
+	int minX1 = ghostLayerWidth;
+	int minX2 = ghostLayerWidth;
+	int minX3 = ghostLayerWidth;
+	int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+	int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+	int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+
+	//------------- Computing the phase-field ------------------
+	for (int x3 = minX3; x3 < maxX3; x3++) {
+		for (int x2 = minX2; x2 < maxX2; x2++) {
+			for (int x1 = minX1; x1 < maxX1; x1++) {
+				// if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+				{
+					int x1p = x1 + 1;
+					int x2p = x2 + 1;
+					int x3p = x3 + 1;
+
+					h[DIR_P00]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+					h[DIR_0P0]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+					h[DIR_00P]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+					h[DIR_PP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+					h[DIR_MP0]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+					h[DIR_P0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+					h[DIR_M0P]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+					h[DIR_0PP]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+					h[DIR_0MP]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+					h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+					h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+					h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+					h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+
+					h[DIR_M00]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+					h[DIR_0M0]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+					h[DIR_00M]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+					h[DIR_MM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+					h[DIR_PM0]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+					h[DIR_M0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+					h[DIR_P0M]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+					h[DIR_0MM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+					h[DIR_0PM]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+					h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+					h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+					h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+					h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+
+					h[DIR_000] = (*this->zeroDistributionsH1)(x1, x2, x3);
+				}
+			}
+		}
+	}
+}
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi[DIR_000] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		} else {
+			//phi[k] = (*ph)(x1 , x2, x3 );// neutral wetting
+			phi[k] = 0.0;//unwetting
+		}
+	}
+}
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+	int x3)
+{
+	using namespace D3Q27System;
+
+	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+
+	phi2[DIR_000] = (*ph)(x1, x2, x3);
+
+
+	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+
+		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+		}
+		else {
+			phi2[k] = 0.05;
+		}
+	}
+}
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::swapDistributions()
+{
+	LBMKernel::swapDistributions();
+	dataSet->getHdistributions()->swap();
+	dataSet->getH2distributions()->swap();
+}
+
+void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::initForcing()
+{
+	muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+	muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+	muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+
+	muDeltaT = deltaT;
+
+	muForcingX1.DefineVar("dt", &muDeltaT);
+	muForcingX2.DefineVar("dt", &muDeltaT);
+	muForcingX3.DefineVar("dt", &muDeltaT);
+
+	muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+
+	muForcingX1.DefineVar("nu", &muNu);
+	muForcingX2.DefineVar("nu", &muNu);
+	muForcingX3.DefineVar("nu", &muNu);
+
+	muForcingX1.DefineVar("rho",&muRho); 
+	muForcingX2.DefineVar("rho",&muRho); 
+	muForcingX3.DefineVar("rho",&muRho); 
+
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old
new file mode 100644
index 000000000..2ab0e9df7
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old
@@ -0,0 +1,3024 @@
+////=======================================================================================
+//// ____          ____    __    ______     __________   __      __       __        __
+//// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+////  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+////   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+////    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+////     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+////      \    \  |    |   ________________________________________________________________
+////       \    \ |    |  |  ______________________________________________________________|
+////        \    \|    |  |  |         __          __     __     __     ______      _______
+////         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+////          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+////           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+////            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+////
+////  This file is part of VirtualFluids. VirtualFluids is free software: you can
+////  redistribute it and/or modify it under the terms of the GNU General Public
+////  License as published by the Free Software Foundation, either version 3 of
+////  the License, or (at your option) any later version.
+////
+////  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+////  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+////  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+////  for more details.
+////
+////  You should have received a copy of the GNU General Public License along
+////  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+////
+////! \file MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
+////! \ingroup LBMKernel
+////! \author M. Geier, K. Kutscher, Hesameddin Safari
+////=======================================================================================
+//
+//#include "MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h"
+//#include "BCArray3D.h"
+//#include "Block3D.h"
+//#include "D3Q27EsoTwist3DSplittedVector.h"
+//#include "D3Q27System.h"
+//#include "DataSet3D.h"
+//#include "LBMKernel.h"
+//#include <cmath>
+//#include <iostream>
+//#include <string>
+//
+//#define PROOF_CORRECTNESS
+//
+////////////////////////////////////////////////////////////////////////////
+//MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::MultiphaseSimpleVelocityBaseExternalPressureLBMKernel() { this->compressible = false; }
+////////////////////////////////////////////////////////////////////////////
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::initDataSet()
+//{
+//	SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+//	SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector( nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field
+//	SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9));
+//	SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D(            nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+//	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure(new  CbArray3D<LBMReal, IndexerX3X2X1>(    nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+//	pressureOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+//	p1Old = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new  CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+//	dataSet->setFdistributions(f);
+//	dataSet->setHdistributions(h); // For phase-field
+//	dataSet->setH2distributions(h2);
+//	dataSet->setPhaseField(divU1);
+//	dataSet->setPressureField(pressure);
+//
+//	phaseField = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0));
+//	phaseFieldOld = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 999.0));
+//
+//	divU = CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0));
+//}
+////////////////////////////////////////////////////////////////////////////
+//SPtr<LBMKernel> MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::clone()
+//{
+//	SPtr<LBMKernel> kernel(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel());
+//	kernel->setNX(nx);
+//	dynamicPointerCast<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(kernel)->initDataSet();
+//	kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG);
+//	kernel->setDensityRatio(this->densityRatio);
+//	kernel->setMultiphaseModelParameters(this->beta, this->kappa);
+//	kernel->setContactAngle(this->contactAngle);
+//	kernel->setPhiL(this->phiL);
+//	kernel->setPhiH(this->phiH);
+//	kernel->setPhaseFieldRelaxation(this->tauH);
+//	kernel->setMobility(this->mob);
+//	kernel->setInterfaceWidth(this->interfaceWidth);
+//
+//	kernel->setBCProcessor(bcProcessor->clone(kernel));
+//	kernel->setWithForcing(withForcing);
+//	kernel->setForcingX1(muForcingX1);
+//	kernel->setForcingX2(muForcingX2);
+//	kernel->setForcingX3(muForcingX3);
+//	kernel->setIndex(ix1, ix2, ix3);
+//	kernel->setDeltaT(deltaT);
+//	kernel->setGhostLayerWidth(2);
+//	dynamicPointerCast<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(kernel)->initForcing();
+//
+//	return kernel;
+//}
+////////////////////////////////////////////////////////////////////////////
+//void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+//	using namespace UbMath;
+//	LBMReal m2 = mfa + mfc;
+//	LBMReal m1 = mfc - mfa;
+//	LBMReal m0 = m2 + mfb;
+//	mfa = m0;
+//	m0 *= Kinverse;
+//	m0 += oneMinusRho;
+//	mfb = (m1 * Kinverse - m0 * vv) * K;
+//	mfc = ((m2 - c2 * m1 * vv) * Kinverse + v2 * m0) * K;
+//}
+//
+//////////////////////////////////////////////////////////////////////////////////
+//void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho) {
+//	using namespace UbMath;
+//	LBMReal m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K;
+//	LBMReal m1 = (((mfa - mfc) - c2 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K;
+//	mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K;
+//	mfa = m0;
+//	mfb = m1;
+//}
+//
+//
+//////////////////////////////////////////////////////////////////////////////////
+//void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+//	using namespace UbMath;
+//	LBMReal m1 = (mfa + mfc) + mfb;
+//	LBMReal m2 = mfc - mfa;
+//	mfc = (mfc + mfa) + (v2 * m1 - c2 * vv * m2);
+//	mfb = m2 - vv * m1;
+//	mfa = m1;
+//}
+//
+//
+//void  MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2) {
+//	using namespace UbMath;
+//	LBMReal ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2);
+//	LBMReal mb = ((mfa - mfc) - mfa * v2) - c2 * mfb * vv;
+//	mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2);
+//	mfb = mb;
+//	mfa = ma;
+//}
+//
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
+//{
+//	using namespace D3Q27System;
+//	using namespace UbMath;
+//
+//	forcingX1 = 0.0;
+//	forcingX2 = 0.0;
+//	forcingX3 = 0.0;
+//
+//	LBMReal oneOverInterfaceScale = c4 / interfaceWidth; //1.0;//1.5;
+//														 /////////////////////////////////////
+//
+//	localDistributionsF    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions();
+//	nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions();
+//	zeroDistributionsF     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions();
+//
+//	localDistributionsH1    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions();
+//	nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions();
+//	zeroDistributionsH1     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions();
+//
+//	localDistributionsH2    = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getLocalDistributions();
+//	nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions();
+//	zeroDistributionsH2     = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions();
+//
+//
+//	CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField();
+//
+//	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+//
+//	const int bcArrayMaxX1 = (int)bcArray->getNX1();
+//	const int bcArrayMaxX2 = (int)bcArray->getNX2();
+//	const int bcArrayMaxX3 = (int)bcArray->getNX3();
+//
+//	int minX1 = ghostLayerWidth;
+//	int minX2 = ghostLayerWidth;
+//	int minX3 = ghostLayerWidth;
+//	int maxX1 = bcArrayMaxX1 - ghostLayerWidth;
+//	int maxX2 = bcArrayMaxX2 - ghostLayerWidth;
+//	int maxX3 = bcArrayMaxX3 - ghostLayerWidth;
+//	LBMReal omegaDRho = 1.0;// 1.25;// 1.3;
+//
+//	for (int x3 = minX3-ghostLayerWidth; x3 < maxX3+ghostLayerWidth; x3++) {
+//		for (int x2 = minX2-ghostLayerWidth; x2 < maxX2+ghostLayerWidth; x2++) {
+//			for (int x1 = minX1-ghostLayerWidth; x1 < maxX1+ghostLayerWidth; x1++) {
+//				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+//					int x1p = x1 + 1;
+//					int x2p = x2 + 1;
+//					int x3p = x3 + 1;
+//
+//					LBMReal mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+//					LBMReal mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+//					LBMReal mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+//					LBMReal mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+//					LBMReal mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+//					LBMReal mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+//					LBMReal mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+//					LBMReal mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+//					LBMReal mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+//					LBMReal mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+//					LBMReal mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+//					LBMReal mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+//					LBMReal mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//					LBMReal mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+//					LBMReal mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+//					LBMReal mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+//					LBMReal mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+//					LBMReal mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+//					LBMReal mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+//					LBMReal mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+//					LBMReal mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+//					LBMReal mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+//					LBMReal mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//					LBMReal mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//					LBMReal mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//					LBMReal mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+//
+//					LBMReal mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+//					(*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca)  + (mfcaa + mfacc))  ) +
+//						(((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) +
+//							((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) +
+//								(mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb;
+//					if ((*phaseField)(x1, x2, x3) > 1 ) {
+//						(*phaseField)(x1, x2, x3) = c1;
+//					}
+//
+//					if ((*phaseField)(x1, x2, x3) < 0) {
+//						(*phaseField)(x1, x2, x3) = 0;
+//					}
+//					////// read F-distributions for velocity formalism
+//
+//					mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+//					mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+//					mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+//					mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+//					mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+//					mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+//					mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+//					mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+//					mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+//					mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+//					mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+//					mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+//					mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//					mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+//					mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+//					mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+//					mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+//					mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+//					mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+//					mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+//					mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+//					mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+//					mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//					mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//					mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//					mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+//
+//					mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+//
+//					//LBMReal rhoH = 1.0;
+//					//LBMReal rhoL = 1.0 / densityRatio;
+//
+//					LBMReal rhoH = 1.0*densityRatio;
+//					LBMReal rhoL = 1.0;
+//
+//					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+//
+//					LBMReal drho = (((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))   )
+//						+ (((mfaab + mfccb) + (mfacb + mfcab) ) + ((mfaba + mfcbc) + (mfabc + mfcba) ) + ((mfbaa + mfbcc) + (mfbac + mfbca) )))
+//						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+//				
+//					omegaDRho = 2.0;// 1.5;
+//					drho *= omegaDRho;
+//					LBMReal keepDrho = drho;
+//					drho = ((*p1Old)(x1, x2, x3) + drho) * c1o2;
+//				//	drho = ((*p1Old)(x1, x2, x3)*c2o3 + drho*c1o3) ;
+//					(*p1Old)(x1, x2, x3) = keepDrho;
+//					
+//					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH); //Incompressible
+/////Density correction
+//					//LBMReal dX1_phi = gradX1_phi();
+//					//LBMReal dX2_phi = gradX2_phi();
+//					//LBMReal dX3_phi = gradX3_phi();
+//					//LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//					//	(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//					//	(mfcbb - mfabb)) ;
+//					//LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//					//	(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//					//	(mfbcb - mfbab)) ;
+//					//LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//					//	(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//					//	(mfbbc - mfbba)) ;
+//					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressure)(x1, x2, x3); //explicit Compressible
+//					//(*pressureOld)(x1, x2, x3) = (((*pressure)(x1, x2, x3) + rho * c1o3 * drho-(rhoH-rhoL)*(vvx*dX1_phi+vvy*dX2_phi+vvz*dX3_phi)*c1o3)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+//					
+//					//(*pressureOld)(x1, x2, x3) = ((*pressure)(x1, x2, x3) - c1o3 * drho * ((*phaseField)(x1, x2, x3) * (rhoH - rhoL) + rhoL)) / (c1 - ((*phaseField)(x1, x2, x3) - c1) * drho);
+//					//LBMReal rho=rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressureOld)(x1, x2, x3);
+//					//LBMReal tempDrho = drho;
+//					//drho = (drho*0.9 + (*pressureOld)(x1, x2, x3)*0.1) ;
+//					//(*pressureOld)(x1, x2, x3) = tempDrho;
+//
+//					//Mathematica
+//
+//					LBMReal rho = ((*pressure)(x1, x2, x3) - (*phaseField)(x1, x2, x3) * (*pressure)(x1, x2, x3) + c1o3 * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (c1o3 + c1o3 * drho * (-1 + (*phaseField)(x1, x2, x3)));
+//					(*pressureOld)(x1, x2, x3) = ((*pressure)(x1, x2, x3) + c1o3 * drho * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (1 + drho * (-1 + (*phaseField)(x1, x2, x3)));
+///////Full Filter
+//					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH)+(one- (*phaseField)(x1, x2, x3))*three* (*pressure)(x1, x2, x3); //explicit Compressible
+//					//(*pressureOld)(x1, x2, x3) = (((*pressure)(x1, x2, x3) + rho * c1o3 * drho)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+////// reduced Filter
+//					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH) + (one - (*phaseField)(x1, x2, x3)) * three * (*pressureOld)(x1, x2, x3); //explicit Compressible
+//					//(*pressure)(x1, x2, x3) = (((*pressureOld)(x1, x2, x3) + rho * c1o3 * drho)) / (one - (one - (*phaseField)(x1, x2, x3)) * drho);
+//
+//					//rho = (rho)/(one- (one - (*phaseField)(x1, x2, x3)) * drho); // now implicit Compressible
+//					
+//					//(*pressure)(x1, x2, x3) = (((*phaseField)(x1, x2, x3)) + ((*phaseField2)(x1, x2, x3)) - c1) * c1o3;
+//					////!!!!!! relplace by pointer swap!
+//					//(*pressureOld)(x1, x2, x3) = (*pressure)(x1, x2, x3);
+//				}
+//			}
+//		}
+//	}
+//
+//	LBMReal collFactorM;
+//
+//	////Periodic Filter
+//	//for (int x3 = minX3-1; x3 <= maxX3; x3++) {
+//	//	for (int x2 = minX2-1; x2 <= maxX2; x2++) {
+//	//		for (int x1 = minX1-1; x1 <= maxX1; x1++) {
+//	//			if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+//
+//	//				LBMReal sum = 0.;
+//
+//	//				///Version for boundaries
+//	//				for (int xx = -1; xx <= 1; xx++) {
+//	//					//int xxx = (xx+x1 <= maxX1) ? ((xx + x1 > 0) ? xx + x1 : maxX1) : 0;
+//	//					int xxx = xx + x1;
+//
+//	//					for (int yy = -1; yy <= 1; yy++) {
+//	//						//int yyy = (yy+x2 <= maxX2) ?( (yy + x2 > 0) ? yy + x2 : maxX2) : 0;
+//	//						int yyy = yy + x2;
+//
+//	//						for (int zz = -1; zz <= 1; zz++) {
+//	//							//int zzz = (zz+x3 <= maxX3) ? zzz = ((zz + x3 > 0) ? zz + x3 : maxX3 ): 0;
+//	//							int zzz = zz + x3;
+//
+//	//							if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) {
+//	//								sum+= 64.0/(216.0*(c1+c3*abs(xx))* (c1 + c3 * abs(yy))* (c1 + c3 * abs(zz)))*(*pressureOld)(xxx, yyy, zzz);
+//	//							}
+//	//							else{ sum+= 64.0 / (216.0 * (c1 + c3 * abs(xx)) * (c1 + c3 * abs(yy)) * (c1 + c3 * abs(zz))) * (*pressureOld)(x1, x2, x3);
+//	//							}
+//
+//
+//	//						}
+//	//					}
+//	//				}
+//	//				(*pressure)(x1, x2, x3) = sum;
+//	//			}
+//	//		}
+//	//	}
+//	//}
+//
+//	////!filter
+//
+//	for (int x3 = minX3; x3 < maxX3; x3++) {
+//		for (int x2 = minX2; x2 < maxX2; x2++) {
+//			for (int x1 = minX1; x1 < maxX1; x1++) {
+//				if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) {
+//					int x1p = x1 + 1;
+//					int x2p = x2 + 1;
+//					int x3p = x3 + 1;
+//
+//					//////////////////////////////////////////////////////////////////////////
+//					// Read distributions and phase field
+//					////////////////////////////////////////////////////////////////////////////
+//					//////////////////////////////////////////////////////////////////////////
+//
+//					// E   N  T
+//					// c   c  c
+//					//////////
+//					// W   S  B
+//					// a   a  a
+//
+//					// Rest ist b
+//
+//					// mfxyz
+//					// a - negative
+//					// b - null
+//					// c - positive
+//
+//					// a b c
+//					//-1 0 1
+//
+//					findNeighbors(phaseField, x1, x2, x3);
+//
+//					LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);
+//					LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);
+//					LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);
+//					LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);
+//					LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);
+//					LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);
+//					LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);
+//					LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);
+//					LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);
+//					LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);
+//					LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);
+//					LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);
+//					LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//					LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);
+//					LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);
+//					LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);
+//					LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);
+//					LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);
+//					LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);
+//					LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);
+//					LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);
+//					LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);
+//					LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//					LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//					LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//					LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);
+//
+//					LBMReal mfbbb = (*this->zeroDistributionsF)(x1, x2, x3);
+//
+//
+//					LBMReal mfhcbb = (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3);
+//					LBMReal mfhbcb = (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3);
+//					LBMReal mfhbbc = (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3);
+//					LBMReal mfhccb = (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3);
+//					LBMReal mfhacb = (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3);
+//					LBMReal mfhcbc = (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3);
+//					LBMReal mfhabc = (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3);
+//					LBMReal mfhbcc = (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3);
+//					LBMReal mfhbac = (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3);
+//					LBMReal mfhccc = (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3);
+//					LBMReal mfhacc = (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3);
+//					LBMReal mfhcac = (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3);
+//					LBMReal mfhaac = (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//					LBMReal mfhabb = (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3);
+//					LBMReal mfhbab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3);
+//					LBMReal mfhbba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p);
+//					LBMReal mfhaab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3);
+//					LBMReal mfhcab = (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3);
+//					LBMReal mfhaba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p);
+//					LBMReal mfhcba = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p);
+//					LBMReal mfhbaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p);
+//					LBMReal mfhbca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p);
+//					LBMReal mfhaaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//					LBMReal mfhcaa = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//					LBMReal mfhaca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//					LBMReal mfhcca = (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p);
+//
+//					LBMReal mfhbbb = (*this->zeroDistributionsH2)(x1, x2, x3);
+//
+//					//LBMReal rhoH = 1.0;
+//					//LBMReal rhoL = 1.0 / densityRatio;
+//
+//					LBMReal rhoH = 1.0;
+//					LBMReal rhoL = 1.0/ densityRatio;
+//
+//					LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL);
+//
+//					LBMReal dX1_phi = gradX1_phi();
+//					LBMReal dX2_phi = gradX2_phi();
+//					LBMReal dX3_phi = gradX3_phi();
+//
+//					LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9+1e-3;
+//					// 01.09.2022: unclear what value we have to add to the normal: lager values better cut of in gas phase?
+//					LBMReal normX1 = dX1_phi / denom;
+//					LBMReal normX2 = dX2_phi / denom;
+//					LBMReal normX3 = dX3_phi / denom;
+//
+//
+//
+//					collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL);
+//
+//
+//					LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi();
+//
+//					//----------- Calculating Macroscopic Values -------------
+//					LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH); //Incompressible
+//
+//																		///scaled phase field
+//					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) / ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) + (c1 - (*phaseField)(x1, x2, x3)) * (c1 - (*phaseField)(x1, x2, x3))) - phiH);
+//					///!scaled phase field
+//					
+//					//LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH)+(one-phi[REST])* (*pressure)(x1, x2, x3)*three; //compressible
+//					//LBMReal rho = rhoL + (rhoH - rhoL) * phi[REST] + (one - phi[REST]) * (*pressure)(x1, x2, x3) * three; //compressible
+//
+//					LBMReal m0, m1, m2;
+//					LBMReal rhoRef=c1;
+//
+//					LBMReal vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//						(mfcbb - mfabb))/rhoRef;
+//					LBMReal vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//						(mfbcb - mfbab))/rhoRef;
+//					LBMReal vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//						(mfbbc - mfbba))/rhoRef;
+//					////Filter&Gradient merged
+//					LBMReal pressureHere = (*pressureOld)(x1, x2, x3);
+//					//LBMReal pressureHere = (*pressure)(x1, x2, x3);
+//
+//					LBMReal arrayP[3][3][3] = { {{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}},
+//												{{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}},
+//												{ {pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere},{pressureHere,pressureHere,pressureHere}} };
+//					//LBMReal LaplaceP = 0.0;
+//					//LaplaceP += WEIGTH[TNE] * (((((*pressureOld)(x1+1,x2+1,x3+1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 + 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3 + 1) - pressureHere)))
+//					//	+ ((((*pressureOld)(x1 + 1, x2 - 1, x3 + 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 - 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3 + 1) - pressureHere))));
+//					//LaplaceP += WEIGTH[TN] * (
+//					//	((((*pressureOld)(x1 + 1, x2 + 1, x3) - pressureHere) + ((*pressureOld)(x1 - 1, x2 - 1, x3) - pressureHere)) + (((*pressureOld)(x1 + 1, x2 - 1, x3) - pressureHere) + ((*pressureOld)(x1 - 1, x2 + 1, x3) - pressureHere)))
+//					//	+ ((((*pressureOld)(x1 + 1, x2, x3 + 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2, x3 -1) - pressureHere)) + (((*pressureOld)(x1 + 1, x2, x3 - 1) - pressureHere) + ((*pressureOld)(x1 - 1, x2, x3 + 1) - pressureHere)))
+//					//	+ ((((*pressureOld)(x1, x2 + 1, x3 + 1) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3 - 1) - pressureHere)) + (((*pressureOld)(x1, x2 + 1, x3 - 1) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3 + 1) - pressureHere)))
+//					//	);
+//					//LaplaceP += WEIGTH[T] * (
+//					//	(((*pressureOld)(x1 + 1, x2, x3) - pressureHere) + ((*pressureOld)(x1, x2-1, x3) - pressureHere))
+//					//	+ (((*pressureOld)(x1, x2 + 1, x3) - pressureHere) + ((*pressureOld)(x1, x2 - 1, x3) - pressureHere))
+//					//	+ (((*pressureOld)(x1, x2, x3 + 1) - pressureHere) + ((*pressureOld)(x1, x2, x3 - 1) - pressureHere))
+//					//	);
+//
+//					//LaplaceP= 6.0 * LaplaceP;
+//					
+//					//LBMReal sum = 0.0;
+//
+//					for (int dir1 = -1; dir1 <= 1; dir1++) {
+//						for (int dir2 = -1; dir2 <= 1; dir2++) {
+//							for (int dir3 = -1; dir3 <= 1; dir3++){
+//								int xxx = x1 + dir1;
+//								int yyy = x2 + dir2;
+//								int zzz = x3 + dir3;
+//								if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) arrayP[dir1 + 1][dir2 + 1][dir3 + 1] = (*pressureOld)(xxx, yyy, zzz);
+//								//if (!bcArray->isSolid(xxx, yyy, zzz) && !bcArray->isUndefined(xxx, yyy, zzz)) arrayP[dir1 + 1][dir2 + 1][dir3 + 1] = (*pressure)(xxx, yyy, zzz);
+//							//	sum += 64.0 / (216.0 * (c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)) * (c1 + c3 * abs(dir3))) * arrayP[dir1 + 1][dir2 + 1][dir3 + 1];
+//							}
+//						}
+//					}
+////					(*pressure)(x1, x2, x3) = sum;// *0.1 + (1.0 - 0.1) * (*pressureOld)(x1, x2, x3);
+//
+//
+//					(*pressure)(x1, x2, x3) = (((((arrayP[0][0][0] + arrayP[2][2][2]) + (arrayP[0][2][0] + arrayP[2][0][2])) + ((arrayP[2][0][0] + arrayP[0][2][2]) + (arrayP[2][2][0] + arrayP[0][0][2]))) * c1o216
+//						+ (((arrayP[0][0][1] + arrayP[2][2][1]) + (arrayP[0][1][0] + arrayP[2][1][2])) + ((arrayP[1][0][0] + arrayP[1][2][2]) + (arrayP[0][1][2] + arrayP[2][1][0])) + ((arrayP[1][0][2] + arrayP[1][2][0]) + (arrayP[0][2][1] + arrayP[2][0][1]))) * c1o54)
+//						+ ((arrayP[0][1][1] + arrayP[2][1][1]) + (arrayP[1][0][1] + arrayP[1][2][1]) + (arrayP[1][1][0] + arrayP[1][1][2])) * c2o27)
+//						+ arrayP[1][1][1] * c8o27;
+//					//LBMReal gradPx = 0.0;
+//					//LBMReal gradPy = 0.0;
+//					//LBMReal gradPz = 0.0;
+//					//for (int dir1 = -1; dir1 <= 1; dir1++) {
+//					//	for (int dir2 = -1; dir2 <= 1; dir2++) {
+//					//		gradPx -= arrayP[0][dir1+1][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		gradPx += arrayP[2][dir1+1][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//
+//
+//
+//					//		gradPy -= arrayP[dir1+1][0][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		gradPy += arrayP[dir1+1][2][dir2+1] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		
+//
+//					//		gradPz -= arrayP[dir1+1][dir2+1][0] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		gradPz += arrayP[dir1+1][dir2+1][2] * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//	}
+//					//}
+//
+//					LBMReal gradPx = ((((arrayP[2][0][0] - arrayP[0][2][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+//						+ (((arrayP[2][1][0] - arrayP[0][1][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[2][0][1] - arrayP[0][2][1]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+//						+ (arrayP[2][1][1] - arrayP[0][1][1]) * c2o9;
+//					LBMReal gradPy = ((((arrayP[0][2][0] - arrayP[2][0][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[0][2][2] - arrayP[2][0][0]))) * c1o72
+//						+ (((arrayP[1][2][0] - arrayP[1][0][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[0][2][1] - arrayP[2][0][1]) + (arrayP[1][2][2] - arrayP[1][0][0]))) * c1o18)
+//						+ (arrayP[1][2][1] - arrayP[1][0][1]) * c2o9;
+//					LBMReal gradPz = ((((arrayP[0][0][2] - arrayP[2][2][0]) + (arrayP[0][2][2] - arrayP[2][0][0])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+//						+ (((arrayP[0][1][2] - arrayP[2][1][0]) + (arrayP[1][2][2] - arrayP[1][0][0])) + ((arrayP[1][0][2] - arrayP[1][2][0]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+//						+ (arrayP[1][1][2] - arrayP[1][1][0]) * c2o9;
+//
+//					//gradPx *=c1 - (*pressure)(x1, x2, x3)+pressureHere;
+//					//gradPy *=c1 - (*pressure)(x1, x2, x3) + pressureHere;
+//					//gradPz *=c1 - (*pressure)(x1, x2, x3) + pressureHere;
+//
+//					////!Filter&Gradient merged
+//					//LBMReal gradPx = 0.0;
+//					//LBMReal gradPy = 0.0;
+//					//LBMReal gradPz = 0.0;
+//					//for (int dir1 = -1; dir1 <= 1; dir1++) {
+//					//	for (int dir2 = -1; dir2 <= 1; dir2++) {
+//					//		int yyy = x2 + dir1;
+//					//		int zzz = x3 + dir2;
+//					//		if (!bcArray->isSolid(x1-1, yyy, zzz) && !bcArray->isUndefined(x1-1, yyy, zzz)) {
+//					//			gradPx -= (*pressure)(x1 - 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) {
+//					//			gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//
+//					//		int xxx = x1 + dir1;
+//					//		if (!bcArray->isSolid(xxx, x2-1, zzz) && !bcArray->isUndefined(xxx, x2-1, zzz)) {
+//					//			gradPy -= (*pressure)(xxx, x2-1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) {
+//					//			gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//
+//					//		yyy = x2 + dir2;
+//					//		if (!bcArray->isSolid(xxx, yyy, x3-1) && !bcArray->isUndefined(xxx, yyy, x3-1)) {
+//					//			gradPz -= (*pressure)(xxx, yyy, x3-1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) {
+//					//			gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//					//		else {
+//					//			gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1 + c3 * abs(dir1)) * (c1 + c3 * abs(dir2)));
+//					//		}
+//
+//					//	}
+//					//}
+//
+//					//Viscosity increase by phase field residuum
+//					//LBMReal errPhi = (((1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale)- denom);
+//					//LBMReal limVis = 0.01;// 0.0000001 * 10;//0.01;
+//					// collFactorM =collFactorM/(c1+limVis*(errPhi*errPhi)*collFactorM);
+//					// collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM;
+//					//errPhi = errPhi * errPhi* errPhi * errPhi * errPhi * errPhi;
+//					//collFactorM = collFactorM + (1.8 - collFactorM) * errPhi / (errPhi + limVis);
+//
+//					//3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+//					//+WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+//					//+WEIGTH[N] * (phi2[T] - phi2[B]));
+//
+//					muRho = rho;
+//
+//					////external pressure
+//					//forcingX1 =/* muForcingX1.Eval()/rho */- gradPx/rho;
+//					//forcingX2 =/* muForcingX2.Eval()/rho */- gradPy/rho;
+//					//forcingX3 =/* muForcingX3.Eval()/rho */- gradPz/rho;
+//
+//					///////////////////////////////////////////////
+//
+//					//LBMReal pBefore = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//					//	+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+//					//pBefore = -c1o3 * (-1.0e-10)/((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) );
+//					////if (vvx * vvx + vvy * vvy + vvz * vvz > 1.0e-100) {
+//					//	mfabb -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[E] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbab -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[N] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbba -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[T] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfaab -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[NE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcab -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[NW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfaba -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcba -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbaa -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TN] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbca -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TS] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfaaa -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TNE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcaa -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TNW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfaca -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TSE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcca -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[TSW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcbb -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[W] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbcb -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[S] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbbc -= pBefore * c2o9 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[B] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfccb -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[SW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfacb -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[SE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcbc -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfabc -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbcc -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BS] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbac -= pBefore * c1o18 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BN] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfccc -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BSW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfacc -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BSE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfcac -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BNW] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfaac -= pBefore * c1o72 * ((rhoL + phi[REST] * (rhoH - rhoL) / (phiH - phiL)) / (rhoL + phi[BNE] * (rhoH - rhoL) / (phiH - phiL)));
+//					//	mfbbb -= pBefore * 8.0 / 9.0;
+//					//}
+//
+//					///////////////////////////////////////////////
+//
+//					LBMReal pStarStart = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+//
+//					/////////////////////
+//					//LBMReal vvxh = ((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
+//					//	(((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
+//					//	(mfhcbb - mfhabb)) / rhoRef;
+//					//LBMReal vvyh = ((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
+//					//	(((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
+//					//	(mfhbcb - mfhbab)) / rhoRef;
+//					//LBMReal vvzh = ((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
+//					//	(((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
+//					//	(mfhbbc - mfhbba)) / rhoRef;
+//
+//					//LBMReal deltaPP = 0*(vvxh * dX1_phi + vvyh * dX2_phi + vvzh * dX3_phi) * rhoToPhi / (rho);
+//					//mfhbcb += c1o6* c2o9  * deltaPP;
+//					//mfhbbc += c1o6* c2o9  * deltaPP;
+//					//mfhcbb += c1o6* c2o9  * deltaPP;
+//					//mfhccb += c1o6* c1o18 * deltaPP;
+//					//mfhacb += c1o6* c1o18 * deltaPP;
+//					//mfhcbc += c1o6* c1o18 * deltaPP;
+//					//mfhabc += c1o6* c1o18 * deltaPP;
+//					//mfhbcc += c1o6* c1o18 * deltaPP;
+//					//mfhbac += c1o6* c1o18 * deltaPP;
+//					//mfhccc += c1o6* c1o72 * deltaPP;
+//					//mfhacc += c1o6* c1o72 * deltaPP;
+//					//mfhcac += c1o6* c1o72 * deltaPP;
+//					//mfhaac += c1o6* c1o72 * deltaPP;
+//					//mfhabb += c1o6* c2o9  * deltaPP;
+//					//mfhbab += c1o6* c2o9  * deltaPP;
+//					//mfhbba += c1o6* c2o9  * deltaPP;
+//					//mfhaab += c1o6* c1o18 * deltaPP;
+//					//mfhcab += c1o6* c1o18 * deltaPP;
+//					//mfhaba += c1o6* c1o18 * deltaPP;
+//					//mfhcba += c1o6* c1o18 * deltaPP;
+//					//mfhbaa += c1o6* c1o18 * deltaPP;
+//					//mfhbca += c1o6* c1o18 * deltaPP;
+//					//mfhaaa += c1o6* c1o72 * deltaPP;
+//					//mfhcaa += c1o6* c1o72 * deltaPP;
+//					//mfhaca += c1o6* c1o72 * deltaPP;
+//					//mfhcca += c1o6* c1o72 * deltaPP;
+//					//mfhbbb += c1o6* c4 * c2o9 * deltaPP;
+//
+//					//////////////////////
+//
+//					/////Recovering the origin distributions
+//					//LBMReal mfStartcbb = mfcbb ;
+//					//LBMReal mfStartbcb = mfbcb ;
+//					//LBMReal mfStartbbc = mfbbc ;
+//					//LBMReal mfStartccb = mfccb ;
+//					//LBMReal mfStartacb = mfacb ;
+//					//LBMReal mfStartcbc = mfcbc ;
+//					//LBMReal mfStartabc = mfabc ;
+//					//LBMReal mfStartbcc = mfbcc ;
+//					//LBMReal mfStartbac = mfbac ;
+//					//LBMReal mfStartccc = mfccc ;
+//					//LBMReal mfStartacc = mfacc ;
+//					//LBMReal mfStartcac = mfcac ;
+//					//LBMReal mfStartaac = mfaac ;
+//					//LBMReal mfStartabb = mfabb ;
+//					//LBMReal mfStartbab = mfbab ;
+//					//LBMReal mfStartbba = mfbba ;
+//					//LBMReal mfStartaab = mfaab ;
+//					//LBMReal mfStartcab = mfcab ;
+//					//LBMReal mfStartaba = mfaba ;
+//					//LBMReal mfStartcba = mfcba ;
+//					//LBMReal mfStartbaa = mfbaa ;
+//					//LBMReal mfStartbca = mfbca ;
+//					//LBMReal mfStartaaa = mfaaa ;
+//					//LBMReal mfStartcaa = mfcaa ;
+//					//LBMReal mfStartaca = mfaca ;
+//					//LBMReal mfStartcca = mfcca ;
+//					//LBMReal mfStartbbb = mfbbb ;
+//
+//
+//						mfcbb += mfhcbb /rho;
+//						mfbcb += mfhbcb /rho;
+//						mfbbc += mfhbbc /rho;
+//						mfccb += mfhccb /rho;
+//						mfacb += mfhacb /rho;
+//						mfcbc += mfhcbc /rho;
+//						mfabc += mfhabc /rho;
+//						mfbcc += mfhbcc /rho;
+//						mfbac += mfhbac /rho;
+//						mfccc += mfhccc /rho;
+//						mfacc += mfhacc /rho;
+//						mfcac += mfhcac /rho;
+//						mfaac += mfhaac /rho;
+//						mfabb += mfhabb /rho;
+//						mfbab += mfhbab /rho;
+//						mfbba += mfhbba /rho;
+//						mfaab += mfhaab /rho;
+//						mfcab += mfhcab /rho;
+//						mfaba += mfhaba /rho;
+//						mfcba += mfhcba /rho;
+//						mfbaa += mfhbaa /rho;
+//						mfbca += mfhbca /rho;
+//						mfaaa += mfhaaa /rho;
+//						mfcaa += mfhcaa /rho;
+//						mfaca += mfhaca /rho;
+//						mfcca += mfhcca /rho;
+//						mfbbb += mfhbbb /rho;
+//
+//
+//
+//					//Abbas
+//					LBMReal pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+//					//22.09.22 not yet in balance, repaire here
+//					LBMReal ppStar = ((((((mfhaaa + mfhccc) + (mfhaac + mfhcca)) + ((mfhcac + mfhaca) + (mfhcaa + mfhacc)))*c3
+//						+ (((mfhaab + mfhccb) + (mfhacb + mfhcab)) + ((mfhaba + mfhcbc) + (mfhabc + mfhcba)) + ((mfhbaa + mfhbcc) + (mfhbac + mfhbca))))*c2
+//						+ ((mfhabb + mfhcbb) + (mfhbab + mfhbcb) + (mfhbba + mfhbbc))) ) * c1o3/rho;
+//	
+//					ppStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))) * c3
+//						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca)))) * c2
+//						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)))) * c1o3 ;
+//
+//					//(*phaseFieldOld)(x1, x2, x3) = ((*phaseFieldOld)(x1, x2, x3) > 99.0) ? phi[REST] : (*phaseFieldOld)(x1, x2, x3);
+//					//LBMReal dtPhi = phi[REST] - (*phaseFieldOld)(x1, x2, x3);
+//					//LBMReal deltaP = -pStar * (c1 - rho / (rho + c1o2 * rhoToPhi * dtPhi));// -pStar * pStar * pStar * 1.0e-4 * rho * rho * rho;
+//					//LBMReal deltaP = pStar * (c1 - mfhbbb*rho) * c1o2;//Explicit
+//					//LBMReal deltaP = pStar * (c1 - mfhbbb * rho) / (c1 + mfhbbb * rho);//Semi-Implicit
+//					//(*phaseFieldOld)(x1, x2, x3) = phi[REST];
+//
+//					//mfabb += c2o9 *deltaP;
+//					//mfbab += c2o9 *deltaP;
+//					//mfbba += c2o9 *deltaP;
+//					//mfaab += c1o18*deltaP;
+//					//mfcab += c1o18*deltaP;
+//					//mfaba += c1o18*deltaP;
+//					//mfcba += c1o18*deltaP;
+//					//mfbaa += c1o18*deltaP;
+//					//mfbca += c1o18*deltaP;
+//					//mfaaa += c1o72*deltaP;
+//					//mfcaa += c1o72*deltaP;
+//					//mfaca += c1o72*deltaP;
+//					//mfcca += c1o72*deltaP;
+//					//mfcbb += c2o9 *deltaP;
+//					//mfbcb += c2o9 *deltaP;
+//					//mfbbc += c2o9 *deltaP;
+//					//mfccb += c1o18*deltaP;
+//					//mfacb += c1o18*deltaP;
+//					//mfcbc += c1o18*deltaP;
+//					//mfabc += c1o18*deltaP;
+//					//mfbcc += c1o18*deltaP;
+//					//mfbac += c1o18*deltaP;
+//					//mfccc += c1o72*deltaP;
+//					//mfacc += c1o72*deltaP;
+//					//mfcac += c1o72*deltaP;
+//					//mfaac += c1o72*deltaP;
+//
+//					//pStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//					//	+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
+//
+//
+//
+//
+//					//mfabb -= c1o2 * c2o9 *pStar*(phi[REST]-phi[E  ])*rhoToPhi/rho;
+//					//mfbab -= c1o2 * c2o9 *pStar*(phi[REST]-phi[N  ])*rhoToPhi/rho;
+//					//mfbba -= c1o2 * c2o9 *pStar*(phi[REST]-phi[T  ])*rhoToPhi/rho;
+//					//mfaab -= c1o2 * c1o18*pStar*(phi[REST]-phi[NE ])*rhoToPhi/rho;
+//					//mfcab -= c1o2 * c1o18*pStar*(phi[REST]-phi[NW ])*rhoToPhi/rho;
+//					//mfaba -= c1o2 * c1o18*pStar*(phi[REST]-phi[TE ])*rhoToPhi/rho;
+//					//mfcba -= c1o2 * c1o18*pStar*(phi[REST]-phi[TW ])*rhoToPhi/rho;
+//					//mfbaa -= c1o2 * c1o18*pStar*(phi[REST]-phi[TN ])*rhoToPhi/rho;
+//					//mfbca -= c1o2 * c1o18*pStar*(phi[REST]-phi[TS ])*rhoToPhi/rho;
+//					//mfaaa -= c1o2 * c1o72*pStar*(phi[REST]-phi[TNE])*rhoToPhi/rho;
+//					//mfcaa -= c1o2 * c1o72*pStar*(phi[REST]-phi[TNW])*rhoToPhi/rho;
+//					//mfaca -= c1o2 * c1o72*pStar*(phi[REST]-phi[TSE])*rhoToPhi/rho;
+//					//mfcca -= c1o2 * c1o72*pStar*(phi[REST]-phi[TSW])*rhoToPhi/rho;
+//					//mfcbb -= c1o2 * c2o9 *pStar*(phi[REST]-phi[W  ])*rhoToPhi/rho;
+//					//mfbcb -= c1o2 * c2o9 *pStar*(phi[REST]-phi[S  ])*rhoToPhi/rho;
+//					//mfbbc -= c1o2 * c2o9 *pStar*(phi[REST]-phi[B  ])*rhoToPhi/rho;
+//					//mfccb -= c1o2 * c1o18*pStar*(phi[REST]-phi[SW ])*rhoToPhi/rho;
+//					//mfacb -= c1o2 * c1o18*pStar*(phi[REST]-phi[SE ])*rhoToPhi/rho;
+//					//mfcbc -= c1o2 * c1o18*pStar*(phi[REST]-phi[BW ])*rhoToPhi/rho;
+//					//mfabc -= c1o2 * c1o18*pStar*(phi[REST]-phi[BE ])*rhoToPhi/rho;
+//					//mfbcc -= c1o2 * c1o18*pStar*(phi[REST]-phi[BS ])*rhoToPhi/rho;
+//					//mfbac -= c1o2 * c1o18*pStar*(phi[REST]-phi[BN ])*rhoToPhi/rho;
+//					//mfccc -= c1o2 * c1o72*pStar*(phi[REST]-phi[BSW])*rhoToPhi/rho;
+//					//mfacc -= c1o2 * c1o72*pStar*(phi[REST]-phi[BSE])*rhoToPhi/rho;
+//					//mfcac -= c1o2 * c1o72*pStar*(phi[REST]-phi[BNW])*rhoToPhi/rho;
+//					//mfaac -= c1o2 * c1o72*pStar*(phi[REST]-phi[BNE])*rhoToPhi/rho;
+//
+//
+//					//forcingX1 =/* muForcingX1.Eval() / rho*/ - pStar * dX1_phi * rhoToPhi / rho;
+//					//forcingX2 =/* muForcingX2.Eval() / rho*/ - pStar * dX2_phi * rhoToPhi / rho;
+//					//forcingX3 =/* muForcingX3.Eval() / rho*/ - pStar * dX3_phi * rhoToPhi / rho;
+//
+//
+//					//mfabb += (-forcingX1) * c2o9;
+//					//mfbab += (-forcingX2) * c2o9;
+//					//mfbba += (-forcingX3) * c2o9;
+//					//mfaab += (-forcingX1 - forcingX2) * c1o16;
+//					//mfcab += (forcingX1 - forcingX2) * c1o16;
+//					//mfaba += (-forcingX1 - forcingX3) * c1o16;
+//					//mfcba += (forcingX1 - forcingX3) * c1o16;
+//					//mfbaa += (-forcingX2 - forcingX3) * c1o16;
+//					//mfbca += (forcingX2 - forcingX3) * c1o16;
+//					//mfaaa += (-forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfcaa += (forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfaca += (-forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcca += (forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcbb += (forcingX1)*c2o9;
+//					//mfbcb += (forcingX2)*c2o9;
+//					//mfbbc += (forcingX3)*c2o9;
+//					//mfccb += (forcingX1 + forcingX2) * c1o16;
+//					//mfacb += (-forcingX1 + forcingX2) * c1o16;
+//					//mfcbc += (forcingX1 + forcingX3) * c1o16;
+//					//mfabc += (-forcingX1 + forcingX3) * c1o16;
+//					//mfbcc += (forcingX2 + forcingX3) * c1o16;
+//					//mfbac += (-forcingX2 + forcingX3) * c1o16;
+//					//mfccc += (forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfacc += (-forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfcac += (forcingX1 - forcingX2 + forcingX3) * c1o72;
+//					//mfaac += (-forcingX1 - forcingX2 + forcingX3) * c1o72;
+//
+//					LBMReal saveForceX1 = forcingX1;
+//					LBMReal saveForceX2 = forcingX2;
+//					LBMReal saveForceX3 = forcingX3;
+//
+//					 vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//						(mfcbb - mfabb)) / rhoRef;
+//					 vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//						(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//						(mfbcb - mfbab)) / rhoRef;
+//					 vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//						(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//						(mfbbc - mfbba)) / rhoRef;
+//
+//
+//					 LBMReal dRhoInvX = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
+//						 (((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
+//						 (mfhcbb - mfhabb)));
+//					 LBMReal dRhoInvY = -(((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
+//						 (((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
+//						 (mfhbcb - mfhbab)));
+//					 LBMReal dRhoInvZ = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
+//						 (((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
+//						 (mfhbbc - mfhbba)));
+//
+//
+//					 forcingX1 = 0.0;
+//					 forcingX2 = 0.0;
+//					 forcingX3 = 0.0;
+//					//!Abbas
+//					//LBMReal dX1_rhoInv = gradX1_rhoInv(rhoL, rhoH - rhoL);
+//					//LBMReal dX2_rhoInv = gradX2_rhoInv(rhoL, rhoH - rhoL);
+//					//LBMReal dX3_rhoInv = gradX3_rhoInv(rhoL, rhoH - rhoL);
+//					//forcingX1 =/* muForcingX1.Eval() / rho*/ +pStar * dX1_rhoInv * rho;
+//					//forcingX2 =/* muForcingX2.Eval() / rho*/ +pStar * dX2_rhoInv * rho;
+//					//forcingX3 =/* muForcingX3.Eval() / rho*/ +pStar * dX3_rhoInv * rho;
+//
+//					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho + pStar * dX1_rhoInv * rho) *c1o2;
+//					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho + pStar * dX2_rhoInv * rho) *c1o2;
+//					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho + pStar * dX3_rhoInv * rho) *c1o2;
+//					 LBMReal FdX1_phi = normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//					 LBMReal FdX2_phi = normX2 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//					 LBMReal FdX3_phi = normX3 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//
+//
+//					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho ) ;
+//					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho ) ;
+//					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho ) ;
+//
+//					//forcingX1 = (pStar * dRhoInvX* rho *c3) ;
+//					//forcingX2 = (pStar * dRhoInvY* rho *c3) ;
+//					//forcingX3 = (pStar * dRhoInvZ* rho *c3) ;
+//					//if (phi[REST] > 0.1 && phi[REST] < 0.9) std::cout << phi[REST] << " " << dX1_phi * rhoToPhi / rho << " " << dRhoInvX * rho *3<< std::endl;
+//					//LBMReal forcingX1ALTERNAT = ( pStar * dX1_rhoInv * rho) ;
+//					//LBMReal forcingX2ALTERNAT = ( pStar * dX2_rhoInv * rho) ;
+//					//LBMReal forcingX3ALTERNAT = ( pStar * dX3_rhoInv * rho) ;
+//
+//					//forcingX1 = (fabs(vvx + c1o2 * forcingX1) < fabs(vvx + c1o2 * forcingX1ALTERNAT)) ? forcingX1 : forcingX1ALTERNAT;
+//					//forcingX2 = (fabs(vvy + c1o2 * forcingX2) < fabs(vvy + c1o2 * forcingX2ALTERNAT)) ? forcingX2 : forcingX2ALTERNAT;
+//					//forcingX3 = (fabs(vvz + c1o2 * forcingX3) < fabs(vvz + c1o2 * forcingX3ALTERNAT)) ? forcingX3 : forcingX3ALTERNAT;
+//
+//					//	 forcingX1 = -pStar * rhoToPhi / rho * normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//					//	 forcingX2 = -pStar * rhoToPhi / rho * normX2 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//					//	 forcingX3 = -pStar * rhoToPhi / rho * normX3 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale;
+//
+//					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho *(c1- phi[REST]) + pStar * dX1_rhoInv * rho*(phi[REST]));
+//					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho *(c1- phi[REST]) + pStar * dX2_rhoInv * rho*(phi[REST]));
+//					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho *(c1- phi[REST]) + pStar * dX3_rhoInv * rho*(phi[REST]));
+//						 //if (phi[REST] > 0.3 && phi[REST] < 0.7)
+//						 //{
+//							// int test = 1;
+//							// std::cout << phi[REST] <<" "<< dX1_phi <<" "<< normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale<<" "<< normX1 * (1.0 - phi[REST]) * (phi[REST]) * oneOverInterfaceScale/ dX1_phi<< std::endl;
+//						 //}
+//
+//
+//
+//					 //LBMReal scaleGrad = c2 * phi[REST] * (1.0 - phi[REST]) / ((phi[REST] * phi[REST] + (1.0 - phi[REST]) * (1.0 - phi[REST])) * (phi[REST] * phi[REST] + (1.0 - phi[REST]) * (1.0 - phi[REST])));
+//					 //dX1_phi *= scaleGrad;
+//					 //dX2_phi *= scaleGrad;
+//					 //dX3_phi *= scaleGrad;
+//
+//					 ///Experimental interface sharpening force 20.06.2022
+//
+//					 LBMReal scaleSharpener = 1.0;
+//					 //forcingX1 += scaleSharpener * (FdX1_phi - dX1_phi) * fabsf(FdX1_phi - dX1_phi)  / rho;
+//					 //forcingX2 += scaleSharpener * (FdX2_phi - dX2_phi) * fabsf(FdX2_phi - dX2_phi)  / rho;
+//					 //forcingX3 += scaleSharpener * (FdX3_phi - dX3_phi) * fabsf(FdX3_phi - dX3_phi)  / rho;
+//					///surface tension force
+//					forcingX1 += mu * dX1_phi/rho;
+//					forcingX2 += mu * dX2_phi/rho;
+//					forcingX3 += mu * dX3_phi/rho;
+//
+//					LBMReal forcingBIAS = 0.5;
+//					forcingX1 += muForcingX1.Eval() / rho;//*phi[REST];
+//					forcingX2 += muForcingX2.Eval() / rho;// * phi[REST];
+//					forcingX3 += muForcingX3.Eval() / rho;// * phi[REST];
+//
+//				//	//19.08.2022
+//					//vvx += vvxh / rho * c1o2;
+//					//vvy += vvyh / rho * c1o2;
+//					//vvz += vvzh / rho * c1o2;
+//				//	//
+//
+//
+//					vvx += (forcingX1) * deltaT * c1o2;
+//					vvy += (forcingX2) * deltaT * c1o2;
+//					vvz += (forcingX3) * deltaT * c1o2;
+//
+//					//vvx += (forcingX1 + muForcingX1.Eval() / rho) * deltaT *  c1o2; // X
+//					//vvy += (forcingX2 + muForcingX2.Eval() / rho) * deltaT *  c1o2; // Y
+//					//vvz += (forcingX3 + muForcingX3.Eval() / rho) * deltaT *  c1o2; // Z
+//
+//
+//
+//				//	vvx += (forcingX1 + muForcingX1.Eval() / rho) * deltaT * forcingBIAS; // X
+//				//	vvy += (forcingX2 + muForcingX2.Eval() / rho) * deltaT * forcingBIAS; // Y
+//				//	vvz += (forcingX3 + muForcingX3.Eval() / rho) * deltaT * forcingBIAS; // Z
+//
+//
+//
+//					//Abbas
+//					LBMReal M200 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) ))
+//						+ ((mfabb + mfcbb))) );
+//					LBMReal M020 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//						+ (((mfaab + mfccb) + (mfacb + mfcab))  + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//						+ ( (mfbab + mfbcb) )) );
+//					LBMReal M002 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+//						+ ( + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+//						+ ( (mfbba + mfbbc))));
+//
+//					LBMReal M110 = ((((((mfaaa + mfccc) + (-mfcac - mfaca)) + ((mfaac + mfcca) + (-mfcaa -mfacc)))
+//						+ (((mfaab + mfccb) + (-mfacb - mfcab))   ))
+//						) );
+//					LBMReal M101 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcac + mfaca) - (mfcaa + mfacc)))
+//						+ (((mfaba + mfcbc) + (-mfabc - mfcba))))
+//						));
+//					LBMReal M011 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ( (mfcaa + mfacc)- (mfcac + mfaca)))
+//						+ (((mfbaa + mfbcc) + (-mfbac - mfbca))))
+//						));
+//					LBMReal vvxI = vvx;
+//					LBMReal vvyI = vvy;
+//					LBMReal vvzI = vvz;
+//
+//					LBMReal collFactorStore=collFactorM;
+//					LBMReal stress;
+//					//for(int iter=0;iter<5;iter++)
+//				 //{
+//					//	LBMReal OxxPyyPzz = 1.0;
+//					//	LBMReal mxxPyyPzz = (M200-vvxI*vvxI) + (M020-vvyI*vvyI) + (M002-vvzI*vvzI);
+//					//	//pStar = mxxPyyPzz * c1o3;
+//					//mxxPyyPzz -= c3 *pStar;
+//
+//					//LBMReal mxxMyy = (M200-vvxI*vvxI) - (M020-vvyI*vvyI);
+//					//LBMReal mxxMzz = (M200-vvxI*vvxI) - (M002-vvzI*vvzI);
+//					//LBMReal mxy = M110 - vvxI * vvyI;
+//					//LBMReal mxz = M101 - vvxI * vvzI;
+//					//LBMReal myz = M011 - vvyI * vvzI;
+//
+//
+//					//mxxMyy *= c1 - collFactorM * c1o2;
+//					//mxxMzz *= c1 - collFactorM * c1o2;
+//					//mxy *= c1 - collFactorM * c1o2;
+//					//mxz *= c1 - collFactorM * c1o2;
+//					//myz *= c1 - collFactorM * c1o2;
+//					//mxxPyyPzz *= c1 - OxxPyyPzz * c1o2;
+//					////mxxPyyPzz = mxxPyyPzz*fabs(mxxPyyPzz)/(1.0e-6+fabs(mxxPyyPzz));
+//					////mxxPyyPzz += c3 * pStar;
+//					//LBMReal mxx = (mxxMyy + mxxMzz + mxxPyyPzz)*c1o3;
+//					//LBMReal myy = (-c2*mxxMyy + mxxMzz + mxxPyyPzz)*c1o3;
+//					//LBMReal mzz = (mxxMyy -c2* mxxMzz + mxxPyyPzz) * c1o3;
+//					//vvxI = vvx - (mxx * dX1_phi + mxy * dX2_phi + mxz * dX3_phi) * rhoToPhi / (rho);
+//					//vvyI = vvy - (mxy * dX1_phi + myy * dX2_phi + myz * dX3_phi) * rhoToPhi / (rho);
+//					//vvzI = vvz - (mxz * dX1_phi + myz * dX2_phi + mzz * dX3_phi) * rhoToPhi / (rho);
+//
+//
+//				////	vvzI = vvz + (mxz * dRhoInvX + myz * dRhoInvY + mzz * dRhoInvZ) *  (rho)*c3;
+//				////	vvxI = vvx + (mxx * dRhoInvX + mxy * dRhoInvY + mxz * dRhoInvZ) *  (rho)*c3;
+//				////	vvyI = vvy + (mxy * dRhoInvX + myy * dRhoInvY + myz * dRhoInvZ) *  (rho)*c3;
+//
+//
+//				//	//LBMReal dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);
+//				//	//
+//				//	//LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy;
+//				//	//LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz;
+//				//	//LBMReal Dxy = -three * collFactorM * mxy;
+//				//	//LBMReal Dxz = -three * collFactorM * mxz;
+//				//	//LBMReal Dyz = -three * collFactorM * myz;
+//				//	////LBMReal stress = sqrt(sqrt((dyuy+dxux+dzuz)* (dyuy + dxux + dzuz))) * sqrt(forcingX1 * forcingX1 + forcingX2 * forcingX2 + forcingX3 * forcingX3);
+//				//	// stress = sqrt(dyuy * dyuy + dxux * dxux + dzuz*dzuz + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz)*sqrt(forcingX1*forcingX1+forcingX2*forcingX2+forcingX3*forcingX3);
+//				//	////collFactorM = collFactorStore + (1.75 - collFactorStore) * stress / (stress + 1.0e-8);
+//				//	//
+//				//	//LBMReal dX2_rho = (rhoToPhi)*dX2_phi;
+//				//	//LBMReal dX1_rho = (rhoToPhi)*dX1_phi;
+//				//	//LBMReal dX3_rho = (rhoToPhi)*dX3_phi;
+//				//	////vvxI= vvx+ c1o6 * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+//				//	////vvyI= vvy+ c1o6 * (c1 / collFactorM - c1o2) * (Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+//				//	////vvzI= vvz+ c1o6 * (c1 / collFactorM - c1o2) * (Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+//
+//				//	//vvxI = vvx + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+//				//	//vvyI = vvy + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+//				//	//vvzI = vvz + c1o3*forcingBIAS * (c1 / collFactorM - c1o2) * (Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+//
+//				//	////vvxI = vvx - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (2 * dxux * dX1_rhoInv + Dxy * dX2_rhoInv + Dxz * dX3_rhoInv);
+//				//	////vvyI = vvy - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (Dxy * dX1_rhoInv + 2 * dyuy * dX2_rhoInv + Dyz * dX3_rhoInv);
+//				//	////vvzI = vvz - c1o3 * forcingBIAS * (c1 / collFactorM - c1o2) * (Dxz * dX1_rhoInv + Dyz * dX2_rhoInv + 2 * dyuy * dX3_rhoInv);
+//
+//
+//					//}
+//				//	//forcingX1+=(vvxI-vvx)/(deltaT* forcingBIAS) + muForcingX1.Eval() / rho;
+//				//	//forcingX2 += (vvyI - vvy) / (deltaT * forcingBIAS) + muForcingX2.Eval() / rho;
+//				//	//forcingX3 += (vvzI - vvz) / (deltaT * forcingBIAS) + muForcingX3.Eval() / rho;
+//
+//
+//				////	forcingX1 += c2 * (vvxI - vvx);
+//				////	forcingX2 += c2 * (vvyI - vvy);
+//				////	forcingX3 += c2 * (vvzI - vvz);
+//
+//
+//					//mfabb += c1o2*(-forcingX1) * c2o9;
+//					//mfbab += c1o2*(-forcingX2) * c2o9;
+//					//mfbba += c1o2*(-forcingX3) * c2o9;
+//					//mfaab += c1o2*(-forcingX1 - forcingX2) * c1o18;
+//					//mfcab += c1o2*( forcingX1 - forcingX2) * c1o18;
+//					//mfaba += c1o2*(-forcingX1 - forcingX3) * c1o18;
+//					//mfcba += c1o2*( forcingX1 - forcingX3) * c1o18;
+//					//mfbaa += c1o2*(-forcingX2 - forcingX3) * c1o18;
+//					//mfbca += c1o2*( forcingX2 - forcingX3) * c1o18;
+//					//mfaaa += c1o2*(-forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfcaa += c1o2*(forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfaca += c1o2*(-forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcca += c1o2*(forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcbb += c1o2*(forcingX1)*c2o9;
+//					//mfbcb += c1o2*(forcingX2)*c2o9;
+//					//mfbbc += c1o2*(forcingX3)*c2o9;
+//					//mfccb += c1o2*( forcingX1 + forcingX2) * c1o18;
+//					//mfacb += c1o2*(-forcingX1 + forcingX2) * c1o18;
+//					//mfcbc += c1o2*( forcingX1 + forcingX3) * c1o18;
+//					//mfabc += c1o2*(-forcingX1 + forcingX3) * c1o18;
+//					//mfbcc += c1o2*( forcingX2 + forcingX3) * c1o18;
+//					//mfbac += c1o2*(-forcingX2 + forcingX3) * c1o18;
+//					//mfccc += c1o2*(forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfacc += c1o2*(-forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfcac += c1o2*(forcingX1 - forcingX2 + forcingX3) * c1o72;
+//					//mfaac += c1o2*(-forcingX1 - forcingX2 + forcingX3) * c1o72;
+//
+//
+//					//forcingX1 = saveForceX1;
+//					//forcingX2 = saveForceX2;
+//					//forcingX3 = saveForceX3;
+//					vvx = vvxI;
+//					vvy = vvyI;
+//					vvz = vvzI;
+//
+//
+//
+//					//!Abbas
+//
+//					LBMReal vx2;
+//					LBMReal vy2;
+//					LBMReal vz2;
+//					vx2 = vvx * vvx;
+//					vy2 = vvy * vvy;
+//					vz2 = vvz * vvz;
+//					//pStar =ppStar- (vx2 + vy2 + vz2)*pStar;
+//				//	pStar = (pStar + ppStar)*c1o2;
+//					///////////////////////////////////////////////////////////////////////////////////////////               
+//					LBMReal oMdrho;
+//					///////////////
+//						//mfabb -= pStar * c2o9;
+//						//mfbab -= pStar * c2o9;
+//						//mfbba -= pStar * c2o9;
+//						//mfaab -= pStar * c1o16;
+//						//mfcab -= pStar * c1o16;
+//						//mfaba -= pStar * c1o16;
+//						//mfcba -= pStar * c1o16;
+//						//mfbaa -= pStar * c1o16;
+//						//mfbca -= pStar * c1o16;
+//						//mfaaa -= pStar * c1o72;
+//						//mfcaa -= pStar * c1o72;
+//						//mfaca -= pStar * c1o72;
+//						//mfcca -= pStar * c1o72;
+//						//mfcbb -= pStar * c2o9;
+//						//mfbcb -= pStar * c2o9;
+//						//mfbbc -= pStar * c2o9;
+//						//mfccb -= pStar * c1o16;
+//						//mfacb -= pStar * c1o16;
+//						//mfcbc -= pStar * c1o16;
+//						//mfabc -= pStar * c1o16;
+//						//mfbcc -= pStar * c1o16;
+//						//mfbac -= pStar * c1o16;
+//						//mfccc -= pStar * c1o72;
+//						//mfacc -= pStar * c1o72;
+//						//mfcac -= pStar * c1o72;
+//						//mfaac -= pStar * c1o72;
+//						//mfbbb -= pStar * 8.0/9.0;
+//					///////////////////
+//
+//					oMdrho = mfccc + mfaaa;
+//					m0 = mfaca + mfcac;
+//					m1 = mfacc + mfcaa;
+//					m2 = mfaac + mfcca;
+//					oMdrho += m0;
+//					m1 += m2;
+//					oMdrho += m1;
+//					m0 = mfbac + mfbca;
+//					m1 = mfbaa + mfbcc;
+//					m0 += m1;
+//					m1 = mfabc + mfcba;
+//					m2 = mfaba + mfcbc;
+//					m1 += m2;
+//					m0 += m1;
+//					m1 = mfacb + mfcab;
+//					m2 = mfaab + mfccb;
+//					m1 += m2;
+//					m0 += m1;
+//					oMdrho += m0;
+//					m0 = mfabb + mfcbb;
+//					m1 = mfbab + mfbcb;
+//					m2 = mfbba + mfbbc;
+//					m0 += m1 + m2;
+//					m0 += mfbbb; //hat gefehlt
+//					oMdrho = (rhoRef - (oMdrho + m0))/rhoRef;// 12.03.21 check derivation!!!!
+//
+//															 ////////////////////////////////////////////////////////////////////////////////////
+//					LBMReal wadjust;
+//					LBMReal qudricLimit = 0.01 / (c1 + 1.0e4 * phi[REST] * (c1 - phi[REST])); //LBMReal qudricLimit = 0.01;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//Hin
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36  Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// Z - Dir
+//					m2 = mfaaa + mfaac;
+//					m1 = mfaac - mfaaa;
+//					m0 = m2 + mfaab;
+//					mfaaa = m0;
+//					m0 += c1o36 * oMdrho;
+//					mfaab = m1 - m0 * vvz;
+//					mfaac = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaba + mfabc;
+//					m1 = mfabc - mfaba;
+//					m0 = m2 + mfabb;
+//					mfaba = m0;
+//					m0 += c1o9 * oMdrho;
+//					mfabb = m1 - m0 * vvz;
+//					mfabc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaca + mfacc;
+//					m1 = mfacc - mfaca;
+//					m0 = m2 + mfacb;
+//					mfaca = m0;
+//					m0 += c1o36 * oMdrho;
+//					mfacb = m1 - m0 * vvz;
+//					mfacc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbaa + mfbac;
+//					m1 = mfbac - mfbaa;
+//					m0 = m2 + mfbab;
+//					mfbaa = m0;
+//					m0 += c1o9 * oMdrho;
+//					mfbab = m1 - m0 * vvz;
+//					mfbac = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbba + mfbbc;
+//					m1 = mfbbc - mfbba;
+//					m0 = m2 + mfbbb;
+//					mfbba = m0;
+//					m0 += c4o9 * oMdrho;
+//					mfbbb = m1 - m0 * vvz;
+//					mfbbc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbca + mfbcc;
+//					m1 = mfbcc - mfbca;
+//					m0 = m2 + mfbcb;
+//					mfbca = m0;
+//					m0 += c1o9 * oMdrho;
+//					mfbcb = m1 - m0 * vvz;
+//					mfbcc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcaa + mfcac;
+//					m1 = mfcac - mfcaa;
+//					m0 = m2 + mfcab;
+//					mfcaa = m0;
+//					m0 += c1o36 * oMdrho;
+//					mfcab = m1 - m0 * vvz;
+//					mfcac = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcba + mfcbc;
+//					m1 = mfcbc - mfcba;
+//					m0 = m2 + mfcbb;
+//					mfcba = m0;
+//					m0 += c1o9 * oMdrho;
+//					mfcbb = m1 - m0 * vvz;
+//					mfcbc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcca + mfccc;
+//					m1 = mfccc - mfcca;
+//					m0 = m2 + mfccb;
+//					mfcca = m0;
+//					m0 += c1o36 * oMdrho;
+//					mfccb = m1 - m0 * vvz;
+//					mfccc = m2 - 2. * m1 * vvz + vz2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// mit  1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// Y - Dir
+//					m2 = mfaaa + mfaca;
+//					m1 = mfaca - mfaaa;
+//					m0 = m2 + mfaba;
+//					mfaaa = m0;
+//					m0 += c1o6 * oMdrho;
+//					mfaba = m1 - m0 * vvy;
+//					mfaca = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaab + mfacb;
+//					m1 = mfacb - mfaab;
+//					m0 = m2 + mfabb;
+//					mfaab = m0;
+//					mfabb = m1 - m0 * vvy;
+//					mfacb = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaac + mfacc;
+//					m1 = mfacc - mfaac;
+//					m0 = m2 + mfabc;
+//					mfaac = m0;
+//					m0 += c1o18 * oMdrho;
+//					mfabc = m1 - m0 * vvy;
+//					mfacc = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbaa + mfbca;
+//					m1 = mfbca - mfbaa;
+//					m0 = m2 + mfbba;
+//					mfbaa = m0;
+//					m0 += c2o3 * oMdrho;
+//					mfbba = m1 - m0 * vvy;
+//					mfbca = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbab + mfbcb;
+//					m1 = mfbcb - mfbab;
+//					m0 = m2 + mfbbb;
+//					mfbab = m0;
+//					mfbbb = m1 - m0 * vvy;
+//					mfbcb = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfbac + mfbcc;
+//					m1 = mfbcc - mfbac;
+//					m0 = m2 + mfbbc;
+//					mfbac = m0;
+//					m0 += c2o9 * oMdrho;
+//					mfbbc = m1 - m0 * vvy;
+//					mfbcc = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcaa + mfcca;
+//					m1 = mfcca - mfcaa;
+//					m0 = m2 + mfcba;
+//					mfcaa = m0;
+//					m0 += c1o6 * oMdrho;
+//					mfcba = m1 - m0 * vvy;
+//					mfcca = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcab + mfccb;
+//					m1 = mfccb - mfcab;
+//					m0 = m2 + mfcbb;
+//					mfcab = m0;
+//					mfcbb = m1 - m0 * vvy;
+//					mfccb = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfcac + mfccc;
+//					m1 = mfccc - mfcac;
+//					m0 = m2 + mfcbc;
+//					mfcac = m0;
+//					m0 += c1o18 * oMdrho;
+//					mfcbc = m1 - m0 * vvy;
+//					mfccc = m2 - 2. * m1 * vvy + vy2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// mit     1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9            Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// X - Dir
+//					m2 = mfaaa + mfcaa;
+//					m1 = mfcaa - mfaaa;
+//					m0 = m2 + mfbaa;
+//					mfaaa = m0;
+//					m0 += 1. * oMdrho;
+//					mfbaa = m1 - m0 * vvx;
+//					mfcaa = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaba + mfcba;
+//					m1 = mfcba - mfaba;
+//					m0 = m2 + mfbba;
+//					mfaba = m0;
+//					mfbba = m1 - m0 * vvx;
+//					mfcba = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaca + mfcca;
+//					m1 = mfcca - mfaca;
+//					m0 = m2 + mfbca;
+//					mfaca = m0;
+//					m0 += c1o3 * oMdrho;
+//					mfbca = m1 - m0 * vvx;
+//					mfcca = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaab + mfcab;
+//					m1 = mfcab - mfaab;
+//					m0 = m2 + mfbab;
+//					mfaab = m0;
+//					mfbab = m1 - m0 * vvx;
+//					mfcab = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfabb + mfcbb;
+//					m1 = mfcbb - mfabb;
+//					m0 = m2 + mfbbb;
+//					mfabb = m0;
+//					mfbbb = m1 - m0 * vvx;
+//					mfcbb = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfacb + mfccb;
+//					m1 = mfccb - mfacb;
+//					m0 = m2 + mfbcb;
+//					mfacb = m0;
+//					mfbcb = m1 - m0 * vvx;
+//					mfccb = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfaac + mfcac;
+//					m1 = mfcac - mfaac;
+//					m0 = m2 + mfbac;
+//					mfaac = m0;
+//					m0 += c1o3 * oMdrho;
+//					mfbac = m1 - m0 * vvx;
+//					mfcac = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfabc + mfcbc;
+//					m1 = mfcbc - mfabc;
+//					m0 = m2 + mfbbc;
+//					mfabc = m0;
+//					mfbbc = m1 - m0 * vvx;
+//					mfcbc = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m2 = mfacc + mfccc;
+//					m1 = mfccc - mfacc;
+//					m0 = m2 + mfbcc;
+//					mfacc = m0;
+//					m0 += c1o9 * oMdrho;
+//					mfbcc = m1 - m0 * vvx;
+//					mfccc = m2 - 2. * m1 * vvx + vx2 * m0;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// Cumulants
+//					////////////////////////////////////////////////////////////////////////////////////
+//
+//					// mfaaa = 0.0;
+//					LBMReal OxxPyyPzz = 1.0; //omega2 or bulk viscosity
+//											//  LBMReal OxyyPxzz = 1.;//-s9;//2+s9;//
+//											//  LBMReal OxyyMxzz  = 1.;//2+s9;//
+//					LBMReal O4 = 1.;
+//					LBMReal O5 = 1.;
+//					LBMReal O6 = 1.;
+//
+//					//collFactorM+= (1.7 - collFactorM) * fabs(mfaaa) / (fabs(mfaaa) + 0.001f);
+//
+//
+//					/////fourth order parameters; here only for test. Move out of loop!
+//
+//					LBMReal OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0)));
+//					LBMReal OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM);
+//				    LBMReal Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0));
+//					LBMReal A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+//					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
+//					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
+//					//LBMReal stress = 1.0;// stress / (stress + 1.0e-10);
+//					stress = 1.0;
+//					//OxyyPxzz += stress*(1.0-OxyyPxzz);
+//					//OxyyPxzz = c3 * (collFactorM - c2) / (collFactorM - c3);
+//					//OxyyMxzz += stress*(1.0-OxyyMxzz);
+//					//Oxyz +=  stress*(1.0-Oxyz);
+//					//A *= 1.0-stress;
+//					//BB *= 1.0-stress;
+//
+//					//Cum 4.
+//					//LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+//					//LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+//					//LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+//
+//					LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//					LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//					LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//					LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+//					LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+//					LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho);
+//
+//					//Cum 5.
+//					LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho;
+//					LBMReal CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho;
+//					LBMReal CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//					//Cum 6.
+//					LBMReal CUMccc = mfccc + ((-4. * mfbbb * mfbbb
+//						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+//						- 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+//						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+//						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+//							+ 2. * (mfcaa * mfaca * mfaac)
+//							+ 16. * mfbba * mfbab * mfabb)
+//						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+//						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+//						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+//							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + c1o27 * oMdrho;
+//
+//					//2.
+//					// linear combinations
+//					LBMReal mxxPyyPzz = mfcaa + mfaca + mfaac;
+//					//pStar = (mxxPyyPzz+vx2+vy2+vz2) * c1o3;//does not work
+//					//pStar = (mxxPyyPzz) * c1o3;
+//					//pStar = pStar + 1.5 * (mxxPyyPzz * c1o3 - pStar);
+//					//mfaaa = mxxPyyPzz;
+//					//  LBMReal mfaaaS = (mfaaa * (-4 - 3 * OxxPyyPzz * (-1 + rho)) + 6 * mxxPyyPzz * OxxPyyPzz * (-1 + rho)) / (-4 + 3 * OxxPyyPzz * (-1 + rho));
+//					mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa
+//										//mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa
+//					LBMReal mxxMyy = mfcaa - mfaca;
+//					LBMReal mxxMzz = mfcaa - mfaac;
+//
+//					///
+//					LBMReal mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+//					LBMReal mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+//					LBMReal mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+//					LBMReal mmfabb = mfabb;
+//					LBMReal mmfbab = mfbab;
+//					LBMReal mmfbba = mfbba;
+//					///
+//
+//					LBMReal dxux =  -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz)*0;
+//					//LBMReal dxux = -c1o2 * (mxxMyy + mxxMzz) * collFactorM - mfaaa * c1o3* omegaDRho;
+//					LBMReal dyuy =  dxux + collFactorM * c3o2 * mxxMyy;
+//					LBMReal dzuz =  dxux + collFactorM * c3o2 * mxxMzz;
+//					LBMReal Dxy = -three * collFactorM * mfbba;
+//					LBMReal Dxz = -three * collFactorM * mfbab;
+//					LBMReal Dyz = -three * collFactorM * mfabb;
+////					// attempt to improve implicit  stress computation by fixed iteration
+////					LBMReal dX2_rho = (rhoToPhi)*dX2_phi;
+////					LBMReal dX1_rho = (rhoToPhi)*dX1_phi;
+////					LBMReal dX3_rho = (rhoToPhi)*dX3_phi;
+////
+////						LBMReal dfx= c1o3 * (c1 / collFactorM - c1o2) *(2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+////						LBMReal dfy = c1o3 * (c1 / collFactorM - c1o2) *(Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+////						LBMReal dfz = c1o3 * (c1 / collFactorM - c1o2) *(Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+////
+////						for (int iteration = 0; iteration < 5; iteration++) {
+////							mxxMyy = (mfcaa - dfx * dfx * c1o2) - (mfaca - dfy * dfy * c1o2);
+////							mxxMzz = (mfcaa - dfx * dfx * c1o2) - (mfaac - dfz * dfz * c1o2);
+////						}
+///////end fixed iteration
+////
+//
+//
+//					//relax
+//					mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+//					mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy);
+//					mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz);
+//
+//					mfabb += collFactorM * (-mfabb);
+//					mfbab += collFactorM * (-mfbab);
+//					mfbba += collFactorM * (-mfbba);
+//
+//					//if (fabsf(mfaaa + (dxux + dyuy + dzuz) > 1e-9)){
+//					//	std::cout << mfaaa <<" "<< (dxux + dyuy + dzuz)<< std::endl;
+//					//}
+//
+//
+//					////updated pressure
+//					//mfaaa += (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling;
+//					//mfaaa *= (one-omegaDRho);// (mfaaa + (dxux + dyuy + dzuz)) * .5; // Pressure elimination as in standard velocity model
+//								 //  mfaaa += (rho - c1) * (dxux + dyuy + dzuz);
+//				
+//					mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa
+//
+//										// mxxPyyPzz += (mfaaa + mfaaaS) * c1o2;
+//										//mfaaa = mfaaaS;
+//										// linear combinations back
+//					mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+//					mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz);
+//					mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz);
+//
+//					//3.
+//					// linear combinations
+//					LBMReal mxxyPyzz = mfcba + mfabc;
+//					LBMReal mxxyMyzz = mfcba - mfabc;
+//
+//					LBMReal mxxzPyyz = mfcab + mfacb;
+//					LBMReal mxxzMyyz = mfcab - mfacb;
+//
+//					LBMReal mxyyPxzz = mfbca + mfbac;
+//					LBMReal mxyyMxzz = mfbca - mfbac;
+//
+//					 mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa);
+//					 mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa);
+//					 mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa);
+//					 mmfabb += mfabb;
+//					 mmfbab += mfbab;
+//					 mmfbba += mfbba;
+//
+//					//relax
+//					wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit);
+//					mfbbb += wadjust * (-mfbbb);
+//					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit);
+//					mxxyPyzz += wadjust * (-mxxyPyzz);
+//					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit);
+//					mxxyMyzz += wadjust * (-mxxyMyzz);
+//					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit);
+//					mxxzPyyz += wadjust * (-mxxzPyyz);
+//					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit);
+//					mxxzMyyz += wadjust * (-mxxzMyyz);
+//					wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit);
+//					mxyyPxzz += wadjust * (-mxyyPxzz);
+//					wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit);
+//					mxyyMxzz += wadjust * (-mxyyMxzz);
+//
+//					// linear combinations back
+//					mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+//					mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+//					mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+//					mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+//					mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+//					mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+//
+//					//4.
+//					CUMacc = -O4 * (one / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (one - O4) * (CUMacc);
+//					CUMcac = -O4 * (one / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (one - O4) * (CUMcac);
+//					CUMcca = -O4 * (one / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (one - O4) * (CUMcca);
+//					CUMbbc = -O4 * (one / collFactorM - c1o2) * Dxy * c1o3 * BB + (one - O4) * (CUMbbc);
+//					CUMbcb = -O4 * (one / collFactorM - c1o2) * Dxz * c1o3 * BB + (one - O4) * (CUMbcb);
+//					CUMcbb = -O4 * (one / collFactorM - c1o2) * Dyz * c1o3 * BB + (one - O4) * (CUMcbb);
+//
+//					//5.
+//					CUMbcc += O5 * (-CUMbcc);
+//					CUMcbc += O5 * (-CUMcbc);
+//					CUMccb += O5 * (-CUMccb);
+//
+//					//6.
+//					CUMccc += O6 * (-CUMccc);
+//
+//					//back cumulants to central moments
+//					//4.
+//					//mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015
+//					//mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015
+//					//mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015
+//
+//					mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab);
+//					mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb);
+//					mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb);
+//
+//					mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+//					mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+//					mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1) * oMdrho;
+//
+//					//5.
+//					mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho;
+//					mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho;
+//					mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho;
+//
+//					//6.
+//					mfccc = CUMccc - ((-4. * mfbbb * mfbbb
+//						- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+//						- 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc)
+//						- 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb))
+//						+ (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+//							+ 2. * (mfcaa * mfaca * mfaac)
+//							+ 16. * mfbba * mfbab * mfabb)
+//						- c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho
+//						- c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho)
+//						+ (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+//							+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - c1o27 * oMdrho;
+//
+//
+//					////////
+//
+//
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//forcing
+//					mfbaa = -mfbaa;// *(c1 - forcingBIAS) / forcingBIAS;
+//					mfaba = -mfaba;// *(c1 - forcingBIAS) / forcingBIAS;
+//					mfaab = -mfaab;// *(c1 - forcingBIAS) / forcingBIAS;
+//
+//					//mfbaa += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (2 * dxux * dX1_phi + Dxy * dX2_phi + Dxz * dX3_phi) / (rho);
+//					//mfaba += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxy * dX1_phi + 2 * dyuy * dX2_phi + Dyz * dX3_phi) / (rho);
+//					//mfaab += c1o3 * (c1 / collFactorM - c1o2) * rhoToPhi * (Dxz * dX1_phi + Dyz * dX2_phi + 2 * dyuy * dX3_phi) / (rho);
+//
+//					mfbaa -= c1o2 * rhoToPhi * (mmfcaa* dX1_phi + mmfbba * dX2_phi + mmfbab * dX3_phi) / (rho);
+//					mfaba -= c1o2 * rhoToPhi * (mmfbba* dX1_phi + mmfaca * dX2_phi + mmfabb * dX3_phi) / (rho);
+//					mfaab -= c1o2 * rhoToPhi * (mmfbab* dX1_phi + mmfabb * dX2_phi + mmfaac * dX3_phi) / (rho);
+//					
+//					vvx -= c1o4 * rhoToPhi * (mmfcaa * dX1_phi + mmfbba * dX2_phi + mmfbab * dX3_phi) / (rho);
+//					vvy -= c1o4 * rhoToPhi * (mmfbba * dX1_phi + mmfaca * dX2_phi + mmfabb * dX3_phi) / (rho);
+//					vvz -= c1o4 * rhoToPhi * (mmfbab * dX1_phi + mmfabb * dX2_phi + mmfaac * dX3_phi) / (rho);
+//
+//					vx2 = vvx * vvx;
+//					vy2 = vvy * vvy;
+//					vz2 = vvz * vvz;
+//
+//					//mmfcaa =0;// c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz - mfaaa);
+//					//mmfaca =0;// c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz - mfaaa);
+//					//mmfaac =0;// c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz - mfaaa);
+//					//mmfabb =0;// mfabb;
+//					//mmfbab =0;// mfbab;
+//					//mmfbba =0;// mfbba;
+//
+//
+//					//////////////////////////////////////////////////////////////////////////////////////
+//					//grad Rho
+//					//LBMReal dX1_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX1_phi - phi[REST] * three * gradPx;
+//					//LBMReal dX2_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX2_phi - phi[REST] * three * gradPy;
+//					//LBMReal dX3_rho = (rhoToPhi - three * (*pressure)(x1, x2, x3)) * dX3_phi - phi[REST] * three * gradPz;
+//
+//					//LBMReal dX2_rho = (rhoToPhi ) * dX2_phi ;
+//					//LBMReal dX1_rho = (rhoToPhi ) * dX1_phi ;
+//					//LBMReal dX3_rho = (rhoToPhi ) * dX3_phi ;
+//					///////////////////////////////////////////////////////////////////////////////////////
+//					//mfbaa += c1o3 * (c1 / collFactorM - c1o2) *(2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho);
+//					//mfaba += c1o3 * (c1 / collFactorM - c1o2) *(Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho);
+//					//mfaab += c1o3 * (c1 / collFactorM - c1o2) *(Dxz * dX1_rho + Dyz * dX2_rho + 2 * dyuy * dX3_rho) / (rho);
+//					
+//					///////Fakhari pressure correction
+//					//mfbaa -= mfaaa / rho * dX1_rho*c1o3;
+//					//mfaba -= mfaaa / rho * dX2_rho*c1o3;
+//					//mfaab -= mfaaa / rho * dX3_rho*c1o3;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//back
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// Z - Dir
+//					m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + 1. * oMdrho) * (vz2 - vvz) * c1o2;
+//					m1 = -mfaac - 2. * mfaab * vvz + mfaaa * (1. - vz2) - 1. * oMdrho * vz2;
+//					m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + 1. * oMdrho) * (vz2 + vvz) * c1o2;
+//					mfaaa = m0;
+//					mfaab = m1;
+//					mfaac = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2;
+//					m1 = -mfabc - 2. * mfabb * vvz + mfaba * (1. - vz2);
+//					m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2;
+//					mfaba = m0;
+//					mfabb = m1;
+//					mfabc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+//					m1 = -mfacc - 2. * mfacb * vvz + mfaca * (1. - vz2) - c1o3 * oMdrho * vz2;
+//					m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+//					mfaca = m0;
+//					mfacb = m1;
+//					mfacc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2;
+//					m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2);
+//					m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2;
+//					mfbaa = m0;
+//					mfbab = m1;
+//					mfbac = m2;
+//					/////////b//////////////////////////////////////////////////////////////////////////
+//					m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2;
+//					m1 = -mfbbc - 2. * mfbbb * vvz + mfbba * (1. - vz2);
+//					m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2;
+//					mfbba = m0;
+//					mfbbb = m1;
+//					mfbbc = m2;
+//					/////////b//////////////////////////////////////////////////////////////////////////
+//					m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2;
+//					m1 = -mfbcc - 2. * mfbcb * vvz + mfbca * (1. - vz2);
+//					m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2;
+//					mfbca = m0;
+//					mfbcb = m1;
+//					mfbcc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2;
+//					m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2;
+//					m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2;
+//					mfcaa = m0;
+//					mfcab = m1;
+//					mfcac = m2;
+//					/////////c//////////////////////////////////////////////////////////////////////////
+//					m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2;
+//					m1 = -mfcbc - 2. * mfcbb * vvz + mfcba * (1. - vz2);
+//					m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2;
+//					mfcba = m0;
+//					mfcbb = m1;
+//					mfcbc = m2;
+//					/////////c//////////////////////////////////////////////////////////////////////////
+//					m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2;
+//					m1 = -mfccc - 2. * mfccb * vvz + mfcca * (1. - vz2) - c1o9 * oMdrho * vz2;
+//					m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2;
+//					mfcca = m0;
+//					mfccb = m1;
+//					mfccc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// Y - Dir
+//					m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfaca - 2. * mfaba * vvy + mfaaa * (1. - vy2) - c1o6 * oMdrho * vy2;
+//					m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfaaa = m0;
+//					mfaba = m1;
+//					mfaca = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfacb - 2. * mfabb * vvy + mfaab * (1. - vy2) - c2o3 * oMdrho * vy2;
+//					m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfaab = m0;
+//					mfabb = m1;
+//					mfacb = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfacc - 2. * mfabc * vvy + mfaac * (1. - vy2) - c1o6 * oMdrho * vy2;
+//					m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfaac = m0;
+//					mfabc = m1;
+//					mfacc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2;
+//					m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2);
+//					m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2;
+//					mfbaa = m0;
+//					mfbba = m1;
+//					mfbca = m2;
+//					/////////b//////////////////////////////////////////////////////////////////////////
+//					m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2;
+//					m1 = -mfbcb - 2. * mfbbb * vvy + mfbab * (1. - vy2);
+//					m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2;
+//					mfbab = m0;
+//					mfbbb = m1;
+//					mfbcb = m2;
+//					/////////b//////////////////////////////////////////////////////////////////////////
+//					m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2;
+//					m1 = -mfbcc - 2. * mfbbc * vvy + mfbac * (1. - vy2);
+//					m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2;
+//					mfbac = m0;
+//					mfbbc = m1;
+//					mfbcc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2;
+//					m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfcaa = m0;
+//					mfcba = m1;
+//					mfcca = m2;
+//					/////////c//////////////////////////////////////////////////////////////////////////
+//					m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfccb - 2. * mfcbb * vvy + mfcab * (1. - vy2) - c2o9 * oMdrho * vy2;
+//					m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfcab = m0;
+//					mfcbb = m1;
+//					mfccb = m2;
+//					/////////c//////////////////////////////////////////////////////////////////////////
+//					m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2;
+//					m1 = -mfccc - 2. * mfcbc * vvy + mfcac * (1. - vy2) - c1o18 * oMdrho * vy2;
+//					m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2;
+//					mfcac = m0;
+//					mfcbc = m1;
+//					mfccc = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					//mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+//					////////////////////////////////////////////////////////////////////////////////////
+//					// X - Dir
+//					m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcaa - 2. * mfbaa * vvx + mfaaa * (1. - vx2) - c1o36 * oMdrho * vx2;
+//					m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfaaa = m0;
+//					mfbaa = m1;
+//					mfcaa = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcba - 2. * mfbba * vvx + mfaba * (1. - vx2) - c1o9 * oMdrho * vx2;
+//					m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfaba = m0;
+//					mfbba = m1;
+//					mfcba = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcca - 2. * mfbca * vvx + mfaca * (1. - vx2) - c1o36 * oMdrho * vx2;
+//					m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfaca = m0;
+//					mfbca = m1;
+//					mfcca = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2;
+//					m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfaab = m0;
+//					mfbab = m1;
+//					mfcab = m2;
+//					///////////b////////////////////////////////////////////////////////////////////////
+//					m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcbb - 2. * mfbbb * vvx + mfabb * (1. - vx2) - c4o9 * oMdrho * vx2;
+//					m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfabb = m0;
+//					mfbbb = m1;
+//					mfcbb = m2;
+//					///////////b////////////////////////////////////////////////////////////////////////
+//					m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfccb - 2. * mfbcb * vvx + mfacb * (1. - vx2) - c1o9 * oMdrho * vx2;
+//					m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfacb = m0;
+//					mfbcb = m1;
+//					mfccb = m2;
+//					////////////////////////////////////////////////////////////////////////////////////
+//					////////////////////////////////////////////////////////////////////////////////////
+//					m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2;
+//					m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfaac = m0;
+//					mfbac = m1;
+//					mfcac = m2;
+//					///////////c////////////////////////////////////////////////////////////////////////
+//					m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfcbc - 2. * mfbbc * vvx + mfabc * (1. - vx2) - c1o9 * oMdrho * vx2;
+//					m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfabc = m0;
+//					mfbbc = m1;
+//					mfcbc = m2;
+//					///////////c////////////////////////////////////////////////////////////////////////
+//					m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2;
+//					m1 = -mfccc - 2. * mfbcc * vvx + mfacc * (1. - vx2) - c1o36 * oMdrho * vx2;
+//					m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2;
+//					mfacc = m0;
+//					mfbcc = m1;
+//					mfccc = m2;
+//					/////SimpleForce
+//
+//					//mfabb += c2o9 * deltaP;
+//					//mfbab += c2o9 * deltaP;
+//					//mfbba += c2o9 * deltaP;
+//					//mfaab += c1o18 * deltaP;
+//					//mfcab += c1o18 * deltaP;
+//					//mfaba += c1o18 * deltaP;
+//					//mfcba += c1o18 * deltaP;
+//					//mfbaa += c1o18 * deltaP;
+//					//mfbca += c1o18 * deltaP;
+//					//mfaaa += c1o72 * deltaP;
+//					//mfcaa += c1o72 * deltaP;
+//					//mfaca += c1o72 * deltaP;
+//					//mfcca += c1o72 * deltaP;
+//					//mfcbb += c2o9 * deltaP;
+//					//mfbcb += c2o9 * deltaP;
+//					//mfbbc += c2o9 * deltaP;
+//					//mfccb += c1o18 * deltaP;
+//					//mfacb += c1o18 * deltaP;
+//					//mfcbc += c1o18 * deltaP;
+//					//mfabc += c1o18 * deltaP;
+//					//mfbcc += c1o18 * deltaP;
+//					//mfbac += c1o18 * deltaP;
+//					//mfccc += c1o72 * deltaP;
+//					//mfacc += c1o72 * deltaP;
+//					//mfcac += c1o72 * deltaP;
+//					//mfaac += c1o72 * deltaP;
+//
+//					//mfabb += c1o2*(-forcingX1                        ) * c2o9;
+//					//mfbab += c1o2*(           - forcingX2            ) * c2o9;
+//					//mfbba += c1o2*(                       - forcingX3) * c2o9;
+//					//mfaab += c1o2*(-forcingX1 - forcingX2            ) * c1o18;
+//					//mfcab += c1o2*( forcingX1 - forcingX2            ) * c1o18;
+//					//mfaba += c1o2*(-forcingX1             - forcingX3) * c1o18;
+//					//mfcba += c1o2*( forcingX1             - forcingX3) * c1o18;
+//					//mfbaa += c1o2*(           - forcingX2 - forcingX3) * c1o18;
+//					//mfbca += c1o2*(             forcingX2 - forcingX3) * c1o18;
+//					//mfaaa += c1o2*(-forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfcaa += c1o2*( forcingX1 - forcingX2 - forcingX3) * c1o72;
+//					//mfaca += c1o2*(-forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcca += c1o2*( forcingX1 + forcingX2 - forcingX3) * c1o72;
+//					//mfcbb += c1o2*( forcingX1                        ) * c2o9;
+//					//mfbcb += c1o2*(             forcingX2            ) * c2o9;
+//					//mfbbc += c1o2*(                         forcingX3) * c2o9;
+//					//mfccb += c1o2*( forcingX1 + forcingX2            ) * c1o18;
+//					//mfacb += c1o2*(-forcingX1 + forcingX2            ) * c1o18;
+//					//mfcbc += c1o2*( forcingX1             + forcingX3) * c1o18;
+//					//mfabc += c1o2*(-forcingX1             + forcingX3) * c1o18;
+//					//mfbcc += c1o2*(             forcingX2 + forcingX3) * c1o18;
+//					//mfbac += c1o2*(           - forcingX2 + forcingX3) * c1o18;
+//					//mfccc += c1o2*( forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfacc += c1o2*(-forcingX1 + forcingX2 + forcingX3) * c1o72;
+//					//mfcac += c1o2*( forcingX1 - forcingX2 + forcingX3) * c1o72;
+//					//mfaac += c1o2*(-forcingX1 - forcingX2 + forcingX3) * c1o72;
+//					//pStarStart -= (vx2 + vy2 + vz2) * c1o3;
+//
+//					///Take the diffusion part with out
+//
+//					//mfStartcbb -= D3Q27System::getIncompFeqForDirection(D3Q27System::E  , zeroReal, vvx, vvy, vvz);
+//					//mfStartbcb -= D3Q27System::getIncompFeqForDirection(D3Q27System::N  , zeroReal, vvx, vvy, vvz);
+//					//mfStartbbc -= D3Q27System::getIncompFeqForDirection(D3Q27System::T  , zeroReal, vvx, vvy, vvz);
+//					//mfStartccb -= D3Q27System::getIncompFeqForDirection(D3Q27System::NE , zeroReal, vvx, vvy, vvz);
+//					//mfStartacb -= D3Q27System::getIncompFeqForDirection(D3Q27System::NW , zeroReal, vvx, vvy, vvz);
+//					//mfStartcbc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TE , zeroReal, vvx, vvy, vvz);
+//					//mfStartabc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TW , zeroReal, vvx, vvy, vvz);
+//					//mfStartbcc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TN , zeroReal, vvx, vvy, vvz);
+//					//mfStartbac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TS , zeroReal, vvx, vvy, vvz);
+//					//mfStartccc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TNE, zeroReal, vvx, vvy, vvz);
+//					//mfStartacc -= D3Q27System::getIncompFeqForDirection(D3Q27System::TNW, zeroReal, vvx, vvy, vvz);
+//					//mfStartcac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TSE, zeroReal, vvx, vvy, vvz);
+//					//mfStartaac -= D3Q27System::getIncompFeqForDirection(D3Q27System::TSW, zeroReal, vvx, vvy, vvz);
+//					//mfStartabb -= D3Q27System::getIncompFeqForDirection(D3Q27System::W  , zeroReal, vvx, vvy, vvz);
+//					//mfStartbab -= D3Q27System::getIncompFeqForDirection(D3Q27System::S  , zeroReal, vvx, vvy, vvz);
+//					//mfStartbba -= D3Q27System::getIncompFeqForDirection(D3Q27System::B  , zeroReal, vvx, vvy, vvz);
+//					//mfStartaab -= D3Q27System::getIncompFeqForDirection(D3Q27System::SW , zeroReal, vvx, vvy, vvz);
+//					//mfStartcab -= D3Q27System::getIncompFeqForDirection(D3Q27System::SE , zeroReal, vvx, vvy, vvz);
+//					//mfStartaba -= D3Q27System::getIncompFeqForDirection(D3Q27System::BW , zeroReal, vvx, vvy, vvz);
+//					//mfStartcba -= D3Q27System::getIncompFeqForDirection(D3Q27System::BE , zeroReal, vvx, vvy, vvz);
+//					//mfStartbaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BS , zeroReal, vvx, vvy, vvz);
+//					//mfStartbca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BN , zeroReal, vvx, vvy, vvz);
+//					//mfStartaaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BSW, zeroReal, vvx, vvy, vvz);
+//					//mfStartcaa -= D3Q27System::getIncompFeqForDirection(D3Q27System::BSE, zeroReal, vvx, vvy, vvz);
+//					//mfStartaca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BNW, zeroReal, vvx, vvy, vvz);
+//					//mfStartcca -= D3Q27System::getIncompFeqForDirection(D3Q27System::BNE, zeroReal, vvx, vvy, vvz);
+//					//mfStartbbb -= D3Q27System::getIncompFeqForDirection(D3Q27System::REST, zeroReal, vvx, vvy, vvz);
+//					//
+//					//pStar += pStarStart*(omegaDRho-c1);
+//
+//					//mfStartcbb = c2o9 * pStar;
+//					//	mfStartbcb= c2o9 * pStar;
+//					//	mfStartbbc= c2o9 * pStar;
+//					//	mfStartccb= c1o18 * pStar;
+//					//	mfStartacb= c1o18 * pStar;
+//					//	mfStartcbc= c1o18 * pStar;
+//					//	mfStartabc= c1o18 * pStar;
+//					//	mfStartbcc= c1o18 * pStar;
+//					//	mfStartbac= c1o18 * pStar;
+//					//	mfStartccc= c1o72 * pStar;
+//					//	mfStartacc= c1o72 * pStar;
+//					//	mfStartcac= c1o72 * pStar;
+//					//	mfStartaac= c1o72 * pStar;
+//					//	mfStartabb= c2o9 * pStar;
+//					//	mfStartbab= c2o9 * pStar;
+//					//	mfStartbba= c2o9 * pStar;
+//					//	mfStartaab= c1o18 * pStar;
+//					//	mfStartcab= c1o18 * pStar;
+//					//	mfStartaba= c1o18 * pStar;
+//					//	mfStartcba= c1o18 * pStar;
+//					//	mfStartbaa= c1o18 * pStar;
+//					//	mfStartbca= c1o18 * pStar;
+//					//	mfStartaaa= c1o72 * pStar;
+//					//	mfStartcaa= c1o72 * pStar;
+//					//	mfStartaca= c1o72 * pStar;
+//					//	mfStartcca= c1o72 * pStar;
+//					//	mfStartbbb= c4 * c2o9 * pStar;
+//
+//					//mfaaa -= c1o2 * (mfStartaaa + mfStartccc)+ c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa);
+//					//mfaab -= c1o2 * (mfStartaab + mfStartccb)+c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa));
+//					//mfaac -= c1o2 * (mfStartaac + mfStartcca)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa);
+//					//mfaba -= c1o2 * (mfStartaba + mfStartcbc)+c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa);
+//					//mfabb -= c1o2 * (mfStartabb + mfStartcbb)+c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa);
+//					//mfabc -= c1o2 * (mfStartabc + mfStartcba)+c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa);
+//					//mfaca -= c1o2 * (mfStartaca + mfStartcac)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa);
+//					//mfacb -= c1o2 * (mfStartacb + mfStartcab)+c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa));
+//					//mfacc -= c1o2 * (mfStartacc + mfStartcaa)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa);
+//					//mfbaa -= c1o2 * (mfStartbaa + mfStartbcc)+c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa);
+//					//mfbab -= c1o2 * (mfStartbab + mfStartbcb)+c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa);
+//					//mfbac -= c1o2 * (mfStartbac + mfStartbca)+c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa);
+//					//mfbba -= c1o2 * (mfStartbba + mfStartbbc)+c1o9 * (c2 * mmfaac - mmfaca - mmfcaa);
+//					//mfbbb -=  (mfStartbbb)-(c4o9 * (mmfaac + mmfaca + mmfcaa));
+//					//mfbbc -= c1o2 * (mfStartbbc + mfStartbba)+c1o9 * (c2 * mmfaac - mmfaca - mmfcaa);
+//					//mfbca -= c1o2 * (mfStartbca + mfStartbac)+c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa);
+//					//mfbcb -= c1o2 * (mfStartbcb + mfStartbab)+c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa);
+//					//mfbcc -= c1o2 * (mfStartbcc + mfStartbaa)+c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa);
+//					//mfcaa -= c1o2 * (mfStartcaa + mfStartacc)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa);
+//					//mfcab -= c1o2 * (mfStartcab + mfStartacb)+c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa));
+//					//mfcac -= c1o2 * (mfStartcac + mfStartaca)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa);
+//					//mfcba -= c1o2 * (mfStartcba + mfStartabc)+c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa);
+//					//mfcbb -= c1o2 * (mfStartcbb + mfStartabb)+c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa);
+//					//mfcbc -= c1o2 * (mfStartcbc + mfStartaba)+c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa);
+//					//mfcca -= c1o2 * (mfStartcca + mfStartaac)+c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa);
+//					//mfccb -= c1o2 * (mfStartccb + mfStartaab)+c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa));
+//					//mfccc -= c1o2 * (mfStartccc + mfStartaaa)+c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa);
+//
+//					//mfhaaa =rho*( c1o2 * (mfStartaaa + mfStartccc) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa));
+//					//mfhaab =rho*( c1o2 * (mfStartaab + mfStartccb) + c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa)));
+//					//mfhaac =rho*( c1o2 * (mfStartaac + mfStartcca) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa));
+//					//mfhaba =rho*( c1o2 * (mfStartaba + mfStartcbc) + c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa));
+//					//mfhabb =rho*( c1o2 * (mfStartabb + mfStartcbb) + c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa));
+//					//mfhabc =rho*( c1o2 * (mfStartabc + mfStartcba) + c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa));
+//					//mfhaca =rho*( c1o2 * (mfStartaca + mfStartcac) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa));
+//					//mfhacb =rho*( c1o2 * (mfStartacb + mfStartcab) + c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa)));
+//					//mfhacc =rho*( c1o2 * (mfStartacc + mfStartcaa) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa));
+//					//mfhbaa =rho*( c1o2 * (mfStartbaa + mfStartbcc) + c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa));
+//					//mfhbab =rho*( c1o2 * (mfStartbab + mfStartbcb) + c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa));
+//					//mfhbac =rho*( c1o2 * (mfStartbac + mfStartbca) + c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa));
+//					//mfhbba =rho*( c1o2 * (mfStartbba + mfStartbbc) + c1o9 * (c2 * mmfaac - mmfaca - mmfcaa));
+//					//mfhbbb =rho*( (mfStartbbb)-(c4o9 * (mmfaac + mmfaca + mmfcaa)));
+//					//mfhbbc =rho*( c1o2 * (mfStartbbc + mfStartbba) + c1o9 * (c2 * mmfaac - mmfaca - mmfcaa));
+//					//mfhbca =rho*( c1o2 * (mfStartbca + mfStartbac) + c1o36 * (c2 * mmfaac - 6 * mmfabb + c2 * mmfaca - mmfcaa));
+//					//mfhbcb =rho*( c1o2 * (mfStartbcb + mfStartbab) + c1o9 * (-mmfaac + c2 * mmfaca - mmfcaa));
+//					//mfhbcc =rho*( c1o2 * (mfStartbcc + mfStartbaa) + c1o36 * (c2 * mmfaac + c6 * mmfabb + c2 * mmfaca - mmfcaa));
+//					//mfhcaa =rho*( c1o2 * (mfStartcaa + mfStartacc) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca - c3 * mmfbab - c3 * mmfbba + mmfcaa));
+//					//mfhcab =rho*( c1o2 * (mfStartcab + mfStartacb) + c1o36 * (-mmfaac + c2 * (mmfaca - c3 * mmfbba + mmfcaa)));
+//					//mfhcac =rho*( c1o2 * (mfStartcac + mfStartaca) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca + c3 * mmfbab - c3 * mmfbba + mmfcaa));
+//					//mfhcba =rho*( c1o2 * (mfStartcba + mfStartabc) + c1o36 * (c2 * mmfaac - mmfaca - 6 * mmfbab + c2 * mmfcaa));
+//					//mfhcbb =rho*( c1o2 * (mfStartcbb + mfStartabb) + c1o9 * (-mmfaac - mmfaca + c2 * mmfcaa));
+//					//mfhcbc =rho*( c1o2 * (mfStartcbc + mfStartaba) + c1o36 * (c2 * mmfaac - mmfaca + c6 * mmfbab + c2 * mmfcaa));
+//					//mfhcca =rho*( c1o2 * (mfStartcca + mfStartaac) + c1o72 * (mmfaac - c3 * mmfabb + mmfaca - c3 * mmfbab + c3 * mmfbba + mmfcaa));
+//					//mfhccb =rho*( c1o2 * (mfStartccb + mfStartaab) + c1o36 * (-mmfaac + c2 * (mmfaca + c3 * mmfbba + mmfcaa)));
+//					//mfhccc =rho*( c1o2 * (mfStartccc + mfStartaaa) + c1o72 * (mmfaac + c3 * mmfabb + mmfaca + c3 * mmfbab + c3 * mmfbba + mmfcaa));
+//
+//
+//
+//
+//					pStar += pStarStart*(omegaDRho-c1);
+//
+//					mfcbb -= c2o9*pStar;
+//					mfbcb -= c2o9*pStar;
+//					mfbbc -= c2o9*pStar;
+//					mfccb -= c1o18*pStar;
+//					mfacb -= c1o18*pStar;
+//					mfcbc -= c1o18*pStar;
+//					mfabc -= c1o18*pStar;
+//					mfbcc -= c1o18*pStar;
+//					mfbac -= c1o18*pStar;
+//					mfccc -= c1o72*pStar;
+//					mfacc -= c1o72*pStar;
+//					mfcac -= c1o72*pStar;
+//					mfaac -= c1o72*pStar;
+//					mfabb -= c2o9*pStar;
+//					mfbab -= c2o9*pStar;
+//					mfbba -= c2o9*pStar;
+//					mfaab -= c1o18*pStar;
+//					mfcab -= c1o18*pStar;
+//					mfaba -= c1o18*pStar;
+//					mfcba -= c1o18*pStar;
+//					mfbaa -= c1o18*pStar;
+//					mfbca -= c1o18*pStar;
+//					mfaaa -= c1o72*pStar;
+//					mfcaa -= c1o72*pStar;
+//					mfaca -= c1o72*pStar;
+//					mfcca -= c1o72*pStar;
+//					mfbbb -= c4*c2o9*pStar;
+//
+//					mfhbcb = rho*c2o9 * pStar;
+//					mfhbbc = rho*c2o9 * pStar;
+//					mfhcbb = rho*c2o9 * pStar;
+//					mfhccb = rho*c1o18 * pStar;
+//					mfhacb = rho*c1o18 * pStar;
+//					mfhcbc = rho*c1o18 * pStar;
+//					mfhabc = rho*c1o18 * pStar;
+//					mfhbcc = rho*c1o18 * pStar;
+//					mfhbac = rho*c1o18 * pStar;
+//					mfhccc = rho*c1o72 * pStar;
+//					mfhacc = rho*c1o72 * pStar;
+//					mfhcac = rho*c1o72 * pStar;
+//					mfhaac = rho*c1o72 * pStar;
+//					mfhabb = rho*c2o9 * pStar;
+//					mfhbab = rho*c2o9 * pStar;
+//					mfhbba = rho*c2o9 * pStar;
+//					mfhaab = rho*c1o18 * pStar;
+//					mfhcab = rho*c1o18 * pStar;
+//					mfhaba = rho*c1o18 * pStar;
+//					mfhcba = rho*c1o18 * pStar;
+//					mfhbaa = rho*c1o18 * pStar;
+//					mfhbca = rho*c1o18 * pStar;
+//					mfhaaa = rho*c1o72 * pStar;
+//					mfhcaa = rho*c1o72 * pStar;
+//					mfhaca = rho*c1o72 * pStar;
+//					mfhcca = rho*c1o72 * pStar;
+//					mfhbbb = rho*c4 * c2o9 * pStar;
+//
+//					//mfStartbcb =  c2o9  * pStarStart;
+//					//mfStartbbc =  c2o9  * pStarStart;
+//					//mfStartcbb =  c2o9  * pStarStart;
+//					//mfStartccb =  c1o18 * pStarStart;
+//					//mfStartacb =  c1o18 * pStarStart;
+//					//mfStartcbc =  c1o18 * pStarStart;
+//					//mfStartabc =  c1o18 * pStarStart;
+//					//mfStartbcc =  c1o18 * pStarStart;
+//					//mfStartbac =  c1o18 * pStarStart;
+//					//mfStartccc =  c1o72 * pStarStart;
+//					//mfStartacc =  c1o72 * pStarStart;
+//					//mfStartcac =  c1o72 * pStarStart;
+//					//mfStartaac =  c1o72 * pStarStart;
+//					//mfStartabb =  c2o9  * pStarStart;
+//					//mfStartbab =  c2o9  * pStarStart;
+//					//mfStartbba =  c2o9  * pStarStart;
+//					//mfStartaab =  c1o18 * pStarStart;
+//					//mfStartcab =  c1o18 * pStarStart;
+//					//mfStartaba =  c1o18 * pStarStart;
+//					//mfStartcba =  c1o18 * pStarStart;
+//					//mfStartbaa =  c1o18 * pStarStart;
+//					//mfStartbca =  c1o18 * pStarStart;
+//					//mfStartaaa =  c1o72 * pStarStart;
+//					//mfStartcaa =  c1o72 * pStarStart;
+//					//mfStartaca =  c1o72 * pStarStart;
+//					//mfStartcca =  c1o72 * pStarStart;
+//					//mfStartbbb =  c4 * c2o9 * pStarStart;
+//
+//					//LBMReal scaleSplit = 0.5;
+//					//mfStartbcb = mfStartbcb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartbbc = mfStartbbc*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartcbb = mfStartcbb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartccb = mfStartccb*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartacb = mfStartacb*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartcbc = mfStartcbc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartabc = mfStartabc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartbcc = mfStartbcc*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartbac = mfStartbac*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartccc = mfStartccc*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartacc = mfStartacc*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartcac = mfStartcac*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartaac = mfStartaac*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartabb = mfStartabb*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartbab = mfStartbab*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartbba = mfStartbba*scaleSplit+(c1-scaleSplit)* c2o9 * pStarStart;
+//					//mfStartaab = mfStartaab*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartcab = mfStartcab*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartaba = mfStartaba*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartcba = mfStartcba*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartbaa = mfStartbaa*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartbca = mfStartbca*scaleSplit+(c1-scaleSplit)* c1o18 * pStarStart;
+//					//mfStartaaa = mfStartaaa*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartcaa = mfStartcaa*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartaca = mfStartaca*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartcca = mfStartcca*scaleSplit+(c1-scaleSplit)* c1o72 * pStarStart;
+//					//mfStartbbb = mfStartbbb*scaleSplit+(c1-scaleSplit)* c4 * c2o9 * pStarStart;
+//
+//
+//					//mfaaa -= c1o2 * (mfStartaaa + mfStartccc);
+//     //               mfaab -= c1o2 * (mfStartaab + mfStartccb);
+//     //               mfaac -= c1o2 * (mfStartaac + mfStartcca);
+//     //               mfaba -= c1o2 * (mfStartaba + mfStartcbc);
+//     //               mfabb -= c1o2 * (mfStartabb + mfStartcbb);
+//     //               mfabc -= c1o2 * (mfStartabc + mfStartcba);
+//     //               mfaca -= c1o2 * (mfStartaca + mfStartcac);
+//     //               mfacb -= c1o2 * (mfStartacb + mfStartcab);
+//     //               mfacc -= c1o2 * (mfStartacc + mfStartcaa);
+//     //               mfbaa -= c1o2 * (mfStartbaa + mfStartbcc);
+//     //               mfbab -= c1o2 * (mfStartbab + mfStartbcb);
+//     //               mfbac -= c1o2 * (mfStartbac + mfStartbca);
+//     //               mfbba -= c1o2 * (mfStartbba + mfStartbbc);
+//					//mfbbb -= (mfStartbbb);
+//     //               mfbbc -= c1o2 * (mfStartbbc + mfStartbba);
+//     //               mfbca -= c1o2 * (mfStartbca + mfStartbac);
+//     //               mfbcb -= c1o2 * (mfStartbcb + mfStartbab);
+//     //               mfbcc -= c1o2 * (mfStartbcc + mfStartbaa);
+//     //               mfcaa -= c1o2 * (mfStartcaa + mfStartacc);
+//     //               mfcab -= c1o2 * (mfStartcab + mfStartacb);
+//     //               mfcac -= c1o2 * (mfStartcac + mfStartaca);
+//     //               mfcba -= c1o2 * (mfStartcba + mfStartabc);
+//     //               mfcbb -= c1o2 * (mfStartcbb + mfStartabb);
+//     //               mfcbc -= c1o2 * (mfStartcbc + mfStartaba);
+//     //               mfcca -= c1o2 * (mfStartcca + mfStartaac);
+//     //               mfccb -= c1o2 * (mfStartccb + mfStartaab);
+//     //               mfccc -= c1o2 * (mfStartccc + mfStartaaa);
+//					//												
+//					//mfhaaa += rho*c1o2 * (mfStartaaa + mfStartccc);
+//					//mfhaab += rho*c1o2 * (mfStartaab + mfStartccb);
+//					//mfhaac += rho*c1o2 * (mfStartaac + mfStartcca);
+//					//mfhaba += rho*c1o2 * (mfStartaba + mfStartcbc);
+//					//mfhabb += rho*c1o2 * (mfStartabb + mfStartcbb);
+//					//mfhabc += rho*c1o2 * (mfStartabc + mfStartcba);
+//					//mfhaca += rho*c1o2 * (mfStartaca + mfStartcac);
+//					//mfhacb += rho*c1o2 * (mfStartacb + mfStartcab);
+//					//mfhacc += rho*c1o2 * (mfStartacc + mfStartcaa);
+//					//mfhbaa += rho*c1o2 * (mfStartbaa + mfStartbcc);
+//					//mfhbab += rho*c1o2 * (mfStartbab + mfStartbcb);
+//					//mfhbac += rho*c1o2 * (mfStartbac + mfStartbca);
+//					//mfhbba += rho*c1o2 * (mfStartbba + mfStartbbc);
+//					//mfhbbb += rho*(mfStartbbb);
+//					//mfhbbc += rho*c1o2 * (mfStartbbc + mfStartbba);
+//					//mfhbca += rho*c1o2 * (mfStartbca + mfStartbac);
+//					//mfhbcb += rho*c1o2 * (mfStartbcb + mfStartbab);
+//					//mfhbcc += rho*c1o2 * (mfStartbcc + mfStartbaa);
+//					//mfhcaa += rho*c1o2 * (mfStartcaa + mfStartacc);
+//					//mfhcab += rho*c1o2 * (mfStartcab + mfStartacb);
+//					//mfhcac += rho*c1o2 * (mfStartcac + mfStartaca);
+//					//mfhcba += rho*c1o2 * (mfStartcba + mfStartabc);
+//					//mfhcbb += rho*c1o2 * (mfStartcbb + mfStartabb);
+//					//mfhcbc += rho*c1o2 * (mfStartcbc + mfStartaba);
+//					//mfhcca += rho*c1o2 * (mfStartcca + mfStartaac);
+//					//mfhccb += rho*c1o2 * (mfStartccb + mfStartaab);
+//					//mfhccc += rho*c1o2 * (mfStartccc + mfStartaaa);
+//					//mfhbcb += c1o6 * c2o9 * deltaPP;
+//					//mfhbbc += c1o6 * c2o9 * deltaPP;
+//					//mfhcbb += c1o6 * c2o9 * deltaPP;
+//					//mfhccb += c1o6 * c1o18 * deltaPP;
+//					//mfhacb += c1o6 * c1o18 * deltaPP;
+//					//mfhcbc += c1o6 * c1o18 * deltaPP;
+//					//mfhabc += c1o6 * c1o18 * deltaPP;
+//					//mfhbcc += c1o6 * c1o18 * deltaPP;
+//					//mfhbac += c1o6 * c1o18 * deltaPP;
+//					//mfhccc += c1o6 * c1o72 * deltaPP;
+//					//mfhacc += c1o6 * c1o72 * deltaPP;
+//					//mfhcac += c1o6 * c1o72 * deltaPP;
+//					//mfhaac += c1o6 * c1o72 * deltaPP;
+//					//mfhabb += c1o6 * c2o9 * deltaPP;
+//					//mfhbab += c1o6 * c2o9 * deltaPP;
+//					//mfhbba += c1o6 * c2o9 * deltaPP;
+//					//mfhaab += c1o6 * c1o18 * deltaPP;
+//					//mfhcab += c1o6 * c1o18 * deltaPP;
+//					//mfhaba += c1o6 * c1o18 * deltaPP;
+//					//mfhcba += c1o6 * c1o18 * deltaPP;
+//					//mfhbaa += c1o6 * c1o18 * deltaPP;
+//					//mfhbca += c1o6 * c1o18 * deltaPP;
+//					//mfhaaa += c1o6 * c1o72 * deltaPP;
+//					//mfhcaa += c1o6 * c1o72 * deltaPP;
+//					//mfhaca += c1o6 * c1o72 * deltaPP;
+//					//mfhcca += c1o6 * c1o72 * deltaPP;
+//					//mfhbbb += c1o6 * c4 * c2o9 * deltaPP;
+//
+//
+//					//mfhbcb = c1o3/rho * c2o9 ;
+//					//mfhbbc = c1o3/rho * c2o9 ;
+//					//mfhcbb = c1o3/rho * c2o9 ;
+//					//mfhccb = c1o3/rho * c1o18 ;
+//					//mfhacb = c1o3/rho * c1o18 ;
+//					//mfhcbc = c1o3/rho * c1o18 ;
+//					//mfhabc = c1o3/rho * c1o18 ;
+//					//mfhbcc = c1o3/rho * c1o18 ;
+//					//mfhbac = c1o3/rho * c1o18 ;
+//					//mfhccc = c1o3/rho * c1o72 ;
+//					//mfhacc = c1o3/rho * c1o72 ;
+//					//mfhcac = c1o3/rho * c1o72 ;
+//					//mfhaac = c1o3/rho * c1o72 ;
+//					//mfhabb = c1o3/rho * c2o9 ;
+//					//mfhbab = c1o3/rho * c2o9 ;
+//					//mfhbba = c1o3/rho * c2o9 ;
+//					//mfhaab = c1o3/rho * c1o18 ;
+//					//mfhcab = c1o3/rho * c1o18 ;
+//					//mfhaba = c1o3/rho * c1o18 ;
+//					//mfhcba = c1o3/rho * c1o18 ;
+//					//mfhbaa = c1o3/rho * c1o18 ;
+//					//mfhbca = c1o3/rho * c1o18 ;
+//					//mfhaaa = c1o3/rho * c1o72 ;
+//					//mfhcaa = c1o3/rho * c1o72 ;
+//					//mfhaca = c1o3/rho * c1o72 ;
+//					//mfhcca = c1o3/rho * c1o72 ;
+//					//mfhbbb = c1/rho;//c1o3/rho * c4 * c2o9 ;
+//
+//
+//					
+//					//mfabb += c1o2 * c2o9 * pStar * (phi[REST] - phi[W]) * rhoToPhi / rho;
+//					//mfbab += c1o2 * c2o9 * pStar * (phi[REST] - phi[S]) * rhoToPhi / rho;
+//					//mfbba += c1o2 * c2o9 * pStar * (phi[REST] - phi[B]) * rhoToPhi / rho;
+//					//mfaab += c1o2 * c1o18 * pStar * (phi[REST] - phi[SW]) * rhoToPhi / rho;
+//					//mfcab += c1o2 * c1o18 * pStar * (phi[REST] - phi[SE]) * rhoToPhi / rho;
+//					//mfaba += c1o2 * c1o18 * pStar * (phi[REST] - phi[BW]) * rhoToPhi / rho;
+//					//mfcba += c1o2 * c1o18 * pStar * (phi[REST] - phi[BE]) * rhoToPhi / rho;
+//					//mfbaa += c1o2 * c1o18 * pStar * (phi[REST] - phi[BS]) * rhoToPhi / rho;
+//					//mfbca += c1o2 * c1o18 * pStar * (phi[REST] - phi[BN]) * rhoToPhi / rho;
+//					//mfaaa += c1o2 * c1o72 * pStar * (phi[REST] - phi[BSW]) * rhoToPhi / rho;
+//					//mfcaa += c1o2 * c1o72 * pStar * (phi[REST] - phi[BSE]) * rhoToPhi / rho;
+//					//mfaca += c1o2 * c1o72 * pStar * (phi[REST] - phi[BNW]) * rhoToPhi / rho;
+//					//mfcca += c1o2 * c1o72 * pStar * (phi[REST] - phi[BNE]) * rhoToPhi / rho;
+//					//mfcbb += c1o2 * c2o9 * pStar * (phi[REST] - phi[E]) * rhoToPhi / rho;
+//					//mfbcb += c1o2 * c2o9 * pStar * (phi[REST] - phi[N]) * rhoToPhi / rho;
+//					//mfbbc += c1o2 * c2o9 * pStar * (phi[REST] - phi[T]) * rhoToPhi / rho;
+//					//mfccb += c1o2 * c1o18 * pStar * (phi[REST] - phi[NE]) * rhoToPhi / rho;
+//					//mfacb += c1o2 * c1o18 * pStar * (phi[REST] - phi[NW]) * rhoToPhi / rho;
+//					//mfcbc += c1o2 * c1o18 * pStar * (phi[REST] - phi[TE]) * rhoToPhi / rho;
+//					//mfabc += c1o2 * c1o18 * pStar * (phi[REST] - phi[TW]) * rhoToPhi / rho;
+//					//mfbcc += c1o2 * c1o18 * pStar * (phi[REST] - phi[TN]) * rhoToPhi / rho;
+//					//mfbac += c1o2 * c1o18 * pStar * (phi[REST] - phi[TS]) * rhoToPhi / rho;
+//					//mfccc += c1o2 * c1o72 * pStar * (phi[REST] - phi[TNE]) * rhoToPhi / rho;
+//					//mfacc += c1o2 * c1o72 * pStar * (phi[REST] - phi[TNW]) * rhoToPhi / rho;
+//					//mfcac += c1o2 * c1o72 * pStar * (phi[REST] - phi[TSE]) * rhoToPhi / rho;
+//					//mfaac += c1o2 * c1o72 * pStar * (phi[REST] - phi[TSW]) * rhoToPhi / rho;
+//					
+//					///////////////
+//					//mfabb += (pBefore-pStar) * c2o9  ;
+//					//mfbab += (pBefore-pStar) * c2o9  ;
+//					//mfbba += (pBefore-pStar) * c2o9  ;
+//					//mfaab += (pBefore-pStar) * c1o18 ;
+//					//mfcab += (pBefore-pStar) * c1o18 ;
+//					//mfaba += (pBefore-pStar) * c1o18 ;
+//					//mfcba += (pBefore-pStar) * c1o18 ;
+//					//mfbaa += (pBefore-pStar) * c1o18 ;
+//					//mfbca += (pBefore-pStar) * c1o18 ;
+//					//mfaaa += (pBefore-pStar) * c1o72 ;
+//					//mfcaa += (pBefore-pStar) * c1o72 ;
+//					//mfaca += (pBefore-pStar) * c1o72 ;
+//					//mfcca += (pBefore-pStar) * c1o72 ;
+//					//mfcbb += (pBefore-pStar) * c2o9  ;
+//					//mfbcb += (pBefore-pStar) * c2o9  ;
+//					//mfbbc += (pBefore-pStar) * c2o9  ;
+//					//mfccb += (pBefore-pStar) * c1o18 ;
+//					//mfacb += (pBefore-pStar) * c1o18 ;
+//					//mfcbc += (pBefore-pStar) * c1o18 ;
+//					//mfabc += (pBefore-pStar) * c1o18 ;
+//					//mfbcc += (pBefore-pStar) * c1o18 ;
+//					//mfbac += (pBefore-pStar) * c1o18 ;
+//					//mfccc += (pBefore-pStar) * c1o72 ;
+//					//mfacc += (pBefore-pStar) * c1o72 ;
+//					//mfcac += (pBefore-pStar) * c1o72 ;
+//					//mfaac += (pBefore-pStar) * c1o72 ;
+//					//mfbbb += (pBefore-pStar) * 8.0 / 9.0;
+//
+//					//mfabb = (pBefore ) * c2o9;
+//					//mfbab = (pBefore ) * c2o9;
+//					//mfbba = (pBefore ) * c2o9;
+//					//mfaab = (pBefore ) * c1o16;
+//					//mfcab = (pBefore ) * c1o16;
+//					//mfaba = (pBefore ) * c1o16;
+//					//mfcba = (pBefore ) * c1o16;
+//					//mfbaa = (pBefore ) * c1o16;
+//					//mfbca = (pBefore ) * c1o16;
+//					//mfaaa = (pBefore ) * c1o72;
+//					//mfcaa = (pBefore ) * c1o72;
+//					//mfaca = (pBefore ) * c1o72;
+//					//mfcca = (pBefore ) * c1o72;
+//					//mfcbb = (pBefore ) * c2o9;
+//					//mfbcb = (pBefore ) * c2o9;
+//					//mfbbc = (pBefore ) * c2o9;
+//					//mfccb = (pBefore ) * c1o16;
+//					//mfacb = (pBefore ) * c1o16;
+//					//mfcbc = (pBefore ) * c1o16;
+//					//mfabc = (pBefore ) * c1o16;
+//					//mfbcc = (pBefore ) * c1o16;
+//					//mfbac = (pBefore ) * c1o16;
+//					//mfccc = (pBefore ) * c1o72;
+//					//mfacc = (pBefore ) * c1o72;
+//					//mfcac = (pBefore ) * c1o72;
+//					//mfaac = (pBefore ) * c1o72;
+//					//mfbbb = (pBefore ) * 8.0 / 9.0;
+//					///////////////////
+//
+//					//////////////////////////////////////////////////////////////////////////
+//					//proof correctness
+//					//////////////////////////////////////////////////////////////////////////
+//					//#ifdef  PROOF_CORRECTNESS
+//					LBMReal rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca)
+//						+ (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc)
+//						+ (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb;
+//					//			   //LBMReal dif = fabs(drho - rho_post);
+//					//               LBMReal dif = drho + (dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz) * correctionScaling - rho_post;
+//					//#ifdef SINGLEPRECISION
+//					//			   if (dif > 10.0E-7 || dif < -10.0E-7)
+//					//#else
+//					//			   if (dif > 10.0E-15 || dif < -10.0E-15)
+//					//#endif
+//					//			   {
+//					//				   UB_THROW(UbException(UB_EXARGS, "drho=" + UbSystem::toString(drho) + ", rho_post=" + UbSystem::toString(rho_post)
+//					//					   + " dif=" + UbSystem::toString(dif)
+//					//					   + " drho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//					//				   //UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): drho is not correct for node "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3));
+//					//				   //exit(EXIT_FAILURE);
+//					//			   }
+//					//#endif
+//
+//					if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post))
+//						UB_THROW(UbException(
+//							UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," +
+//							UbSystem::toString(x2) + "," + UbSystem::toString(x3)));
+//
+//					//////////////////////////////////////////////////////////////////////////
+//					//write distribution
+//					//////////////////////////////////////////////////////////////////////////
+//					(*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3)         = mfabb         ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3)         = mfbab         ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3)         = mfbba         ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3)        = mfaab        ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3)       = mfcab       ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3)        = mfaba        ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3)       = mfcba       ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3)        = mfbaa        ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3)       = mfbca       ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3)       = mfaaa       ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3)      = mfcaa      ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3)      = mfaca      ;//* rho * c1o3;
+//					(*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3)     = mfcca     ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)     = mfcbb     ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3)     = mfbcb     ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p)     = mfbbc     ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfccb   ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3)    = mfacb    ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfcbc   ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p)    = mfabc    ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfbcc   ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p)    = mfbac    ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfacc  ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfcac  ;//* rho * c1o3;
+//					(*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfaac   ;//* rho * c1o3;
+//
+//					(*this->zeroDistributionsF)(x1, x2, x3) = mfbbb;// *rho* c1o3;
+//
+//			
+//					(*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3)         = mfhabb;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3)         = mfhbab;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3)         = mfhbba;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3)        = mfhaab;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3)       = mfhcab;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3)        = mfhaba;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3)       = mfhcba;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3)        = mfhbaa;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3)       = mfhbca;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3)       = mfhaaa;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3)      = mfhcaa;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3)      = mfhaca;//* rho * c1o3;
+//					(*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3)     = mfhcca;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3)     = mfhcbb;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3)     = mfhbcb;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p)     = mfhbbc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3)   = mfhccb;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3)    = mfhacb;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p)   = mfhcbc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p)    = mfhabc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p)   = mfhbcc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p)    = mfhbac;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfhccc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p)  = mfhacc;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p)  = mfhcac;//* rho * c1o3;
+//					(*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p)   = mfhaac;//* rho * c1o3;
+//
+//					(*this->zeroDistributionsH2)(x1, x2, x3) = mfhbbb;// *rho* c1o3;
+//
+//																	// !Old Kernel
+///////////////////////  P H A S E - F I E L D   S O L V E R
+//////////////////////////////////////////////
+///////CUMULANT PHASE-FIELD
+//					LBMReal omegaD =1.0/( 3.0 * mob + 0.5);
+//					{
+//						mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+//						mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+//						mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+//						mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+//						mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+//						mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+//						mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+//						mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+//						mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+//						mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+//						mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+//						mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+//						mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//						mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+//						mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+//						mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+//						mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+//						mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+//						mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+//						mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+//						mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+//						mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+//						mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//						mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//						mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//						mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+//						mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3);
+//
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+//						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//						//!
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// second component
+//						LBMReal concentration =
+//							((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+//								(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+//								((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+//						////////////////////////////////////////////////////////////////////////////////////
+//						LBMReal oneMinusRho = c1- concentration;
+//
+//						LBMReal cx =
+//							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+//								(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+//								(mfcbb - mfabb));
+//						LBMReal cy =
+//							((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+//								(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+//								(mfbcb - mfbab));
+//						LBMReal cz =
+//							((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+//								(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+//								(mfbbc - mfbba));
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// calculate the square of velocities for this lattice node
+//						LBMReal cx2 = cx * cx;
+//						LBMReal cy2 = cy * cy;
+//						LBMReal cz2 = cz * cz;
+//						////////////////////////////////////////////////////////////////////////////////////
+//						//! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+//						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//						//! see also Eq. (6)-(14) in \ref
+//						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//						//!
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// Z - Dir
+//						forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// Y - Dir
+//						forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+//						forwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+//						forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+//						forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+//						forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+//						forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+//						forwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+//						forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// X - Dir
+//						forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+//						forwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+//						forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+//						forwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+//						forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+//						forwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+//						forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+//						forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+//						forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3, c1o9, oneMinusRho);
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						//! - experimental Cumulant ... to be published ... hopefully
+//						//!
+//
+//						// linearized orthogonalization of 3rd order central moments
+//						LBMReal Mabc = mfabc - mfaba * c1o3;
+//						LBMReal Mbca = mfbca - mfbaa * c1o3;
+//						LBMReal Macb = mfacb - mfaab * c1o3;
+//						LBMReal Mcba = mfcba - mfaba * c1o3;
+//						LBMReal Mcab = mfcab - mfaab * c1o3;
+//						LBMReal Mbac = mfbac - mfbaa * c1o3;
+//						// linearized orthogonalization of 5th order central moments
+//						LBMReal Mcbc = mfcbc - mfaba * c1o9;
+//						LBMReal Mbcc = mfbcc - mfbaa * c1o9;
+//						LBMReal Mccb = mfccb - mfaab * c1o9;
+//
+//						//31.05.2022 addaptive mobility
+//						//omegaD = c1 + (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) / (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration)) + fabs((1.0 - concentration) * (concentration)) * c1o6 * oneOverInterfaceScale+1.0e-200);
+//						//omegaD = c2 * (concentration * (concentration - c1)) / (-c6 * (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) + (concentration * (concentration - c1))+1.0e-200);
+//						// collision of 1st order moments
+//						cx = cx * (c1 - omegaD) + omegaD * vvx * concentration +
+//							normX1 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+//						cy = cy * (c1 - omegaD) + omegaD * vvy * concentration +
+//							normX2 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+//						cz = cz * (c1 - omegaD) + omegaD * vvz * concentration +
+//							normX3 * (c1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale;
+//
+//						cx2 = cx * cx;
+//						cy2 = cy * cy;
+//						cz2 = cz * cz;
+//
+//						// equilibration of 2nd order moments
+//						mfbba = zeroReal;
+//						mfbab = zeroReal;
+//						mfabb = zeroReal;
+//
+//						mfcaa = c1o3 * concentration;
+//						mfaca = c1o3 * concentration;
+//						mfaac = c1o3 * concentration;
+//
+//						// equilibration of 3rd order moments
+//						Mabc = zeroReal;
+//						Mbca = zeroReal;
+//						Macb = zeroReal;
+//						Mcba = zeroReal;
+//						Mcab = zeroReal;
+//						Mbac = zeroReal;
+//						mfbbb = zeroReal;
+//
+//						// from linearized orthogonalization 3rd order central moments to central moments
+//						mfabc = Mabc + mfaba * c1o3;
+//						mfbca = Mbca + mfbaa * c1o3;
+//						mfacb = Macb + mfaab * c1o3;
+//						mfcba = Mcba + mfaba * c1o3;
+//						mfcab = Mcab + mfaab * c1o3;
+//						mfbac = Mbac + mfbaa * c1o3;
+//
+//						// equilibration of 4th order moments
+//						mfacc = c1o9 * concentration;
+//						mfcac = c1o9 * concentration;
+//						mfcca = c1o9 * concentration;
+//
+//						mfcbb = zeroReal;
+//						mfbcb = zeroReal;
+//						mfbbc = zeroReal;
+//
+//						// equilibration of 5th order moments
+//						Mcbc = zeroReal;
+//						Mbcc = zeroReal;
+//						Mccb = zeroReal;
+//
+//						// from linearized orthogonalization 5th order central moments to central moments
+//						mfcbc = Mcbc + mfaba * c1o9;
+//						mfbcc = Mbcc + mfbaa * c1o9;
+//						mfccb = Mccb + mfaab * c1o9;
+//
+//						// equilibration of 6th order moment
+//						mfccc = c1o27 * concentration;
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						//! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+//						//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+//						//! see also Eq. (88)-(96) in
+//						//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//						//!
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// X - Dir
+//						backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1, c1, oneMinusRho);
+//						backwardChimera(mfaba, mfbba, mfcba, cx, cx2);
+//						backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3, c1o3, oneMinusRho);
+//						backwardChimera(mfaab, mfbab, mfcab, cx, cx2);
+//						backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2);
+//						backwardChimera(mfacb, mfbcb, mfccb, cx, cx2);
+//						backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3, c1o3, oneMinusRho);
+//						backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2);
+//						backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9, c1o9, oneMinusRho);
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// Y - Dir
+//						backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6, c1o6, oneMinusRho);
+//						backwardChimera(mfaab, mfabb, mfacb, cy, cy2);
+//						backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18, c1o18, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho);
+//						backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2);
+//						backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6, c1o6, oneMinusRho);
+//						backwardChimera(mfcab, mfcbb, mfccb, cy, cy2);
+//						backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18, c1o18, oneMinusRho);
+//
+//						////////////////////////////////////////////////////////////////////////////////////
+//						// Z - Dir
+//						backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36, c1o36, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9, c1o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36, c1o36, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9, c1o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9, c1o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36, c1o36, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9, c1o9, oneMinusRho);
+//						backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36, c1o36, oneMinusRho);
+//
+//
+//
+//						(*this->localDistributionsH1)(D3Q27System::ET_E,   x1,  x2,  x3) = mfabb;
+//						(*this->localDistributionsH1)(D3Q27System::ET_N,   x1,  x2,  x3) = mfbab;
+//						(*this->localDistributionsH1)(D3Q27System::ET_T,   x1,  x2,  x3) = mfbba;
+//						(*this->localDistributionsH1)(D3Q27System::ET_NE,  x1,  x2,  x3) = mfaab;
+//						(*this->localDistributionsH1)(D3Q27System::ET_NW,  x1p, x2,  x3) = mfcab;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TE,  x1,  x2,  x3) = mfaba;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TW,  x1p, x2,  x3) = mfcba;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TN,  x1,  x2,  x3) = mfbaa;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TS,  x1,  x2p, x3) = mfbca;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TNE, x1,  x2,  x3) = mfaaa;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2,  x3) = mfcaa;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TSE, x1,  x2p, x3) = mfaca;
+//						(*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;
+//
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_W,   x1p, x2,  x3 ) = mfcbb;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_S,   x1,  x2p, x3 ) = mfbcb;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_B,   x1,  x2,  x3p) = mfbbc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SW,  x1p, x2p, x3 ) = mfccb;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_SE,  x1,  x2p, x3 ) = mfacb;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BW,  x1p, x2,  x3p) = mfcbc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BE,  x1,  x2,  x3p) = mfabc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BS,  x1,  x2p, x3p) = mfbcc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BN,  x1,  x2,  x3p) = mfbac;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1,  x2p, x3p) = mfacc;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2,  x3p) = mfcac;
+//						(*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1,  x2,  x3p) = mfaac;
+//
+//						(*this->zeroDistributionsH1)(x1,x2,x3) = mfbbb;
+//
+//
+//
+//
+//					}
+//				}
+//			}
+//		}
+//	}
+//}
+////////////////////////////////////////////////////////////////////////////
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_phi()
+//{
+//	using namespace D3Q27System;
+//	return 3.0* ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) + (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) + (phi[BNE] - phi[TSW])))
+//		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) + (phi[BE] - phi[TW])) + ((phi[SE] - phi[NW]) + (phi[NE] - phi[SW])))) +
+//		+WEIGTH[N] * (phi[E] - phi[W]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_phi()
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[BNE] - phi[TSW])- (phi[TSE] - phi[BNW])))
+//		+ WEIGTH[NE] * (((phi[TN] - phi[BS]) + (phi[BN] - phi[TS])) + ((phi[NE] - phi[SW])- (phi[SE] - phi[NW])))) +
+//		+WEIGTH[N] * (phi[N] - phi[S]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_phi()
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((phi[TNE] - phi[BSW]) - (phi[BSE] - phi[TNW])) + ((phi[TSE] - phi[BNW]) - (phi[BNE] - phi[TSW])))
+//		+ WEIGTH[NE] * (((phi[TE] - phi[BW]) - (phi[BE] - phi[TW])) + ((phi[TS] - phi[BN]) + (phi[TN] - phi[BS])))) +
+//		+WEIGTH[N] * (phi[T] - phi[B]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_rhoInv(LBMReal rhoL,LBMReal rhoDIV)
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((1.0/(rhoL+rhoDIV*phi[TNE]) - 1.0 / (rhoL + rhoDIV * phi[BSW])) + (1.0 / (rhoL + rhoDIV * phi[BSE]) - 1.0 / (rhoL + rhoDIV * phi[TNW]))) + ((1.0 / (rhoL + rhoDIV * phi[TSE]) - 1.0 / (rhoL + rhoDIV * phi[BNW])) + (1.0 / (rhoL + rhoDIV * phi[BNE]) - 1.0 / (rhoL + rhoDIV * phi[TSW]))))
+//		+ WEIGTH[NE] * (((1.0 / (rhoL + rhoDIV * phi[TE]) - 1.0 / (rhoL + rhoDIV * phi[BW])) + (1.0 / (rhoL + rhoDIV * phi[BE]) - 1.0 / (rhoL + rhoDIV * phi[TW]))) + ((1.0 / (rhoL + rhoDIV * phi[SE]) - 1.0 / (rhoL + rhoDIV * phi[NW])) + (1.0 / (rhoL + rhoDIV * phi[NE]) - 1.0 / (rhoL + rhoDIV * phi[SW]))))) +
+//		+WEIGTH[N] * (1.0 / (rhoL + rhoDIV * phi[E]) - 1.0 / (rhoL + rhoDIV * phi[W])));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_rhoInv(LBMReal rhoL,LBMReal rhoDIV)
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((1.0 / (rhoL + rhoDIV * phi[TNE]) - 1.0 / (rhoL + rhoDIV * phi[BSW])) - (1.0 / (rhoL + rhoDIV * phi[BSE]) - 1.0 / (rhoL + rhoDIV * phi[TNW]))) + ((1.0 / (rhoL + rhoDIV * phi[BNE]) - 1.0 / (rhoL + rhoDIV * phi[TSW])) - (1.0 / (rhoL + rhoDIV * phi[TSE]) - 1.0 / (rhoL + rhoDIV * phi[BNW]))))
+//		+ WEIGTH[NE] * (((1.0 / (rhoL + rhoDIV * phi[TN]) - 1.0 / (rhoL + rhoDIV * phi[BS])) + (1.0 / (rhoL + rhoDIV * phi[BN]) - 1.0 / (rhoL + rhoDIV * phi[TS]))) + ((1.0 / (rhoL + rhoDIV * phi[NE]) - 1.0 / (rhoL + rhoDIV * phi[SW])) - (1.0 / (rhoL + rhoDIV * phi[SE]) - 1.0 / (rhoL + rhoDIV * phi[NW]))))) +
+//		+WEIGTH[N] * (1.0 / (rhoL + rhoDIV * phi[N]) - 1.0 / (rhoL + rhoDIV * phi[S])));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_rhoInv(LBMReal rhoL, LBMReal rhoDIV)
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((1.0 / (rhoL + rhoDIV * phi[TNE]) - 1.0 / (rhoL + rhoDIV * phi[BSW])) - (1.0 / (rhoL + rhoDIV * phi[BSE]) - 1.0 / (rhoL + rhoDIV * phi[TNW]))) + ((1.0 / (rhoL + rhoDIV * phi[TSE]) - 1.0 / (rhoL + rhoDIV * phi[BNW])) - (1.0 / (rhoL + rhoDIV * phi[BNE]) - 1.0 / (rhoL + rhoDIV * phi[TSW]))))
+//		+ WEIGTH[NE] * (((1.0 / (rhoL + rhoDIV * phi[TE]) - 1.0 / (rhoL + rhoDIV * phi[BW])) - (1.0 / (rhoL + rhoDIV * phi[BE]) - 1.0 / (rhoL + rhoDIV * phi[TW]))) + ((1.0 / (rhoL + rhoDIV * phi[TS]) - 1.0 / (rhoL + rhoDIV * phi[BN])) + (1.0 / (rhoL + rhoDIV * phi[TN]) - 1.0 / (rhoL + rhoDIV * phi[BS]))))) +
+//		+WEIGTH[N] * (1.0 / (rhoL + rhoDIV * phi[T]) - 1.0 / (rhoL + rhoDIV * phi[B])));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX1_phi2()
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) + (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) + (phi2[BNE] - phi2[TSW])))
+//		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) + (phi2[BE] - phi2[TW])) + ((phi2[SE] - phi2[NW]) + (phi2[NE] - phi2[SW])))) +
+//		+WEIGTH[N] * (phi2[E] - phi2[W]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX2_phi2()
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[BNE] - phi2[TSW]) - (phi2[TSE] - phi2[BNW])))
+//		+ WEIGTH[NE] * (((phi2[TN] - phi2[BS]) + (phi2[BN] - phi2[TS])) + ((phi2[NE] - phi2[SW]) - (phi2[SE] - phi2[NW])))) +
+//		+WEIGTH[N] * (phi2[N] - phi2[S]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::gradX3_phi2()
+//{
+//	using namespace D3Q27System;
+//	return 3.0 * ((WEIGTH[TNE] * (((phi2[TNE] - phi2[BSW]) - (phi2[BSE] - phi2[TNW])) + ((phi2[TSE] - phi2[BNW]) - (phi2[BNE] - phi2[TSW])))
+//		+ WEIGTH[NE] * (((phi2[TE] - phi2[BW]) - (phi2[BE] - phi2[TW])) + ((phi2[TS] - phi2[BN]) + (phi2[TN] - phi2[BS])))) +
+//		+WEIGTH[N] * (phi2[T] - phi2[B]));
+//}
+//
+//LBMReal MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::nabla2_phi()
+//{
+//	using namespace D3Q27System;
+//	LBMReal sum = 0.0;
+//	sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000])))
+//		+ (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000]))));
+//	sum += WEIGTH[DIR_0PP] * (
+//			(((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000])))
+//		+	(((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000])))
+//		+	(((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))
+//		);
+//	sum += WEIGTH[DIR_00P] * (
+//			((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000]))
+//		+	((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000]))
+//		+	((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))
+//		);
+//
+//
+//	return 6.0 * sum;
+//}
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::computePhasefield()
+//{
+//	using namespace D3Q27System;
+//	SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions();
+//
+//	int minX1 = ghostLayerWidth;
+//	int minX2 = ghostLayerWidth;
+//	int minX3 = ghostLayerWidth;
+//	int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth;
+//	int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth;
+//	int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth;
+//
+//	//------------- Computing the phase-field ------------------
+//	for (int x3 = minX3; x3 < maxX3; x3++) {
+//		for (int x2 = minX2; x2 < maxX2; x2++) {
+//			for (int x1 = minX1; x1 < maxX1; x1++) {
+//				// if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3))
+//				{
+//					int x1p = x1 + 1;
+//					int x2p = x2 + 1;
+//					int x3p = x3 + 1;
+//
+//					h[E]   = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);
+//					h[N]   = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);
+//					h[T]   = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);
+//					h[NE]  = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);
+//					h[NW]  = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);
+//					h[TE]  = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);
+//					h[TW]  = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);
+//					h[TN]  = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);
+//					h[TS]  = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);
+//					h[TNE] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);
+//					h[TNW] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);
+//					h[TSE] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);
+//					h[TSW] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);
+//
+//					h[W]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);
+//					h[S]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);
+//					h[B]   = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);
+//					h[SW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);
+//					h[SE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);
+//					h[BW]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);
+//					h[BE]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);
+//					h[BS]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);
+//					h[BN]  = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);
+//					h[BSW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);
+//					h[BSE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);
+//					h[BNW] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);
+//					h[BNE] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);
+//
+//					h[REST] = (*this->zeroDistributionsH1)(x1, x2, x3);
+//				}
+//			}
+//		}
+//	}
+//}
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+//	int x3)
+//{
+//	using namespace D3Q27System;
+//
+//	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+//
+//	phi[REST] = (*ph)(x1, x2, x3);
+//
+//
+//	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+//
+//		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+//			phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+//		} else {
+//			//phi[k] = (*ph)(x1 , x2, x3 );// neutral wetting
+//			phi[k] = 0.0;//unwetting
+//		}
+//	}
+//}
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2,
+//	int x3)
+//{
+//	using namespace D3Q27System;
+//
+//	SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray();
+//
+//	phi2[REST] = (*ph)(x1, x2, x3);
+//
+//
+//	for (int k = FSTARTDIR; k <= FENDDIR; k++) {
+//
+//		if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) {
+//			phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]);
+//		}
+//		else {
+//			phi2[k] = 0.05;
+//		}
+//	}
+//}
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::swapDistributions()
+//{
+//	LBMKernel::swapDistributions();
+//	dataSet->getHdistributions()->swap();
+//	dataSet->getH2distributions()->swap();
+//}
+//
+//void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::initForcing()
+//{
+//	muForcingX1.DefineVar("x1", &muX1); muForcingX1.DefineVar("x2", &muX2); muForcingX1.DefineVar("x3", &muX3);
+//	muForcingX2.DefineVar("x1", &muX1); muForcingX2.DefineVar("x2", &muX2); muForcingX2.DefineVar("x3", &muX3);
+//	muForcingX3.DefineVar("x1", &muX1); muForcingX3.DefineVar("x2", &muX2); muForcingX3.DefineVar("x3", &muX3);
+//
+//	muDeltaT = deltaT;
+//
+//	muForcingX1.DefineVar("dt", &muDeltaT);
+//	muForcingX2.DefineVar("dt", &muDeltaT);
+//	muForcingX3.DefineVar("dt", &muDeltaT);
+//
+//	muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0);
+//
+//	muForcingX1.DefineVar("nu", &muNu);
+//	muForcingX2.DefineVar("nu", &muNu);
+//	muForcingX3.DefineVar("nu", &muNu);
+//
+//	muForcingX1.DefineVar("rho",&muRho); 
+//	muForcingX2.DefineVar("rho",&muRho); 
+//	muForcingX3.DefineVar("rho",&muRho); 
+//
+//}
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h
new file mode 100644
index 000000000..c5bc35604
--- /dev/null
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h
@@ -0,0 +1,125 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h
+//! \ingroup LBMKernel
+//! \author M. Geier, K. Kutscher, Hesameddin Safari
+//=======================================================================================
+
+#ifndef MultiphaseSimpleVelocityBaseExternalPressureLBMKernel_H
+#define MultiphaseSimpleVelocityBaseExternalPressureLBMKernel_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief  Multiphase Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  M. Geier, K. Kutscher, Hesameddin Safari
+class MultiphaseSimpleVelocityBaseExternalPressureLBMKernel : public LBMKernel
+{
+public:
+    MultiphaseSimpleVelocityBaseExternalPressureLBMKernel();
+    virtual ~MultiphaseSimpleVelocityBaseExternalPressureLBMKernel(void) = default;
+    void calculate(int step) override;
+    SPtr<LBMKernel> clone() override;
+
+
+    ///refactor
+    //CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressure;
+
+
+    double getCalculationTime() override { return .0; }
+protected:
+    virtual void initDataSet();
+    void swapDistributions() override;
+
+    void initForcing();
+
+    void forwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void backwardInverseChimeraWithKincompressible(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K, LBMReal oneMinusRho);
+    void forwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+    void backwardChimera(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2);
+
+    LBMReal f1[D3Q27System::ENDF+1];
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsF;
+
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1;
+    CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1;
+    CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH1;
+
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2;
+    CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsH2;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr pressureOld;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr p1Old;
+
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld;
+    CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU; 
+
+    LBMReal h  [D3Q27System::ENDF+1];
+    LBMReal h2[D3Q27System::ENDF + 1];
+    LBMReal g  [D3Q27System::ENDF+1];
+    LBMReal phi[D3Q27System::ENDF+1];
+    LBMReal phi2[D3Q27System::ENDF + 1];
+    LBMReal pr1[D3Q27System::ENDF+1];
+    LBMReal phi_cutoff[D3Q27System::ENDF+1];
+
+    LBMReal gradX1_phi();
+    LBMReal gradX2_phi();
+    LBMReal gradX3_phi();
+	LBMReal gradX1_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
+	LBMReal gradX2_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
+	LBMReal gradX3_rhoInv(LBMReal rhoL, LBMReal rhoDIV);
+    LBMReal gradX1_phi2();
+    LBMReal gradX2_phi2();
+    LBMReal gradX3_phi2();
+    void computePhasefield();
+    void findNeighbors(CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3);
+    void findNeighbors2(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3);
+
+    LBMReal nabla2_phi();
+
+    mu::value_type muX1,muX2,muX3;
+    mu::value_type muDeltaT;
+    mu::value_type muNu;
+    mu::value_type muRho;
+    LBMReal forcingX1;
+    LBMReal forcingX2;
+    LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
index 229ff921a..db1397374 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp
@@ -468,7 +468,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step)
 			   uy2 = vvyF * vvyF;
 			   uz2 = vvzF * vvzF;
 			   LBMReal forcingTerm[D3Q27System::ENDF + 1];
-			   for (int dir = STARTF; dir <= (FENDDIR); dir++) {
+			   for (int dir = FSTARTDIR; dir <= FENDDIR; dir++) {
 				   LBMReal velProd = DX1[dir] * vvxF + DX2[dir] * vvyF + DX3[dir] * vvzF;
 				   LBMReal velSq1 = velProd * velProd;
 				   LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + (4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)));
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
index 623fcade6..28b035f71 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp
@@ -48,6 +48,7 @@ MultiphaseVelocityFormInitDistributionsBlockVisitor::MultiphaseVelocityFormInitD
 	this->setVx2(0.0);
 	this->setVx3(0.0);
 	this->setRho(0.0);
+	this->setPressure(0.0);
 }
 //////////////////////////////////////////////////////////////////////////
 void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( const mu::Parser& parser)  
@@ -79,6 +80,11 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPhi( const mu::Pars
 	this->checkFunction(parser); 
 	this->muPhi = parser;  
 }
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPressure(const mu::Parser& parser)
+{
+	this->checkFunction(parser);
+	this->muPressure = parser;
+}
 //////////////////////////////////////////////////////////////////////////
 void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( const std::string& muParserString)  
 { 
@@ -109,6 +115,11 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPhi( const std::str
 	this->muPhi.SetExpr(muParserString); 
 	this->checkFunction(muPhi); 
 }
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPressure(const std::string& muParserString)
+{
+	this->muPressure.SetExpr(muParserString);
+	this->checkFunction(muPressure);
+}
 //////////////////////////////////////////////////////////////////////////
 void MultiphaseVelocityFormInitDistributionsBlockVisitor::setVx1( LBMReal vx1 ) 
 { 
@@ -153,6 +164,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 	this->muVx3.DefineVar("x1",&x1); this->muVx3.DefineVar("x2",&x2); this->muVx3.DefineVar("x3",&x3);
 	this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3);
 	this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3);
+	this->muPressure.DefineVar("x1", &x1); this->muPressure.DefineVar("x2", &x2); this->muPressure.DefineVar("x3", &x3);
 
 	
 
@@ -169,6 +181,8 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
         SPtr<EsoTwist3D> distributionsF = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); 
 		SPtr<EsoTwist3D> distributionsH = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getHdistributions());
         SPtr<EsoTwist3D> distributionsH2 = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getH2distributions());
+		SPtr<PhaseFieldArray3D> pressure = dynamicPointerCast<PhaseFieldArray3D>(kernel->getDataSet()->getPressureField());
+
 
 		//LBMReal phiL = kernel->getPhiL();
 		//LBMReal phiH = kernel->getPhiH();
@@ -184,13 +198,16 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
                     x2              = coords[1];
                     x3              = coords[2];
 
-					LBMReal vx1 = 0, vx2 = 0, vx3 = 0, p1 = 0, phi = 0;
-					p1  = 0.0;
-					//p1 = muRho.Eval();
+					LBMReal vx1 = 0, vx2 = 0, vx3 = 0, p1 = 0, phi = 0,pres=0;
+					//p1  = 0.0;
+					p1 = muRho.Eval();
 					vx1 = muVx1.Eval();
 					vx2 = muVx2.Eval();
 					vx3 = muVx3.Eval();
 					phi = muPhi.Eval();
+					pres = muPressure.Eval();
+					(*pressure)(ix1, ix2, ix3) = pres;
+
 					
 					//rho = phi*1.0 + (1.0-phi)/densityRatio;
 					//LBMReal rhoH = 1.0;
@@ -250,66 +267,68 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3
 					distributionsF->setDistribution(f, ix1, ix2, ix3);
 					distributionsF->setDistributionInv(f, ix1, ix2, ix3);
 
-					f[DIR_P00]    =  phi * feq[DIR_P00]    ;// / rho;
-					f[DIR_M00]    =  phi * feq[DIR_M00]    ;// / rho;
-					f[DIR_0P0]    =  phi * feq[DIR_0P0]    ;// / rho;
-					f[DIR_0M0]    =  phi * feq[DIR_0M0]    ;// / rho;
-					f[DIR_00P]    =  phi * feq[DIR_00P]    ;// / rho;
-					f[DIR_00M]    =  phi * feq[DIR_00M]    ;// / rho;
-					f[DIR_PP0]   =  phi * feq[DIR_PP0]   ;// / rho;
-					f[DIR_MM0]   =  phi * feq[DIR_MM0]   ;// / rho;
-					f[DIR_PM0]   =  phi * feq[DIR_PM0]   ;// / rho;
-					f[DIR_MP0]   =  phi * feq[DIR_MP0]   ;// / rho;
-					f[DIR_P0P]   =  phi * feq[DIR_P0P]   ;// / rho;
-					f[DIR_M0M]   =  phi * feq[DIR_M0M]   ;// / rho;
-					f[DIR_P0M]   =  phi * feq[DIR_P0M]   ;// / rho;
-					f[DIR_M0P]   =  phi * feq[DIR_M0P]   ;// / rho;
-					f[DIR_0PP]   =  phi * feq[DIR_0PP]   ;// / rho;
-					f[DIR_0MM]   =  phi * feq[DIR_0MM]   ;// / rho;
-					f[DIR_0PM]   =  phi * feq[DIR_0PM]   ;// / rho;
-					f[DIR_0MP]   =  phi * feq[DIR_0MP]   ;// / rho;
-					f[DIR_PPP]  =  phi * feq[DIR_PPP]  ;// / rho;
-					f[DIR_MPP]  =  phi * feq[DIR_MPP]  ;// / rho;
-					f[DIR_PMP]  =  phi * feq[DIR_PMP]  ;// / rho;
-					f[DIR_MMP]  =  phi * feq[DIR_MMP]  ;// / rho;
-					f[DIR_PPM]  =  phi * feq[DIR_PPM]  ;// / rho;
-					f[DIR_MPM]  =  phi * feq[DIR_MPM]  ;// / rho;
-					f[DIR_PMM]  =  phi * feq[DIR_PMM]  ;// / rho;
-					f[DIR_MMM]  =  phi * feq[DIR_MMM]  ;// / rho;
-					f[DIR_000] =  phi * feq[DIR_000] ;// / rho;
+					f[DIR_000] = phi * feq[DIR_000];        // / rho;
+					f[DIR_P00] = phi * feq[DIR_P00]    ;// / rho;
+					f[DIR_M00] = phi * feq[DIR_M00]    ;// / rho;
+					f[DIR_0P0] = phi * feq[DIR_0P0]    ;// / rho;
+					f[DIR_0M0] = phi * feq[DIR_0M0]    ;// / rho;
+					f[DIR_00P] = phi * feq[DIR_00P]    ;// / rho;
+					f[DIR_00M] = phi * feq[DIR_00M]    ;// / rho;
+					f[DIR_PP0] = phi * feq[DIR_PP0]   ;// / rho;
+					f[DIR_MM0] = phi * feq[DIR_MM0]   ;// / rho;
+					f[DIR_PM0] = phi * feq[DIR_PM0]   ;// / rho;
+					f[DIR_MP0] = phi * feq[DIR_MP0]   ;// / rho;
+					f[DIR_P0P] = phi * feq[DIR_P0P]   ;// / rho;
+					f[DIR_M0M] = phi * feq[DIR_M0M]   ;// / rho;
+					f[DIR_P0M] = phi * feq[DIR_P0M]   ;// / rho;
+					f[DIR_M0P] = phi * feq[DIR_M0P]   ;// / rho;
+					f[DIR_0PP] = phi * feq[DIR_0PP]   ;// / rho;
+					f[DIR_0MM] = phi * feq[DIR_0MM]   ;// / rho;
+					f[DIR_0PM] = phi * feq[DIR_0PM]   ;// / rho;
+					f[DIR_0MP] = phi * feq[DIR_0MP]   ;// / rho;
+					f[DIR_PPP] = phi * feq[DIR_PPP]  ;// / rho;
+					f[DIR_MPP] = phi * feq[DIR_MPP]  ;// / rho;
+					f[DIR_PMP] = phi * feq[DIR_PMP]  ;// / rho;
+					f[DIR_MMP] = phi * feq[DIR_MMP]  ;// / rho;
+					f[DIR_PPM] = phi * feq[DIR_PPM]  ;// / rho;
+					f[DIR_MPM] = phi * feq[DIR_MPM]  ;// / rho;
+					f[DIR_PMM] = phi * feq[DIR_PMM]  ;// / rho;
+					f[DIR_MMM] =  phi * feq[DIR_MMM]  ;// / rho;
+					
 
 					distributionsH->setDistribution(f, ix1, ix2, ix3);
 					distributionsH->setDistributionInv(f, ix1, ix2, ix3);
 
 					if (distributionsH2) {
 
-						f[DIR_P00]    = (1.-phi) * feq[DIR_P00]   ;// / rho;
-						f[DIR_M00]    = (1.-phi) * feq[DIR_M00]   ;// / rho;
-						f[DIR_0P0]    = (1.-phi) * feq[DIR_0P0]   ;// / rho;
-						f[DIR_0M0]    = (1.-phi) * feq[DIR_0M0]   ;// / rho;
-						f[DIR_00P]    = (1.-phi) * feq[DIR_00P]   ;// / rho;
-						f[DIR_00M]    = (1.-phi) * feq[DIR_00M]   ;// / rho;
-						f[DIR_PP0]   = (1.-phi) * feq[DIR_PP0]  ;// / rho;
-						f[DIR_MM0]   = (1.-phi) * feq[DIR_MM0]  ;// / rho;
-						f[DIR_PM0]   = (1.-phi) * feq[DIR_PM0]  ;// / rho;
-						f[DIR_MP0]   = (1.-phi) * feq[DIR_MP0]  ;// / rho;
-						f[DIR_P0P]   = (1.-phi) * feq[DIR_P0P]  ;// / rho;
-						f[DIR_M0M]   = (1.-phi) * feq[DIR_M0M]  ;// / rho;
-						f[DIR_P0M]   = (1.-phi) * feq[DIR_P0M]  ;// / rho;
-						f[DIR_M0P]   = (1.-phi) * feq[DIR_M0P]  ;// / rho;
-						f[DIR_0PP]   = (1.-phi) * feq[DIR_0PP]  ;// / rho;
-						f[DIR_0MM]   = (1.-phi) * feq[DIR_0MM]  ;// / rho;
-						f[DIR_0PM]   = (1.-phi) * feq[DIR_0PM]  ;// / rho;
-						f[DIR_0MP]   = (1.-phi) * feq[DIR_0MP]  ;// / rho;
-						f[DIR_PPP]  = (1.-phi) * feq[DIR_PPP] ;// / rho;
-						f[DIR_MPP]  = (1.-phi) * feq[DIR_MPP] ;// / rho;
-						f[DIR_PMP]  = (1.-phi) * feq[DIR_PMP] ;// / rho;
-						f[DIR_MMP]  = (1.-phi) * feq[DIR_MMP] ;// / rho;
-						f[DIR_PPM]  = (1.-phi) * feq[DIR_PPM] ;// / rho;
-						f[DIR_MPM]  = (1.-phi) * feq[DIR_MPM] ;// / rho;
-						f[DIR_PMM]  = (1.-phi) * feq[DIR_PMM] ;// / rho;
-						f[DIR_MMM]  = (1.-phi) * feq[DIR_MMM] ;// / rho;
-						f[DIR_000] = (1.-phi) * feq[DIR_000];//  / rho;
+						f[DIR_000] = 0;//(1. - phi) * feq[DIR_000]; //  / rho;
+						f[DIR_P00] = 0;//(1.-phi) * feq[DIR_P00]   ;// / rho;
+						f[DIR_M00] = 0;//(1.-phi) * feq[DIR_M00]   ;// / rho;
+						f[DIR_0P0] = 0;//(1.-phi) * feq[DIR_0P0]   ;// / rho;
+						f[DIR_0M0] = 0;//(1.-phi) * feq[DIR_0M0]   ;// / rho;
+						f[DIR_00P] = 0;//(1.-phi) * feq[DIR_00P]   ;// / rho;
+						f[DIR_00M] = 0;//(1.-phi) * feq[DIR_00M]   ;// / rho;
+						f[DIR_PP0] = 0;//(1.-phi) * feq[DIR_PP0]  ;// / rho;
+						f[DIR_MM0] = 0;//(1.-phi) * feq[DIR_MM0]  ;// / rho;
+						f[DIR_PM0] = 0;//(1.-phi) * feq[DIR_PM0]  ;// / rho;
+						f[DIR_MP0] = 0;//(1.-phi) * feq[DIR_MP0]  ;// / rho;
+						f[DIR_P0P] = 0;//(1.-phi) * feq[DIR_P0P]  ;// / rho;
+						f[DIR_M0M] = 0;//(1.-phi) * feq[DIR_M0M]  ;// / rho;
+						f[DIR_P0M] = 0;//(1.-phi) * feq[DIR_P0M]  ;// / rho;
+						f[DIR_M0P] = 0;//(1.-phi) * feq[DIR_M0P]  ;// / rho;
+						f[DIR_0PP] = 0;//(1.-phi) * feq[DIR_0PP]  ;// / rho;
+						f[DIR_0MM] = 0;//(1.-phi) * feq[DIR_0MM]  ;// / rho;
+						f[DIR_0PM] = 0;//(1.-phi) * feq[DIR_0PM]  ;// / rho;
+						f[DIR_0MP] = 0;//(1.-phi) * feq[DIR_0MP]  ;// / rho;
+						f[DIR_PPP] = 0;//(1.-phi) * feq[DIR_PPP] ;// / rho;
+						f[DIR_MPP] = 0;//(1.-phi) * feq[DIR_MPP] ;// / rho;
+						f[DIR_PMP] = 0;//(1.-phi) * feq[DIR_PMP] ;// / rho;
+						f[DIR_MMP] = 0;//(1.-phi) * feq[DIR_MMP] ;// / rho;
+						f[DIR_PPM] = 0;//(1.-phi) * feq[DIR_PPM] ;// / rho;
+						f[DIR_MPM] = 0;//(1.-phi) * feq[DIR_MPM] ;// / rho;
+						f[DIR_PMM] = 0;//(1.-phi) * feq[DIR_PMM] ;// / rho;
+						f[DIR_MMM] = 0;//(1.-phi) * feq[DIR_MMM] ;// / rho;
+						
 
                         distributionsH2->setDistribution(f, ix1, ix2, ix3);
                         distributionsH2->setDistributionInv(f, ix1, ix2, ix3);                    
@@ -349,3 +368,10 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::setNu( LBMReal nu )
 	this->nu = nu;
 }
 
+void MultiphaseVelocityFormInitDistributionsBlockVisitor::setPressure(LBMReal pres)
+{
+	this->muPressure.SetExpr(UbSystem::toString(pres, D3Q27RealLim::digits10));
+	this->checkFunction(muPressure);
+
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
index 72841a7c5..553cfe75b 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h
@@ -65,12 +65,14 @@ public:
 	void setVx3( const mu::Parser& parser);
 	void setRho( const mu::Parser& parser);
 	void setPhi( const mu::Parser& parser);
+	void setPressure(const mu::Parser& parser);
 
 	void setVx1( const std::string& muParserString);
 	void setVx2( const std::string& muParserString);
 	void setVx3( const std::string& muParserString);
 	void setRho( const std::string& muParserString);
 	void setPhi( const std::string& muParserString);
+	void setPressure(const std::string& muParserString);
 
 	//////////////////////////////////////////////////////////////////////////
 	void setVx1( LBMReal vx1 );
@@ -79,6 +81,7 @@ public:
 	void setRho( LBMReal rho );
 	void setPhi( LBMReal rho );
 	void setNu( LBMReal nu );
+	void setPressure(LBMReal pres);
 
 	void visit(SPtr<Grid3D> grid, SPtr<Block3D> block);
 
@@ -91,6 +94,7 @@ private:
 	mu::Parser muVx3;
 	mu::Parser muRho;
 	mu::Parser muPhi;
+	mu::Parser muPressure;
 
 	LBMReal nu;
 };
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
index 0b8b631e6..3bb154689 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
@@ -55,7 +55,7 @@ void RefineCrossAndInsideGbObjectHelper::refine()
 
     std::vector<int> dirs;
 
-    for (int i = D3Q27System::DIR_P00; i < D3Q27System::ENDDIR; i++) {
+    for (int i = D3Q27System::STARTDIR; i <= D3Q27System::ENDDIR; i++) {
         dirs.push_back(i);
     }
     SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 53068df96..793021945 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -114,7 +114,7 @@ void SetConnectorsBlockVisitor<T1, T2>::setSameLevelConnectors(SPtr<Grid3D> grid
         int ix3   = block->getX3();
         int level = block->getLevel();
 
-        for (int dir = D3Q27System::STARTDIR; dir < D3Q27System::ENDDIR; dir++) {
+        for (int dir = D3Q27System::STARTDIR; dir <= D3Q27System::ENDDIR; dir++) {
             SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
 
             if (neighBlock) {
diff --git a/utilities/DirRename.py b/utilities/DirRename.py
new file mode 100644
index 000000000..3f01e630a
--- /dev/null
+++ b/utilities/DirRename.py
@@ -0,0 +1,181 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Dec  6 13:21:27 2022
+
+@author: kutscher
+"""
+
+filename = "d:/temp/MultiphaseNonReflectingOutflowBCAlgorithm.cpp"
+
+#read input file
+fin = open(filename, "rt")
+#read file contents to string
+data = fin.read()
+#replace all occurrences of the required string
+data = data.replace('[REST]','[DIR_000]')
+data = data.replace('[TNE]', '[DIR_PPP]')
+data = data.replace('[TNW]', '[DIR_MPP]')
+data = data.replace('[TSE]', '[DIR_PMP]')
+data = data.replace('[TSW]', '[DIR_MMP]')
+data = data.replace('[BNE]', '[DIR_PPM]')
+data = data.replace('[BNW]', '[DIR_MPM]')
+data = data.replace('[BSE]', '[DIR_PMM]')
+data = data.replace('[BSW]', '[DIR_MMM]')
+data = data.replace('[NE]',  '[DIR_PP0]')
+data = data.replace('[SW]',  '[DIR_MM0]')
+data = data.replace('[SE]',  '[DIR_PM0]')
+data = data.replace('[NW]',  '[DIR_MP0]')
+data = data.replace('[TE]',  '[DIR_P0P]')
+data = data.replace('[BW]',  '[DIR_M0M]')
+data = data.replace('[BE]',  '[DIR_P0M]')
+data = data.replace('[TW]',  '[DIR_M0P]')
+data = data.replace('[TN]',  '[DIR_0PP]')
+data = data.replace('[BS]',  '[DIR_0MM]')
+data = data.replace('[BN]',  '[DIR_0PM]')
+data = data.replace('[TS]',  '[DIR_0MP]')
+data = data.replace('[NE ]', '[DIR_PP0]')
+data = data.replace('[SW ]', '[DIR_MM0]')
+data = data.replace('[SE ]', '[DIR_PM0]')
+data = data.replace('[NW ]', '[DIR_MP0]')
+data = data.replace('[TE ]', '[DIR_P0P]')
+data = data.replace('[BW ]', '[DIR_M0M]')
+data = data.replace('[BE ]', '[DIR_P0M]')
+data = data.replace('[TW ]', '[DIR_M0P]')
+data = data.replace('[TN ]', '[DIR_0PP]')
+data = data.replace('[BS ]', '[DIR_0MM]')
+data = data.replace('[BN ]', '[DIR_0PM]')
+data = data.replace('[TS ]', '[DIR_0MP]')
+data = data.replace('[E]',   '[DIR_P00]')
+data = data.replace('[W]',   '[DIR_M00]')
+data = data.replace('[N]',   '[DIR_0P0]')
+data = data.replace('[S]',   '[DIR_0M0]')
+data = data.replace('[T]',   '[DIR_00P]')
+data = data.replace('[B]',   '[DIR_00M]')
+
+# data = data.replace('[REST]','[DIR_000]')
+# data = data.replace('[E  ]', '[DIR_P00]')
+# data = data.replace('[W  ]', '[DIR_M00]')
+# data = data.replace('[N  ]', '[DIR_0P0]')
+# data = data.replace('[S  ]', '[DIR_0M0]')
+# data = data.replace('[T  ]', '[DIR_00P]')
+# data = data.replace('[B  ]', '[DIR_00M]')
+# data = data.replace('[NE ]', '[DIR_PP0]')
+# data = data.replace('[SW ]', '[DIR_MM0]')
+# data = data.replace('[SE ]', '[DIR_PM0]')
+# data = data.replace('[NW ]', '[DIR_MP0]')
+# data = data.replace('[TE ]', '[DIR_P0P]')
+# data = data.replace('[BW ]', '[DIR_M0M]')
+# data = data.replace('[BE ]', '[DIR_P0M]')
+# data = data.replace('[TW ]', '[DIR_M0P]')
+# data = data.replace('[TN ]', '[DIR_0PP]')
+# data = data.replace('[BS ]', '[DIR_0MM]')
+# data = data.replace('[BN ]', '[DIR_0PM]')
+# data = data.replace('[TS ]', '[DIR_0MP]')
+# data = data.replace('[TNE]', '[DIR_PPP]')
+# data = data.replace('[TNW]', '[DIR_MPP]')
+# data = data.replace('[TSE]', '[DIR_PMP]')
+# data = data.replace('[TSW]', '[DIR_MMP]')
+# data = data.replace('[BNE]', '[DIR_PPM]')
+# data = data.replace('[BNW]', '[DIR_MPM]')
+# data = data.replace('[BSE]', '[DIR_PMM]')
+# data = data.replace('[BSW]', '[DIR_MMM]')
+
+# data = data.replace('D3Q27System::REST','[DIR_000]')
+# data = data.replace('D3Q27System::E', '[DIR_P00]')
+# data = data.replace('D3Q27System::W', '[DIR_M00]')
+# data = data.replace('D3Q27System::N', '[DIR_0P0]')
+# data = data.replace('D3Q27System::S', '[DIR_0M0]')
+# data = data.replace('D3Q27System::T', '[DIR_00P]')
+# data = data.replace('D3Q27System::B', '[DIR_00M]')
+# data = data.replace('D3Q27System::NE', '[DIR_PP0]')
+# data = data.replace('D3Q27System::SW', '[DIR_MM0]')
+# data = data.replace('D3Q27System::SE', '[DIR_PM0]')
+# data = data.replace('D3Q27System::NW', '[DIR_MP0]')
+# data = data.replace('D3Q27System::TE', '[DIR_P0P]')
+# data = data.replace('D3Q27System::BW', '[DIR_M0M]')
+# data = data.replace('D3Q27System::BE', '[DIR_P0M]')
+# data = data.replace('D3Q27System::TW', '[DIR_M0P]')
+# data = data.replace('D3Q27System::TN', '[DIR_0PP]')
+# data = data.replace('D3Q27System::BS', '[DIR_0MM]')
+# data = data.replace('D3Q27System::BN', '[DIR_0PM]')
+# data = data.replace('D3Q27System::TS', '[DIR_0MP]')
+# data = data.replace('D3Q27System::TNE', '[DIR_PPP]')
+# data = data.replace('D3Q27System::TNW', '[DIR_MPP]')
+# data = data.replace('D3Q27System::TSE', '[DIR_PMP]')
+# data = data.replace('D3Q27System::TSW', '[DIR_MMP]')
+# data = data.replace('D3Q27System::BNE', '[DIR_PPM]')
+# data = data.replace('D3Q27System::BNW', '[DIR_MPM]')
+# data = data.replace('D3Q27System::BSE', '[DIR_PMM]')
+# data = data.replace('D3Q27System::BSW', '[DIR_MMM]')
+
+data = data.replace('REST)','DIR_000)')
+data = data.replace('TNE)', 'DIR_PPP)')
+data = data.replace('TNW)', 'DIR_MPP)')
+data = data.replace('TSE)', 'DIR_PMP)')
+data = data.replace('TSW)', 'DIR_MMP)')
+data = data.replace('BNE)', 'DIR_PPM)')
+data = data.replace('BNW)', 'DIR_MPM)')
+data = data.replace('BSE)', 'DIR_PMM)')
+data = data.replace('BSW)', 'DIR_MMM)')
+data = data.replace('NE)',  'DIR_PP0)')
+data = data.replace('SW)',  'DIR_MM0)')
+data = data.replace('SE)',  'DIR_PM0)')
+data = data.replace('NW)',  'DIR_MP0)')
+data = data.replace('TE)',  'DIR_P0P)')
+data = data.replace('BW)',  'DIR_M0M)')
+data = data.replace('BE)',  'DIR_P0M)')
+data = data.replace('TW)',  'DIR_M0P)')
+data = data.replace('TN)',  'DIR_0PP)')
+data = data.replace('BS)',  'DIR_0MM)')
+data = data.replace('BN)',  'DIR_0PM)')
+data = data.replace('TS)',  'DIR_0MP)')
+data = data.replace('E)',   'DIR_P00)')
+data = data.replace('W)',   'DIR_M00)')
+data = data.replace('N)',   'DIR_0P0)')
+data = data.replace('S)',   'DIR_0M0)')
+data = data.replace('T)',   'DIR_00P)')
+data = data.replace('B)',   'DIR_00M)')
+
+# data = data.replace('REST','DIR_000')
+# data = data.replace('TNE', 'DIR_PPP')
+# data = data.replace('TNW', 'DIR_MPP')
+# data = data.replace('TSE', 'DIR_PMP')
+# data = data.replace('TSW', 'DIR_MMP')
+# data = data.replace('BNE', 'DIR_PPM')
+# data = data.replace('BNW', 'DIR_MPM')
+# data = data.replace('BSE', 'DIR_PMM')
+# data = data.replace('BSW', 'DIR_MMM')
+# data = data.replace('NE',  'DIR_PP0')
+# data = data.replace('SW',  'DIR_MM0')
+# data = data.replace('SE',  'DIR_PM0')
+# data = data.replace('NW',  'DIR_MP0')
+# data = data.replace('TE',  'DIR_P0P')
+# data = data.replace('BW',  'DIR_M0M')
+# data = data.replace('BE',  'DIR_P0M')
+# data = data.replace('TW',  'DIR_M0P')
+# data = data.replace('TN',  'DIR_0PP')
+# data = data.replace('BS',  'DIR_0MM')
+# data = data.replace('BN',  'DIR_0PM')
+# data = data.replace('TS',  'DIR_0MP')
+# data = data.replace('E',   'DIR_P00')
+# data = data.replace('W',   'DIR_M00')
+# data = data.replace('N',   'DIR_0P0')
+# data = data.replace('S',   'DIR_0M0')
+# data = data.replace('T',   'DIR_00P')
+# data = data.replace('B',   'DIR_00M')
+
+# text = 'bat::ball'
+
+# # replace b with c
+# replaced_text = text.replace('b', 'c')
+# print(replaced_text)
+
+
+#close the input file
+fin.close()
+#open the input file in write mode
+fin = open(filename, "wt")
+#overrite the input file with the resulting data
+fin.write(data)
+#close the file
+fin.close()
\ No newline at end of file
-- 
GitLab


From 1d14c4bf11acd2e8cde66f3d30e7f33c24a5c885 Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 10:33:23 +0100
Subject: [PATCH 092/179] Set use liggghts to off.

---
 cpu.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpu.cmake b/cpu.cmake
index 1e2b159d4..13f216203 100644
--- a/cpu.cmake
+++ b/cpu.cmake
@@ -29,7 +29,7 @@ SET(USE_CATALYST OFF CACHE BOOL "include Paraview Catalyst support")
 SET(USE_HLRN_LUSTRE OFF CACHE BOOL "include HLRN Lustre support")
 SET(USE_DEM_COUPLING OFF CACHE BOOL "PE plugin")
 
-SET(USE_LIGGGHTS ON CACHE BOOL "include LIGGGHTS library support")
+SET(USE_LIGGGHTS OFF CACHE BOOL "include LIGGGHTS library support")
 
 #MPI
 IF((NOT ${CMAKE_CXX_COMPILER} MATCHES mpicxx) AND (NOT ${CMAKE_CXX_COMPILER} MATCHES mpiicpc))# OR NOT ${CMAKE_CXX_COMPILER} MATCHES cc OR NOT ${CMAKE_CXX_COMPILER} MATCHES mpiCC)
-- 
GitLab


From 5e85dcaa814d0374941fc10dec18b0e4bd20f2ca Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 11:02:37 +0100
Subject: [PATCH 093/179] fix warnings

---
 .../VirtualFluidsCore/LBM/LBMUnitConverter.h  |   2 +-
 .../LBM/MultiphasePressureFilterLBMKernel.cpp |   4 +-
 ...eVelocityBaseExternalPressureLBMKernel.cpp | 110 +++++++++---------
 3 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
index 7c4ef7372..de485c28d 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
@@ -126,7 +126,7 @@ public:
     double getFactorForceWToLb() { return 1.0 / this->getFactorForceLbToW(); }
 
     double getFactorTorqueLbToW() { return factorMassLbToW * factorLengthLbToW * factorLengthLbToW / (factorTimeLbToW * factorTimeLbToW);}
-    double getFactorTorqueWToLb() { return 1.0 / this->getFactorTorqueWToLb(); }
+    double getFactorTorqueWToLb() { return 1.0 / this->getFactorTorqueLbToW(); }
 
     double getFactorAccLbToW() { return factorLengthLbToW / (factorTimeLbToW * factorTimeLbToW); }
     double getFactorAccWToLb() { return 1.0 / this->getFactorAccLbToW(); }
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
index 918a162e3..e1d24a227 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp
@@ -510,8 +510,8 @@ void MultiphasePressureFilterLBMKernel::calculate(int step)
 					LBMReal vvyI = vvy;
 					LBMReal vvzI = vvz;
 
-					LBMReal collFactorStore = collFactorM;
-					LBMReal stress;
+					//LBMReal collFactorStore = collFactorM;
+					//LBMReal stress;
 					for (int iter = 0; iter < 1; iter++) {
 						LBMReal OxxPyyPzz = 1.0;
 						LBMReal mxxPyyPzz = (M200 - vvxI * vvxI) + (M020 - vvyI * vvyI) + (M002 - vvzI * vvzI);
diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
index 673ea2927..0d8452060 100644
--- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp
@@ -303,7 +303,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 
 					//Mathematica
 
-					LBMReal rho = ((*pressure)(x1, x2, x3) - (*phaseField)(x1, x2, x3) * (*pressure)(x1, x2, x3) + c1o3 * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (c1o3 + c1o3 * drho * (-1 + (*phaseField)(x1, x2, x3)));
+					//LBMReal rho = ((*pressure)(x1, x2, x3) - (*phaseField)(x1, x2, x3) * (*pressure)(x1, x2, x3) + c1o3 * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (c1o3 + c1o3 * drho * (-1 + (*phaseField)(x1, x2, x3)));
 					(*pressureOld)(x1, x2, x3) = ((*pressure)(x1, x2, x3) + c1o3 * drho * (rhoH + ((*phaseField)(x1, x2, x3) - phiH) * rhoToPhi)) / (1 + drho * (-1 + (*phaseField)(x1, x2, x3)));
 /////Full Filter
 					//LBMReal rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) - phiH)+(one- (*phaseField)(x1, x2, x3))*three* (*pressure)(x1, x2, x3); //explicit Compressible
@@ -563,15 +563,15 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 					//	}
 					//}
 
-					LBMReal gradPx = ((((arrayP[2][0][0] - arrayP[0][2][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
-						+ (((arrayP[2][1][0] - arrayP[0][1][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[2][0][1] - arrayP[0][2][1]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
-						+ (arrayP[2][1][1] - arrayP[0][1][1]) * c2o9;
-					LBMReal gradPy = ((((arrayP[0][2][0] - arrayP[2][0][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[0][2][2] - arrayP[2][0][0]))) * c1o72
-						+ (((arrayP[1][2][0] - arrayP[1][0][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[0][2][1] - arrayP[2][0][1]) + (arrayP[1][2][2] - arrayP[1][0][0]))) * c1o18)
-						+ (arrayP[1][2][1] - arrayP[1][0][1]) * c2o9;
-					LBMReal gradPz = ((((arrayP[0][0][2] - arrayP[2][2][0]) + (arrayP[0][2][2] - arrayP[2][0][0])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
-						+ (((arrayP[0][1][2] - arrayP[2][1][0]) + (arrayP[1][2][2] - arrayP[1][0][0])) + ((arrayP[1][0][2] - arrayP[1][2][0]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
-						+ (arrayP[1][1][2] - arrayP[1][1][0]) * c2o9;
+					//LBMReal gradPx = ((((arrayP[2][0][0] - arrayP[0][2][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+					//	+ (((arrayP[2][1][0] - arrayP[0][1][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[2][0][1] - arrayP[0][2][1]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+					//	+ (arrayP[2][1][1] - arrayP[0][1][1]) * c2o9;
+					//LBMReal gradPy = ((((arrayP[0][2][0] - arrayP[2][0][2]) + (arrayP[2][2][0] - arrayP[0][0][2])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[0][2][2] - arrayP[2][0][0]))) * c1o72
+					//	+ (((arrayP[1][2][0] - arrayP[1][0][2]) + (arrayP[2][2][1] - arrayP[0][0][1])) + ((arrayP[0][2][1] - arrayP[2][0][1]) + (arrayP[1][2][2] - arrayP[1][0][0]))) * c1o18)
+					//	+ (arrayP[1][2][1] - arrayP[1][0][1]) * c2o9;
+					//LBMReal gradPz = ((((arrayP[0][0][2] - arrayP[2][2][0]) + (arrayP[0][2][2] - arrayP[2][0][0])) + ((arrayP[2][2][2] - arrayP[0][0][0]) + (arrayP[2][0][2] - arrayP[0][2][0]))) * c1o72
+					//	+ (((arrayP[0][1][2] - arrayP[2][1][0]) + (arrayP[1][2][2] - arrayP[1][0][0])) + ((arrayP[1][0][2] - arrayP[1][2][0]) + (arrayP[2][1][2] - arrayP[0][1][0]))) * c1o18)
+					//	+ (arrayP[1][1][2] - arrayP[1][1][0]) * c2o9;
 
 					//gradPx *=c1 - (*pressure)(x1, x2, x3)+pressureHere;
 					//gradPy *=c1 - (*pressure)(x1, x2, x3) + pressureHere;
@@ -797,13 +797,13 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
 						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb) * c1o3;
 					//22.09.22 not yet in balance, repaire here
-					LBMReal ppStar = ((((((mfhaaa + mfhccc) + (mfhaac + mfhcca)) + ((mfhcac + mfhaca) + (mfhcaa + mfhacc)))*c3
-						+ (((mfhaab + mfhccb) + (mfhacb + mfhcab)) + ((mfhaba + mfhcbc) + (mfhabc + mfhcba)) + ((mfhbaa + mfhbcc) + (mfhbac + mfhbca))))*c2
-						+ ((mfhabb + mfhcbb) + (mfhbab + mfhbcb) + (mfhbba + mfhbbc))) ) * c1o3/rho;
+					//LBMReal ppStar = ((((((mfhaaa + mfhccc) + (mfhaac + mfhcca)) + ((mfhcac + mfhaca) + (mfhcaa + mfhacc)))*c3
+					//	+ (((mfhaab + mfhccb) + (mfhacb + mfhcab)) + ((mfhaba + mfhcbc) + (mfhabc + mfhcba)) + ((mfhbaa + mfhbcc) + (mfhbac + mfhbca))))*c2
+					//	+ ((mfhabb + mfhcbb) + (mfhbab + mfhbcb) + (mfhbba + mfhbbc))) ) * c1o3/rho;
 	
-					ppStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))) * c3
-						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca)))) * c2
-						+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)))) * c1o3 ;
+					//ppStar = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc))) * c3
+					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca)))) * c2
+					//	+ ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)))) * c1o3 ;
 
 					//(*phaseFieldOld)(x1, x2, x3) = ((*phaseFieldOld)(x1, x2, x3) > 99.0) ? phi[DIR_000] : (*phaseFieldOld)(x1, x2, x3);
 					//LBMReal dtPhi = phi[DIR_000] - (*phaseFieldOld)(x1, x2, x3);
@@ -906,9 +906,9 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 					//mfcac += (forcingX1 - forcingX2 + forcingX3) * c1o72;
 					//mfaac += (-forcingX1 - forcingX2 + forcingX3) * c1o72;
 
-					LBMReal saveForceX1 = forcingX1;
-					LBMReal saveForceX2 = forcingX2;
-					LBMReal saveForceX3 = forcingX3;
+					//LBMReal saveForceX1 = forcingX1;
+					//LBMReal saveForceX2 = forcingX2;
+					//LBMReal saveForceX3 = forcingX3;
 
 					 vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
 						(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
@@ -921,15 +921,15 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 						(mfbbc - mfbba)) / rhoRef;
 
 
-					 LBMReal dRhoInvX = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
-						 (((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
-						 (mfhcbb - mfhabb)));
-					 LBMReal dRhoInvY = -(((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
-						 (((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
-						 (mfhbcb - mfhbab)));
-					 LBMReal dRhoInvZ = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
-						 (((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
-						 (mfhbbc - mfhbba)));
+					 //LBMReal dRhoInvX = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) +
+						// (((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) +
+						// (mfhcbb - mfhabb)));
+					 //LBMReal dRhoInvY = -(((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) +
+						// (((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) +
+						// (mfhbcb - mfhbab)));
+					 //LBMReal dRhoInvZ = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhacc - mfhcaa) + (mfhaac - mfhcca))) +
+						// (((mfhbac - mfhbca) + (mfhbcc - mfhbaa)) + ((mfhabc - mfhcba) + (mfhcbc - mfhaba))) +
+						// (mfhbbc - mfhbba)));
 
 
 					 forcingX1 = 0.0;
@@ -946,9 +946,9 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho + pStar * dX1_rhoInv * rho) *c1o2;
 					//forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho + pStar * dX2_rhoInv * rho) *c1o2;
 					//forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho + pStar * dX3_rhoInv * rho) *c1o2;
-					 LBMReal FdX1_phi = normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
-					 LBMReal FdX2_phi = normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
-					 LBMReal FdX3_phi = normX3 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					 //LBMReal FdX1_phi = normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					 //LBMReal FdX2_phi = normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
+					 //LBMReal FdX3_phi = normX3 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale;
 
 
 					//forcingX1 = (-pStar * dX1_phi * rhoToPhi / rho ) ;
@@ -989,7 +989,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 
 					 ///Experimental interface sharpening force 20.06.2022
 
-					 LBMReal scaleSharpener = 1.0;
+					 //LBMReal scaleSharpener = 1.0;
 					 //forcingX1 += scaleSharpener * (FdX1_phi - dX1_phi) * fabsf(FdX1_phi - dX1_phi)  / rho;
 					 //forcingX2 += scaleSharpener * (FdX2_phi - dX2_phi) * fabsf(FdX2_phi - dX2_phi)  / rho;
 					 //forcingX3 += scaleSharpener * (FdX3_phi - dX3_phi) * fabsf(FdX3_phi - dX3_phi)  / rho;
@@ -998,7 +998,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 					forcingX2 += mu * dX2_phi/rho;
 					forcingX3 += mu * dX3_phi/rho;
 
-					LBMReal forcingBIAS = 0.5;
+					//LBMReal forcingBIAS = 0.5;
 					forcingX1 += muForcingX1.Eval() / rho;//*phi[DIR_000];
 					forcingX2 += muForcingX2.Eval() / rho;// * phi[DIR_000];
 					forcingX3 += muForcingX3.Eval() / rho;// * phi[DIR_000];
@@ -1027,31 +1027,31 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 
 
 					//Abbas
-					LBMReal M200 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
-						+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) ))
-						+ ((mfabb + mfcbb))) );
-					LBMReal M020 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
-						+ (((mfaab + mfccb) + (mfacb + mfcab))  + ((mfbaa + mfbcc) + (mfbac + mfbca))))
-						+ ( (mfbab + mfbcb) )) );
-					LBMReal M002 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
-						+ ( + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
-						+ ( (mfbba + mfbbc))));
-
-					LBMReal M110 = ((((((mfaaa + mfccc) + (-mfcac - mfaca)) + ((mfaac + mfcca) + (-mfcaa -mfacc)))
-						+ (((mfaab + mfccb) + (-mfacb - mfcab))   ))
-						) );
-					LBMReal M101 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcac + mfaca) - (mfcaa + mfacc)))
-						+ (((mfaba + mfcbc) + (-mfabc - mfcba))))
-						));
-					LBMReal M011 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ( (mfcaa + mfacc)- (mfcac + mfaca)))
-						+ (((mfbaa + mfbcc) + (-mfbac - mfbca))))
-						));
+					//LBMReal M200 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+					//	+ (((mfaab + mfccb) + (mfacb + mfcab)) + ((mfaba + mfcbc) + (mfabc + mfcba)) ))
+					//	+ ((mfabb + mfcbb))) );
+					//LBMReal M020 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+					//	+ (((mfaab + mfccb) + (mfacb + mfcab))  + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+					//	+ ( (mfbab + mfbcb) )) );
+					//LBMReal M002 = ((((((mfaaa + mfccc) + (mfaac + mfcca)) + ((mfcac + mfaca) + (mfcaa + mfacc)))
+					//	+ ( + ((mfaba + mfcbc) + (mfabc + mfcba)) + ((mfbaa + mfbcc) + (mfbac + mfbca))))
+					//	+ ( (mfbba + mfbbc))));
+
+					//LBMReal M110 = ((((((mfaaa + mfccc) + (-mfcac - mfaca)) + ((mfaac + mfcca) + (-mfcaa -mfacc)))
+					//	+ (((mfaab + mfccb) + (-mfacb - mfcab))   ))
+					//	) );
+					//LBMReal M101 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ((mfcac + mfaca) - (mfcaa + mfacc)))
+					//	+ (((mfaba + mfcbc) + (-mfabc - mfcba))))
+					//	));
+					//LBMReal M011 = ((((((mfaaa + mfccc) - (mfaac + mfcca)) + ( (mfcaa + mfacc)- (mfcac + mfaca)))
+					//	+ (((mfbaa + mfbcc) + (-mfbac - mfbca))))
+					//	));
 					LBMReal vvxI = vvx;
 					LBMReal vvyI = vvy;
 					LBMReal vvzI = vvz;
 
-					LBMReal collFactorStore=collFactorM;
-					LBMReal stress;
+					//LBMReal collFactorStore=collFactorM;
+					//LBMReal stress;
 					//for(int iter=0;iter<5;iter++)
 				 //{
 					//	LBMReal OxxPyyPzz = 1.0;
@@ -1484,7 +1484,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step)
 					//FIXME:  warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' )
 					LBMReal BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM));
 					//LBMReal stress = 1.0;// stress / (stress + 1.0e-10);
-					stress = 1.0;
+					//stress = 1.0;
 					//OxyyPxzz += stress*(1.0-OxyyPxzz);
 					//OxyyPxzz = c3 * (collFactorM - c2) / (collFactorM - c3);
 					//OxyyMxzz += stress*(1.0-OxyyMxzz);
-- 
GitLab


From 088965e605901161dda5444e0b1e5deb0f4a0b6c Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 11:39:24 +0100
Subject: [PATCH 094/179] fix warnings

---
 apps/cpu/JetBreakup/JetBreakup.cpp         | 8 ++++----
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index aabc3f4d0..03c1d34c4 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -81,7 +81,7 @@ void run(string configname)
 
         // Sleep(30000);
 
-        double rho_h, rho_l, r_rho, mu_h, mu_l, Uo, D, sigma;
+        double rho_h=0, rho_l=0, r_rho=0, mu_h=0, /*mu_l,*/ Uo=0, D=0, sigma=0;
 
         switch (caseN) {
             case 1: 
@@ -94,7 +94,7 @@ void run(string configname)
                 //dynamic viscosity of heavy fluid (Pa � s)
                 mu_h = 2.87e-3;
                 //dynamic viscosity of light fluid (Pa � s)
-                mu_l = 1.97e-5;
+                //mu_l = 1.97e-5;
                 //velocity (m/s)
                 Uo = 100;
                 //diameter of jet (m)
@@ -112,7 +112,7 @@ void run(string configname)
                 // dynamic viscosity of heavy fluid (Pa � s)
                 mu_h = 2.87e-3;
                 // dynamic viscosity of light fluid (Pa � s)
-                mu_l = 1.84e-5;
+                //mu_l = 1.84e-5;
                 // velocity (m/s)
                 Uo = 200;
                 // diameter of jet (m)
@@ -130,7 +130,7 @@ void run(string configname)
                 // dynamic viscosity of heavy fluid (Pa � s)
                 mu_h = 2.87e-3;
                 // dynamic viscosity of light fluid (Pa � s)
-                mu_l = 1.84e-5;
+                //mu_l = 1.84e-5;
                 // velocity (m/s)
                 Uo = 200;
                 // diameter of jet (m)
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index f5e215fe7..448353340 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -46,7 +46,7 @@ void run(string configname)
         double cpStart     = config.getValue<double>("cpStart");
         double cpStep      = config.getValue<double>("cpStep");
         bool newStart      = config.getValue<bool>("newStart");
-        double rStep = config.getValue<double>("rStep");
+        //double rStep = config.getValue<double>("rStep");
 
         std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance();
         int myid                = comm->getProcessID();
@@ -100,13 +100,13 @@ void run(string configname)
         //density of heavy fluid
         LBMReal rho_h = 1.0;
         //density of light fluid
-        LBMReal rho_l = rho_h / r_rho;
+        //LBMReal rho_l = rho_h / r_rho;
 
         //kinimatic viscosity
         LBMReal nu_h = nuL;
         //LBMReal nu_l = nuG;
         //#dynamic viscosity
-        LBMReal mu_h = rho_h * nu_h;
+        //LBMReal mu_h = rho_h * nu_h;
         
         //gravity
         LBMReal g_y = Re * Re * nu_h * nu_h / (D*D*D);
-- 
GitLab


From 5eb4f8c195fa685284d0c154a5bbfcfa8c1a7a19 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 14:06:37 +0100
Subject: [PATCH 095/179] Fix wrong scaling factor for stress in Probes

---
 apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp        | 13 +++++++------
 src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp   |  4 ++++
 src/gpu/VirtualFluids_GPU/Parameter/Parameter.h     |  2 ++
 .../PreCollisionInteractor/Probes/Probe.cu          |  2 +-
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
index 51b890d20..7d2d79d8c 100644
--- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
+++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
@@ -238,11 +238,11 @@ void multipleLevel(const std::string& configPath)
     if(isFirstSubDomain || isMidSubDomain)
     {
         xGridMax += overlap;
-        xGridMin -= overlap;
+        // xGridMin -= overlap;
     }
     if(isLastSubDomain || isMidSubDomain)
     {
-        xGridMax += overlap;
+        // xGridMax += overlap;
         xGridMin -= overlap;
     }
 
@@ -252,8 +252,8 @@ void multipleLevel(const std::string& configPath)
     {
         gridBuilder->setNumberOfLayers(4,0);
         real xMaxRefinement = readPrecursor? xGridMax-H: xGridMax;   //Stop refinement some distance before outlet if domain ist not periodic
-        gridBuilder->addGrid( new Cuboid( xGridMin+dx, 0.f, 0.f, xMaxRefinement, L_y,  0.5*L_z) , 1 );
-
+        // gridBuilder->addGrid( new Cuboid( xGridMin+dx, 0.f, 0.f, xMaxRefinement, L_y,  0.5*L_z) , 1 );
+        gridBuilder->addGrid( new Cuboid( 0.f, 0.f, 0.f, 5000.0, L_y,  0.5*L_z) , 1 );
         para->setMaxLevel(2);
         scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
     }
@@ -302,8 +302,9 @@ void multipleLevel(const std::string& configPath)
     {
         if(isFirstSubDomain || nProcs == 1)
         {   
-            auto precursor = createFileCollection(precursorDirectory + "/precursor", FileType::VTK);
-            gridBuilder->setPrecursorBoundaryCondition(SideType::MX, precursor, nTReadPrecursor);
+            // auto precursor = createFileCollection(precursorDirectory + "/precursor", FileType::VTK);
+            // gridBuilder->setPrecursorBoundaryCondition(SideType::MX, precursor, nTReadPrecursor);
+            gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0);
         }
 
         if(isLastSubDomain || nProcs == 1)
diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp
index df53a0d93..d1568932d 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp
+++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp
@@ -861,6 +861,10 @@ real Parameter::getScaledForceRatio(int level)
 {
     return this->getForceRatio()*(level+1);
 }
+real Parameter::getScaledStressRatio(int level)
+{
+    return this->getVelocityRatio()*this->getVelocityRatio();
+}
 void Parameter::setRealX(real RealX)
 {
     ic.RealX = RealX;
diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
index cf71b20bb..de5e2b0a4 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
+++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
@@ -778,6 +778,8 @@ public:
     real getScaledDensityRatio(int level);
     //! \returns the pressure ratio in SI/LB units scaled to the respective level
     real getScaledPressureRatio(int level);
+    //! \returns the stress ratio in SI/LB units scaled to the respective level
+    real getScaledStressRatio(int level)
     //! \returns the time ratio in SI/LB units scaled to the respective level
     real getScaledTimeRatio(int level);
     //! \returns the length ratio in SI/LB units scaled to the respective level
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
index 3bde6e8d8..44f76220f 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
@@ -187,7 +187,7 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager*
     this->velocityRatio      = std::bind(&Parameter::getScaledVelocityRatio,        para, _1); 
     this->densityRatio       = std::bind(&Parameter::getScaledDensityRatio,         para, _1);
     this->forceRatio         = std::bind(&Parameter::getScaledForceRatio,           para, _1);
-    this->stressRatio        = std::bind(&Parameter::getScaledPressureRatio,        para, _1);
+    this->stressRatio        = std::bind(&Parameter::getScaledStressRatio,          para, _1);
     this->viscosityRatio     = std::bind(&Parameter::getScaledViscosityRatio,       para, _1);
     this->nondimensional     = std::bind(&Probe::getNondimensionalConversionFactor, this, _1);
 
-- 
GitLab


From 2b568def76b830f430e5641723dce4ca562cdfb0 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 14:08:29 +0100
Subject: [PATCH 096/179] Add missing ;

---
 src/gpu/VirtualFluids_GPU/Parameter/Parameter.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
index de5e2b0a4..f83e50d52 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
+++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
@@ -779,7 +779,7 @@ public:
     //! \returns the pressure ratio in SI/LB units scaled to the respective level
     real getScaledPressureRatio(int level);
     //! \returns the stress ratio in SI/LB units scaled to the respective level
-    real getScaledStressRatio(int level)
+    real getScaledStressRatio(int level);
     //! \returns the time ratio in SI/LB units scaled to the respective level
     real getScaledTimeRatio(int level);
     //! \returns the length ratio in SI/LB units scaled to the respective level
-- 
GitLab


From 921e9ee3e20d411e19a8762c4cc0dbf3aae80fef Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 15:00:28 +0100
Subject: [PATCH 097/179] fix warnings

---
 apps/cpu/Applications.cmake                | 11 ++++++++---
 apps/cpu/JetBreakup/JetBreakup.cpp         |  2 +-
 apps/cpu/RisingBubble2D/RisingBubble2D.cpp |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake
index 71648d1fd..68dfeb3ed 100644
--- a/apps/cpu/Applications.cmake
+++ b/apps/cpu/Applications.cmake
@@ -11,10 +11,15 @@ add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
 add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
 add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D)
 add_subdirectory(${APPS_ROOT_CPU}/JetBreakup)
-add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
-add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
-add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
+
 add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex)
+
+IF(${USE_LIGGGHTS})
+	add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
+	add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
+	add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
+ENDIF()
+
 #add_subdirectory(tests)
 #add_subdirectory(Applications/gridRf)
 #add_subdirectory(Applications/greenvortex)
diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp
index 03c1d34c4..01d4cc3eb 100644
--- a/apps/cpu/JetBreakup/JetBreakup.cpp
+++ b/apps/cpu/JetBreakup/JetBreakup.cpp
@@ -153,7 +153,7 @@ void run(string configname)
 
         // LBMReal dLB = 0; // = length[1] / dx;
         LBMReal rhoLB = 0.0;
-        LBMReal nuLB = nu_l; //(uLB*dLB) / Re;
+        //LBMReal nuLB = nu_l; //(uLB*dLB) / Re;
 
         double beta = 12.0 * sigma_LB / interfaceWidth;
         double kappa = 1.5 * interfaceWidth * sigma_LB;
diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
index 448353340..19677aac7 100644
--- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
+++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp
@@ -95,7 +95,7 @@ void run(string configname)
         LBMReal D  = 2.0*radius;
 
         //density retio
-        LBMReal r_rho = densityRatio;
+        //LBMReal r_rho = densityRatio;
 
         //density of heavy fluid
         LBMReal rho_h = 1.0;
-- 
GitLab


From fb0d3564545aab88debbe3ce41a547a55dfe0e75 Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 15:11:43 +0100
Subject: [PATCH 098/179] fix warnings

---
 apps/cpu/ConvectionOfVortex/cov.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/cpu/ConvectionOfVortex/cov.cpp b/apps/cpu/ConvectionOfVortex/cov.cpp
index ba53075ca..627f5d03a 100644
--- a/apps/cpu/ConvectionOfVortex/cov.cpp
+++ b/apps/cpu/ConvectionOfVortex/cov.cpp
@@ -75,7 +75,7 @@ void run()
 
       SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
 
-      int baseLevel = 0;
+      //int baseLevel = 0;
       int refineLevel = 1;
 
       //bounding box
-- 
GitLab


From 18fc6b3ee3c8bf8eb0618114ac906a6a124524f9 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 14:13:17 +0000
Subject: [PATCH 099/179] Apply small suggestions from Anna

---
 src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp        | 2 +-
 src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp b/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
index 35ab9002f..92434e18b 100644
--- a/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
+++ b/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
@@ -28,7 +28,7 @@
 //
 //! \file WbWriterVtkXmlImageBinary.cpp
 //! \ingroup writer
-//! \author Soeren Freudiger, Sebastian Geller
+//! \author Soeren Freudiger, Sebastian Geller, Henry Korb, Henrik Asmuth
 //=======================================================================================
 #include <basics/utilities/UbLogger.h>
 #include <basics/writer/WbWriterVtkXmlImageBinary.h>
diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index 30507493a..7c2c41bb8 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -33,6 +33,7 @@ SPtr<TransientBCInputFileReader> createReaderForCollection(SPtr<FileCollection>
             return nullptr;
     }
 }
+
 template<typename T>
 std::vector<T> readStringToVector(std::string s)
 {
@@ -45,6 +46,7 @@ std::vector<T> readStringToVector(std::string s)
     }
     return out;
 }
+
 std::string readElement(std::string line)
 {
     size_t elemStart = line.find("<")+1;
-- 
GitLab


From e457c9913fcdcfc88bbfa15fb7dd5b9ff2b988c4 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 15:15:29 +0100
Subject: [PATCH 100/179] Remove old debugging comments in Side

---
 .../grid/BoundaryConditions/Side.cpp          | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
index 270aff9d8..9b4301882 100644
--- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
+++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
@@ -85,25 +85,6 @@ void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition
 
                 boundaryCondition->patches.push_back(0);
             }
-            // else if(boundaryCondition->getType()==vf::gpu::BC_STRESS && (index != INVALID_INDEX) && (   grid->getFieldEntry(index) == vf::gpu::FLUID
-            //                                 ||  grid->getFieldEntry(index) == vf::gpu::FLUID_CFC
-            //                                 ||  grid->getFieldEntry(index) == vf::gpu::FLUID_CFF
-            //                                 ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCC
-            //                                 ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCF 
-            //                                 ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCF
-            //                                 ||  grid->getFieldEntry(index)  == vf::gpu::BC_PRESSURE
-            //                                 ))
-            // {
-            //     grid->setFieldEntry(index, boundaryCondition->getType());
-            //     boundaryCondition->indices.push_back(index);
-            //     setPressureNeighborIndices(boundaryCondition, grid, index);
-            //     setStressSamplingIndices(boundaryCondition, grid, index);
-
-            //     setQs(grid, boundaryCondition, index);
-
-            //     boundaryCondition->patches.push_back(0);
-            // }
-
         }
     }
 }
-- 
GitLab


From 0a389fc03f677255b911ef26a33ca706f9fc6059 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 15:32:00 +0100
Subject: [PATCH 101/179] Small refactoring and mods in TransientBCSetter

---
 src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp | 4 ++--
 src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index 7c2c41bb8..8b3fca3e3 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -156,7 +156,7 @@ void VTKFile::unloadFile()
     this->loaded = false;
 }
 
-void VTKFile::getData(real* data, uint numberOfNodes, std::vector<uint> readIndeces, std::vector<uint> writeIndices, uint offsetRead, uint offsetWrite)
+void VTKFile::getData(real* data, uint numberOfNodes, const std::vector<uint>& readIndices, const std::vector<uint>& writeIndices, uint offsetRead, uint offsetWrite)
 {
     if(!this->loaded) loadFile();
 
@@ -167,7 +167,7 @@ void VTKFile::getData(real* data, uint numberOfNodes, std::vector<uint> readInde
         real* quant = &data[j*numberOfNodes];
         for(size_t i=0; i<nPoints; i++)
         {
-            quant[offsetWrite+writeIndices[i]] = this->quantities[j].values[readIndeces[i]+offsetRead];
+            quant[offsetWrite+writeIndices[i]] = this->quantities[j].values[readIndices[i]+offsetRead];
         }
     }
 }
diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
index 7b1145185..49b085973 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
@@ -40,7 +40,7 @@ public:
         // printFileInfo();
     };
 
-    void getData(real* data, uint numberOfNodes, std::vector<uint> readIndeces, std::vector<uint> writeIndices, uint offsetRead, uint offsetWrite);
+    void getData(real* data, uint numberOfNodes, const std::vector<uint>& readIndices, const std::vector<uint>& writeIndices, uint offsetRead, uint offsetWrite);
     bool markNANs(std::vector<uint> readIndices);
     bool inBoundingBox(real posX, real posY, real posZ){return  inXBounds(posX) && inYBounds(posY) && inZBounds(posZ); };
     bool inXBounds(real posX){ return posX<=maxX && posX>=minX; };
-- 
GitLab


From edaec77b95ccae7dea9a8b1685c77d785f8795f5 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 15:35:37 +0100
Subject: [PATCH 102/179] Change to pass by const ref addFluidNodeIndices
 functions

---
 src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h        | 6 +++---
 src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp | 6 +++---
 src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h   | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
index c9aa7678b..d4893c3c2 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -147,9 +147,9 @@ public:
 
     virtual void findFluidNodes(bool splitDomain) = 0;
 
-    virtual void addFluidNodeIndicesMacroVars(std::vector<uint> fluidNodeIndicesMacroVars, uint level)           = 0;
-    virtual void addFluidNodeIndicesApplyBodyForce(std::vector<uint> fluidNodeIndicesApplyBodyForce, uint level) = 0;
-    virtual void addFluidNodeIndicesAllFeatures(std::vector<uint> fluidNodeIndicesAllFeatures, uint level)       = 0;
+    virtual void addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level)           = 0;
+    virtual void addFluidNodeIndicesApplyBodyForce(const std::vector<uint>& fluidNodeIndicesApplyBodyForce, uint level) = 0;
+    virtual void addFluidNodeIndicesAllFeatures(const std::vector<uint>& fluidNodeIndicesAllFeatures, uint level)       = 0;
     virtual void sortFluidNodeIndicesMacroVars(uint level) = 0;
     virtual void sortFluidNodeIndicesApplyBodyForce(uint level) = 0;
     virtual void sortFluidNodeIndicesAllFeatures(uint level) = 0;
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index 267f03c5a..a797fdf01 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -798,17 +798,17 @@ void LevelGridBuilder::findFluidNodes(bool splitDomain)
 }
 
 
-void LevelGridBuilder::addFluidNodeIndicesMacroVars(std::vector<uint> fluidNodeIndicesMacroVars, uint level) 
+void LevelGridBuilder::addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level) 
 {
     grids[level]->addFluidNodeIndicesMacroVars(fluidNodeIndicesMacroVars);
 }
 
-void LevelGridBuilder::addFluidNodeIndicesApplyBodyForce(std::vector<uint> fluidNodeIndicesApplyBodyForce, uint level)
+void LevelGridBuilder::addFluidNodeIndicesApplyBodyForce(const std::vector<uint>& fluidNodeIndicesApplyBodyForce, uint level)
 {
     grids[level]->addFluidNodeIndicesApplyBodyForce(fluidNodeIndicesApplyBodyForce);
 }
 
-void LevelGridBuilder::addFluidNodeIndicesAllFeatures(std::vector<uint> fluidNodeIndicesAllFeatures, uint level)
+void LevelGridBuilder::addFluidNodeIndicesAllFeatures(const std::vector<uint>& fluidNodeIndicesAllFeatures, uint level)
 {
     grids[level]->addFluidNodeIndicesAllFeatures(fluidNodeIndicesAllFeatures);
 }
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
index cc6f31800..cf422c8bb 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -211,9 +211,9 @@ public:
     // needed for CUDA Streams MultiGPU (Communication Hiding)
     void findFluidNodes(bool splitDomain) override;
 
-    void addFluidNodeIndicesMacroVars(std::vector<uint> fluidNodeIndicesMacroVars, uint level) override;
-    void addFluidNodeIndicesApplyBodyForce(std::vector<uint> fluidNodeIndicesApplyBodyForce, uint level) override;
-    void addFluidNodeIndicesAllFeatures(std::vector<uint> fluidNodeIndicesAllFeatures, uint level) override;
+    void addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level) override;
+    void addFluidNodeIndicesApplyBodyForce(const std::vector<uint>& fluidNodeIndicesApplyBodyForce, uint level) override;
+    void addFluidNodeIndicesAllFeatures(const std::vector<uint>& fluidNodeIndicesAllFeatures, uint level) override;
     
     void sortFluidNodeIndicesMacroVars(uint level) override;
     void sortFluidNodeIndicesApplyBodyForce(uint level) override;
-- 
GitLab


From 22e06d9e8565cdb79bee12fe7b382511e1d7f6da Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 14:38:44 +0000
Subject: [PATCH 103/179] Apply 2 suggestion(s) to 2 file(s)

---
 src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h | 12 ++++++------
 .../grid/GridBuilder/LevelGridBuilder.cpp            |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
index d4893c3c2..ae150d96b 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -153,12 +153,12 @@ public:
     virtual void sortFluidNodeIndicesMacroVars(uint level) = 0;
     virtual void sortFluidNodeIndicesApplyBodyForce(uint level) = 0;
     virtual void sortFluidNodeIndicesAllFeatures(uint level) = 0;
-    virtual uint getNumberOfFluidNodesMacroVars(unsigned int level) const = 0;
-    virtual void getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, const int level) const = 0;
-    virtual uint getNumberOfFluidNodesApplyBodyForce(unsigned int level) const = 0;
-    virtual void getFluidNodeIndicesApplyBodyForce(uint *fluidNodeIndicesApplyBodyForce, const int level) const = 0;
-    virtual uint getNumberOfFluidNodesAllFeatures(unsigned int level) const = 0;
-    virtual void getFluidNodeIndicesAllFeatures(uint *fluidNodeIndicesAllFeatures, const int level) const = 0;
+    virtual uint getNumberOfFluidNodesMacroVars(uint level) const = 0;
+    virtual void getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, int level) const = 0;
+    virtual uint getNumberOfFluidNodesApplyBodyForce(uint level) const = 0;
+    virtual void getFluidNodeIndicesApplyBodyForce(uint *fluidNodeIndicesApplyBodyForce, int level) const = 0;
+    virtual uint getNumberOfFluidNodesAllFeatures(uint level) const = 0;
+    virtual void getFluidNodeIndicesAllFeatures(uint *fluidNodeIndicesAllFeatures, int level) const = 0;
 
 
 };
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index a797fdf01..8b3d35d06 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -122,7 +122,7 @@ void LevelGridBuilder::setSlipGeometryBoundaryCondition(real normalX, real norma
 //=======================================================================================
 //! \brief Set stress boundary concdition using iMEM
 //! \param samplingOffset number of grid points above boundary where velocity for wall model is sampled
-//! \param z0 roghness length [m]
+//! \param z0 roughness length [m]
 //! \param dx dx of level 0 [m] 
 //!
 void LevelGridBuilder::setStressBoundaryCondition(  SideType sideType, 
-- 
GitLab


From e7fc646649d382eb74a2dd9e54f3f7a33c24923f Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:01:30 +0100
Subject: [PATCH 104/179] Rename nTRead to timeStepsBetweenReads

---
 apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp  | 10 ++++-----
 .../BoundaryConditions/BoundaryCondition.h    |  8 +++----
 .../grid/GridBuilder/GridBuilder.h            |  2 +-
 .../grid/GridBuilder/LevelGridBuilder.cpp     | 22 +++++++++----------
 .../grid/GridBuilder/LevelGridBuilder.h       |  7 +++---
 .../GridReaderGenerator/GridGenerator.cpp     |  6 ++---
 .../KernelManager/BCKernelManager.cpp         | 10 ++++-----
 src/gpu/VirtualFluids_GPU/LBM/LB.h            |  2 +-
 8 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
index 7d2d79d8c..6d5bf598c 100644
--- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
+++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
@@ -150,10 +150,10 @@ void multipleLevel(const std::string& configPath)
     }
 
     const bool readPrecursor = config.getValue("readPrecursor", false);
-    int nTReadPrecursor;
+    int timestepsBetweenReadsPrecursor;
     if(readPrecursor)
     {
-        nTReadPrecursor = config.getValue<int>("nTimestepsReadPrecursor");
+        timestepsBetweenReadsPrecursor = config.getValue<int>("nTimestepsReadPrecursor");
         precursorDirectory = config.getValue<std::string>("precursorDirectory");
         useDistributions     = config.getValue<bool>("useDistributions", false);
     }
@@ -302,9 +302,9 @@ void multipleLevel(const std::string& configPath)
     {
         if(isFirstSubDomain || nProcs == 1)
         {   
-            // auto precursor = createFileCollection(precursorDirectory + "/precursor", FileType::VTK);
-            // gridBuilder->setPrecursorBoundaryCondition(SideType::MX, precursor, nTReadPrecursor);
-            gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0);
+            auto precursor = createFileCollection(precursorDirectory + "/precursor", FileType::VTK);
+            gridBuilder->setPrecursorBoundaryCondition(SideType::MX, precursor, timestepsBetweenReadsPrecursor);
+            // gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0);
         }
 
         if(isLastSubDomain || nProcs == 1)
diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h
index 12e1fb61c..22342aec9 100644
--- a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h
+++ b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h
@@ -337,9 +337,9 @@ public:
 class PrecursorBoundaryCondition : public gg::BoundaryCondition
 {
 public:
-    static SPtr<PrecursorBoundaryCondition> make(SPtr<TransientBCInputFileReader> reader, int nTRead, real velocityX, real velocityY, real velocityZ)
+    static SPtr<PrecursorBoundaryCondition> make(SPtr<TransientBCInputFileReader> reader, int timeStepsBetweenReads, real velocityX, real velocityY, real velocityZ)
     {
-        return SPtr<PrecursorBoundaryCondition>(new PrecursorBoundaryCondition(reader, nTRead, velocityX, velocityY, velocityZ));
+        return SPtr<PrecursorBoundaryCondition>(new PrecursorBoundaryCondition(reader, timeStepsBetweenReads, velocityX, velocityY, velocityZ));
     }
 
     SPtr<TransientBCInputFileReader> getReader(){ return reader; }
@@ -348,13 +348,13 @@ public:
     real getVelocityZ() { return velocityZ; }
 
 private:
-    PrecursorBoundaryCondition(SPtr<TransientBCInputFileReader> _reader, uint _nTRead, real vx, real vy, real vz) : reader(_reader), nTRead(_nTRead), velocityX(vx), velocityY(vy), velocityZ(vz) { };
+    PrecursorBoundaryCondition(SPtr<TransientBCInputFileReader> _reader, uint _timeStepsBetweenReads, real vx, real vy, real vz) : reader(_reader), timeStepsBetweenReads(_timeStepsBetweenReads), velocityX(vx), velocityY(vy), velocityZ(vz) { };
     virtual char getType() const override
     {
         return vf::gpu::BC_VELOCITY;
     }
 public:
-    uint nTRead; //!> read data every nth timestep
+    uint timeStepsBetweenReads; //!> read data every nth timestep
 
 private:
     real velocityX = 0.0;
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
index d4893c3c2..1c372b12f 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -118,7 +118,7 @@ public:
     virtual void getPrecursorValues(uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
                                     real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
                                     int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
-                                    int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& nTRead, 
+                                    int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads, 
                                     real& velocityX, real& velocityY, real& velocityZ, int level) const = 0;
 
     virtual void getPrecursorQs(real* qs[27], int level) const  = 0;
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index a797fdf01..4acd2a537 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -251,7 +251,7 @@ void LevelGridBuilder::setNoSlipGeometryBoundaryCondition()
     }
 }
 
-void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int nTRead, 
+void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads, 
                                                         real velocityX, real velocityY, real velocityZ, std::vector<uint> fileLevelToGridLevelMap)
 {
     if(fileLevelToGridLevelMap.empty())                         
@@ -271,7 +271,7 @@ void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<Fil
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
     {
         auto reader = createReaderForCollection(fileCollection, fileLevelToGridLevelMap[level]);
-        SPtr<PrecursorBoundaryCondition> precursorBoundaryCondition = PrecursorBoundaryCondition::make( reader, nTRead, velocityX, velocityY, velocityZ);
+        SPtr<PrecursorBoundaryCondition> precursorBoundaryCondition = PrecursorBoundaryCondition::make( reader, timeStepsBetweenReads, velocityX, velocityY, velocityZ);
 
         auto side = SideFactory::make(sideType);
 
@@ -648,20 +648,20 @@ uint LevelGridBuilder::getPrecursorSize(int level) const
 void LevelGridBuilder::getPrecursorValues(  uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
                                             real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
                                             int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
-                                            int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& nTRead, 
+                                            int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads, 
                                             real& velocityX, real& velocityY, real& velocityZ, int level) const
 {
     int allIndicesCounter = 0;
     int allNodesCounter = 0;
-    uint tmpNTRead = 0;
+    uint tmpTimeStepsBetweenReads = 0;
     size_t tmpNQuantities = 0;
     
     for (auto boundaryCondition : boundaryConditions[level]->precursorBoundaryConditions)
     {
-        if( tmpNTRead == 0 )
-            tmpNTRead = boundaryCondition->nTRead;
-        if( tmpNTRead != boundaryCondition->nTRead )
-            throw std::runtime_error("All precursor boundary conditions must have the same NTRead value");
+        if( tmpTimeStepsBetweenReads == 0 )
+            tmpTimeStepsBetweenReads = boundaryCondition->timeStepsBetweenReads;
+        if( tmpTimeStepsBetweenReads != boundaryCondition->timeStepsBetweenReads )
+            throw std::runtime_error("All precursor boundary conditions must have the same timeStepsBetweenReads value");
         auto BCreader = boundaryCondition->getReader();
         BCreader->setWritingOffset(allIndicesCounter);
         reader.push_back(BCreader);
@@ -690,9 +690,9 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighborNT, uint* neighborNB,
     }
     numberOfPrecursorNodes = allNodesCounter;
 
-    if (tmpNTRead == 0)
-        throw std::runtime_error("NTRead of precursor needs to be larger than 0.");
-    nTRead = tmpNTRead;
+    if (tmpTimeStepsBetweenReads == 0)
+        throw std::runtime_error("timeStepsBetweenReads of precursor needs to be larger than 0.");
+    timeStepsBetweenReads = tmpTimeStepsBetweenReads;
     
     if (tmpNQuantities == 0)
         throw std::runtime_error("Number of quantities in precursor needs to be larger than 0.");
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
index cf422c8bb..afaf41184 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -84,8 +84,9 @@ public:
     GRIDGENERATOR_EXPORT void setPressureBoundaryCondition(SideType sideType, real rho);
     GRIDGENERATOR_EXPORT void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z);
     GRIDGENERATOR_EXPORT void setNoSlipBoundaryCondition(SideType sideType);
-    GRIDGENERATOR_EXPORT void setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int nTRead, real velocityX=0.0f, real velocityY=0.0f, real velocityZ=0.0f,          
-                                                                std::vector<uint> fileLevelToGridLevelMap = {});
+    GRIDGENERATOR_EXPORT void setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads, 
+                                                            real velocityX=0.0f, real velocityY=0.0f, real velocityZ=0.0f,     
+                                                            std::vector<uint> fileLevelToGridLevelMap = {});
 
     GRIDGENERATOR_EXPORT void setEnableFixRefinementIntoTheWall(bool enableFixRefinementIntoTheWall);
 
@@ -131,7 +132,7 @@ public:
     GRIDGENERATOR_EXPORT void getPrecursorValues(   uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
                                                     real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
                                                     int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
-                                                    int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& nTRead,
+                                                    int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads,
                                                     real& velocityX, real& velocityY, real& velocityZ, int level) const override;
     GRIDGENERATOR_EXPORT virtual void getPrecursorQs(real* qs[27], int level) const override;
 
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index a89b5a1ca..5f1393791 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -347,13 +347,13 @@ void GridGenerator::allocArrays_BoundaryValues()
                     para->getParH(level)->precursorBC.weightsNT, para->getParH(level)->precursorBC.weightsNB, 
                     para->getParH(level)->precursorBC.weightsST, para->getParH(level)->precursorBC.weightsSB, 
                     para->getParH(level)->precursorBC.k, para->getParH(level)->transientBCInputFileReader, para->getParH(level)->precursorBC.numberOfPrecursorNodes, 
-                    para->getParH(level)->precursorBC.numberOfQuantities, para->getParH(level)->precursorBC.nTRead, 
+                    para->getParH(level)->precursorBC.numberOfQuantities, para->getParH(level)->precursorBC.timeStepsBetweenReads, 
                     para->getParH(level)->precursorBC.velocityX, para->getParH(level)->precursorBC.velocityY, para->getParH(level)->precursorBC.velocityZ,
                     level);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             para->getParD(level)->precursorBC.numberOfPrecursorNodes = para->getParH(level)->precursorBC.numberOfPrecursorNodes;
             para->getParD(level)->precursorBC.numberOfQuantities = para->getParH(level)->precursorBC.numberOfQuantities;
-            para->getParD(level)->precursorBC.nTRead = para->getParH(level)->precursorBC.nTRead;
+            para->getParD(level)->precursorBC.timeStepsBetweenReads = para->getParH(level)->precursorBC.timeStepsBetweenReads;
             para->getParD(level)->precursorBC.velocityX = para->getParH(level)->precursorBC.velocityX;
             para->getParD(level)->precursorBC.velocityY = para->getParH(level)->precursorBC.velocityY;
             para->getParD(level)->precursorBC.velocityZ = para->getParH(level)->precursorBC.velocityZ;
@@ -380,7 +380,7 @@ void GridGenerator::allocArrays_BoundaryValues()
             para->getParD(level)->precursorBC.next = tmp;
 
             //read second timestep of precursor into next and copy next to device
-            real nextTime = para->getParD(level)->precursorBC.nTRead*pow(2,-((real)level))*para->getTimeRatio();
+            real nextTime = para->getParD(level)->precursorBC.timeStepsBetweenReads*pow(2,-((real)level))*para->getTimeRatio();
             for(auto reader : para->getParH(level)->transientBCInputFileReader)
             {   
                 reader->getNextData(para->getParH(level)->precursorBC.next, para->getParH(level)->precursorBC.numberOfPrecursorNodes, nextTime);
diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
index 29341d243..1310cf09e 100644
--- a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
@@ -398,16 +398,16 @@ void BCKernelManager::runPrecursorBCKernelPost(int level, uint t, CudaMemoryMana
 
     uint t_level = para->getTimeStep(level, t, true);
 
-    uint lastTime =    (para->getParD(level)->precursorBC.nPrecursorReads-2)*para->getParD(level)->precursorBC.nTRead; // timestep currently loaded into last arrays
-    uint currentTime = (para->getParD(level)->precursorBC.nPrecursorReads-1)*para->getParD(level)->precursorBC.nTRead; // timestep currently loaded into current arrays
-    uint nextTime =     para->getParD(level)->precursorBC.nPrecursorReads   *para->getParD(level)->precursorBC.nTRead; // timestep currently loaded into next arrays
+    uint lastTime =    (para->getParD(level)->precursorBC.nPrecursorReads-2)*para->getParD(level)->precursorBC.timeStepsBetweenReads; // timestep currently loaded into last arrays
+    uint currentTime = (para->getParD(level)->precursorBC.nPrecursorReads-1)*para->getParD(level)->precursorBC.timeStepsBetweenReads; // timestep currently loaded into current arrays
+    uint nextTime =     para->getParD(level)->precursorBC.nPrecursorReads   *para->getParD(level)->precursorBC.timeStepsBetweenReads; // timestep currently loaded into next arrays
     
     if(t_level>=currentTime)
     {
         //cycle time
         lastTime = currentTime;
         currentTime = nextTime;
-        nextTime += para->getParD(level)->precursorBC.nTRead;
+        nextTime += para->getParD(level)->precursorBC.timeStepsBetweenReads;
 
         //cycle pointers
         real* tmp = para->getParD(level)->precursorBC.last;
@@ -426,6 +426,6 @@ void BCKernelManager::runPrecursorBCKernelPost(int level, uint t, CudaMemoryMana
         para->getParH(level)->precursorBC.nPrecursorReads++;  
     }
     
-    real tRatio = real(t_level-lastTime)/para->getParD(level)->precursorBC.nTRead;
+    real tRatio = real(t_level-lastTime)/para->getParD(level)->precursorBC.timeStepsBetweenReads;
     precursorBoundaryConditionPost(para->getParD(level).get(), &para->getParD(level)->precursorBC, tRatio, para->getVelocityRatio());
 }
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h
index 904471123..e08544bdf 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/LB.h
+++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h
@@ -237,7 +237,7 @@ typedef struct QforPrecursorBC{
    int sizeQ;
    int numberOfPrecursorNodes=0;
    uint nPrecursorReads=0;
-   uint nTRead;
+   uint timeStepsBetweenReads;
    size_t numberOfQuantities;
    real* q27[27];
    uint* planeNeighborNT, *planeNeighborNB, *planeNeighborST, *planeNeighborSB;
-- 
GitLab


From 0943b6f334f6d0f278fba267fe9a03fc9d84226a Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 15:03:49 +0000
Subject: [PATCH 105/179] Apply 1 suggestion(s) to 1 file(s)

---
 src/gpu/GridGenerator/grid/GridImp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h
index 981245c70..d330bc8b8 100644
--- a/src/gpu/GridGenerator/grid/GridImp.h
+++ b/src/gpu/GridGenerator/grid/GridImp.h
@@ -116,7 +116,7 @@ private:
     int *sparseIndices;
 
     std::vector<uint> fluidNodeIndices;                 // run on CollisionTemplate::Default
-    std::vector<uint> fluidNodeIndicesBorder;           // run on border nodes
+    std::vector<uint> fluidNodeIndicesBorder;           // run on subdomain border nodes (CollisionTemplate::Border)
     std::vector<uint> fluidNodeIndicesMacroVars;        // run on CollisionTemplate::MacroVars
     std::vector<uint> fluidNodeIndicesApplyBodyForce;   // run on CollisionTemplate::ApplyBodyForce
     std::vector<uint> fluidNodeIndicesAllFeatures;      // run on CollisionTemplate::AllFeatures
-- 
GitLab


From 0f9eda18b21aa5529d946a906691d62b10ed2fed Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Tue, 13 Dec 2022 16:10:58 +0100
Subject: [PATCH 106/179] fix warnings

---
 src/cpu/simulationconfig/src/Simulation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/simulationconfig/src/Simulation.cpp b/src/cpu/simulationconfig/src/Simulation.cpp
index ab818f528..1258df75b 100644
--- a/src/cpu/simulationconfig/src/Simulation.cpp
+++ b/src/cpu/simulationconfig/src/Simulation.cpp
@@ -120,7 +120,7 @@ void Simulation::run()
 
     auto metisVisitor = std::make_shared<MetisPartitioningGridVisitor>(communicator,
                                                                        MetisPartitioningGridVisitor::LevelBased,
-                                                                       D3Q27System::B, MetisPartitioner::RECURSIVE);
+                                                                       D3Q27System::DIR_00M, MetisPartitioner::RECURSIVE);
 
     InteractorsHelper intHelper(grid, metisVisitor);
     for (auto const &interactor : interactors)
-- 
GitLab


From deee0c9732194f7f50887531a18368d98c178ccf Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:22:06 +0100
Subject: [PATCH 107/179] Rename tRatio to timeRatio

---
 .../Factories/BoundaryConditionFactory.h      |  2 +-
 src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh |  8 +--
 src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu    | 16 +++---
 .../VirtualFluids_GPU/GPU/PrecursorBCs27.cu   | 56 +++++++++----------
 4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h
index f7cd7cc1a..c6877cbfe 100644
--- a/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h
+++ b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h
@@ -48,7 +48,7 @@ class Parameter;
 
 using boundaryCondition = std::function<void(LBMSimulationParameter *, QforBoundaryConditions *)>;
 using boundaryConditionWithParameter = std::function<void(Parameter *, QforBoundaryConditions *, const int level)>;
-using precursorBoundaryConditionFunc = std::function<void(LBMSimulationParameter *, QforPrecursorBoundaryConditions *, real tRatio, real velocityRatio)>;
+using precursorBoundaryConditionFunc = std::function<void(LBMSimulationParameter *, QforPrecursorBoundaryConditions *, real timeRatio, real velocityRatio)>;
 
 class BoundaryConditionFactory
 {
diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
index b35e01eb9..9ef5057bb 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
+++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
@@ -1266,7 +1266,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 real velocityX,
                                                 real velocityY,
                                                 real velocityZ,
-                                                real tRatio,
+                                                real timeRatio,
                                                 real velocityRatio,
                                                 unsigned long long numberOfLBnodes,
                                                 bool isEvenTimestep);
@@ -1292,7 +1292,7 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         real velocityX,
                                         real velocityY,
                                         real velocityZ,
-                                        real tRatio,
+                                        real timeRatio,
                                         real velocityRatio,
                                         unsigned long long numberOfLBnodes,
                                         bool isEvenTimestep);
@@ -1314,7 +1314,7 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												real* weightsSB,
 												real* fsLast, 
 												real* fsNext,
-												real tRatio,
+												real timeRatio,
 												unsigned long long numberOfLBnodes,
 												bool isEvenTimestep);
 __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
@@ -1336,7 +1336,7 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												real* weightsSB,
 												real* fsLast, 
 												real* fsNext,
-												real tRatio,
+												real timeRatio,
 												unsigned long long numberOfLBnodes,
 												bool isEvenTimestep);
 												
diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
index ae51ce98e..06628edb5 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -3208,7 +3208,7 @@ void VelSchlaffer27(  unsigned int numberOfThreads,
       getLastCudaError("VelSchlaff27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
-void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real tRatio, real velocityRatio)
+void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
@@ -3220,12 +3220,12 @@ void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, QforPre
 		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
 		boundaryCondition->last, boundaryCondition->current,
 		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
-		tRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
 //////////////////////////////////////////////////////////////////////////
-void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real tRatio, real velocityRatio)
+void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
@@ -3236,12 +3236,12 @@ void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice, QforPrecursorBou
 		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
 		boundaryCondition->last, boundaryCondition->current,
 		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
-		tRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("PrecursorDeviceEQ27 execution failed"); 
 
 }
 //////////////////////////////////////////////////////////////////////////
-void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real tRatio, real velocityRatio)
+void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
@@ -3251,13 +3251,13 @@ void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPre
 		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
 		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
 		boundaryCondition->last, boundaryCondition->current,
-		tRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
 
 //////////////////////////////////////////////////////////////////////////
-void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real tRatio, real velocityRatio)
+void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
@@ -3267,7 +3267,7 @@ void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPr
 		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
 		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
 		boundaryCondition->last, boundaryCondition->current,
-		tRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
diff --git a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
index 9c7958cdc..f089a3295 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
@@ -32,7 +32,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 real velocityX,
                                                 real velocityY,
                                                 real velocityZ,
-                                                real tRatio,
+                                                real timeRatio,
                                                 real velocityRatio,
                                                 unsigned long long numberOfLBnodes,
                                                 bool isEvenTimestep)
@@ -89,9 +89,9 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     }
 
     // if(k==16300)s printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
-    real VeloX = (velocityX + (1.f-tRatio)*vxLastInterpd + tRatio*vxNextInterpd)/velocityRatio;
-    real VeloY = (velocityY + (1.f-tRatio)*vyLastInterpd + tRatio*vyNextInterpd)/velocityRatio; 
-    real VeloZ = (velocityZ + (1.f-tRatio)*vzLastInterpd + tRatio*vzNextInterpd)/velocityRatio;
+    real VeloX = (velocityX + (1.f-timeRatio)*vxLastInterpd + timeRatio*vxNextInterpd)/velocityRatio;
+    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio; 
+    real VeloZ = (velocityZ + (1.f-timeRatio)*vzLastInterpd + timeRatio*vzNextInterpd)/velocityRatio;
     // From here on just a copy of QVelDeviceCompZeroPress
     ////////////////////////////////////////////////////////////////////////////////
 
@@ -445,7 +445,7 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         real velocityX,
                                         real velocityY,
                                         real velocityZ,
-                                        real tRatio,
+                                        real timeRatio,
                                         real velocityRatio,
                                         unsigned long long numberOfLBnodes,
                                         bool isEvenTimestep)
@@ -502,9 +502,9 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     }
 
     // if(k==16300) printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
-    real VeloX = (velocityX + (1.f-tRatio)*vxLastInterpd + tRatio*vxNextInterpd)/velocityRatio;
-    real VeloY = (velocityY + (1.f-tRatio)*vyLastInterpd + tRatio*vyNextInterpd)/velocityRatio; 
-    real VeloZ = (velocityZ + (1.f-tRatio)*vzLastInterpd + tRatio*vzNextInterpd)/velocityRatio;
+    real VeloX = (velocityX + (1.f-timeRatio)*vxLastInterpd + timeRatio*vxNextInterpd)/velocityRatio;
+    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio; 
+    real VeloZ = (velocityZ + (1.f-timeRatio)*vzLastInterpd + timeRatio*vzNextInterpd)/velocityRatio;
     // From here on just a copy of QVelDeviceCompZeroPress
     ////////////////////////////////////////////////////////////////////////////////
 
@@ -666,7 +666,7 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												real* weightsSB,
 												real* fsLast, 
 												real* fsNext,
-												real tRatio,
+												real timeRatio,
 												unsigned long long numberOfLBnodes,
 												bool isEvenTimestep)
 {
@@ -793,15 +793,15 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     unsigned int ktne = KQK;
     // unsigned int kbsw = neighborZ[ksw];
 
-    dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-tRatio) + f0NextInterp*tRatio;
-    dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-tRatio) + f1NextInterp*tRatio;
-    dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-tRatio) + f2NextInterp*tRatio;
-    dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-tRatio) + f3NextInterp*tRatio;
-    dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-tRatio) + f4NextInterp*tRatio;
-    dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-tRatio) + f5NextInterp*tRatio;
-    dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-tRatio) + f6NextInterp*tRatio;
-    dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-tRatio) + f7NextInterp*tRatio;
-    dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-tRatio) + f8NextInterp*tRatio;
+    dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
+    dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
+    dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
+    dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
+    dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
+    dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
+    dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
+    dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
+    dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -825,7 +825,7 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												real* weightsSB,
 												real* fsLast, 
 												real* fsNext,
-												real tRatio,
+												real timeRatio,
 												unsigned long long numberOfLBnodes,
 												bool isEvenTimestep)
 {
@@ -955,15 +955,15 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     getPointersToSubgridDistances(qs, subgridDistances, sizeQ);
 
     real q;
-    q = qs.q[DIR_P00][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-tRatio) + f0NextInterp*tRatio;
-    q = qs.q[DIR_PP0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-tRatio) + f1NextInterp*tRatio;
-    q = qs.q[DIR_PM0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-tRatio) + f2NextInterp*tRatio;
-    q = qs.q[DIR_P0P][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-tRatio) + f3NextInterp*tRatio;
-    q = qs.q[DIR_P0M][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-tRatio) + f4NextInterp*tRatio;
-    q = qs.q[DIR_PPP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-tRatio) + f5NextInterp*tRatio;
-    q = qs.q[DIR_PMP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-tRatio) + f6NextInterp*tRatio;
-    q = qs.q[DIR_PPM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-tRatio) + f7NextInterp*tRatio;
-    q = qs.q[DIR_PMM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-tRatio) + f8NextInterp*tRatio;
+    q = qs.q[DIR_P00][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
+    q = qs.q[DIR_PP0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
+    q = qs.q[DIR_PM0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
+    q = qs.q[DIR_P0P][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
+    q = qs.q[DIR_P0M][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
+    q = qs.q[DIR_PPP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
+    q = qs.q[DIR_PMP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
+    q = qs.q[DIR_PPM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
+    q = qs.q[DIR_PMM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
 
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-- 
GitLab


From 7c08c14d642da2f7988ff2bdadd47180a23a1cd5 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 15:22:25 +0000
Subject: [PATCH 108/179] Apply 1 suggestion(s) to 1 file(s)

---
 src/gpu/VirtualFluids_GPU/Kernel/Kernel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h
index 7eaf0050b..50b4460d7 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h
@@ -16,7 +16,7 @@ class Kernel
 public:
     virtual ~Kernel()  = default;
     virtual void run() = 0;
-    virtual void runOnIndices(const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIdx=CudaStreamIndex::Legacy) = 0; //if stream == -1: run on default stream
+    virtual void runOnIndices(const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIdx=CudaStreamIndex::Legacy) = 0;
 
     virtual bool checkParameter()                                = 0;
     virtual std::vector<PreProcessorType> getPreProcessorTypes() = 0;
-- 
GitLab


From 2bc8cc80817fd9cc430916bc7fc49aef025a29b9 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:29:11 +0100
Subject: [PATCH 109/179] Rename CollisionTemplate:: and
 CudaStreamIndex::Border to SubDomainBorder

---
 src/gpu/GridGenerator/grid/GridImp.h          |  2 +-
 .../Calculation/CollisisionStrategy.cpp       | 12 ++++----
 .../Calculation/RefinementStrategy.cpp        | 28 +++++++++----------
 .../Communication/ExchangeData27.cpp          |  2 +-
 .../GridReaderGenerator/GridGenerator.cpp     | 16 +++++------
 .../GPU/CudaMemoryManager.cpp                 | 24 ++++++++--------
 .../Compressible/CumulantK17/CumulantK17.cu   |  2 +-
 src/gpu/VirtualFluids_GPU/LBM/LB.h            |  4 +--
 src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp  |  2 +-
 .../Parameter/CudaStreamManager.h             |  2 +-
 .../VirtualFluids_GPU/Parameter/Parameter.h   |  4 +--
 11 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h
index d330bc8b8..8283bf569 100644
--- a/src/gpu/GridGenerator/grid/GridImp.h
+++ b/src/gpu/GridGenerator/grid/GridImp.h
@@ -116,7 +116,7 @@ private:
     int *sparseIndices;
 
     std::vector<uint> fluidNodeIndices;                 // run on CollisionTemplate::Default
-    std::vector<uint> fluidNodeIndicesBorder;           // run on subdomain border nodes (CollisionTemplate::Border)
+    std::vector<uint> fluidNodeIndicesBorder;           // run on subdomain border nodes (CollisionTemplate::SubDomainBorder)
     std::vector<uint> fluidNodeIndicesMacroVars;        // run on CollisionTemplate::MacroVars
     std::vector<uint> fluidNodeIndicesApplyBodyForce;   // run on CollisionTemplate::ApplyBodyForce
     std::vector<uint> fluidNodeIndicesAllFeatures;      // run on CollisionTemplate::AllFeatures
diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp b/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp
index 1c279ad52..49543f37d 100644
--- a/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp
+++ b/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp
@@ -72,16 +72,16 @@ void CollisionAndExchange_streams::operator()(UpdateGrid27 *updateGrid, Paramete
     //! 1. run collision for nodes which are at the border of the gpus/processes, running with WriteMacroVars in case probes sample on these nodes
     //!    
     updateGrid->collisionUsingIndices(  level, t, 
-                                        para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Border],
-                                        para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Border], 
+                                        para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::SubDomainBorder],
+                                        para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::SubDomainBorder], 
                                         CollisionTemplate::WriteMacroVars,  
-                                        CudaStreamIndex::Border);
+                                        CudaStreamIndex::SubDomainBorder);
 
     //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished
     //!
-    updateGrid->prepareExchangeMultiGPU(level, CudaStreamIndex::Border);
+    updateGrid->prepareExchangeMultiGPU(level, CudaStreamIndex::SubDomainBorder);
     if (para->getUseStreams())
-        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::Border);
+        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::SubDomainBorder);
 
     //! 3. launch the collision kernel for bulk nodes. This includes nodes with \param tag Default, WriteMacroVars, ApplyBodyForce, 
     //!    or AllFeatures. All assigned tags are listed in \param allocatedBulkFluidNodeTags during initialization in Simulation::init
@@ -97,5 +97,5 @@ void CollisionAndExchange_streams::operator()(UpdateGrid27 *updateGrid, Paramete
                                             CudaStreamIndex::Bulk);
     }
     //! 4. exchange information between GPUs
-    updateGrid->exchangeMultiGPU(level, CudaStreamIndex::Border);
+    updateGrid->exchangeMultiGPU(level, CudaStreamIndex::SubDomainBorder);
 }
diff --git a/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp
index fe7da04d4..b8ca4e9c2 100644
--- a/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp
+++ b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp
@@ -42,27 +42,27 @@ void RefinementAndExchange_streams_exchangeInterface::operator()(UpdateGrid27 *u
     //!
     //! 1. Interpolation fine to coarse for nodes which are at the border of the gpus/processes
     //!
-    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBorder, para->getParD(level)->offFC, CudaStreamIndex::Border);
+    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBorder, para->getParD(level)->offFC, CudaStreamIndex::SubDomainBorder);
 
     //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished
     //!
-    updateGrid->prepareExchangeMultiGPUAfterFtoC(level, CudaStreamIndex::Border);
+    updateGrid->prepareExchangeMultiGPUAfterFtoC(level, CudaStreamIndex::SubDomainBorder);
     if (para->getUseStreams())
-        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::Border);
+        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::SubDomainBorder);
 
     //! 3. launch the bulk kernels for both interpolation processes (fine to coarse and coarse to fine)
     //!
     para->getStreamManager()->waitOnStartBulkKernelEvent(CudaStreamIndex::Bulk);
-    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, CudaStreamIndex::Border);
-    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, CudaStreamIndex::Border);
+    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, CudaStreamIndex::SubDomainBorder);
+    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, CudaStreamIndex::SubDomainBorder);
 
     //! 4. exchange information between GPUs (only nodes which are part of the interpolation)
     //!
-    updateGrid->exchangeMultiGPUAfterFtoC(level, CudaStreamIndex::Border);
+    updateGrid->exchangeMultiGPUAfterFtoC(level, CudaStreamIndex::SubDomainBorder);
 
     // 5. interpolation fine to coarse for nodes which are at the border of the gpus/processes
     //!
-    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBorder, para->getParD(level)->offCF, CudaStreamIndex::Border);
+    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBorder, para->getParD(level)->offCF, CudaStreamIndex::SubDomainBorder);
 
     cudaDeviceSynchronize();
 }
@@ -73,27 +73,27 @@ void RefinementAndExchange_streams_exchangeAllNodes::operator()(UpdateGrid27 *up
     //!
     //! 1. interpolation fine to coarse for nodes which are at the border of the gpus/processes
     //!
-    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBorder, para->getParD(level)->offFC, CudaStreamIndex::Border);
+    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBorder, para->getParD(level)->offFC, CudaStreamIndex::SubDomainBorder);
 
     //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished
     //!
-    updateGrid->prepareExchangeMultiGPU(level, CudaStreamIndex::Border);
+    updateGrid->prepareExchangeMultiGPU(level, CudaStreamIndex::SubDomainBorder);
     if (para->getUseStreams())
-        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::Border);
+        para->getStreamManager()->triggerStartBulkKernel(CudaStreamIndex::SubDomainBorder);
 
     //! 3. launch the bulk kernels for both interpolation processes (fine to coarse and coarse to fine)
     //!
     para->getStreamManager()->waitOnStartBulkKernelEvent(CudaStreamIndex::Bulk);
-    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, CudaStreamIndex::Border);
-    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, CudaStreamIndex::Border);
+    updateGrid->fineToCoarse(level, &para->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, CudaStreamIndex::SubDomainBorder);
+    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, CudaStreamIndex::SubDomainBorder);
 
     //! 4. exchange information between GPUs (all nodes)
     //!
-    updateGrid->exchangeMultiGPU(level, CudaStreamIndex::Border);
+    updateGrid->exchangeMultiGPU(level, CudaStreamIndex::SubDomainBorder);
 
     // 5. interpolation fine to coarse for nodes which are at the border of the gpus/processes
     //!
-    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBorder, para->getParD(level)->offCF, CudaStreamIndex::Border);
+    updateGrid->coarseToFine(level, &para->getParD(level)->intCFBorder, para->getParD(level)->offCF, CudaStreamIndex::SubDomainBorder);
 
     cudaDeviceSynchronize();
 }
diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
index 44202b716..00a7b4566 100644
--- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
+++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
@@ -240,7 +240,7 @@ void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe
                             std::vector<ProcessNeighbor27> *sendProcessNeighborHost,
                             std::vector<ProcessNeighbor27> *recvProcessNeighborHost)
 {
-    cudaStream_t stream = para->getStreamManager()->getStream(CudaStreamIndex::Border);
+    cudaStream_t stream = para->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder);
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // copy Device to Host
     for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++)
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index 5f1393791..c3dd9e414 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -120,11 +120,11 @@ void GridGenerator::allocArrays_taggedFluidNodes() {
                     if(para->getParH(level)->numberOfTaggedFluidNodes[tag]>0)
                         para->getParH(level)->allocatedBulkFluidNodeTags.push_back(tag);
                     break;
-                case CollisionTemplate::Border:
-                    this->setNumberOfTaggedFluidNodes(builder->getNumberOfFluidNodesBorder(level), CollisionTemplate::Border, level);
-                    cudaMemoryManager->cudaAllocTaggedFluidNodeIndices(CollisionTemplate::Border, level);
-                    builder->getFluidNodeIndicesBorder(para->getParH(level)->taggedFluidNodeIndices[CollisionTemplate::Border], level);
-                    cudaMemoryManager->cudaCopyTaggedFluidNodeIndices(CollisionTemplate::Border, level);
+                case CollisionTemplate::SubDomainBorder:
+                    this->setNumberOfTaggedFluidNodes(builder->getNumberOfFluidNodesBorder(level), CollisionTemplate::SubDomainBorder, level);
+                    cudaMemoryManager->cudaAllocTaggedFluidNodeIndices(CollisionTemplate::SubDomainBorder, level);
+                    builder->getFluidNodeIndicesBorder(para->getParH(level)->taggedFluidNodeIndices[CollisionTemplate::SubDomainBorder], level);
+                    cudaMemoryManager->cudaCopyTaggedFluidNodeIndices(CollisionTemplate::SubDomainBorder, level);
                     break;
                 case CollisionTemplate::WriteMacroVars:
                     this->setNumberOfTaggedFluidNodes(builder->getNumberOfFluidNodesMacroVars(level), CollisionTemplate::WriteMacroVars, level);
@@ -157,7 +157,7 @@ void GridGenerator::allocArrays_taggedFluidNodes() {
         VF_LOG_INFO("Number of tagged nodes on level {}:", level);
         VF_LOG_INFO("Default: {}, Border: {}, WriteMacroVars: {}, ApplyBodyForce: {}, AllFeatures: {}", 
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default],
-                    para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::Border],
+                    para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::SubDomainBorder],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::WriteMacroVars],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::ApplyBodyForce],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::AllFeatures]    );        
@@ -177,8 +177,8 @@ void GridGenerator::tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices
             builder->addFluidNodeIndicesAllFeatures( taggedFluidNodeIndices, level );
             break;
         case CollisionTemplate::Default:
-        case CollisionTemplate::Border:
-            throw std::runtime_error("Cannot tag fluid nodes as Default or Border!");
+        case CollisionTemplate::SubDomainBorder:
+            throw std::runtime_error("Cannot tag fluid nodes as Default or SubDomainBorder!");
         default:
             throw std::runtime_error("Tagging fluid nodes with invald tag!");
             break;
diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
index 253960f96..8807c2230 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -530,7 +530,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborXIndex(int lev, unsigned int proc
 void CudaMemoryManager::cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor,
                                                      const unsigned int &memsizeFsRecv)
 {
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
         checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].f[0],
 						 parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].f[0],
 						 parameter->getD3Qxx() * memsizeFsRecv,
@@ -540,12 +540,12 @@ void CudaMemoryManager::cudaCopyProcessNeighborXFsHD(int lev, unsigned int proce
                                          parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].f[0],
                                          parameter->getD3Qxx() * memsizeFsRecv,
                                          cudaMemcpyHostToDevice,
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor,
                                                      const unsigned int &memsizeFsSend)
 {  
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
     	checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].f[0],
     								parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].f[0],
     								parameter->getD3Qxx() * memsizeFsSend,
@@ -555,7 +555,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborXFsDH(int lev, unsigned int proce
     								     parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].f[0],
     								     parameter->getD3Qxx() * memsizeFsSend,
     								     cudaMemcpyDeviceToHost,
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor)
 {
@@ -600,7 +600,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborYIndex(int lev, unsigned int proc
 }
 void CudaMemoryManager::cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv)
 {
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
 	    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].f[0],
 								    parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].f[0],
 								    parameter->getD3Qxx() * memsizeFsRecv,
@@ -610,11 +610,11 @@ void CudaMemoryManager::cudaCopyProcessNeighborYFsHD(int lev, unsigned int proce
                                          parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].f[0],
                                          parameter->getD3Qxx() * memsizeFsRecv,
                                          cudaMemcpyHostToDevice,
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend)
 {
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
 	    checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].f[0],
 	    							parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].f[0],
 	    							parameter->getD3Qxx() * memsizeFsSend,
@@ -624,7 +624,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborYFsDH(int lev, unsigned int proce
                                          parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].f[0],
                                          parameter->getD3Qxx() * memsizeFsSend,
                                          cudaMemcpyDeviceToHost, 
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaFreeProcessNeighborY(int lev, unsigned int processNeighbor)
 {
@@ -670,7 +670,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborZIndex(int lev, unsigned int proc
 void CudaMemoryManager::cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor,
                                                      const unsigned int &memsizeFsRecv)
 {
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
 	    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].f[0],
 	    							parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].f[0],
 	    							parameter->getD3Qxx() * memsizeFsRecv,
@@ -680,12 +680,12 @@ void CudaMemoryManager::cudaCopyProcessNeighborZFsHD(int lev, unsigned int proce
 	    				                 parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].f[0],
 	    				                 parameter->getD3Qxx() * memsizeFsRecv,
 	    				                 cudaMemcpyHostToDevice,
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor,
                                                      const unsigned int &memsizeFsSend)
 {
-    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::Border))
+    if (!parameter->getStreamManager()->streamIsRegistered(CudaStreamIndex::SubDomainBorder))
         checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].f[0],
 	        					    parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].f[0],
 	        					    parameter->getD3Qxx() * memsizeFsSend,
@@ -695,7 +695,7 @@ void CudaMemoryManager::cudaCopyProcessNeighborZFsDH(int lev, unsigned int proce
 	        						     parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].f[0],
 	        						     parameter->getD3Qxx() * memsizeFsSend,
 	        						     cudaMemcpyDeviceToHost,
-                                         parameter->getStreamManager()->getStream(CudaStreamIndex::Border)));
+                                         parameter->getStreamManager()->getStream(CudaStreamIndex::SubDomainBorder)));
 }
 void CudaMemoryManager::cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor)
 {
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
index 54dd11142..8565d9660 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
@@ -85,7 +85,7 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un
 																																size_indices);
 			break;
 		
-		case CollisionTemplate::Border:
+		case CollisionTemplate::SubDomainBorder:
 		case CollisionTemplate::AllFeatures:
 			LB_Kernel_CumulantK17 < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  
 																																para->getParD(level)->omega, 	
diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h
index e08544bdf..c07769d5c 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/LB.h
+++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h
@@ -75,9 +75,9 @@ enum class CollisionTemplate {
    //! - AllFeatures: collision \w write out macroscopic variables AND read and apply body force
    AllFeatures,
    //! - Border: collision on border nodes
-   Border
+   SubDomainBorder
 };
-constexpr std::initializer_list<CollisionTemplate> all_CollisionTemplate  = { CollisionTemplate::Default, CollisionTemplate::WriteMacroVars, CollisionTemplate::ApplyBodyForce, CollisionTemplate::AllFeatures, CollisionTemplate::Border};
+constexpr std::initializer_list<CollisionTemplate> all_CollisionTemplate  = { CollisionTemplate::Default, CollisionTemplate::WriteMacroVars, CollisionTemplate::ApplyBodyForce, CollisionTemplate::AllFeatures, CollisionTemplate::SubDomainBorder};
 constexpr std::initializer_list<CollisionTemplate> bulk_CollisionTemplate = { CollisionTemplate::Default, CollisionTemplate::WriteMacroVars, CollisionTemplate::ApplyBodyForce, CollisionTemplate::AllFeatures};
 
 struct InitCondition
diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
index b120dd205..84ab84ff9 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
+++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -139,7 +139,7 @@ void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFa
     //////////////////////////////////////////////////////////////////////////
     // CUDA streams
     if (para->getUseStreams()) {
-        para->getStreamManager()->registerStream(CudaStreamIndex::Border);
+        para->getStreamManager()->registerStream(CudaStreamIndex::SubDomainBorder);
         para->getStreamManager()->registerStream(CudaStreamIndex::Bulk);
         para->getStreamManager()->launchStreams();
         para->getStreamManager()->createCudaEvents();
diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h
index 06fc56247..5c59bcd3a 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h
+++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h
@@ -39,7 +39,7 @@ enum class CudaStreamIndex
     {
         Legacy,
         Bulk,
-        Border,
+        SubDomainBorder,
         Precursor,
         ActuatorFarm
     };
diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
index f83e50d52..86b7bc2a0 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
+++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h
@@ -372,12 +372,12 @@ struct LBMSimulationParameter {
 
     ///////////////////////////////////////////////////////
     std::map<CollisionTemplate, uint*>    taggedFluidNodeIndices = {{CollisionTemplate::Default,        nullptr},
-                                                                    {CollisionTemplate::Border,         nullptr},
+                                                                    {CollisionTemplate::SubDomainBorder,nullptr},
                                                                     {CollisionTemplate::WriteMacroVars, nullptr},
                                                                     {CollisionTemplate::ApplyBodyForce, nullptr},
                                                                     {CollisionTemplate::AllFeatures,    nullptr}};
     std::map<CollisionTemplate, uint >  numberOfTaggedFluidNodes = {{CollisionTemplate::Default,        0},
-                                                                    {CollisionTemplate::Border,         0},
+                                                                    {CollisionTemplate::SubDomainBorder,0},
                                                                     {CollisionTemplate::WriteMacroVars, 0},
                                                                     {CollisionTemplate::ApplyBodyForce, 0},
                                                                     {CollisionTemplate::AllFeatures,    0}};
-- 
GitLab


From 8503b2924b10fc9672f0941c3655c4299fe25e51 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 15:29:57 +0000
Subject: [PATCH 110/179] Apply 1 suggestion(s) to 1 file(s)

---
 src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
index 73c6b9fa2..4eb08559e 100644
--- a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
+++ b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
@@ -1,5 +1,5 @@
-#ifndef FILE_WRITER_H
-#define FILE_WRITER_H
+#ifndef DISTRIBUTION_INSPECTOR_H
+#define DISTRIBUTION_INSPECTOR_H
 
 #include "Parameter/Parameter.h"
 
-- 
GitLab


From ffdcd7930bb2f2ae0f4bf19c252b60c45af00813 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:36:31 +0100
Subject: [PATCH 111/179] Add header description for DistributionDebugInspector

---
 .../Output/DistributionDebugInspector.h       | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
index 4eb08559e..53e030c0d 100644
--- a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
+++ b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
@@ -1,3 +1,41 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file DistributionDebugInspector.h
+//! \author Henrik Asmuth
+//! \date 13/012/2022
+//! \brief Basic debugging class to print out f's in a certain area of the domain
+//!
+//! Basic debugging class. Needs to be directly added in UpdateGrid (could potentially also be added as a proper Probe in the future)
+//! How to use: Define a part of the domain via min/max x, y, and z. The DistributionDebugInspector will print out all f's in that area.
+//!
+//=======================================================================================
+
 #ifndef DISTRIBUTION_INSPECTOR_H
 #define DISTRIBUTION_INSPECTOR_H
 
-- 
GitLab


From f86cc12ca56a7745f485a2f9a18d961d1ca1144d Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 15:37:13 +0000
Subject: [PATCH 112/179] Apply 1 suggestion(s) to 1 file(s)

---
 src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp
index abe780470..3cc771e41 100644
--- a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp
@@ -29,8 +29,6 @@
 //=======================================================================================
 #include "CudaStreamManager.h"
 #include <helper_cuda.h>
-#include <cuda_runtime.h>
-#include <cuda.h>
 #include <iostream>
 
 void CudaStreamManager::registerStream(CudaStreamIndex streamIndex)
-- 
GitLab


From f68ca6620ca7e1eaa0b20f7dcc164d7896009155 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <soe.peters@tu-braunschweig.de>
Date: Tue, 13 Dec 2022 15:43:13 +0000
Subject: [PATCH 113/179] Update PHOENIX.config.cmake

---
 CMake/cmake_config_files/PHOENIX.config.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMake/cmake_config_files/PHOENIX.config.cmake b/CMake/cmake_config_files/PHOENIX.config.cmake
index 12355ebb3..d31d8684a 100644
--- a/CMake/cmake_config_files/PHOENIX.config.cmake
+++ b/CMake/cmake_config_files/PHOENIX.config.cmake
@@ -29,6 +29,6 @@ set(CMAKE_CUDA_ARCHITECTURES 60) # NVIDIA Tesla P100
 set(GPU_APP "apps/gpu/LBM/")
 list(APPEND USER_APPS 
     # "${GPU_APP}DrivenCavityMultiGPU"
-    "${GPU_APP}SphereScaling"
+    # "${GPU_APP}SphereScaling"
     # "${GPU_APP}MusselOyster"
     )
-- 
GitLab


From ddc51a3bf628f427318a09e0c3696317a889185c Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:51:05 +0100
Subject: [PATCH 114/179] Remove bodyForce and typeOfGridNode from CumulantK17
 kernel

---
 .../Compressible/CumulantK17/CumulantK17.cu   | 170 ++++++++----------
 .../CumulantK17/CumulantK17_Device.cu         |  34 ++--
 .../CumulantK17/CumulantK17_Device.cuh        |   2 -
 3 files changed, 93 insertions(+), 113 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
index 8565d9660..70b0c4352 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
@@ -15,23 +15,21 @@ std::shared_ptr< CumulantK17<turbulenceModel> > CumulantK17<turbulenceModel>::ge
 template<TurbulenceModel turbulenceModel>
 void CumulantK17<turbulenceModel>::run()
 {
-	LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega, 	
-																												para->getParD(level)->typeOfGridNode, 										
-																												para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																												para->getParD(level)->distributions.f[0],	
-																												para->getParD(level)->rho,		
-																												para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																												para->getParD(level)->turbViscosity,
-																												para->getSGSConstant(),
-																												(unsigned long)para->getParD(level)->numberOfNodes,	
-																												level,				
-																												para->getIsBodyForce(),				
-																												para->getForcesDev(),				
-																												para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																												para->getQuadricLimitersDev(),			
-																												para->getParD(level)->isEvenTimestep,
-																												para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
-        																										para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
+	LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega,										
+																										para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																										para->getParD(level)->distributions.f[0],	
+																										para->getParD(level)->rho,		
+																										para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																										para->getParD(level)->turbViscosity,
+																										para->getSGSConstant(),
+																										(unsigned long)para->getParD(level)->numberOfNodes,	
+																										level,			
+																										para->getForcesDev(),				
+																										para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																										para->getQuadricLimitersDev(),			
+																										para->getParD(level)->isEvenTimestep,
+																										para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
+																										para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
 
 	getLastCudaError("LB_Kernel_CumulantK17 execution failed");
 }
@@ -44,89 +42,75 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un
 	switch (collisionTemplate)
 	{
 		case CollisionTemplate::Default:
-			LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(   
-																																	para->getParD(level)->omega, 	
-																																	para->getParD(level)->typeOfGridNode, 										
-																																	para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																	para->getParD(level)->distributions.f[0],	
-																																	para->getParD(level)->rho,		
-																																	para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																	para->getParD(level)->turbViscosity,
-																																	para->getSGSConstant(),
-																																	(unsigned long)para->getParD(level)->numberOfNodes,	
-																																	level,				
-																																	para->getIsBodyForce(),				
-																																	para->getForcesDev(),				
-																																	para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																	para->getQuadricLimitersDev(),			
-																																	para->getParD(level)->isEvenTimestep,
-																																	indices,
-																																	size_indices);
+			LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(para->getParD(level)->omega,								
+																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																														para->getParD(level)->distributions.f[0],	
+																														para->getParD(level)->rho,		
+																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																														para->getParD(level)->turbViscosity,
+																														para->getSGSConstant(),
+																														(unsigned long)para->getParD(level)->numberOfNodes,	
+																														level,			
+																														para->getForcesDev(),				
+																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																														para->getQuadricLimitersDev(),			
+																														para->getParD(level)->isEvenTimestep,
+																														indices,
+																														size_indices);
 			break;
 		
 		case CollisionTemplate::WriteMacroVars:
-			LB_Kernel_CumulantK17 < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
+			LB_Kernel_CumulantK17 < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,										
+																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																														para->getParD(level)->distributions.f[0],	
+																														para->getParD(level)->rho,		
+																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																														para->getParD(level)->turbViscosity,
+																														para->getSGSConstant(),
+																														(unsigned long)para->getParD(level)->numberOfNodes,	
+																														level,			
+																														para->getForcesDev(),				
+																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																														para->getQuadricLimitersDev(),			
+																														para->getParD(level)->isEvenTimestep,
+																														indices,
+																														size_indices);
 			break;
 		
 		case CollisionTemplate::SubDomainBorder:
 		case CollisionTemplate::AllFeatures:
-			LB_Kernel_CumulantK17 < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
-			break;
-		case CollisionTemplate::ApplyBodyForce:
-			LB_Kernel_CumulantK17 < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
-			break;
-		default:
+			LB_Kernel_CumulantK17 < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  para->getParD(level)->omega,
+																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																														para->getParD(level)->distributions.f[0],	
+																														para->getParD(level)->rho,		
+																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																														para->getParD(level)->turbViscosity,
+																														para->getSGSConstant(),
+																														(unsigned long)para->getParD(level)->numberOfNodes,	
+																														level,			
+																														para->getForcesDev(),				
+																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																														para->getQuadricLimitersDev(),			
+																														para->getParD(level)->isEvenTimestep,
+																														indices,
+																														size_indices);
+			break;	case CollisionTemplate::ApplyBodyForce:
+			LB_Kernel_CumulantK17 < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,									
+																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																														para->getParD(level)->distributions.f[0],	
+																														para->getParD(level)->rho,		
+																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																														para->getParD(level)->turbViscosity,
+																														para->getSGSConstant(),
+																														(unsigned long)para->getParD(level)->numberOfNodes,	
+																														level,			
+																														para->getForcesDev(),				
+																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																														para->getQuadricLimitersDev(),			
+																														para->getParD(level)->isEvenTimestep,
+																														indices,
+																														size_indices);
+			break;	default:
 			throw std::runtime_error("Invalid CollisionTemplate in CumulantK17::runOnIndices()");
 			break;
 	}
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
index d2b679395..34a444230 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
@@ -58,7 +58,6 @@ using namespace vf::lbm::dir;
 template<TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce>
 __global__ void LB_Kernel_CumulantK17(
 	real omega_in,
-	uint* typeOfGridNode,
 	uint* neighborX,
 	uint* neighborY,
 	uint* neighborZ,
@@ -71,7 +70,6 @@ __global__ void LB_Kernel_CumulantK17(
     real SGSconstant,
 	unsigned long numberOfLBnodes,
 	int level,
-    bool bodyForce,
 	real* forces,
     real* bodyForceX,
     real* bodyForceY,
@@ -695,34 +693,34 @@ __global__ void LB_Kernel_CumulantK17(
     (dist.f[DIR_MMM])[k_MMM]  = f_PPP;
 }
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
index 9d56098f5..b8cc9543e 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
@@ -6,7 +6,6 @@
 
 template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void LB_Kernel_CumulantK17(
 	real omega_in,
-	uint* typeOfGridNode,
 	uint* neighborX,
 	uint* neighborY,
 	uint* neighborZ,
@@ -19,7 +18,6 @@ template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool
 	real SGSconstant,
 	unsigned long numberOfLBnodes,
 	int level,
-	bool bodyForce,
 	real* forces,
 	real* bodyForceX,
 	real* bodyForceY,
-- 
GitLab


From da6e16bfc6fcfc41fbc56211cc78baf4331d71d2 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Tue, 13 Dec 2022 16:59:28 +0100
Subject: [PATCH 115/179] Fix grid set-up in BoundaryLayer

---
 apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
index 6d5bf598c..7ec203e78 100644
--- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
+++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
@@ -235,14 +235,19 @@ void multipleLevel(const std::string& configPath)
     bool isLastSubDomain  = (procID == nProcs-1 && nProcs > 1)?                    true: false;
     bool isMidSubDomain   = (!isFirstSubDomain && !isLastSubDomain && nProcs > 1)? true: false;
     
-    if(isFirstSubDomain || isMidSubDomain)
+    if(isFirstSubDomain)
     {
         xGridMax += overlap;
-        // xGridMin -= overlap;
+        if(!readPrecursor) xGridMin -= overlap;
     }
-    if(isLastSubDomain || isMidSubDomain)
+    if(isLastSubDomain)
     {
-        // xGridMax += overlap;
+        xGridMin -= overlap;
+        if(!readPrecursor) xGridMax += overlap;
+    }
+    if(isMidSubDomain)
+    {
+        xGridMax += overlap;
         xGridMin -= overlap;
     }
 
@@ -252,8 +257,7 @@ void multipleLevel(const std::string& configPath)
     {
         gridBuilder->setNumberOfLayers(4,0);
         real xMaxRefinement = readPrecursor? xGridMax-H: xGridMax;   //Stop refinement some distance before outlet if domain ist not periodic
-        // gridBuilder->addGrid( new Cuboid( xGridMin+dx, 0.f, 0.f, xMaxRefinement, L_y,  0.5*L_z) , 1 );
-        gridBuilder->addGrid( new Cuboid( 0.f, 0.f, 0.f, 5000.0, L_y,  0.5*L_z) , 1 );
+        gridBuilder->addGrid( new Cuboid( xGridMin, 0.f, 0.f, xMaxRefinement, L_y,  0.5*L_z) , 1 );
         para->setMaxLevel(2);
         scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
     }
-- 
GitLab


From ef5f211a654c8535c9eda631e394d03504b9b363 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <dev.peters@icloud.com>
Date: Wed, 14 Dec 2022 11:50:08 +0100
Subject: [PATCH 116/179] Use preset in analyse ci jobs and update preset
 version. Remove default build folder as binary dir from preset

---
 .gitlab-ci.yml                             | 6 ++----
 CMakePresets.json                          | 5 ++---
 apps/cpu/ConvectionOfVortex/CMakeLists.txt | 2 --
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b34c5a8f6..f65586927 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -319,8 +319,7 @@ clang_build_analyzer_clang_10:
     - mkdir -p $CI_PROJECT_DIR/build
     - cd $CI_PROJECT_DIR/build
     - cmake ..
-      -DBUILD_VF_CPU=ON
-      -DBUILD_VF_GPU=ON
+      --preset=al_make
       -DCMAKE_CUDA_ARCHITECTURES=60
       -DCMAKE_CXX_FLAGS=-ftime-trace
     - ClangBuildAnalyzer --start .
@@ -352,8 +351,7 @@ include_what_you_use_clang_10:
     - mkdir -p $CI_PROJECT_DIR/build
     - cd $CI_PROJECT_DIR/build
     - cmake ..
-      -DBUILD_VF_CPU=ON
-      -DBUILD_VF_GPU=ON
+      --preset=al_make
       -DCMAKE_CUDA_ARCHITECTURES=60
       -DBUILD_VF_INCLUDE_WHAT_YOU_USE=ON
     - make
diff --git a/CMakePresets.json b/CMakePresets.json
index 0f360fd30..4c9f5f483 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -1,15 +1,14 @@
 {
-    "version": 2,
+    "version": 5,
     "cmakeMinimumRequired": {
         "major": 3,
-        "minor": 20,
+        "minor": 24,
         "patch": 0
     },
     "configurePresets": [
         {
             "name": "default",
             "hidden": true,
-            "binaryDir": "${sourceDir}/build/",
             "cacheVariables": {
                 "BUILD_VF_UNIT_TESTS": "ON"
             }
diff --git a/apps/cpu/ConvectionOfVortex/CMakeLists.txt b/apps/cpu/ConvectionOfVortex/CMakeLists.txt
index b76c48282..33d60676c 100644
--- a/apps/cpu/ConvectionOfVortex/CMakeLists.txt
+++ b/apps/cpu/ConvectionOfVortex/CMakeLists.txt
@@ -1,5 +1,3 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
 ########################################################
 ## C++ PROJECT                                       ###
 ########################################################
-- 
GitLab


From 3ac9a92eed6c791a2c904e32df8185e5e7f92c6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <dev.peters@icloud.com>
Date: Wed, 14 Dec 2022 13:08:52 +0000
Subject: [PATCH 117/179] Switch preset minimum cmake back to 3.22.

---
 CMakePresets.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakePresets.json b/CMakePresets.json
index 4c9f5f483..9d8d31f6f 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -1,8 +1,8 @@
 {
-    "version": 5,
+    "version": 3,
     "cmakeMinimumRequired": {
         "major": 3,
-        "minor": 24,
+        "minor": 22,
         "patch": 0
     },
     "configurePresets": [
-- 
GitLab


From d68dc46796508d100920d3376d73035b075f703c Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Wed, 14 Dec 2022 14:32:31 +0100
Subject: [PATCH 118/179] bug fix in probe: no array names in parallel file

---
 .../VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu   | 3 ++-
 .../VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h    | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
index 44f76220f..03c18f5a9 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu
@@ -379,9 +379,10 @@ void Probe::writeParallelFile(Parameter* para, int t)
     int t_write = this->fileNameLU ? t: t/this->tOut; 
     std::string filename = this->outputPath + "/" + this->makeParallelFileName(para->getMyProcessID(), t_write);
 
+    std::vector<std::string> nodedatanames = this->getVarNames();
     std::vector<std::string> cellNames;
 
-    getWriter()->writeParallelFile(filename, fileNamesForCollectionFile, varNames, cellNames);
+    getWriter()->writeParallelFile(filename, fileNamesForCollectionFile, nodedatanames, cellNames);
 
     this->fileNamesForCollectionFile.clear();
 }
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h
index cc67a5535..aaf294e87 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h
@@ -208,7 +208,6 @@ protected:
     bool hasDeviceQuantityArray;    //!> flag initiating memCopy in Point and PlaneProbe. Other probes are only based on thrust reduce functions and therefore dont need explict memCopy in interact()
     bool outputTimeSeries;          //!> flag initiating overwrite of output vtk files, skipping collection files and limiting the length of the written data to the current time step (currently only used for WallModelProbe)
     std::vector<std::string> fileNamesForCollectionFile;
-    std::vector<std::string> varNames;
 
     bool fileNameLU = true; //!> if true, written file name contains time step in LU, else is the number of the written probe files
 
-- 
GitLab


From a09c62e044a62a8bbb30fc00574f952463827108 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <dev.peters@icloud.com>
Date: Wed, 14 Dec 2022 13:33:21 +0000
Subject: [PATCH 119/179] Revert changes in preset.

---
 CMakePresets.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/CMakePresets.json b/CMakePresets.json
index 9d8d31f6f..0f360fd30 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -1,14 +1,15 @@
 {
-    "version": 3,
+    "version": 2,
     "cmakeMinimumRequired": {
         "major": 3,
-        "minor": 22,
+        "minor": 20,
         "patch": 0
     },
     "configurePresets": [
         {
             "name": "default",
             "hidden": true,
+            "binaryDir": "${sourceDir}/build/",
             "cacheVariables": {
                 "BUILD_VF_UNIT_TESTS": "ON"
             }
-- 
GitLab


From 2a2744fea210fe7c8e6fb143598d9f5d1ecfa866 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Wed, 14 Dec 2022 18:01:02 +0100
Subject: [PATCH 120/179] Fix wrong scaling of z0 in StressBC

---
 src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index 0a31b6f91..ec0db541b 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -131,8 +131,7 @@ void LevelGridBuilder::setStressBoundaryCondition(  SideType sideType,
 {
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
     {
-        SPtr<StressBoundaryCondition> stressBoundaryCondition = StressBoundaryCondition::make(nomalX, normalY, normalZ, samplingOffset, z0/(dx*(level+1)));
-
+        SPtr<StressBoundaryCondition> stressBoundaryCondition = StressBoundaryCondition::make(nomalX, normalY, normalZ, samplingOffset, z0*pow(2.0f,level)/dx);
         auto side = SideFactory::make(sideType);
 
         stressBoundaryCondition->side = side;
-- 
GitLab


From 6069b1fc6f82ef194e27c2960234b3911c96a045 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <soe.peters@tu-braunschweig.de>
Date: Thu, 15 Dec 2022 10:14:29 +0000
Subject: [PATCH 121/179] Fix typo

---
 .gitlab-ci.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f65586927..c0b4920c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 ###############################################################################
 ##                       VirtualFluids CI Pipeline                           ##
 ###############################################################################
-image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.3
+image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.4
 
 stages:
   - build
@@ -319,7 +319,7 @@ clang_build_analyzer_clang_10:
     - mkdir -p $CI_PROJECT_DIR/build
     - cd $CI_PROJECT_DIR/build
     - cmake ..
-      --preset=al_make
+      --preset=all_make
       -DCMAKE_CUDA_ARCHITECTURES=60
       -DCMAKE_CXX_FLAGS=-ftime-trace
     - ClangBuildAnalyzer --start .
@@ -351,7 +351,7 @@ include_what_you_use_clang_10:
     - mkdir -p $CI_PROJECT_DIR/build
     - cd $CI_PROJECT_DIR/build
     - cmake ..
-      --preset=al_make
+      --preset=all_make
       -DCMAKE_CUDA_ARCHITECTURES=60
       -DBUILD_VF_INCLUDE_WHAT_YOU_USE=ON
     - make
-- 
GitLab


From e5f98e7ff1db8800f23567ae8dff92549bfb677b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <soe.peters@tu-braunschweig.de>
Date: Fri, 16 Dec 2022 08:53:21 +0000
Subject: [PATCH 122/179] Use double accuracy in clang-tidy job.

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c0b4920c3..22cc5bdf0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -471,6 +471,7 @@ clang-tidy:
     - cd $CI_PROJECT_DIR/build
     - cmake ..
       -DBUILD_VF_CPU=ON
+      -DBUILD_VF_DOUBLE_ACCURACY=ON
       -DBUILD_VF_GPU=OFF
     - python3 ../utilities/filterCompileCommands.py compile_commands.json
     - run-clang-tidy -quiet > clangtidy.txt
-- 
GitLab


From 8425c95d1498194e07850c83cdd3df570585b487 Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 10:28:16 +0100
Subject: [PATCH 123/179] correct args in logger bindings

---
 pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi | 2 +-
 pythonbindings/src/basics/submodules/logger.cpp          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi b/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
index 2f3d84f41..757eb59d6 100644
--- a/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
@@ -26,7 +26,7 @@ class Logger:
     @staticmethod
     def add_stdout() -> None: ...
     @staticmethod
-    def enable_printed_rank_numbers() -> None: ...
+    def enable_printed_rank_numbers(print: bool) -> None: ...
     @staticmethod
     def set_debug_level(level: int) -> None: ...
     @staticmethod
diff --git a/pythonbindings/src/basics/submodules/logger.cpp b/pythonbindings/src/basics/submodules/logger.cpp
index 1816ccb50..2f32853cc 100644
--- a/pythonbindings/src/basics/submodules/logger.cpp
+++ b/pythonbindings/src/basics/submodules/logger.cpp
@@ -17,7 +17,7 @@ namespace logger
         })
         .def_static("set_debug_level", &logging::Logger::setDebugLevel)
         .def_static("time_stamp", &logging::Logger::timeStamp, py::arg("time_stamp"))
-        .def_static("enable_printed_rank_numbers", &logging::Logger::enablePrintedRankNumbers);
+        .def_static("enable_printed_rank_numbers", &logging::Logger::enablePrintedRankNumbers, py::arg("print"));
 
         loggerModule.attr("log") = logging::out;
         py::enum_<logging::Logger::Level>(loggerModule, "Level")
-- 
GitLab


From 58b75634a5636f7d3cc6a4f3e220096db9540693 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 12:53:12 +0100
Subject: [PATCH 124/179] Rename E,W,N,,etc. in TransientBCSetter

---
 .../TransientBCSetter/TransientBCSetter.cpp   |  8 +++----
 .../TransientBCSetter/TransientBCSetter.h     | 22 +++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index 8b3fca3e3..d8c6fc471 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -289,7 +289,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
 
             // y in simulation is x in precursor/file, z in simulation is y in precursor/file 
             // simulation -> file: N -> E, S -> W, T -> N, B -> S
-            int idx = file.findNeighborWSB(posY, posZ, 0.f);                            //!> index of nearest WSB neighbor on precursor file
+            int idx = file.findNeighborMMM(posY, posZ, 0.f);                            //!> index of nearest WSB neighbor on precursor file
             
             if(idx!=-1)
             {
@@ -325,7 +325,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
             
             if(!foundNT) //NT in simulation is EN in precursor
             {
-                int idx = file.findNeighborENB(posY, posZ, 0.f);
+                int idx = file.findNeighborPPM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
                     foundNT = true;
@@ -338,7 +338,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
 
             if(!foundNB) //NB in simulation is ES in precursor
             {
-                int idx = file.findNeighborESB(posY, posZ, 0.f);
+                int idx = file.findNeighborPMM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
                     foundNB = true;
@@ -351,7 +351,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
 
             if(!foundST) //ST in simulation is WN in precursor
             {
-                int idx = file.findNeighborWNB(posY, posZ, 0.f);
+                int idx = file.findNeighborMPM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
                     foundST = true;
diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
index 49b085973..2c5018872 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
@@ -46,23 +46,23 @@ public:
     bool inXBounds(real posX){ return posX<=maxX && posX>=minX; };
     bool inYBounds(real posY){ return posY<=maxY && posY>=minY; };
     bool inZBounds(real posZ){ return posZ<=maxZ && posZ>=minZ; };
-    int findNeighborWSB(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)  , getIdxSY(posY)  , getIdxBZ(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborWST(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)  , getIdxSY(posY)  , getIdxBZ(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborWNB(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)  , getIdxSY(posY)+1, getIdxBZ(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborWNT(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)  , getIdxSY(posY)+1, getIdxBZ(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborESB(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)+1, getIdxSY(posY)  , getIdxBZ(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborEST(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)+1, getIdxSY(posY)  , getIdxBZ(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborENB(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)+1, getIdxSY(posY)+1, getIdxBZ(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
-    int findNeighborENT(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxWX(posX)+1, getIdxSY(posY)+1, getIdxBZ(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborMMM(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)  , getIdx0M0(posY)  , getIdx00M(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborMMP(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)  , getIdx0M0(posY)  , getIdx00M(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborMPM(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)  , getIdx0M0(posY)+1, getIdx00M(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborMPP(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)  , getIdx0M0(posY)+1, getIdx00M(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborPMM(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)+1, getIdx0M0(posY)  , getIdx00M(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborPMP(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)+1, getIdx0M0(posY)  , getIdx00M(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborPPM(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)+1, getIdx0M0(posY)+1, getIdx00M(posZ)  ); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
+    int findNeighborPPP(real posX, real posY, real posZ){ int idx = getLinearIndex(getIdxM00(posX)+1, getIdx0M0(posY)+1, getIdx00M(posZ)+1); return (idx>=0) && (idx<nx*ny*nz) ? idx : -1; };
     int getIdxX(int linearIdx){ return linearIdx%nx;};
     int getIdxY(int linearIdx){ return (linearIdx/nx)%ny;};
     int getIdxZ(int linearIdx){ return linearIdx/(nx*ny); };
     real getX(int linearIdx){ return getIdxX(linearIdx)*deltaX+minX; };
     real getY(int linearIdx){ return getIdxY(linearIdx)*deltaY+minY; };
     real getZ(int linearIdx){ return getIdxZ(linearIdx)*deltaZ+minZ; };
-    int getIdxWX(real posX){ return (posX-minX)/deltaX; };
-    int getIdxSY(real posY){ return (posY-minY)/deltaY; };
-    int getIdxBZ(real posZ){ return (posZ-minZ)/deltaZ; };
+    int getIdxM00(real posX){ return (posX-minX)/deltaX; };
+    int getIdx0M0(real posY){ return (posY-minY)/deltaY; };
+    int getIdx00M(real posZ){ return (posZ-minZ)/deltaZ; };
     int getClosestIdxX(real posX){ int x = round((posX-minX)/deltaX); return x>nx ? nx : (x<0 ? 0 : x);};
     int getClosestIdxY(real posY){ int y = round((posY-minY)/deltaY); return y>ny ? ny : (y<0 ? 0 : y);};
     int getClosestIdxZ(real posZ){ int z = round((posZ-minZ)/deltaZ); return z>nz ? nz : (z<0 ? 0 : z);};
-- 
GitLab


From 15ce38dd902e05464b4d07d562951c1e4105f620 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:17:04 +0100
Subject: [PATCH 125/179] More renaming in TransientBCSetter

---
 .../TransientBCSetter/TransientBCSetter.cpp   | 90 +++++++++----------
 .../TransientBCSetter/TransientBCSetter.h     |  8 +-
 2 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index d8c6fc471..a7a2f0faa 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -225,20 +225,20 @@ void VTKFileCollection::findFiles()
         VF_LOG_CRITICAL("VTKFileCollection found no files!"); 
 }
     
-void TransientBCInputFileReader::getNeighbors(uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB)
+void TransientBCInputFileReader::getNeighbors(uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM)
 {
-    std::copy(planeNeighborNT.begin(), planeNeighborNT.end(), &neighborNT[writingOffset]);
-    std::copy(planeNeighborNB.begin(), planeNeighborNB.end(), &neighborNB[writingOffset]);
-    std::copy(planeNeighborST.begin(), planeNeighborST.end(), &neighborST[writingOffset]);
-    std::copy(planeNeighborSB.begin(), planeNeighborSB.end(), &neighborSB[writingOffset]);
+    std::copy(planeNeighbor0PP.begin(), planeNeighbor0PP.end(), &neighbor0PP[writingOffset]);
+    std::copy(planeNeighbor0PM.begin(), planeNeighbor0PM.end(), &neighbor0PM[writingOffset]);
+    std::copy(planeNeighbor0MP.begin(), planeNeighbor0MP.end(), &neighbor0MP[writingOffset]);
+    std::copy(planeNeighbor0MM.begin(), planeNeighbor0MM.end(), &neighbor0MM[writingOffset]);
 }
 
-void TransientBCInputFileReader::getWeights(real* _weightsNT, real* _weightsNB, real* _weightsST, real* _weightsSB)
+void TransientBCInputFileReader::getWeights(real* _weights0PP, real* _weights0PM, real* _weights0MP, real* _weights0MM)
 {
-    std::copy(weightsNT.begin(), weightsNT.end(), &_weightsNT[writingOffset]);
-    std::copy(weightsNB.begin(), weightsNB.end(), &_weightsNB[writingOffset]);
-    std::copy(weightsST.begin(), weightsST.end(), &_weightsST[writingOffset]);
-    std::copy(weightsSB.begin(), weightsSB.end(), &_weightsSB[writingOffset]);
+    std::copy(weights0PP.begin(), weights0PP.end(), &_weights0PP[writingOffset]);
+    std::copy(weights0PM.begin(), weights0PM.end(), &_weights0PM[writingOffset]);
+    std::copy(weights0MP.begin(), weights0MP.end(), &_weights0MP[writingOffset]);
+    std::copy(weights0MM.begin(), weights0MM.end(), &_weights0MM[writingOffset]);
 }
 
 
@@ -263,22 +263,22 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
     real eps = 1e-7; // small number to avoid division by zero
     bool perfect_match = true;
 
-    this->weightsNT.reserve(this->nPoints);
-    this->weightsNB.reserve(this->nPoints);
-    this->weightsST.reserve(this->nPoints);
-    this->weightsSB.reserve(this->nPoints);
+    this->weights0PP.reserve(this->nPoints);
+    this->weights0PM.reserve(this->nPoints);
+    this->weights0MP.reserve(this->nPoints);
+    this->weights0MM.reserve(this->nPoints);
 
-    this->planeNeighborNT.reserve(this->nPoints);
-    this->planeNeighborNB.reserve(this->nPoints);
-    this->planeNeighborST.reserve(this->nPoints);
-    this->planeNeighborSB.reserve(this->nPoints);
+    this->planeNeighbor0PP.reserve(this->nPoints);
+    this->planeNeighbor0PM.reserve(this->nPoints);
+    this->planeNeighbor0MP.reserve(this->nPoints);
+    this->planeNeighbor0MM.reserve(this->nPoints);
 
     for(uint i=0; i<nPoints; i++)
     {
 
         real posY = coordsY[i];
         real posZ = coordsZ[i];
-        bool foundNT = false, foundNB = false, foundST = false, foundSB = false, foundAll = false;
+        bool found0PP = false, found0PM = false, found0MP = false, found0MM = false, foundAll = false;
 
         uint level = this->readLevel;
 
@@ -296,73 +296,73 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
                 // Filter for exact matches
                 if(abs(posY-file.getX(idx)) < max_diff && abs(posZ-file.getY(idx)) < max_diff) 
                 {
-                    this->weightsNT.emplace_back(1e6f);
-                    this->weightsNB.emplace_back(0.f);
-                    this->weightsST.emplace_back(0.f);
-                    this->weightsSB.emplace_back(0.f);
+                    this->weights0PP.emplace_back(1e6f);
+                    this->weights0PM.emplace_back(0.f);
+                    this->weights0MP.emplace_back(0.f);
+                    this->weights0MM.emplace_back(0.f);
                     uint writeIdx = this->getWriteIndex(level, fileId, idx);            //!> writeIdx: index on host/device array where precursor value will be written to after loading from file
-                    this->planeNeighborNT.push_back(writeIdx);                          //!> neighbor lists mapping where BC kernel should read from on host/device array
-                    this->planeNeighborNB.push_back(writeIdx);
-                    this->planeNeighborST.push_back(writeIdx);
-                    this->planeNeighborSB.push_back(writeIdx);
-                    foundNT = true; foundNB = true; foundSB = true; foundST = true;
+                    this->planeNeighbor0PP.push_back(writeIdx);                          //!> neighbor lists mapping where BC kernel should read from on host/device array
+                    this->planeNeighbor0PM.push_back(writeIdx);
+                    this->planeNeighbor0MP.push_back(writeIdx);
+                    this->planeNeighbor0MM.push_back(writeIdx);
+                    found0PP = true; found0PM = true; found0MM = true; found0MP = true;
                 } 
                 else
                 {
                     perfect_match = false;
                 }
 
-                if(!foundSB)
+                if(!found0MM)
                 {
-                    foundSB = true;
+                    found0MM = true;
                     real dy = file.getX(idx)-posY;
                     real dz = file.getY(idx)-posZ;
-                    this->weightsSB.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighborSB.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->weights0MM.emplace_back(1.f/(dy*dy+dz*dz+eps));
+                    this->planeNeighbor0MM.emplace_back(getWriteIndex(level, fileId, idx));
                 }
                 
             } 
             
-            if(!foundNT) //NT in simulation is EN in precursor
+            if(!found0PP) //NT in simulation is EN in precursor
             {
                 int idx = file.findNeighborPPM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
-                    foundNT = true;
+                    found0PP = true;
                     real dy = file.getX(idx)-posY;
                     real dz = file.getY(idx)-posZ;
-                    this->weightsNT.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighborNT.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->weights0PP.emplace_back(1.f/(dy*dy+dz*dz+eps));
+                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, idx));
                 }
             }
 
-            if(!foundNB) //NB in simulation is ES in precursor
+            if(!found0PM) //NB in simulation is ES in precursor
             {
                 int idx = file.findNeighborPMM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
-                    foundNB = true;
+                    found0PM = true;
                     real dy = file.getX(idx)-posY;
                     real dz = file.getY(idx)-posZ;
-                    this->weightsNB.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighborNT.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->weights0PM.emplace_back(1.f/(dy*dy+dz*dz+eps));
+                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, idx));
                 }
             }
 
-            if(!foundST) //ST in simulation is WN in precursor
+            if(!found0MP) //ST in simulation is WN in precursor
             {
                 int idx = file.findNeighborMPM(posY, posZ, 0.f);
                 if(idx!=-1)
                 {
-                    foundST = true;
+                    found0MP = true;
                     real dy = file.getX(idx)-posY;
                     real dz = file.getY(idx)-posZ;
-                    this->weightsST.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighborST.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->weights0MP.emplace_back(1.f/(dy*dy+dz*dz+eps));
+                    this->planeNeighbor0MP.emplace_back(getWriteIndex(level, fileId, idx));
                 }
             }
 
-            foundAll = foundNT && foundNB && foundST && foundSB;
+            foundAll = found0PP && found0PM && found0MP && found0MM;
 
             if(foundAll) break;
         }
diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
index 2c5018872..5bee61e19 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
@@ -156,12 +156,12 @@ public:
     uint getNPointsRead(){return nPointsRead; };
     size_t getNumberOfQuantities(){ return nQuantities; };
     void setWritingOffset(uint offset){ this->writingOffset = offset; }
-    void getNeighbors(uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSN);
-    void getWeights(real* _weightsNT, real* _weightsNB, real* _weightsST, real* _weightsSB);
+    void getNeighbors(uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM);
+    void getWeights(real* _weights0PP, real* _weights0PM, real* _weights0MP, real* _weights0MM);
 
 public:
-    std::vector<uint> planeNeighborNT,  planeNeighborNB, planeNeighborST, planeNeighborSB;
-    std::vector<real> weightsNT, weightsNB, weightsST,  weightsSB;
+    std::vector<uint> planeNeighbor0PP,  planeNeighbor0PM, planeNeighbor0MP, planeNeighbor0MM;
+    std::vector<real> weights0PP, weights0PM, weights0MP,  weights0MM;
 
 protected:
     uint nPoints, nPointsRead, writingOffset;
-- 
GitLab


From 237bc0eabc9a3e5ff48cebf6eb34c3b3c2876bf2 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:26:07 +0100
Subject: [PATCH 126/179] Rename nF in TransientBCSetter

---
 .../TransientBCSetter/TransientBCSetter.cpp   | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index a7a2f0faa..3026458c9 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -406,35 +406,35 @@ void VTKReader::getNextData(real* data, uint numberOfNodes, real time)
         uint level = this->readLevel;
         for(size_t id=0; id<this->fileCollection->files[level].size(); id++)
         {
-            size_t nF = this->nFile[level][id];
+            size_t numberOfFiles = this->nFile[level][id];
 
 
-            if(!this->fileCollection->files[level][id][nF].inZBounds(time))
+            if(!this->fileCollection->files[level][id][numberOfFiles].inZBounds(time))
             {
-                nF++;
+                numberOfFiles++;
 
-                printf("switching to precursor file no. %zd\n", nF);
-                if(nF == this->fileCollection->files[level][id].size())
+                printf("switching to precursor file no. %zd\n", numberOfFiles);
+                if(numberOfFiles == this->fileCollection->files[level][id].size())
                     throw std::runtime_error("Not enough Precursor Files to read");
 
-                this->fileCollection->files[level][id][nF-1].unloadFile();
-                if(nF+1<this->fileCollection->files[level][id].size())
+                this->fileCollection->files[level][id][numberOfFiles-1].unloadFile();
+                if(numberOfFiles+1<this->fileCollection->files[level][id].size())
                 {
-                    VTKFile* nextFile = &this->fileCollection->files[level][id][nF+1];
+                    VTKFile* nextFile = &this->fileCollection->files[level][id][numberOfFiles+1];
                     if(! nextFile->isLoaded())
                     {
                         read.wait();
-                        read = std::async(std::launch::async, [](VTKFile* file){ file->loadFile(); }, &this->fileCollection->files[level][id][nF+1]);
+                        read = std::async(std::launch::async, [](VTKFile* file){ file->loadFile(); }, &this->fileCollection->files[level][id][numberOfFiles+1]);
                     }
                 }
             }
         
 
-            VTKFile* file = &this->fileCollection->files[level][id][nF];
+            VTKFile* file = &this->fileCollection->files[level][id][numberOfFiles];
 
             int off = file->getClosestIdxZ(time)*file->getNumberOfPointsInXYPlane();
             file->getData(data, numberOfNodes, this->readIndices[level][id], this->writeIndices[level][id], off, this->writingOffset);
-            this->nFile[level][id] = nF;
+            this->nFile[level][id] = numberOfFiles;
         }
     // }
 }
\ No newline at end of file
-- 
GitLab


From f8a0285981a22ba5ca6decc8ed0012032a321ed0 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:28:43 +0100
Subject: [PATCH 127/179] Remove old debugging comments

---
 src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
index 9b4301882..6b18bdebe 100644
--- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
+++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
@@ -73,8 +73,7 @@ void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition
                                             ||  grid->getFieldEntry(index)  == vf::gpu::BC_VELOCITY 
                                             ||  grid->getFieldEntry(index)  == vf::gpu::BC_NOSLIP   
                                             ||  grid->getFieldEntry(index)  == vf::gpu::BC_SLIP     
-                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_STRESS )
-                                            /*&& boundaryCondition->getType()!=vf::gpu::BC_STRESS*/ )
+                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_STRESS ))
             {
                 grid->setFieldEntry(index, boundaryCondition->getType());
                 boundaryCondition->indices.push_back(index);
-- 
GitLab


From 82070a9198766253f7fff50b82533ce04237340b Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:30:00 +0100
Subject: [PATCH 128/179] Remove more old debugging comments

---
 src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
index 6b18bdebe..0900c2d58 100644
--- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
+++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
@@ -176,13 +176,6 @@ void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uin
                                   this->getNormal()[1]*grid->getDirection()[dir * DIMENSION + 1]+
                                   this->getNormal()[2]*grid->getDirection()[dir * DIMENSION + 2] ) > 0;
         
-        // if(boundaryCondition->getType()==vf::gpu::BC_VELOCITY && z < 8.0 )
-        // {
-        //     alignedWithNormal = true;
-        //     printf("XYZ: %f \t %f \t %f \n", x,y,z);
-        //     printf("dir: %d \t %d \t %d \n\n", grid->getDirection()[dir * DIMENSION + 0], grid->getDirection()[dir * DIMENSION + 1], grid->getDirection()[dir * DIMENSION + 2]);
-        // }
-
         uint neighborIndex = grid->transCoordToIndex( neighborX, neighborY, neighborZ );
         if((grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY ||
             grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID          ||
-- 
GitLab


From 2767d34e39e623e5a924f94084bce3b8131749bd Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:34:27 +0100
Subject: [PATCH 129/179] Replace 0.f with const expr

---
 src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
index afaf41184..5c2115f6f 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -38,6 +38,8 @@
 #include <memory>
 #include <array>
 
+#include <lbm/constants/NumericConstants.h>
+
 #include "gpu/GridGenerator/global.h"
 
 #include "gpu/GridGenerator/grid/GridBuilder/GridBuilder.h"
@@ -45,6 +47,8 @@
 #include "gpu/GridGenerator/grid/GridInterface.h"
 #include "gpu/GridGenerator/grid/NodeValues.h"
 
+using namespace vf::lbm::constant;
+
 struct Vertex;
 class  Grid;
 class Transformator;
@@ -64,8 +68,6 @@ enum class SideType;
 class TransientBCInputFileReader;
 class FileCollection;
 
-
-
 class LevelGridBuilder : public GridBuilder
 {
 protected:
@@ -85,7 +87,7 @@ public:
     GRIDGENERATOR_EXPORT void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z);
     GRIDGENERATOR_EXPORT void setNoSlipBoundaryCondition(SideType sideType);
     GRIDGENERATOR_EXPORT void setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads, 
-                                                            real velocityX=0.0f, real velocityY=0.0f, real velocityZ=0.0f,     
+                                                            real velocityX=c0o1, real velocityY=c0o1, real velocityZ=c0o1,     
                                                             std::vector<uint> fileLevelToGridLevelMap = {});
 
     GRIDGENERATOR_EXPORT void setEnableFixRefinementIntoTheWall(bool enableFixRefinementIntoTheWall);
-- 
GitLab


From 0d3080a343f6f0a990faf3d7af664060084bb248 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:44:40 +0100
Subject: [PATCH 130/179] More renaming of E,W,N, etc.

---
 .../GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp   | 8 ++++----
 src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index ec0db541b..3733f539e 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -644,8 +644,8 @@ uint LevelGridBuilder::getPrecursorSize(int level) const
     return size;
 }
 
-void LevelGridBuilder::getPrecursorValues(  uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
-                                            real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
+void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM, 
+                                            real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM,
                                             int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
                                             int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads, 
                                             real& velocityX, real& velocityY, real& velocityZ, int level) const
@@ -676,8 +676,8 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighborNT, uint* neighborNB,
             allIndicesCounter++;
         }
         BCreader->fillArrays(y, z);
-        BCreader->getNeighbors(neighborNT, neighborNB, neighborST, neighborSB);
-        BCreader->getWeights(weightsNT, weightsNB, weightsST, weightsSB);
+        BCreader->getNeighbors(neighbor0PP, neighbor0PM, neighbor0MP, neighbor0MM);
+        BCreader->getWeights(weights0PP, weights0PM, weights0MP, weights0MM);
         if(tmpNQuantities == 0)
             tmpNQuantities = BCreader->getNumberOfQuantities();
         if(tmpNQuantities != BCreader->getNumberOfQuantities()) 
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
index 5c2115f6f..56ae1e4fc 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -131,8 +131,8 @@ public:
     GRIDGENERATOR_EXPORT virtual void getPressureQs(real* qs[27], int level) const override;
 
     GRIDGENERATOR_EXPORT uint getPrecursorSize(int level) const override;
-    GRIDGENERATOR_EXPORT void getPrecursorValues(   uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
-                                                    real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
+    GRIDGENERATOR_EXPORT void getPrecursorValues(   uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM, 
+                                                    real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM, 
                                                     int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
                                                     int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads,
                                                     real& velocityX, real& velocityY, real& velocityZ, int level) const override;
-- 
GitLab


From 428208b5cb43e489e6cfc596b64c147d3b664313 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Fri, 16 Dec 2022 13:58:57 +0100
Subject: [PATCH 131/179] Even more renaming

---
 .../grid/GridBuilder/GridBuilder.h            |  4 +-
 .../grid/GridBuilder/LevelGridBuilder.cpp     | 12 +--
 .../GridReaderGenerator/GridGenerator.cpp     |  8 +-
 .../GPU/CudaMemoryManager.cpp                 | 80 +++++++++----------
 src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh | 32 ++++----
 src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu    | 16 ++--
 .../VirtualFluids_GPU/GPU/PrecursorBCs27.cu   | 64 +++++++--------
 src/gpu/VirtualFluids_GPU/LBM/LB.h            |  4 +-
 8 files changed, 110 insertions(+), 110 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
index 8c3db0afd..065665d21 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -115,8 +115,8 @@ public:
     virtual void getPressureQs(real *qs[27], int level) const                                      = 0;
 
     virtual uint getPrecursorSize(int level) const              = 0;
-    virtual void getPrecursorValues(uint* neighborNT, uint* neighborNB, uint* neighborST, uint* neighborSB, 
-                                    real* weightsNT, real* weightsNB, real* weightsST, real* weightsSB, 
+    virtual void getPrecursorValues(uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM, 
+                                    real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM, 
                                     int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
                                     int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads, 
                                     real& velocityX, real& velocityY, real& velocityZ, int level) const = 0;
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index 3733f539e..ff6f4913e 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -653,7 +653,7 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM
     int allIndicesCounter = 0;
     int allNodesCounter = 0;
     uint tmpTimeStepsBetweenReads = 0;
-    size_t tmpNQuantities = 0;
+    size_t tmpNumberOfQuantities = 0;
     
     for (auto boundaryCondition : boundaryConditions[level]->precursorBoundaryConditions)
     {
@@ -678,9 +678,9 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM
         BCreader->fillArrays(y, z);
         BCreader->getNeighbors(neighbor0PP, neighbor0PM, neighbor0MP, neighbor0MM);
         BCreader->getWeights(weights0PP, weights0PM, weights0MP, weights0MM);
-        if(tmpNQuantities == 0)
-            tmpNQuantities = BCreader->getNumberOfQuantities();
-        if(tmpNQuantities != BCreader->getNumberOfQuantities()) 
+        if(tmpNumberOfQuantities == 0)
+            tmpNumberOfQuantities = BCreader->getNumberOfQuantities();
+        if(tmpNumberOfQuantities != BCreader->getNumberOfQuantities()) 
             throw std::runtime_error("All precursor files must have the same quantities.");
         allNodesCounter += BCreader->getNPointsRead();
         velocityX = boundaryCondition->getVelocityX();
@@ -693,9 +693,9 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM
         throw std::runtime_error("timeStepsBetweenReads of precursor needs to be larger than 0.");
     timeStepsBetweenReads = tmpTimeStepsBetweenReads;
     
-    if (tmpNQuantities == 0)
+    if (tmpNumberOfQuantities == 0)
         throw std::runtime_error("Number of quantities in precursor needs to be larger than 0.");
-    numberOfQuantities = tmpNQuantities;
+    numberOfQuantities = tmpNumberOfQuantities;
 }
 
 void LevelGridBuilder::getPrecursorQs(real* qs[27], int level) const
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index c3dd9e414..d89f4cd85 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -342,10 +342,10 @@ void GridGenerator::allocArrays_BoundaryValues()
             cudaMemoryManager->cudaAllocPrecursorBC(level);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             builder->getPrecursorValues(
-                    para->getParH(level)->precursorBC.planeNeighborNT, para->getParH(level)->precursorBC.planeNeighborNB, 
-                    para->getParH(level)->precursorBC.planeNeighborST, para->getParH(level)->precursorBC.planeNeighborSB, 
-                    para->getParH(level)->precursorBC.weightsNT, para->getParH(level)->precursorBC.weightsNB, 
-                    para->getParH(level)->precursorBC.weightsST, para->getParH(level)->precursorBC.weightsSB, 
+                    para->getParH(level)->precursorBC.planeNeighbor0PP, para->getParH(level)->precursorBC.planeNeighbor0PM, 
+                    para->getParH(level)->precursorBC.planeNeighbor0MP, para->getParH(level)->precursorBC.planeNeighbor0MM, 
+                    para->getParH(level)->precursorBC.weights0PP, para->getParH(level)->precursorBC.weights0PM, 
+                    para->getParH(level)->precursorBC.weights0MP, para->getParH(level)->precursorBC.weights0MM, 
                     para->getParH(level)->precursorBC.k, para->getParH(level)->transientBCInputFileReader, para->getParH(level)->precursorBC.numberOfPrecursorNodes, 
                     para->getParH(level)->precursorBC.numberOfQuantities, para->getParH(level)->precursorBC.timeStepsBetweenReads, 
                     para->getParH(level)->precursorBC.velocityX, para->getParH(level)->precursorBC.velocityY, para->getParH(level)->precursorBC.velocityZ,
diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
index 8807c2230..c4f3807ef 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -1669,28 +1669,28 @@ void CudaMemoryManager::cudaAllocPrecursorBC(int lev)
     checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.q27[0], parameter->getD3Qxx()*memSizeQReal));
     
 
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighborNT, memSizeQUint));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighborNB, memSizeQUint));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighborST, memSizeQUint));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighborSB, memSizeQUint));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighbor0PP, memSizeQUint));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighbor0PM, memSizeQUint));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighbor0MP, memSizeQUint));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.planeNeighbor0MM, memSizeQUint));
 
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weightsNT, memSizeQReal));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weightsNB, memSizeQReal));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weightsST, memSizeQReal));
-    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weightsSB, memSizeQReal));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weights0PP, memSizeQReal));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weights0PM, memSizeQReal));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weights0MP, memSizeQReal));
+    checkCudaErrors( cudaMallocHost((void**) &parameter->getParH(lev)->precursorBC.weights0MM, memSizeQReal));
 
     checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.k, memSizeQInt));
     checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.q27[0], parameter->getD3Qxx()*memSizeQReal));
 
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighborNT, memSizeQUint));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighborNB, memSizeQUint));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighborST, memSizeQUint));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighborSB, memSizeQUint));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighbor0PP, memSizeQUint));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighbor0PM, memSizeQUint));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighbor0MP, memSizeQUint));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.planeNeighbor0MM, memSizeQUint));
 
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weightsNT, memSizeQReal));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weightsNB, memSizeQReal));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weightsST, memSizeQReal));
-    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weightsSB, memSizeQReal));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weights0PP, memSizeQReal));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weights0PM, memSizeQReal));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weights0MP, memSizeQReal));
+    checkCudaErrors( cudaMalloc((void**) &parameter->getParD(lev)->precursorBC.weights0MM, memSizeQReal));
 
     real memSize = memSizeQInt+4*memSizeQUint+(4+parameter->getD3Qxx())*memSizeQReal;
     setMemsizeGPU(memSize, false);
@@ -1723,15 +1723,15 @@ void CudaMemoryManager::cudaCopyPrecursorBC(int lev)
 
     checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.q27[0], parameter->getParH(lev)->precursorBC.q27[0], memSizeQReal*parameter->getD3Qxx(), cudaMemcpyHostToDevice));
 
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighborNT, parameter->getParH(lev)->precursorBC.planeNeighborNT, memSizeQUint, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighborNB, parameter->getParH(lev)->precursorBC.planeNeighborNB, memSizeQUint, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighborST, parameter->getParH(lev)->precursorBC.planeNeighborST, memSizeQUint, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighborSB, parameter->getParH(lev)->precursorBC.planeNeighborSB, memSizeQUint, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighbor0PP, parameter->getParH(lev)->precursorBC.planeNeighbor0PP, memSizeQUint, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighbor0PM, parameter->getParH(lev)->precursorBC.planeNeighbor0PM, memSizeQUint, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighbor0MP, parameter->getParH(lev)->precursorBC.planeNeighbor0MP, memSizeQUint, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.planeNeighbor0MM, parameter->getParH(lev)->precursorBC.planeNeighbor0MM, memSizeQUint, cudaMemcpyHostToDevice));
 
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weightsNT, parameter->getParH(lev)->precursorBC.weightsNT, memSizeQReal, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weightsNB, parameter->getParH(lev)->precursorBC.weightsNB, memSizeQReal, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weightsST, parameter->getParH(lev)->precursorBC.weightsST, memSizeQReal, cudaMemcpyHostToDevice));
-    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weightsSB, parameter->getParH(lev)->precursorBC.weightsSB, memSizeQReal, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weights0PP, parameter->getParH(lev)->precursorBC.weights0PP, memSizeQReal, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weights0PM, parameter->getParH(lev)->precursorBC.weights0PM, memSizeQReal, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weights0MP, parameter->getParH(lev)->precursorBC.weights0MP, memSizeQReal, cudaMemcpyHostToDevice));
+    checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->precursorBC.weights0MM, parameter->getParH(lev)->precursorBC.weights0MM, memSizeQReal, cudaMemcpyHostToDevice));
 }
 void CudaMemoryManager::cudaCopyPrecursorData(int lev)
 {
@@ -1749,29 +1749,29 @@ void CudaMemoryManager::cudaFreePrecursorBC(int lev)
 
     checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.q27[0]));
 
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighborNT));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighborNB));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighborST));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighborSB));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighbor0PP));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighbor0PM));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighbor0MP));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.planeNeighbor0MM));
 
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weightsNT));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weightsNB));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weightsST));
-    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weightsSB));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weights0PP));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weights0PM));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weights0MP));
+    checkCudaErrors( cudaFreeHost( parameter->getParH(lev)->precursorBC.weights0MM));
 
     checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.k));
 
     checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.q27[0]));
 
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighborNT));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighborNB));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighborST));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighborSB));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighbor0PP));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighbor0PM));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighbor0MP));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.planeNeighbor0MM));
 
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weightsNT));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weightsNB));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weightsST));
-    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weightsSB));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weights0PP));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weights0PM));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weights0MP));
+    checkCudaErrors( cudaFree( parameter->getParD(lev)->precursorBC.weights0MM));
 }
 
 void CudaMemoryManager::cudaFreePrecursorData(int lev)
diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
index 9ef5057bb..a7b22c244 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
+++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
@@ -1257,10 +1257,10 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 uint* neighborsNB,
                                                 uint* neighborsST,
                                                 uint* neighborsSB,
-                                                real* weightsNT, 
-                                                real* weightsNB,
-                                                real* weightsST,
-                                                real* weightsSB,
+                                                real* weights0PP, 
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
                                                 real* vLast, 
                                                 real* vCurrent,
                                                 real velocityX,
@@ -1283,10 +1283,10 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         uint* neighborsNB,
                                         uint* neighborsST,
                                         uint* neighborsSB,
-                                        real* weightsNT, 
-                                        real* weightsNB,
-                                        real* weightsST,
-                                        real* weightsSB,
+                                        real* weights0PP, 
+                                        real* weights0PM,
+                                        real* weights0MP,
+                                        real* weights0MM,
                                         real* vLast, 
                                         real* vCurrent,
                                         real velocityX,
@@ -1308,10 +1308,10 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborsNB,
 												uint* neighborsST,
 												uint* neighborsSB,
-												real* weightsNT, 
-												real* weightsNB,
-												real* weightsST,
-												real* weightsSB,
+												real* weights0PP, 
+												real* weights0PM,
+												real* weights0MP,
+												real* weights0MM,
 												real* fsLast, 
 												real* fsNext,
 												real timeRatio,
@@ -1330,10 +1330,10 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborsNB,
 												uint* neighborsST,
 												uint* neighborsSB,
-												real* weightsNT, 
-												real* weightsNB,
-												real* weightsST,
-												real* weightsSB,
+												real* weights0PP, 
+												real* weights0PM,
+												real* weights0MP,
+												real* weights0MM,
 												real* fsLast, 
 												real* fsNext,
 												real timeRatio,
diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
index 06628edb5..41f74113f 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -3216,8 +3216,8 @@ void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, QforPre
 	QPrecursorDeviceCompZeroPress<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, boundaryCondition->sizeQ, parameterDevice->omega, 
 		parameterDevice->distributions.f[0], boundaryCondition->q27[0],
 		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
-		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
+		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
+		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
 		boundaryCondition->last, boundaryCondition->current,
 		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
 		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
@@ -3232,8 +3232,8 @@ void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice, QforPrecursorBou
 
 	PrecursorDeviceEQ27<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->omega, parameterDevice->distributions.f[0], 
 		parameterDevice->neighborX, parameterDevice->neighborX, parameterDevice->neighborX,
-		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
-		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
+		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
+		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
 		boundaryCondition->last, boundaryCondition->current,
 		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
 		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
@@ -3248,8 +3248,8 @@ void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPre
 
 	PrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->distributions.f[0],
 		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
-		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
+		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
+		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
 		boundaryCondition->last, boundaryCondition->current,
 		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
@@ -3264,8 +3264,8 @@ void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPr
 
 	QPrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->q27[0], boundaryCondition->sizeQ, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->distributions.f[0],
 		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighborNT, boundaryCondition->planeNeighborNB, boundaryCondition->planeNeighborST, boundaryCondition->planeNeighborSB,
-		boundaryCondition->weightsNT, boundaryCondition->weightsNB, boundaryCondition->weightsST, boundaryCondition->weightsSB,
+		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
+		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
 		boundaryCondition->last, boundaryCondition->current,
 		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
diff --git a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
index f089a3295..e7b0c6079 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
@@ -23,10 +23,10 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 uint* neighborsNB,
                                                 uint* neighborsST,
                                                 uint* neighborsSB,
-                                                real* weightsNT, 
-                                                real* weightsNB,
-                                                real* weightsST,
-                                                real* weightsSB,
+                                                real* weights0PP, 
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
                                                 real* vLast, 
                                                 real* vCurrent,
                                                 real velocityX,
@@ -47,7 +47,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
 
     uint kNT = neighborsNT[k];
-    real dNT = weightsNT[k];
+    real dNT = weights0PP[k];
 
     real* vxLast = vLast;
     real* vyLast = &vLast[numberOfPrecursorNodes];
@@ -63,9 +63,9 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         uint kST = neighborsST[k];
         uint kSB = neighborsSB[k];
 
-        real dNB = weightsNB[k];
-        real dST = weightsST[k];
-        real dSB = weightsSB[k];
+        real dNB = weights0PM[k];
+        real dST = weights0MP[k];
+        real dSB = weights0MM[k];
 
         real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
 
@@ -436,10 +436,10 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         uint* neighborsNB,
                                         uint* neighborsST,
                                         uint* neighborsSB,
-                                        real* weightsNT, 
-                                        real* weightsNB,
-                                        real* weightsST,
-                                        real* weightsSB,
+                                        real* weights0PP, 
+                                        real* weights0PM,
+                                        real* weights0MP,
+                                        real* weights0MM,
                                         real* vLast, 
                                         real* vCurrent,
                                         real velocityX,
@@ -460,7 +460,7 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
 
     uint kNT = neighborsNT[k];
-    real dNT = weightsNT[k];
+    real dNT = weights0PP[k];
 
     real* vxLast = vLast;
     real* vyLast = &vLast[numberOfPrecursorNodes];
@@ -476,9 +476,9 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
         uint kST = neighborsST[k];
         uint kSB = neighborsSB[k];
 
-        real dNB = weightsNB[k];
-        real dST = weightsST[k];
-        real dSB = weightsSB[k];
+        real dNB = weights0PM[k];
+        real dST = weights0MP[k];
+        real dSB = weights0MM[k];
 
         real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
 
@@ -660,10 +660,10 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborsNB,
 												uint* neighborsST,
 												uint* neighborsSB,
-												real* weightsNT, 
-												real* weightsNB,
-												real* weightsST,
-												real* weightsSB,
+												real* weights0PP, 
+												real* weights0PM,
+												real* weights0MP,
+												real* weights0MM,
 												real* fsLast, 
 												real* fsNext,
 												real timeRatio,
@@ -675,7 +675,7 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     if(k>=numberOfBCnodes) return;
 
     uint kNT = neighborsNT[k];
-    real dNT = weightsNT[k];
+    real dNT = weights0PP[k];
 
     real f0LastInterp, f1LastInterp, f2LastInterp, f3LastInterp, f4LastInterp, f5LastInterp, f6LastInterp, f7LastInterp, f8LastInterp;
     real f0NextInterp, f1NextInterp, f2NextInterp, f3NextInterp, f4NextInterp, f5NextInterp, f6NextInterp, f7NextInterp, f8NextInterp;
@@ -707,9 +707,9 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
         uint kST = neighborsST[k];
         uint kSB = neighborsSB[k];
 
-        real dNB = weightsNB[k];
-        real dST = weightsST[k];
-        real dSB = weightsSB[k];
+        real dNB = weights0PM[k];
+        real dST = weights0MP[k];
+        real dSB = weights0MM[k];
 
         real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
 
@@ -819,10 +819,10 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborsNB,
 												uint* neighborsST,
 												uint* neighborsSB,
-												real* weightsNT, 
-												real* weightsNB,
-												real* weightsST,
-												real* weightsSB,
+												real* weights0PP, 
+												real* weights0PM,
+												real* weights0MP,
+												real* weights0MM,
 												real* fsLast, 
 												real* fsNext,
 												real timeRatio,
@@ -834,7 +834,7 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     if(k>=numberOfBCnodes) return;
 
     uint kNT = neighborsNT[k];
-    real dNT = weightsNT[k];
+    real dNT = weights0PP[k];
 
     real f0LastInterp, f1LastInterp, f2LastInterp, f3LastInterp, f4LastInterp, f5LastInterp, f6LastInterp, f7LastInterp, f8LastInterp;
     real f0NextInterp, f1NextInterp, f2NextInterp, f3NextInterp, f4NextInterp, f5NextInterp, f6NextInterp, f7NextInterp, f8NextInterp;
@@ -866,9 +866,9 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
         uint kST = neighborsST[k];
         uint kSB = neighborsSB[k];
 
-        real dNB = weightsNB[k];
-        real dST = weightsST[k];
-        real dSB = weightsSB[k];
+        real dNB = weights0PM[k];
+        real dST = weights0MP[k];
+        real dSB = weights0MM[k];
 
         real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
 
diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h
index c07769d5c..a7517ca0f 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/LB.h
+++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h
@@ -240,8 +240,8 @@ typedef struct QforPrecursorBC{
    uint timeStepsBetweenReads;
    size_t numberOfQuantities;
    real* q27[27];
-   uint* planeNeighborNT, *planeNeighborNB, *planeNeighborST, *planeNeighborSB;
-   real* weightsNT, *weightsNB, *weightsST,  *weightsSB;
+   uint* planeNeighbor0PP, *planeNeighbor0PM, *planeNeighbor0MP, *planeNeighbor0MM;
+   real* weights0PP, *weights0PM, *weights0MP,  *weights0MM;
    real* last, *current, *next;
    real velocityX, velocityY, velocityZ;
 }QforPrecursorBoundaryConditions;
-- 
GitLab


From 9497418cb34e3520fb7949d9addf219d1dd2727d Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 15:39:18 +0100
Subject: [PATCH 132/179] add license and VF heading to files

---
 Python/SlurmTests/poiseuille/settings.py      | 34 +++++++++++++++++++
 Python/acousticscaling.py                     | 34 +++++++++++++++++++
 Python/actuator_line/actuator_line.py         | 34 +++++++++++++++++++
 Python/boundary_layer/boundary_layer.py       | 34 +++++++++++++++++++
 Python/cubeflow/simulation.py                 | 34 +++++++++++++++++++
 Python/liddrivencavity/simulation.py          | 34 +++++++++++++++++++
 Python/poiseuille/poiseuille_hpc.py           | 34 +++++++++++++++++++
 Python/poiseuille/simulation.py               | 34 +++++++++++++++++++
 Python/poiseuille/test_poiseuille_l2.py       | 34 +++++++++++++++++++
 Python/tests/test_acousticscaling.py          | 34 +++++++++++++++++++
 Python/tests/test_boundaryconditions.py       | 34 +++++++++++++++++++
 Python/tests/test_geometry.py                 | 34 +++++++++++++++++++
 Python/tests/test_kernel.py                   | 34 +++++++++++++++++++
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 33 +++++++++++++++++-
 apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp  | 33 +++++++++++++++++-
 .../LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp   | 33 +++++++++++++++++-
 .../pyfluids-stubs/bindings/__init__.pyi      | 34 +++++++++++++++++++
 .../bindings/basics/__init__.pyi              | 34 +++++++++++++++++++
 .../pyfluids-stubs/bindings/basics/logger.pyi | 34 +++++++++++++++++++
 .../pyfluids-stubs/bindings/gpu/__init__.pyi  | 34 +++++++++++++++++++
 .../bindings/gpu/grid_generator.pyi           | 34 +++++++++++++++++++
 .../pyfluids-stubs/bindings/gpu/probes.pyi    | 34 +++++++++++++++++++
 .../pyfluids-stubs/bindings/logger.pyi        | 34 +++++++++++++++++++
 pythonbindings/pyfluids/__init__.py           | 34 +++++++++++++++++++
 pythonbindings/pymuparser/__init__.py         | 34 +++++++++++++++++++
 pythonbindings/src/VirtualFluids.cpp          | 32 +++++++++++++++++
 pythonbindings/src/basics/basics.cpp          | 32 +++++++++++++++++
 .../basics/submodules/configuration_file.cpp  | 32 +++++++++++++++++
 .../src/basics/submodules/lbm_or_gks.cpp      | 32 +++++++++++++++++
 .../src/basics/submodules/logger.cpp          | 32 +++++++++++++++++
 pythonbindings/src/cpu/cpu.cpp                | 32 +++++++++++++++++
 .../src/cpu/submodules/boundaryconditions.cpp | 32 +++++++++++++++++
 .../src/cpu/submodules/geometry.cpp           | 32 +++++++++++++++++
 pythonbindings/src/cpu/submodules/kernel.cpp  | 32 +++++++++++++++++
 .../src/cpu/submodules/simulationconfig.cpp   | 32 +++++++++++++++++
 .../cpu/submodules/simulationparameters.cpp   | 32 +++++++++++++++++
 pythonbindings/src/cpu/submodules/writer.cpp  | 32 +++++++++++++++++
 pythonbindings/src/gpu/gpu.cpp                | 32 +++++++++++++++++
 .../src/gpu/submodules/actuator_farm.cpp      | 32 +++++++++++++++++
 .../gpu/submodules/boundary_conditions.cpp    | 32 +++++++++++++++++
 .../src/gpu/submodules/communicator.cpp       | 32 +++++++++++++++++
 .../gpu/submodules/cuda_memory_manager.cpp    | 32 +++++++++++++++++
 .../src/gpu/submodules/grid_generator.cpp     | 32 +++++++++++++++++
 .../src/gpu/submodules/grid_provider.cpp      | 31 +++++++++++++++++
 .../gpu/submodules/grid_scaling_factory.cpp   | 32 +++++++++++++++++
 .../src/gpu/submodules/parameter.cpp          | 32 +++++++++++++++++
 .../submodules/pre_collision_interactor.cpp   | 33 ++++++++++++++++++
 .../src/gpu/submodules/precursor_writer.cpp   | 32 +++++++++++++++++
 pythonbindings/src/gpu/submodules/probes.cpp  | 32 +++++++++++++++++
 .../src/gpu/submodules/simulation.cpp         | 32 +++++++++++++++++
 .../gpu/submodules/transient_bc_setter.cpp    | 32 +++++++++++++++++
 .../src/gpu/submodules/turbulence_models.cpp  | 32 +++++++++++++++++
 pythonbindings/src/lbm/lbm.cpp                | 32 +++++++++++++++++
 pythonbindings/src/logger/logger.cpp          | 32 +++++++++++++++++
 pythonbindings/src/muParser.cpp               | 32 +++++++++++++++++
 55 files changed, 1804 insertions(+), 3 deletions(-)

diff --git a/Python/SlurmTests/poiseuille/settings.py b/Python/SlurmTests/poiseuille/settings.py
index d70a9574b..a3cdc5dc8 100644
--- a/Python/SlurmTests/poiseuille/settings.py
+++ b/Python/SlurmTests/poiseuille/settings.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file settings.py
+! \ingroup Poiseuille
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import os
 from acousticscaling import OneDirectionalAcousticScaling
 from pyfluids import cpu
diff --git a/Python/acousticscaling.py b/Python/acousticscaling.py
index 9ba6f8765..7e71fed9f 100644
--- a/Python/acousticscaling.py
+++ b/Python/acousticscaling.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file acousticscaling.py
+! \ingroup tests
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 from pyfluids import cpu
 
 
diff --git a/Python/actuator_line/actuator_line.py b/Python/actuator_line/actuator_line.py
index 44a757247..721af737f 100644
--- a/Python/actuator_line/actuator_line.py
+++ b/Python/actuator_line/actuator_line.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file actuator_line.py
+! \ingroup actuator_line
+! \author Henry Korb, Henrik Asmuth
+=======================================================================================
+"""
 #%%
 import numpy as np
 from pathlib import Path
diff --git a/Python/boundary_layer/boundary_layer.py b/Python/boundary_layer/boundary_layer.py
index e1ddb275e..6f6c64bc0 100644
--- a/Python/boundary_layer/boundary_layer.py
+++ b/Python/boundary_layer/boundary_layer.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file boundary_layer.py
+! \ingroup boundary_layer
+! \author Henry Korb, Henrik Asmuth
+=======================================================================================
+"""
 #%%
 import numpy as np
 from pathlib import Path
diff --git a/Python/cubeflow/simulation.py b/Python/cubeflow/simulation.py
index da8d4f3df..deb041196 100644
--- a/Python/cubeflow/simulation.py
+++ b/Python/cubeflow/simulation.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file simulation.py
+! \ingroup cubeflow
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import os
 
 from pyfluids import cpu
diff --git a/Python/liddrivencavity/simulation.py b/Python/liddrivencavity/simulation.py
index 468cce669..3c247b87a 100644
--- a/Python/liddrivencavity/simulation.py
+++ b/Python/liddrivencavity/simulation.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file simulation.py
+! \ingroup liddrivencavity
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 from pyfluids import cpu
 from pymuparser import Parser
 
diff --git a/Python/poiseuille/poiseuille_hpc.py b/Python/poiseuille/poiseuille_hpc.py
index e5a89250f..b108f3444 100644
--- a/Python/poiseuille/poiseuille_hpc.py
+++ b/Python/poiseuille/poiseuille_hpc.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file poiseuille_hpc.py
+! \ingroup poiseuille
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 from poiseuille.simulation import run_simulation
 from pyfluids import cpu
 
diff --git a/Python/poiseuille/simulation.py b/Python/poiseuille/simulation.py
index 0f793d0c0..a6f12e59f 100644
--- a/Python/poiseuille/simulation.py
+++ b/Python/poiseuille/simulation.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file simulation.py
+! \ingroup poiseuille
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 from pyfluids import cpu
 
 
diff --git a/Python/poiseuille/test_poiseuille_l2.py b/Python/poiseuille/test_poiseuille_l2.py
index 1c6cdbd01..818cba40e 100644
--- a/Python/poiseuille/test_poiseuille_l2.py
+++ b/Python/poiseuille/test_poiseuille_l2.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file test_poiseuille_l2.py
+! \ingroup poiseuille
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import os
 import shutil
 import unittest
diff --git a/Python/tests/test_acousticscaling.py b/Python/tests/test_acousticscaling.py
index e37b57c98..02454b935 100644
--- a/Python/tests/test_acousticscaling.py
+++ b/Python/tests/test_acousticscaling.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file test_acousticscaling.py
+! \ingroup tests
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import unittest
 from typing import List
 
diff --git a/Python/tests/test_boundaryconditions.py b/Python/tests/test_boundaryconditions.py
index c2f6c494f..d914c50ca 100644
--- a/Python/tests/test_boundaryconditions.py
+++ b/Python/tests/test_boundaryconditions.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file test_boundaryconditions.py
+! \ingroup tests
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import unittest
 from pyfluids import cpu
 
diff --git a/Python/tests/test_geometry.py b/Python/tests/test_geometry.py
index b0ac2f64b..3d297f5c1 100644
--- a/Python/tests/test_geometry.py
+++ b/Python/tests/test_geometry.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file test_geometry.py
+! \ingroup tests
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import unittest
 
 from pyfluids import cpu
diff --git a/Python/tests/test_kernel.py b/Python/tests/test_kernel.py
index 4736f4ebe..e0159bec6 100644
--- a/Python/tests/test_kernel.py
+++ b/Python/tests/test_kernel.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file test_kernel.py
+! \ingroup tests
+! \author Sven Marcus, Henry Korb
+=======================================================================================
+"""
 import unittest
 
 from pyfluids import cpu
diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 68927ad87..9d982ebac 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -1,4 +1,35 @@
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file ActuatorLine.cpp
+//! \ingroup ActuatorLine
+//! \author Henry Korb, Henrik Asmuth
+//=======================================================================================
 #define _USE_MATH_DEFINES
 #include <math.h>
 #include <string>
diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
index 7ec203e78..5fc319044 100644
--- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
+++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp
@@ -1,4 +1,35 @@
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file BoundaryLayer.cpp
+//! \ingroup BoundaryLayer
+//! \author Henry Korb, Henrik Asmuth
+//=======================================================================================
 #define _USE_MATH_DEFINES
 #include <math.h>
 #include <string>
diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp
index 78ebd542b..045c20827 100644
--- a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp
+++ b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp
@@ -1,7 +1,38 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file TGV_3d_MuitiGPU.cpp
+//! \ingroup TGV_3D_MultiGPU
+//! \author Martin Schoenherr
+//=======================================================================================
 //#define MPI_LOGGING
 
 //Martin Branch
-
 #include <mpi.h>
 #if defined( MPI_LOGGING )
 	#include <mpe.h>
diff --git a/pythonbindings/pyfluids-stubs/bindings/__init__.pyi b/pythonbindings/pyfluids-stubs/bindings/__init__.pyi
index f4bc67842..4e7f353ea 100644
--- a/pythonbindings/pyfluids-stubs/bindings/__init__.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/__init__.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file __init__.pyi
+! \ingroup bindings
+! \author Henry Korb
+=======================================================================================
+"""
 class ostream_redirect:
     def __init__(self, stdout: bool = ..., stderr: bool = ...) -> None: ...
     def __enter__(self) -> None: ...
diff --git a/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi b/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi
index 60259efe0..a41b7934c 100644
--- a/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file __init__.py
+! \ingroup basics
+! \author Henry Korb
+=======================================================================================
+"""
 from typing import ClassVar
 
 from typing import overload
diff --git a/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi b/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
index 757eb59d6..43938ff76 100644
--- a/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/basics/logger.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file logger.pyi
+! \ingroup basics
+! \author Henry Korb
+=======================================================================================
+"""
 from typing import Any, ClassVar
 
 log: None
diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi b/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi
index 568a1c4ee..36c2fea76 100644
--- a/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file __init__.pyi
+! \ingroup gpu
+! \author Henry Korb
+=======================================================================================
+"""
 from typing import Any, Callable, ClassVar, List, Optional
 
 from typing import overload
diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi b/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi
index cf0329015..8d715e4b4 100644
--- a/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file grid_generator.pyi
+! \ingroup gpu
+! \author Henry Korb
+=======================================================================================
+"""
 from typing import Any, List
 
 from typing import overload
diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi b/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi
index a844bc9c5..af9c40078 100644
--- a/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file probes.pyi
+! \ingroup gpu
+! \author Henry Korb
+=======================================================================================
+"""
 from typing import ClassVar, List
 
 import pyfluids.bindings.gpu
diff --git a/pythonbindings/pyfluids-stubs/bindings/logger.pyi b/pythonbindings/pyfluids-stubs/bindings/logger.pyi
index ead1b2898..fe84eeb18 100644
--- a/pythonbindings/pyfluids-stubs/bindings/logger.pyi
+++ b/pythonbindings/pyfluids-stubs/bindings/logger.pyi
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file logger.pyi
+! \ingroup bindings
+! \author Henry Korb
+=======================================================================================
+"""
 class Logger:
     @staticmethod
     def change_log_path(path: str) -> None: ...
diff --git a/pythonbindings/pyfluids/__init__.py b/pythonbindings/pyfluids/__init__.py
index 558442014..f0537b758 100644
--- a/pythonbindings/pyfluids/__init__.py
+++ b/pythonbindings/pyfluids/__init__.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file __init__.py
+! \ingroup pyfluids
+! \author Henry Korb
+=======================================================================================
+"""
 try:
     from .bindings import basics
 except ImportError:
diff --git a/pythonbindings/pymuparser/__init__.py b/pythonbindings/pymuparser/__init__.py
index 3a2ffbb36..398069bcb 100644
--- a/pythonbindings/pymuparser/__init__.py
+++ b/pythonbindings/pymuparser/__init__.py
@@ -1,3 +1,37 @@
+r"""
+=======================================================================================
+ ____          ____    __    ______     __________   __      __       __        __
+ \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+      \    \  |    |   ________________________________________________________________
+       \    \ |    |  |  ______________________________________________________________|
+        \    \|    |  |  |         __          __     __     __     ______      _______
+         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+
+  This file is part of VirtualFluids. VirtualFluids is free software: you can
+  redistribute it and/or modify it under the terms of the GNU General Public
+  License as published by the Free Software Foundation, either version 3 of
+  the License, or (at your option) any later version.
+
+  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+
+! \file __init__.pyi
+! \ingroup pymuparser
+! \author Henry Korb
+=======================================================================================
+"""
 try:
     from .bindings import Parser
 except ImportError as e:
diff --git a/pythonbindings/src/VirtualFluids.cpp b/pythonbindings/src/VirtualFluids.cpp
index 151d17575..20e5012e0 100644
--- a/pythonbindings/src/VirtualFluids.cpp
+++ b/pythonbindings/src/VirtualFluids.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file VirtualFluids.cpp
+//! \ingroup src
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "basics/basics.cpp"
 #include "lbm/lbm.cpp"
diff --git a/pythonbindings/src/basics/basics.cpp b/pythonbindings/src/basics/basics.cpp
index 381e345d7..e67dfb053 100644
--- a/pythonbindings/src/basics/basics.cpp
+++ b/pythonbindings/src/basics/basics.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file basics.cpp
+//! \ingroup basics
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "submodules/logger.cpp"
 #include "submodules/configuration_file.cpp"
diff --git a/pythonbindings/src/basics/submodules/configuration_file.cpp b/pythonbindings/src/basics/submodules/configuration_file.cpp
index 2bab1f439..7fcd48c34 100644
--- a/pythonbindings/src/basics/submodules/configuration_file.cpp
+++ b/pythonbindings/src/basics/submodules/configuration_file.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file configuration_file.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "basics/config/ConfigurationFile.h"
 
diff --git a/pythonbindings/src/basics/submodules/lbm_or_gks.cpp b/pythonbindings/src/basics/submodules/lbm_or_gks.cpp
index ed1deeca6..d20cf2d1f 100644
--- a/pythonbindings/src/basics/submodules/lbm_or_gks.cpp
+++ b/pythonbindings/src/basics/submodules/lbm_or_gks.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file lbm_or_gks.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "basics/Core/LbmOrGks.h"
 
diff --git a/pythonbindings/src/basics/submodules/logger.cpp b/pythonbindings/src/basics/submodules/logger.cpp
index 2f32853cc..fa7e00e4d 100644
--- a/pythonbindings/src/basics/submodules/logger.cpp
+++ b/pythonbindings/src/basics/submodules/logger.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file logger.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/iostream.h>
 #include <basics/Core/Logger/Logger.h>
diff --git a/pythonbindings/src/cpu/cpu.cpp b/pythonbindings/src/cpu/cpu.cpp
index 554de53b4..75143d913 100644
--- a/pythonbindings/src/cpu/cpu.cpp
+++ b/pythonbindings/src/cpu/cpu.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file cpu.cpp
+//! \ingroup cpu
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "submodules/boundaryconditions.cpp"
 #include "submodules/simulationconfig.cpp"
diff --git a/pythonbindings/src/cpu/submodules/boundaryconditions.cpp b/pythonbindings/src/cpu/submodules/boundaryconditions.cpp
index 3bff7bc06..ac9ec8605 100644
--- a/pythonbindings/src/cpu/submodules/boundaryconditions.cpp
+++ b/pythonbindings/src/cpu/submodules/boundaryconditions.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file boundaryconditions.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 #include <BoundaryConditions/DensityBCAdapter.h>
diff --git a/pythonbindings/src/cpu/submodules/geometry.cpp b/pythonbindings/src/cpu/submodules/geometry.cpp
index b7ff4dd76..4c4c47b00 100644
--- a/pythonbindings/src/cpu/submodules/geometry.cpp
+++ b/pythonbindings/src/cpu/submodules/geometry.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file geometry.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <geometry3d/GbPoint3D.h>
 #include <geometry3d/GbObject3D.h>
diff --git a/pythonbindings/src/cpu/submodules/kernel.cpp b/pythonbindings/src/cpu/submodules/kernel.cpp
index fb2917906..b00d86579 100644
--- a/pythonbindings/src/cpu/submodules/kernel.cpp
+++ b/pythonbindings/src/cpu/submodules/kernel.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file kernel.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <memory>
 #include <pybind11/pybind11.h>
 #include <simulationconfig/KernelFactory.h>
diff --git a/pythonbindings/src/cpu/submodules/simulationconfig.cpp b/pythonbindings/src/cpu/submodules/simulationconfig.cpp
index 60af4e36a..09d91f44e 100644
--- a/pythonbindings/src/cpu/submodules/simulationconfig.cpp
+++ b/pythonbindings/src/cpu/submodules/simulationconfig.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file simulationconfig.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <simulationconfig/Simulation.h>
 
diff --git a/pythonbindings/src/cpu/submodules/simulationparameters.cpp b/pythonbindings/src/cpu/submodules/simulationparameters.cpp
index acc272f2e..b33d20f9e 100644
--- a/pythonbindings/src/cpu/submodules/simulationparameters.cpp
+++ b/pythonbindings/src/cpu/submodules/simulationparameters.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file simulationparameters.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 #include <complex>
diff --git a/pythonbindings/src/cpu/submodules/writer.cpp b/pythonbindings/src/cpu/submodules/writer.cpp
index d5ec527a2..f1cfd8934 100644
--- a/pythonbindings/src/cpu/submodules/writer.cpp
+++ b/pythonbindings/src/cpu/submodules/writer.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file writer.cpp
+//! \ingroup submodules
+//! \author Sven Marcus, Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <simulationconfig/WriterConfiguration.h>
 
diff --git a/pythonbindings/src/gpu/gpu.cpp b/pythonbindings/src/gpu/gpu.cpp
index b747b4996..9eb160ae7 100644
--- a/pythonbindings/src/gpu/gpu.cpp
+++ b/pythonbindings/src/gpu/gpu.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file gpu.cpp
+//! \ingroup gpu
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "submodules/pre_collision_interactor.cpp"
 #include "submodules/simulation.cpp"
diff --git a/pythonbindings/src/gpu/submodules/actuator_farm.cpp b/pythonbindings/src/gpu/submodules/actuator_farm.cpp
index 234308dd8..a930616db 100644
--- a/pythonbindings/src/gpu/submodules/actuator_farm.cpp
+++ b/pythonbindings/src/gpu/submodules/actuator_farm.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file actuator_farm.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/numpy.h>
 #include <gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h>
diff --git a/pythonbindings/src/gpu/submodules/boundary_conditions.cpp b/pythonbindings/src/gpu/submodules/boundary_conditions.cpp
index e2fb05e9a..865817bb1 100644
--- a/pythonbindings/src/gpu/submodules/boundary_conditions.cpp
+++ b/pythonbindings/src/gpu/submodules/boundary_conditions.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file boindary_conditions.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/GridGenerator/grid/BoundaryConditions/Side.h>
 #include "gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h"
diff --git a/pythonbindings/src/gpu/submodules/communicator.cpp b/pythonbindings/src/gpu/submodules/communicator.cpp
index 63594a559..26a570619 100644
--- a/pythonbindings/src/gpu/submodules/communicator.cpp
+++ b/pythonbindings/src/gpu/submodules/communicator.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file communicator.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/VirtualFluids_GPU/Communication/Communicator.h>
 
diff --git a/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp b/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp
index cda1bea9b..bbff4832c 100644
--- a/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp
+++ b/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file cuda_memory_manager.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h>
 #include <gpu/VirtualFluids_GPU/Parameter/Parameter.h>
diff --git a/pythonbindings/src/gpu/submodules/grid_generator.cpp b/pythonbindings/src/gpu/submodules/grid_generator.cpp
index a10b48cc7..3e9fb5655 100644
--- a/pythonbindings/src/gpu/submodules/grid_generator.cpp
+++ b/pythonbindings/src/gpu/submodules/grid_generator.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file grid_generator.cpp
+//! \ingroup submodules
+//! \author Henry Korb, Henrik Asmuth
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "gpu/GridGenerator/utilities/communication.h"
 #include "gpu/GridGenerator/geometries/Object.h"
diff --git a/pythonbindings/src/gpu/submodules/grid_provider.cpp b/pythonbindings/src/gpu/submodules/grid_provider.cpp
index ff5749da2..717e9d5cd 100644
--- a/pythonbindings/src/gpu/submodules/grid_provider.cpp
+++ b/pythonbindings/src/gpu/submodules/grid_provider.cpp
@@ -1,3 +1,34 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file grid_provider
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include "gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h"
 
diff --git a/pythonbindings/src/gpu/submodules/grid_scaling_factory.cpp b/pythonbindings/src/gpu/submodules/grid_scaling_factory.cpp
index 7ec35bee6..a3a572875 100644
--- a/pythonbindings/src/gpu/submodules/grid_scaling_factory.cpp
+++ b/pythonbindings/src/gpu/submodules/grid_scaling_factory.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file grid_scaling_factory.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/VirtualFluids_GPU/Factories/GridScalingFactory.h>
 
diff --git a/pythonbindings/src/gpu/submodules/parameter.cpp b/pythonbindings/src/gpu/submodules/parameter.cpp
index ae3a529a1..a7c42223e 100644
--- a/pythonbindings/src/gpu/submodules/parameter.cpp
+++ b/pythonbindings/src/gpu/submodules/parameter.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file parameter.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/functional.h>
 #include <pybind11/stl.h>
diff --git a/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp b/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp
index 362ee1a8c..308f6c37a 100644
--- a/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp
+++ b/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp
@@ -1,3 +1,36 @@
+
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file pre_collision_interactor.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h>
 
diff --git a/pythonbindings/src/gpu/submodules/precursor_writer.cpp b/pythonbindings/src/gpu/submodules/precursor_writer.cpp
index c7b921d25..64164ef99 100644
--- a/pythonbindings/src/gpu/submodules/precursor_writer.cpp
+++ b/pythonbindings/src/gpu/submodules/precursor_writer.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file precursor_writer.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 #include <pybind11/numpy.h>
diff --git a/pythonbindings/src/gpu/submodules/probes.cpp b/pythonbindings/src/gpu/submodules/probes.cpp
index 79ee11705..7c26958df 100644
--- a/pythonbindings/src/gpu/submodules/probes.cpp
+++ b/pythonbindings/src/gpu/submodules/probes.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file probes.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
 #include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h>
diff --git a/pythonbindings/src/gpu/submodules/simulation.cpp b/pythonbindings/src/gpu/submodules/simulation.cpp
index 8149f2d73..d32ef272a 100644
--- a/pythonbindings/src/gpu/submodules/simulation.cpp
+++ b/pythonbindings/src/gpu/submodules/simulation.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file simulation.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/VirtualFluids_GPU/LBM/Simulation.h>
 #include <gpu/VirtualFluids_GPU/Communication/Communicator.h>
diff --git a/pythonbindings/src/gpu/submodules/transient_bc_setter.cpp b/pythonbindings/src/gpu/submodules/transient_bc_setter.cpp
index 293e311a4..89370ef4c 100644
--- a/pythonbindings/src/gpu/submodules/transient_bc_setter.cpp
+++ b/pythonbindings/src/gpu/submodules/transient_bc_setter.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file transient_bc_setter.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h>
 
diff --git a/pythonbindings/src/gpu/submodules/turbulence_models.cpp b/pythonbindings/src/gpu/submodules/turbulence_models.cpp
index 79ba5a5b4..cfbb9e561 100644
--- a/pythonbindings/src/gpu/submodules/turbulence_models.cpp
+++ b/pythonbindings/src/gpu/submodules/turbulence_models.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file turbulence_models.cpp
+//! \ingroup submodules
+//! \author Henry Korb
+//=======================================================================================
 #include "pybind11/pybind11.h"
 #include "gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h"
 #include "gpu/VirtualFluids_GPU/LBM/LB.h"
diff --git a/pythonbindings/src/lbm/lbm.cpp b/pythonbindings/src/lbm/lbm.cpp
index 441b9ff37..90fd4a71b 100644
--- a/pythonbindings/src/lbm/lbm.cpp
+++ b/pythonbindings/src/lbm/lbm.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file lbm.cpp
+//! \ingroup lbm
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 
 namespace lbm
diff --git a/pythonbindings/src/logger/logger.cpp b/pythonbindings/src/logger/logger.cpp
index bae2f9362..555b502fa 100644
--- a/pythonbindings/src/logger/logger.cpp
+++ b/pythonbindings/src/logger/logger.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file logging.cpp
+//! \ingroup logger
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <logger/Logger.h>
 
diff --git a/pythonbindings/src/muParser.cpp b/pythonbindings/src/muParser.cpp
index 0b65d715b..eec39de0b 100644
--- a/pythonbindings/src/muParser.cpp
+++ b/pythonbindings/src/muParser.cpp
@@ -1,3 +1,35 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of
+//  the License, or (at your option) any later version.
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+//  for more details.
+//
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file muParser.cpp
+//! \ingroup src
+//! \author Henry Korb
+//=======================================================================================
 #include <pybind11/pybind11.h>
 #include <muParser.h>
 
-- 
GitLab


From 962408c5620e367ad0369ce73a806df907c5d992 Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 15:50:23 +0100
Subject: [PATCH 133/179] rename blade*DNew to blade*DCurrentTimestep rename
 blade*DOld to blade*DPreviousTimestep

---
 .../GPU/CudaMemoryManager.cpp                 | 108 +++++++++---------
 .../PreCollisionInteractor/ActuatorFarm.cu    |  44 +++----
 .../PreCollisionInteractor/ActuatorFarm.h     |  48 ++++----
 3 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
index c4f3807ef..d651ac0cb 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -3172,40 +3172,40 @@ void CudaMemoryManager::cudaAllocBladeCoords(ActuatorFarm* actuatorFarm)
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeCoordsYH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeCoordsZH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );    
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );    
     
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsXDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsYDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsZDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsXDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsYDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeCoordsZDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
     setMemsizeGPU(6.f*actuatorFarm->getNumberOfNodes(), false);
 }
 
 void CudaMemoryManager::cudaCopyBladeCoordsHtoD(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsXDNew, actuatorFarm->bladeCoordsXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsYDNew, actuatorFarm->bladeCoordsYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsZDNew, actuatorFarm->bladeCoordsZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsXDCurrentTimestep, actuatorFarm->bladeCoordsXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsYDCurrentTimestep, actuatorFarm->bladeCoordsYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsZDCurrentTimestep, actuatorFarm->bladeCoordsZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
 }
 
 void CudaMemoryManager::cudaCopyBladeCoordsDtoH(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsXH, actuatorFarm->bladeCoordsXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsYH, actuatorFarm->bladeCoordsYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsZH, actuatorFarm->bladeCoordsZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsXH, actuatorFarm->bladeCoordsXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsYH, actuatorFarm->bladeCoordsYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeCoordsZH, actuatorFarm->bladeCoordsZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
 }
 
 void CudaMemoryManager::cudaFreeBladeCoords(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsXDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsYDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsZDNew) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsXDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsYDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsZDCurrentTimestep) );
 
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsXDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsYDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsZDOld) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsXDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsYDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeCoordsZDPreviousTimestep) );
 
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeCoordsXH) );
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeCoordsYH) );
@@ -3239,40 +3239,40 @@ void CudaMemoryManager::cudaAllocBladeVelocities(ActuatorFarm* actuatorFarm)
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeVelocitiesYH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeVelocitiesZH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesXDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesYDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesZDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesXDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesYDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeVelocitiesZDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
     setMemsizeGPU(3.*sizeof(real)*actuatorFarm->getNumberOfNodes(), false);
 }
 
 void CudaMemoryManager::cudaCopyBladeVelocitiesHtoD(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesXDNew, actuatorFarm->bladeVelocitiesXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesYDNew, actuatorFarm->bladeVelocitiesYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesZDNew, actuatorFarm->bladeVelocitiesZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesXDCurrentTimestep, actuatorFarm->bladeVelocitiesXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesYDCurrentTimestep, actuatorFarm->bladeVelocitiesYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesZDCurrentTimestep, actuatorFarm->bladeVelocitiesZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
 }
 
 void CudaMemoryManager::cudaCopyBladeVelocitiesDtoH(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesXH, actuatorFarm->bladeVelocitiesXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesYH, actuatorFarm->bladeVelocitiesYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesZH, actuatorFarm->bladeVelocitiesZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesXH, actuatorFarm->bladeVelocitiesXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesYH, actuatorFarm->bladeVelocitiesYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeVelocitiesZH, actuatorFarm->bladeVelocitiesZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
 }
 
 void CudaMemoryManager::cudaFreeBladeVelocities(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesXDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesYDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesZDNew) );    
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesXDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesYDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesZDCurrentTimestep) );    
     
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesXDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesYDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesZDOld) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesXDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesYDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeVelocitiesZDPreviousTimestep) );
 
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeVelocitiesXH) );
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeVelocitiesYH) );
@@ -3285,40 +3285,40 @@ void CudaMemoryManager::cudaAllocBladeForces(ActuatorFarm* actuatorFarm)
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeForcesYH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
     checkCudaErrors( cudaMallocHost((void**) &actuatorFarm->bladeForcesZH, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesXDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesYDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
-    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesZDOld, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesXDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesYDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
+    checkCudaErrors( cudaMalloc((void**) &actuatorFarm->bladeForcesZDPreviousTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes()) );
 
     setMemsizeGPU(3.*sizeof(real)*actuatorFarm->getNumberOfNodes(), false);
 }
 
 void CudaMemoryManager::cudaCopyBladeForcesHtoD(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesXDNew, actuatorFarm->bladeForcesXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesYDNew, actuatorFarm->bladeForcesYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesZDNew, actuatorFarm->bladeForcesZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesXDCurrentTimestep, actuatorFarm->bladeForcesXH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesYDCurrentTimestep, actuatorFarm->bladeForcesYH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesZDCurrentTimestep, actuatorFarm->bladeForcesZH, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyHostToDevice) );
 }
 
 void CudaMemoryManager::cudaCopyBladeForcesDtoH(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesXH, actuatorFarm->bladeForcesXDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesYH, actuatorFarm->bladeForcesYDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
-    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesZH, actuatorFarm->bladeForcesZDNew, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesXH, actuatorFarm->bladeForcesXDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesYH, actuatorFarm->bladeForcesYDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
+    checkCudaErrors( cudaMemcpy(actuatorFarm->bladeForcesZH, actuatorFarm->bladeForcesZDCurrentTimestep, sizeof(real)*actuatorFarm->getNumberOfNodes(), cudaMemcpyDeviceToHost) );
 }
 
 void CudaMemoryManager::cudaFreeBladeForces(ActuatorFarm* actuatorFarm)
 {
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesXDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesYDNew) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesZDNew) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesXDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesYDCurrentTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesZDCurrentTimestep) );
 
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesXDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesYDOld) );
-    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesZDOld) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesXDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesYDPreviousTimestep) );
+    checkCudaErrors( cudaFree(actuatorFarm->bladeForcesZDPreviousTimestep) );
 
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeForcesXH) );
     checkCudaErrors( cudaFreeHost(actuatorFarm->bladeForcesYH) );
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
index 3e553ad68..626e3bc0b 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
@@ -292,8 +292,8 @@ void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManage
         para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ,        
         para->getParD(this->level)->neighborX, para->getParD(this->level)->neighborY, para->getParD(this->level)->neighborZ, para->getParD(this->level)->neighborInverse,
         para->getParD(this->level)->velocityX, para->getParD(this->level)->velocityY, para->getParD(this->level)->velocityZ,
-        this->bladeCoordsXDNew, this->bladeCoordsYDNew, this->bladeCoordsZDNew,  
-        this->bladeVelocitiesXDNew, this->bladeVelocitiesYDNew, this->bladeVelocitiesZDNew,  
+        this->bladeCoordsXDCurrentTimestep, this->bladeCoordsYDCurrentTimestep, this->bladeCoordsZDCurrentTimestep,  
+        this->bladeVelocitiesXDCurrentTimestep, this->bladeVelocitiesYDCurrentTimestep, this->bladeVelocitiesZDCurrentTimestep,  
         this->numberOfTurbines, this->numberOfBlades, this->numberOfBladeNodes,
         this->azimuthsD, this->yawsD, this->omegasD, 
         this->turbinePosXD, this->turbinePosYD, this->turbinePosZD,
@@ -311,8 +311,8 @@ void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManage
     applyBodyForces<<<sphereGrid.grid, sphereGrid.threads, 0, stream>>>(
         para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ,        
         para->getParD(this->level)->forceX_SP, para->getParD(this->level)->forceY_SP, para->getParD(this->level)->forceZ_SP,        
-        this->bladeCoordsXDNew, this->bladeCoordsYDNew, this->bladeCoordsZDNew,  
-        this->bladeForcesXDNew, this->bladeForcesYDNew, this->bladeForcesZDNew,
+        this->bladeCoordsXDCurrentTimestep, this->bladeCoordsYDCurrentTimestep, this->bladeCoordsZDCurrentTimestep,  
+        this->bladeForcesXDCurrentTimestep, this->bladeForcesYDCurrentTimestep, this->bladeForcesZDCurrentTimestep,
         this->numberOfTurbines, this->numberOfBlades, this->numberOfBladeNodes,
         this->azimuthsD, this->yawsD, this->diametersD,
         this->turbinePosXD, this->turbinePosYD, this->turbinePosZD,
@@ -434,9 +434,9 @@ void ActuatorFarm::initBladeCoords(CudaMemoryManager* cudaMemoryManager)
         }
     }
     cudaMemoryManager->cudaCopyBladeCoordsHtoD(this);
-    swapArrays(this->bladeCoordsXDNew, this->bladeCoordsXDOld);
-    swapArrays(this->bladeCoordsYDNew, this->bladeCoordsYDOld);
-    swapArrays(this->bladeCoordsZDNew, this->bladeCoordsZDOld);
+    swapArrays(this->bladeCoordsXDCurrentTimestep, this->bladeCoordsXDPreviousTimestep);
+    swapArrays(this->bladeCoordsYDCurrentTimestep, this->bladeCoordsYDPreviousTimestep);
+    swapArrays(this->bladeCoordsZDCurrentTimestep, this->bladeCoordsZDPreviousTimestep);
     cudaMemoryManager->cudaCopyBladeCoordsHtoD(this);
 }
 
@@ -449,9 +449,9 @@ void ActuatorFarm::initBladeVelocities(CudaMemoryManager* cudaMemoryManager)
     std::fill_n(this->bladeVelocitiesZH, this->numberOfNodes, c0o1);
 
     cudaMemoryManager->cudaCopyBladeVelocitiesHtoD(this);
-    swapArrays(this->bladeVelocitiesXDNew, this->bladeVelocitiesXDOld);
-    swapArrays(this->bladeVelocitiesYDNew, this->bladeVelocitiesYDOld);
-    swapArrays(this->bladeVelocitiesZDNew, this->bladeVelocitiesZDOld);
+    swapArrays(this->bladeVelocitiesXDCurrentTimestep, this->bladeVelocitiesXDPreviousTimestep);
+    swapArrays(this->bladeVelocitiesYDCurrentTimestep, this->bladeVelocitiesYDPreviousTimestep);
+    swapArrays(this->bladeVelocitiesZDCurrentTimestep, this->bladeVelocitiesZDPreviousTimestep);
     cudaMemoryManager->cudaCopyBladeVelocitiesHtoD(this);
 }
 
@@ -464,9 +464,9 @@ void ActuatorFarm::initBladeForces(CudaMemoryManager* cudaMemoryManager)
     std::fill_n(this->bladeForcesZH, this->numberOfNodes, c0o1);
 
     cudaMemoryManager->cudaCopyBladeForcesHtoD(this);
-    swapArrays(this->bladeForcesXDNew, this->bladeForcesXDOld);
-    swapArrays(this->bladeForcesYDNew, this->bladeForcesYDOld);
-    swapArrays(this->bladeForcesZDNew, this->bladeForcesZDOld);
+    swapArrays(this->bladeForcesXDCurrentTimestep, this->bladeForcesXDPreviousTimestep);
+    swapArrays(this->bladeForcesYDCurrentTimestep, this->bladeForcesYDPreviousTimestep);
+    swapArrays(this->bladeForcesZDCurrentTimestep, this->bladeForcesZDPreviousTimestep);
     cudaMemoryManager->cudaCopyBladeForcesHtoD(this);
 }
 
@@ -580,15 +580,15 @@ void ActuatorFarm::setTurbineBladeForces(uint turbine, real* _bladeForcesX, real
 
 void ActuatorFarm::swapDeviceArrays()
 {
-    swapArrays(this->bladeCoordsXDOld, this->bladeCoordsXDNew);
-    swapArrays(this->bladeCoordsYDOld, this->bladeCoordsYDNew);
-    swapArrays(this->bladeCoordsZDOld, this->bladeCoordsZDNew);
+    swapArrays(this->bladeCoordsXDPreviousTimestep, this->bladeCoordsXDCurrentTimestep);
+    swapArrays(this->bladeCoordsYDPreviousTimestep, this->bladeCoordsYDCurrentTimestep);
+    swapArrays(this->bladeCoordsZDPreviousTimestep, this->bladeCoordsZDCurrentTimestep);
 
-    swapArrays(this->bladeVelocitiesXDOld, this->bladeVelocitiesXDNew);
-    swapArrays(this->bladeVelocitiesYDOld, this->bladeVelocitiesYDNew);
-    swapArrays(this->bladeVelocitiesZDOld, this->bladeVelocitiesZDNew);
+    swapArrays(this->bladeVelocitiesXDPreviousTimestep, this->bladeVelocitiesXDCurrentTimestep);
+    swapArrays(this->bladeVelocitiesYDPreviousTimestep, this->bladeVelocitiesYDCurrentTimestep);
+    swapArrays(this->bladeVelocitiesZDPreviousTimestep, this->bladeVelocitiesZDCurrentTimestep);
 
-    swapArrays(this->bladeForcesXDOld, this->bladeForcesXDNew);
-    swapArrays(this->bladeForcesYDOld, this->bladeForcesYDNew);
-    swapArrays(this->bladeForcesZDOld, this->bladeForcesZDNew);
+    swapArrays(this->bladeForcesXDPreviousTimestep, this->bladeForcesXDCurrentTimestep);
+    swapArrays(this->bladeForcesYDPreviousTimestep, this->bladeForcesYDCurrentTimestep);
+    swapArrays(this->bladeForcesZDPreviousTimestep, this->bladeForcesZDCurrentTimestep);
 }
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
index c1dd1add5..f771ce10c 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
@@ -106,26 +106,26 @@ public:
     real* getTurbineBladeForcesZ(uint turbine){ return &this->bladeForcesZH[turbine*numberOfBladeNodes*numberOfBlades]; };
 
     real* getAllBladeRadiiDevice(){ return this->bladeRadiiD; };
-    real* getAllBladeCoordsXDevice(){ return this->bladeCoordsXDNew; };
-    real* getAllBladeCoordsYDevice(){ return this->bladeCoordsYDNew; };
-    real* getAllBladeCoordsZDevice(){ return this->bladeCoordsZDNew; };
-    real* getAllBladeVelocitiesXDevice(){ return this->bladeVelocitiesXDNew; };
-    real* getAllBladeVelocitiesYDevice(){ return this->bladeVelocitiesYDNew; };
-    real* getAllBladeVelocitiesZDevice(){ return this->bladeVelocitiesZDNew; };
-    real* getAllBladeForcesXDevice(){ return this->bladeForcesXDNew; };
-    real* getAllBladeForcesYDevice(){ return this->bladeForcesYDNew; };
-    real* getAllBladeForcesZDevice(){ return this->bladeForcesZDNew; };
+    real* getAllBladeCoordsXDevice(){ return this->bladeCoordsXDCurrentTimestep; };
+    real* getAllBladeCoordsYDevice(){ return this->bladeCoordsYDCurrentTimestep; };
+    real* getAllBladeCoordsZDevice(){ return this->bladeCoordsZDCurrentTimestep; };
+    real* getAllBladeVelocitiesXDevice(){ return this->bladeVelocitiesXDCurrentTimestep; };
+    real* getAllBladeVelocitiesYDevice(){ return this->bladeVelocitiesYDCurrentTimestep; };
+    real* getAllBladeVelocitiesZDevice(){ return this->bladeVelocitiesZDCurrentTimestep; };
+    real* getAllBladeForcesXDevice(){ return this->bladeForcesXDCurrentTimestep; };
+    real* getAllBladeForcesYDevice(){ return this->bladeForcesYDCurrentTimestep; };
+    real* getAllBladeForcesZDevice(){ return this->bladeForcesZDCurrentTimestep; };
 
     real* getTurbineBladeRadiiDevice(uint turbine){ return &this->bladeRadiiD[turbine*numberOfBladeNodes]; };
-    real* getTurbineBladeCoordsXDevice(uint turbine){ return &this->bladeCoordsXDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeCoordsYDevice(uint turbine){ return &this->bladeCoordsYDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeCoordsZDevice(uint turbine){ return &this->bladeCoordsZDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeVelocitiesXDevice(uint turbine){ return &this->bladeVelocitiesXDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeVelocitiesYDevice(uint turbine){ return &this->bladeVelocitiesYDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeVelocitiesZDevice(uint turbine){ return &this->bladeVelocitiesZDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeForcesXDevice(uint turbine){ return &this->bladeForcesXDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeForcesYDevice(uint turbine){ return &this->bladeForcesYDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
-    real* getTurbineBladeForcesZDevice(uint turbine){ return &this->bladeForcesZDNew[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeCoordsXDevice(uint turbine){ return &this->bladeCoordsXDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeCoordsYDevice(uint turbine){ return &this->bladeCoordsYDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeCoordsZDevice(uint turbine){ return &this->bladeCoordsZDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeVelocitiesXDevice(uint turbine){ return &this->bladeVelocitiesXDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeVelocitiesYDevice(uint turbine){ return &this->bladeVelocitiesYDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeVelocitiesZDevice(uint turbine){ return &this->bladeVelocitiesZDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeForcesXDevice(uint turbine){ return &this->bladeForcesXDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeForcesYDevice(uint turbine){ return &this->bladeForcesYDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
+    real* getTurbineBladeForcesZDevice(uint turbine){ return &this->bladeForcesZDCurrentTimestep[turbine*numberOfBladeNodes*numberOfBlades]; };
 
     void setAllAzimuths(real* _azimuth);
     void setAllOmegas(real* _omegas);
@@ -166,14 +166,14 @@ public:
     real* bladeRadiiH;
     real* bladeRadiiD;
     real* bladeCoordsXH, * bladeCoordsYH, * bladeCoordsZH;
-    real* bladeCoordsXDNew, * bladeCoordsYDNew, * bladeCoordsZDNew;    
-    real* bladeCoordsXDOld, * bladeCoordsYDOld, * bladeCoordsZDOld;
+    real* bladeCoordsXDPreviousTimestep, * bladeCoordsYDPreviousTimestep, * bladeCoordsZDPreviousTimestep;
+    real* bladeCoordsXDCurrentTimestep, * bladeCoordsYDCurrentTimestep, * bladeCoordsZDCurrentTimestep;    
     real* bladeVelocitiesXH, * bladeVelocitiesYH, * bladeVelocitiesZH;
-    real* bladeVelocitiesXDOld, * bladeVelocitiesYDOld, * bladeVelocitiesZDOld;
-    real* bladeVelocitiesXDNew, * bladeVelocitiesYDNew, * bladeVelocitiesZDNew;
+    real* bladeVelocitiesXDPreviousTimestep, * bladeVelocitiesYDPreviousTimestep, * bladeVelocitiesZDPreviousTimestep;
+    real* bladeVelocitiesXDCurrentTimestep, * bladeVelocitiesYDCurrentTimestep, * bladeVelocitiesZDCurrentTimestep;
     real* bladeForcesXH, * bladeForcesYH, * bladeForcesZH;
-    real* bladeForcesXDOld, * bladeForcesYDOld, * bladeForcesZDOld;
-    real* bladeForcesXDNew, * bladeForcesYDNew, * bladeForcesZDNew;
+    real* bladeForcesXDPreviousTimestep, * bladeForcesYDPreviousTimestep, * bladeForcesZDPreviousTimestep;
+    real* bladeForcesXDCurrentTimestep, * bladeForcesYDCurrentTimestep, * bladeForcesZDCurrentTimestep;
     uint* bladeIndicesH;
     uint* bladeIndicesD; 
     uint* boundingSphereIndicesH;
-- 
GitLab


From 1dbd9279f3b633a91684e22496c4bc87466e7fc0 Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 15:50:36 +0100
Subject: [PATCH 134/179] remove newline in findq

---
 src/gpu/VirtualFluids_GPU/FindQ/FindQ.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h
index d1e8a08a7..551205bd5 100644
--- a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h
+++ b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h
@@ -5,7 +5,6 @@
 #include "lbm/constants/D3Q27.h"
 #include "Parameter/Parameter.h"
 
-
 void findQ(Parameter* para, int lev);
 
 void findKforQ(Parameter* para, int lev);
-- 
GitLab


From 79cd02053efcf427eab2ae590560c6f79a78503b Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 16:03:59 +0100
Subject: [PATCH 135/179] format lbm kernel

---
 src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu | 143 ++++++++++++++++-----
 1 file changed, 111 insertions(+), 32 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
index 41f74113f..b513aa100 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -1189,7 +1189,7 @@ void Calc3rdMomentsCompSP27( real* CUMbbb,
 										unsigned int size_Mat,
 										unsigned int numberOfThreads,
 										real* DD,
-										bool isEvenTimestep)
+										bool isEvenTimestep):
 {
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
@@ -3208,66 +3208,145 @@ void VelSchlaffer27(  unsigned int numberOfThreads,
       getLastCudaError("VelSchlaff27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
-void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
+void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, 
+								QforPrecursorBoundaryConditions* boundaryCondition, 
+								real timeRatio, 
+								real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
 
-	QPrecursorDeviceCompZeroPress<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, boundaryCondition->sizeQ, parameterDevice->omega, 
-		parameterDevice->distributions.f[0], boundaryCondition->q27[0],
-		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
-		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
-		boundaryCondition->last, boundaryCondition->current,
-		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
-		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+	QPrecursorDeviceCompZeroPress<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+																boundaryCondition->numberOfBCnodes,
+																boundaryCondition->numberOfPrecursorNodes,
+																boundaryCondition->sizeQ,
+																parameterDevice->omega,
+																parameterDevice->distributions.f[0],
+																boundaryCondition->q27[0],
+																parameterDevice->neighborX,
+																parameterDevice->neighborY,
+																parameterDevice->neighborZ,
+																boundaryCondition->planeNeighbor0PP,
+																boundaryCondition->planeNeighbor0PM,
+																boundaryCondition->planeNeighbor0MP,
+																boundaryCondition->planeNeighbor0MM,
+																boundaryCondition->weights0PP,
+																boundaryCondition->weights0PM,
+																boundaryCondition->weights0MP,
+																boundaryCondition->weights0MM,
+																boundaryCondition->last,
+																boundaryCondition->current,
+																boundaryCondition->velocityX,
+																boundaryCondition->velocityY,
+																boundaryCondition->velocityZ,
+																timeRatio,
+																velocityRatio,
+																parameterDevice->numberOfNodes,
+																parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
 //////////////////////////////////////////////////////////////////////////
-void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
+void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice,
+						QforPrecursorBoundaryConditions* boundaryCondition,
+						real timeRatio,
+						real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
 
-	PrecursorDeviceEQ27<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->omega, parameterDevice->distributions.f[0], 
-		parameterDevice->neighborX, parameterDevice->neighborX, parameterDevice->neighborX,
-		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
-		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
-		boundaryCondition->last, boundaryCondition->current,
-		boundaryCondition->velocityX, boundaryCondition->velocityY, boundaryCondition->velocityZ, 
-		timeRatio, velocityRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+	PrecursorDeviceEQ27<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+													boundaryCondition->numberOfBCnodes,
+													boundaryCondition->numberOfPrecursorNodes,
+													parameterDevice->omega,
+													parameterDevice->distributions.f[0],
+													parameterDevice->neighborX,
+													parameterDevice->neighborX,
+													parameterDevice->neighborX,
+													boundaryCondition->planeNeighbor0PP,
+													boundaryCondition->planeNeighbor0PM,
+													boundaryCondition->planeNeighbor0MP,
+													boundaryCondition->planeNeighbor0MM,
+													boundaryCondition->weights0PP,
+													boundaryCondition->weights0PM,
+													boundaryCondition->weights0MP,
+													boundaryCondition->weights0MM,
+													boundaryCondition->last,
+													boundaryCondition->current,
+													boundaryCondition->velocityX,
+													boundaryCondition->velocityY,
+													boundaryCondition->velocityZ,
+													timeRatio,
+													velocityRatio,
+													parameterDevice->numberOfNodes,
+													parameterDevice->isEvenTimestep);
 	getLastCudaError("PrecursorDeviceEQ27 execution failed"); 
 
 }
 //////////////////////////////////////////////////////////////////////////
-void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
+void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice,
+								QforPrecursorBoundaryConditions* boundaryCondition,
+								real timeRatio,
+								real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
 
-	PrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->distributions.f[0],
-		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
-		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
-		boundaryCondition->last, boundaryCondition->current,
-		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+	PrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+															boundaryCondition->numberOfBCnodes,
+															boundaryCondition->numberOfPrecursorNodes,
+															parameterDevice->distributions.f[0],
+															parameterDevice->neighborX,
+															parameterDevice->neighborY,
+															parameterDevice->neighborZ,
+															boundaryCondition->planeNeighbor0PP,
+															boundaryCondition->planeNeighbor0PM,
+															boundaryCondition->planeNeighbor0MP,
+															boundaryCondition->planeNeighbor0MM,
+															boundaryCondition->weights0PP,
+															boundaryCondition->weights0PM,
+															boundaryCondition->weights0MP,
+															boundaryCondition->weights0MM,
+															boundaryCondition->last,
+															boundaryCondition->current,
+															timeRatio,
+															parameterDevice->numberOfNodes,
+															parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
 
 //////////////////////////////////////////////////////////////////////////
-void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice, QforPrecursorBoundaryConditions* boundaryCondition, real timeRatio, real velocityRatio)
+void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice,
+								QforPrecursorBoundaryConditions* boundaryCondition,
+								real timeRatio,
+								real velocityRatio)
 {
 
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
 
-	QPrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k, boundaryCondition->q27[0], boundaryCondition->sizeQ, boundaryCondition->numberOfBCnodes, boundaryCondition->numberOfPrecursorNodes, parameterDevice->distributions.f[0],
-		parameterDevice->neighborX, parameterDevice->neighborY, parameterDevice->neighborZ,
-		boundaryCondition->planeNeighbor0PP, boundaryCondition->planeNeighbor0PM, boundaryCondition->planeNeighbor0MP, boundaryCondition->planeNeighbor0MM,
-		boundaryCondition->weights0PP, boundaryCondition->weights0PM, boundaryCondition->weights0MP, boundaryCondition->weights0MM,
-		boundaryCondition->last, boundaryCondition->current,
-		timeRatio, parameterDevice->numberOfNodes, parameterDevice->isEvenTimestep);
+	QPrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+																boundaryCondition->q27[0],
+																boundaryCondition->sizeQ,
+																boundaryCondition->numberOfBCnodes,
+																boundaryCondition->numberOfPrecursorNodes,
+																parameterDevice->distributions.f[0],
+																parameterDevice->neighborX,
+																parameterDevice->neighborY,
+																parameterDevice->neighborZ,
+																boundaryCondition->planeNeighbor0PP,
+																boundaryCondition->planeNeighbor0PM,
+																boundaryCondition->planeNeighbor0MP,
+																boundaryCondition->planeNeighbor0MM,
+																boundaryCondition->weights0PP,
+																boundaryCondition->weights0PM,
+																boundaryCondition->weights0MP,
+																boundaryCondition->weights0MM,
+																boundaryCondition->last,
+																boundaryCondition->current,
+																timeRatio,
+																parameterDevice->numberOfNodes,
+																parameterDevice->isEvenTimestep);
 	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
 
 }
-- 
GitLab


From 5bd31bbad842d78074ca72e5c691d92b6c1cb33f Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 16:04:18 +0100
Subject: [PATCH 136/179] remove commented lines in pressbc

---
 src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu | 129 --------------------
 1 file changed, 129 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
index 29e82196b..e105a1a08 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
@@ -2945,135 +2945,6 @@ __global__ void QPressNoRhoDevice27( real* rhoBC,
    f[DIR_MPM] = (dist.f[DIR_MPM])[kbnw ];
    //////////////////////////////////////////////////////////////////////////
 
-   //real vx1, vx2, vx3, drho;
-   //real vx1, vx2, vx3, drho, drho1;
-   //////////////////////////////////////////////////////////////////////////
-   ////Dichte
-   //   drho1  =  f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW +
-   //             f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + 
-   //             f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[DIR_000])[k1zero]); 
-   //   drho   =  f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW +
-   //             f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + 
-   //             f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); 
-
-   //////////////////////////////////////////////////////////////////////////
-   ////Ux
-
-   //vx1    =  (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-   //               ((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
-   //               (f_E - f_W)) /(one + drho); 
-
-
-   //vx2    =   ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-   //               ((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
-   //               (f_N - f_S)) /(one + drho); 
-
-   //vx3    =   (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
-   //               (-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
-   //               (f_T - f_B)) /(one + drho); 
-
-
-   //real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
-
-   //////////////////////////////////////////////////////////////////////////
-	////real omega = om1;
-   //   real cusq  = c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
-   //   //////////////////////////////////////////////////////////////////////////
-   ////T�st MK
-   ////if(vx1 < zero) vx1 = zero;
-   //   //////////////////////////////////////////////////////////////////////////
-   //   real fZERO = c8over27*  (drho1-(one + drho1)*(cusq))                                                           ;
-   //   real fE    = c2over27*  (drho1+(one + drho1)*(three*( vx1        )+c9over2*( vx1        )*( vx1        )-cusq));
-   //   real fW    = c2over27*  (drho1+(one + drho1)*(three*(-vx1        )+c9over2*(-vx1        )*(-vx1        )-cusq));
-   //   real fN    = c2over27*  (drho1+(one + drho1)*(three*(    vx2     )+c9over2*(     vx2    )*(     vx2    )-cusq));
-   //   real fS    = c2over27*  (drho1+(one + drho1)*(three*(   -vx2     )+c9over2*(    -vx2    )*(    -vx2    )-cusq));
-   //   real fT    = c2over27*  (drho1+(one + drho1)*(three*(         vx3)+c9over2*(         vx3)*(         vx3)-cusq));
-   //   real fB    = c2over27*  (drho1+(one + drho1)*(three*(        -vx3)+c9over2*(        -vx3)*(        -vx3)-cusq));
-   //   real fNE   = c1over54*  (drho1+(one + drho1)*(three*( vx1+vx2    )+c9over2*( vx1+vx2    )*( vx1+vx2    )-cusq));
-   //   real fSW   = c1over54*  (drho1+(one + drho1)*(three*(-vx1-vx2    )+c9over2*(-vx1-vx2    )*(-vx1-vx2    )-cusq));
-   //   real fSE   = c1over54*  (drho1+(one + drho1)*(three*( vx1-vx2    )+c9over2*( vx1-vx2    )*( vx1-vx2    )-cusq));
-   //   real fNW   = c1over54*  (drho1+(one + drho1)*(three*(-vx1+vx2    )+c9over2*(-vx1+vx2    )*(-vx1+vx2    )-cusq));
-   //   real fTE	  /////////////////////////////////////////////////////////////
-   //with velocity
-   //if(true){//vx1 >= zero){
-      // real csMvx = one / sqrtf(three) - vx1;
-      // //real csMvy = one / sqrtf(three) - vx2;
-      // ///////////////////////////////////////////
-      // // X
-      // f_W   = f1_W   * csMvx + (one - csMvx) * f_W   ;//- c2over27  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_NW  = f1_NW  * csMvx + (one - csMvx) * f_NW  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_SW  = f1_SW  * csMvx + (one - csMvx) * f_SW  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_TW  = f1_TW  * csMvx + (one - csMvx) * f_TW  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_BW  = f1_BW  * csMvx + (one - csMvx) * f_BW  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_TNW = f1_TNW * csMvx + (one - csMvx) * f_TNW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_TSW = f1_TSW * csMvx + (one - csMvx) * f_TSW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_BNW = f1_BNW * csMvx + (one - csMvx) * f_BNW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // f_BSW = f1_BSW * csMvx + (one - csMvx) * f_BSW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx1);
-      // ///////////////////////////////////////////
-      // // Y
-      // //f_S   = f1_S   * csMvy + (one - csMvy) * f_S   ;//- c2over27  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_SE  = f1_SE  * csMvy + (one - csMvy) * f_SE  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_SW  = f1_SW  * csMvy + (one - csMvy) * f_SW  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_TS  = f1_TS  * csMvy + (one - csMvy) * f_TS  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_BS  = f1_BS  * csMvy + (one - csMvy) * f_BS  ;//- c1over54  * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_TSE = f1_TSE * csMvy + (one - csMvy) * f_TSE ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_TSW = f1_TSW * csMvy + (one - csMvy) * f_TSW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_BSE = f1_BSE * csMvy + (one - csMvy) * f_BSE ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_BSW = f1_BSW * csMvy + (one - csMvy) * f_BSW ;//- c1over216 * ((drho + drho1)*c1o2-((drho + drho1)*c1o2 )*three*vx2);
-      // //f_S   = f1_S   * csMvy + (one - csMvy) * f_S;
-      // //f_SE  = f1_SE  * csMvy + (one - csMvy) * f_SE;
-      // //f_SW  = f1_SW  * csMvy + (one - csMvy) * f_SW;
-      // //f_TS  = f1_TS  * csMvy + (one - csMvy) * f_TS;
-      // //f_BS  = f1_BS  * csMvy + (one - csMvy) * f_BS;
-      // //f_TSE = f1_TSE * csMvy + (one - csMvy) * f_TSE;
-      // //f_TSW = f1_TSW * csMvy + (one - csMvy) * f_TSW;
-      // //f_BSE = f1_BSE * csMvy + (one - csMvy) * f_BSE;
-      // //f_BSW = f1_BSW * csMvy + (one - csMvy) * f_BSW;
-      // //////////////////////////////////////////////////////////////////////////
-   //}
-   //else
-   //{
-      // ///////////////////////////////////////////
-      // // X
-      // vx1   = vx1 * 0.9;
-      // f_W   = f_E   - six * c2over27  * ( vx1        );
-      // f_NW  = f_SE  - six * c1over54  * ( vx1-vx2    );
-      // f_SW  = f_NE  - six * c1over54  * ( vx1+vx2    );
-      // f_TW  = f_BE  - six * c1over54  * ( vx1    -vx3);
-      // f_BW  = f_TE  - six * c1over54  * ( vx1    +vx3);
-      // f_TNW = f_BSE - six * c1over216 * ( vx1-vx2-vx3);
-      // f_TSW = f_BNE - six * c1over216 * ( vx1+vx2-vx3);
-      // f_BNW = f_TSE - six * c1over216 * ( vx1-vx2+vx3);
-      // f_BSW = f_TNE - six * c1over216 * ( vx1+vx2+vx3);
-      // ///////////////////////////////////////////
-      // // Y
-      // //vx2   = vx2 * 0.9;
-      // //f_S   = f_N   - six * c2over27  * (     vx2    );
-      // //f_SE  = f_NW  - six * c1over54  * (-vx1+vx2    );
-      // //f_SW  = f_NE  - six * c1over54  * ( vx1+vx2    );
-      // //f_TS  = f_BN  - six * c1over54  * (     vx2-vx3);
-      // //f_BS  = f_TN  - six * c1over54  * (     vx2+vx3);
-      // //f_TSE = f_BNW - six * c1over216 * (-vx1+vx2-vx3);
-      // //f_TSW = f_BNE - six * c1over216 * ( vx1+vx2-vx3);
-      // //f_BSE = f_TNW - six * c1over216 * (-vx1+vx2+vx3);
-      // //f_BSW = f_TNE - six * c1over216 * ( vx1+vx2+vx3);
-      // ///////////////////////////////////////////
-   //}
-   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-   //   = c1over54*  (drho1+(one + drho1)*(three*(-vx1    +vx3)+c9over2*(-vx1    +vx3)*(-vx1    +vx3)-cusq));
-   //   real fTN   = c1over54*  (drho1+(one + drho1)*(three*(     vx2+vx3)+c9over2*(     vx2+vx3)*(     vx2+vx3)-cusq));
-   //   real fBS   = c1over54*  (drho1+(one + drho1)*(three*(    -vx2-vx3)+c9over2*(    -vx2-vx3)*(    -vx2-vx3)-cusq));
-   //   real fBN   = c1over54*  (drho1+(one + drho1)*(three*(     vx2-vx3)+c9over2*(     vx2-vx3)*(     vx2-vx3)-cusq));
-   //   real fTS   = c1over54*  (drho1+(one + drho1)*(three*(    -vx2+vx3)+c9over2*(    -vx2+vx3)*(    -vx2+vx3)-cusq));
-   //   real fTNE  = c1over216* (drho1+(one + drho1)*(three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq));
-   //   real fBSW  = c1over216* (drho1+(one + drho1)*(three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq));
-   //   real fBNE  = c1over216* (drho1+(one + drho1)*(three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq));
-   //   real fTSW  = c1over216* (drho1+(one + drho1)*(three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq));
-   //   real fTSE  = c1over216* (drho1+(one + drho1)*(three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq));
-   //   real fBNW  = c1over216* (drho1+(one + drho1)*(three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq));
-   //   real fBSE  = c1over216* (drho1+(one + drho1)*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
-   //   real fTNW  = c1over216* (drho1+(one + drho1)*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
 
    real cs = c1o1 / sqrtf(c3o1);
 
-- 
GitLab


From 33d5c30f8aa58d3c3737c90fdc0999faeba1334d Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Fri, 16 Dec 2022 16:41:16 +0100
Subject: [PATCH 137/179] bug fix in lbmkernel from prev commit

---
 src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
index b513aa100..363fb7662 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -1189,7 +1189,7 @@ void Calc3rdMomentsCompSP27( real* CUMbbb,
 										unsigned int size_Mat,
 										unsigned int numberOfThreads,
 										real* DD,
-										bool isEvenTimestep):
+										bool isEvenTimestep)
 {
 	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-- 
GitLab


From 891b70bc2e17a7c96ecf92742359d59d29362663 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Mon, 19 Dec 2022 12:52:46 +0100
Subject: [PATCH 138/179] Refactor PressureBC

---
 src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu | 294 +++++++++-----------
 1 file changed, 128 insertions(+), 166 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
index e105a1a08..6a14cebd4 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
@@ -3057,124 +3057,86 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
    if(k>=numberOfBCnodes) return;
    ////////////////////////////////////////////////////////////////////////////////
    //index
-   unsigned int KQK  = k_Q[k];
-   unsigned int kzero= KQK;
-   unsigned int ke   = KQK;
-   unsigned int kw   = neighborX[KQK];
-   unsigned int kn   = KQK;
-   unsigned int ks   = neighborY[KQK];
-   unsigned int kt   = KQK;
-   unsigned int kb   = neighborZ[KQK];
-   unsigned int ksw  = neighborY[kw];
-   unsigned int kne  = KQK;
-   unsigned int kse  = ks;
-   unsigned int knw  = kw;
-   unsigned int kbw  = neighborZ[kw];
-   unsigned int kte  = KQK;
-   unsigned int kbe  = kb;
-   unsigned int ktw  = kw;
-   unsigned int kbs  = neighborZ[ks];
-   unsigned int ktn  = KQK;
-   unsigned int kbn  = kb;
-   unsigned int kts  = ks;
-   unsigned int ktse = ks;
-   unsigned int kbnw = kbw;
-   unsigned int ktnw = kw;
-   unsigned int kbse = kbs;
-   unsigned int ktsw = ksw;
-   unsigned int kbne = kb;
-   unsigned int ktne = KQK;
-   unsigned int kbsw = neighborZ[ksw];
+
+   uint k_000 = k_Q[k];
+   uint k_M00 = neighborX[k_000];
+   uint k_0M0 = neighborY[k_000];
+   uint k_00M = neighborZ[k_000];
+   uint k_MM0 = neighborY[k_M00];
+   uint k_M0M = neighborZ[k_M00];
+   uint k_0MM = neighborZ[k_0M0];
+   uint k_MMM = neighborZ[k_MM0];
+
    ////////////////////////////////////////////////////////////////////////////////
-   //index1
-   unsigned int K1QK  = k_N[k];
-   // unsigned int k1zero= K1QK;
-   unsigned int k1e   = K1QK;
-   unsigned int k1w   = neighborX[K1QK];
-   unsigned int k1n   = K1QK;
-   unsigned int k1s   = neighborY[K1QK];
-   unsigned int k1t   = K1QK;
-   unsigned int k1b   = neighborZ[K1QK];
-   unsigned int k1sw  = neighborY[k1w];
-   unsigned int k1ne  = K1QK;
-   unsigned int k1se  = k1s;
-   unsigned int k1nw  = k1w;
-   unsigned int k1bw  = neighborZ[k1w];
-   unsigned int k1te  = K1QK;
-   unsigned int k1be  = k1b;
-   unsigned int k1tw  = k1w;
-   unsigned int k1bs  = neighborZ[k1s];
-   unsigned int k1tn  = K1QK;
-   unsigned int k1bn  = k1b;
-   unsigned int k1ts  = k1s;
-   unsigned int k1tse = k1s;
-   unsigned int k1bnw = k1bw;
-   unsigned int k1tnw = k1w;
-   unsigned int k1bse = k1bs;
-   unsigned int k1tsw = k1sw;
-   unsigned int k1bne = k1b;
-   unsigned int k1tne = K1QK;
-   unsigned int k1bsw = neighborZ[k1sw];
+   //index of neighbor
+   uint kN_000 = k_N[k];
+   uint kN_M00 = neighborX[k_000];
+   uint kN_0M0 = neighborY[k_000];
+   uint kN_00M = neighborZ[k_000];
+   uint kN_MM0 = neighborY[k_M00];
+   uint kN_M0M = neighborZ[k_M00];
+   uint kN_0MM = neighborZ[k_0M0];
+   uint kN_MMM = neighborZ[k_MM0];
    ////////////////////////////////////////////////////////////////////////////////
    Distributions27 dist;
    getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);   
-   real f1[27], f[27];   
+   real f[27], fN[27];   
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   f1[DIR_P00] = (dist.f[DIR_P00])[k1e   ];
-   f1[DIR_M00] = (dist.f[DIR_M00])[k1w   ];
-   f1[DIR_0P0] = (dist.f[DIR_0P0])[k1n   ];
-   f1[DIR_0M0] = (dist.f[DIR_0M0])[k1s   ];
-   f1[DIR_00P] = (dist.f[DIR_00P])[k1t   ];
-   f1[DIR_00M] = (dist.f[DIR_00M])[k1b   ];
-   f1[DIR_PP0] = (dist.f[DIR_PP0])[k1ne  ];
-   f1[DIR_MM0] = (dist.f[DIR_MM0])[k1sw  ];
-   f1[DIR_PM0] = (dist.f[DIR_PM0])[k1se  ];
-   f1[DIR_MP0] = (dist.f[DIR_MP0])[k1nw  ];
-   f1[DIR_P0P] = (dist.f[DIR_P0P])[k1te  ];
-   f1[DIR_M0M] = (dist.f[DIR_M0M])[k1bw  ];
-   f1[DIR_P0M] = (dist.f[DIR_P0M])[k1be  ];
-   f1[DIR_M0P] = (dist.f[DIR_M0P])[k1tw  ];
-   f1[DIR_0PP] = (dist.f[DIR_0PP])[k1tn  ];
-   f1[DIR_0MM] = (dist.f[DIR_0MM])[k1bs  ];
-   f1[DIR_0PM] = (dist.f[DIR_0PM])[k1bn  ];
-   f1[DIR_0MP] = (dist.f[DIR_0MP])[k1ts  ];
-   // f1[DIR_000] = (dist.f[DIR_000])[k1zero];
-   f1[DIR_PPP] = (dist.f[DIR_PPP])[k1tne ];
-   f1[DIR_MMP] = (dist.f[DIR_MMP])[k1tsw ];
-   f1[DIR_PMP] = (dist.f[DIR_PMP])[k1tse ];
-   f1[DIR_MPP] = (dist.f[DIR_MPP])[k1tnw ];
-   f1[DIR_PPM] = (dist.f[DIR_PPM])[k1bne ];
-   f1[DIR_MMM] = (dist.f[DIR_MMM])[k1bsw ];
-   f1[DIR_PMM] = (dist.f[DIR_PMM])[k1bse ];
-   f1[DIR_MPM] = (dist.f[DIR_MPM])[k1bnw ];
+   f[DIR_000] = (dist.f[DIR_000])[k_000];
+   f[DIR_P00] = (dist.f[DIR_P00])[k_000];
+   f[DIR_M00] = (dist.f[DIR_M00])[k_M00];
+   f[DIR_0P0] = (dist.f[DIR_0P0])[k_000];
+   f[DIR_0M0] = (dist.f[DIR_0M0])[k_0M0];
+   f[DIR_00P] = (dist.f[DIR_00P])[k_000];
+   f[DIR_00M] = (dist.f[DIR_00M])[k_00M];
+   f[DIR_PP0] = (dist.f[DIR_PP0])[k_000];
+   f[DIR_MM0] = (dist.f[DIR_MM0])[k_MM0];
+   f[DIR_PM0] = (dist.f[DIR_PM0])[k_0M0];
+   f[DIR_MP0] = (dist.f[DIR_MP0])[k_M00];
+   f[DIR_P0P] = (dist.f[DIR_P0P])[k_000];
+   f[DIR_M0M] = (dist.f[DIR_M0M])[k_M0M];
+   f[DIR_P0M] = (dist.f[DIR_P0M])[k_00M];
+   f[DIR_M0P] = (dist.f[DIR_M0P])[k_M00];
+   f[DIR_0PP] = (dist.f[DIR_0PP])[k_000];
+   f[DIR_0MM] = (dist.f[DIR_0MM])[k_0MM];
+   f[DIR_0PM] = (dist.f[DIR_0PM])[k_00M];
+   f[DIR_0MP] = (dist.f[DIR_0MP])[k_0M0];
+   f[DIR_PPP] = (dist.f[DIR_PPP])[k_000];
+   f[DIR_MPP] = (dist.f[DIR_MPP])[k_M00];
+   f[DIR_PMP] = (dist.f[DIR_PMP])[k_0M0];
+   f[DIR_MMP] = (dist.f[DIR_MMP])[k_MM0];
+   f[DIR_PPM] = (dist.f[DIR_PPM])[k_00M];
+   f[DIR_MPM] = (dist.f[DIR_MPM])[k_M0M];
+   f[DIR_PMM] = (dist.f[DIR_PMM])[k_0MM];
+   f[DIR_MMM] = (dist.f[DIR_MMM])[k_MMM];
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   f[DIR_P00] = (dist.f[DIR_P00])[ke   ];
-   f[DIR_M00] = (dist.f[DIR_M00])[kw   ];
-   f[DIR_0P0] = (dist.f[DIR_0P0])[kn   ];
-   f[DIR_0M0] = (dist.f[DIR_0M0])[ks   ];
-   f[DIR_00P] = (dist.f[DIR_00P])[kt   ];
-   f[DIR_00M] = (dist.f[DIR_00M])[kb   ];
-   f[DIR_PP0] = (dist.f[DIR_PP0])[kne  ];
-   f[DIR_MM0] = (dist.f[DIR_MM0])[ksw  ];
-   f[DIR_PM0] = (dist.f[DIR_PM0])[kse  ];
-   f[DIR_MP0] = (dist.f[DIR_MP0])[knw  ];
-   f[DIR_P0P] = (dist.f[DIR_P0P])[kte  ];
-   f[DIR_M0M] = (dist.f[DIR_M0M])[kbw  ];
-   f[DIR_P0M] = (dist.f[DIR_P0M])[kbe  ];
-   f[DIR_M0P] = (dist.f[DIR_M0P])[ktw  ];
-   f[DIR_0PP] = (dist.f[DIR_0PP])[ktn  ];
-   f[DIR_0MM] = (dist.f[DIR_0MM])[kbs  ];
-   f[DIR_0PM] = (dist.f[DIR_0PM])[kbn  ];
-   f[DIR_0MP] = (dist.f[DIR_0MP])[kts  ];
-   f[DIR_000] = (dist.f[DIR_000])[kzero];
-   f[DIR_PPP] = (dist.f[DIR_PPP])[ktne ];
-   f[DIR_MMP] = (dist.f[DIR_MMP])[ktsw ];
-   f[DIR_PMP] = (dist.f[DIR_PMP])[ktse ];
-   f[DIR_MPP] = (dist.f[DIR_MPP])[ktnw ];
-   f[DIR_PPM] = (dist.f[DIR_PPM])[kbne ];
-   f[DIR_MMM] = (dist.f[DIR_MMM])[kbsw ];
-   f[DIR_PMM] = (dist.f[DIR_PMM])[kbse ];
-   f[DIR_MPM] = (dist.f[DIR_MPM])[kbnw ];
+   fN[DIR_000] = (dist.f[DIR_000])[kN_000];
+   fN[DIR_P00] = (dist.f[DIR_P00])[kN_000];
+   fN[DIR_M00] = (dist.f[DIR_M00])[kN_M00];
+   fN[DIR_0P0] = (dist.f[DIR_0P0])[kN_000];
+   fN[DIR_0M0] = (dist.f[DIR_0M0])[kN_0M0];
+   fN[DIR_00P] = (dist.f[DIR_00P])[kN_000];
+   fN[DIR_00M] = (dist.f[DIR_00M])[kN_00M];
+   fN[DIR_PP0] = (dist.f[DIR_PP0])[kN_000];
+   fN[DIR_MM0] = (dist.f[DIR_MM0])[kN_MM0];
+   fN[DIR_PM0] = (dist.f[DIR_PM0])[kN_0M0];
+   fN[DIR_MP0] = (dist.f[DIR_MP0])[kN_M00];
+   fN[DIR_P0P] = (dist.f[DIR_P0P])[kN_000];
+   fN[DIR_M0M] = (dist.f[DIR_M0M])[kN_M0M];
+   fN[DIR_P0M] = (dist.f[DIR_P0M])[kN_00M];
+   fN[DIR_M0P] = (dist.f[DIR_M0P])[kN_M00];
+   fN[DIR_0PP] = (dist.f[DIR_0PP])[kN_000];
+   fN[DIR_0MM] = (dist.f[DIR_0MM])[kN_0MM];
+   fN[DIR_0PM] = (dist.f[DIR_0PM])[kN_00M];
+   fN[DIR_0MP] = (dist.f[DIR_0MP])[kN_0M0];
+   fN[DIR_PPP] = (dist.f[DIR_PPP])[kN_000];
+   fN[DIR_MPP] = (dist.f[DIR_MPP])[kN_M00];
+   fN[DIR_PMP] = (dist.f[DIR_PMP])[kN_0M0];
+   fN[DIR_MMP] = (dist.f[DIR_MMP])[kN_MM0];
+   fN[DIR_PPM] = (dist.f[DIR_PPM])[kN_00M];
+   fN[DIR_MPM] = (dist.f[DIR_MPM])[kN_M0M];
+   fN[DIR_PMM] = (dist.f[DIR_PMM])[kN_0MM];
+   fN[DIR_MMM] = (dist.f[DIR_MMM])[kN_MMM];
    //////////////////////////////////////////////////////////////////////////
    real drho = vf::lbm::getDensity(f);
    
@@ -3187,75 +3149,75 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
    switch(direction)
    {
       case MZZ:
-         (dist.f[DIR_P00])[ke   ] = computeOutflowDistribution(f, f1, DIR_P00  , rhoCorrection, cs, c2o27);
-         (dist.f[DIR_PM0])[kse  ] = computeOutflowDistribution(f, f1, DIR_PM0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PP0])[kne  ] = computeOutflowDistribution(f, f1, DIR_PP0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_P0M])[kbe  ] = computeOutflowDistribution(f, f1, DIR_P0M, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_P0P])[kte  ] = computeOutflowDistribution(f, f1, DIR_P0P, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PMP])[ktse ] = computeOutflowDistribution(f, f1, DIR_PMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PPP])[ktne ] = computeOutflowDistribution(f, f1, DIR_PPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PMM])[kbse ] = computeOutflowDistribution(f, f1, DIR_PMM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PPM])[kbne ] = computeOutflowDistribution(f, f1, DIR_PPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_P00])[k_000] = computeOutflowDistribution(f, fN, DIR_P00  , rhoCorrection, cs, c2o27);
+         (dist.f[DIR_PM0])[k_0M0] = computeOutflowDistribution(f, fN, DIR_PM0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PP0])[k_000] = computeOutflowDistribution(f, fN, DIR_PP0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_P0M])[k_00M] = computeOutflowDistribution(f, fN, DIR_P0M, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_P0P])[k_000] = computeOutflowDistribution(f, fN, DIR_P0P, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PMP])[k_0M0] = computeOutflowDistribution(f, fN, DIR_PMP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PPP])[k_000] = computeOutflowDistribution(f, fN, DIR_PPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PMM])[k_0MM] = computeOutflowDistribution(f, fN, DIR_PMM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PPM])[k_00M] = computeOutflowDistribution(f, fN, DIR_PPM, rhoCorrection, cs, c1o216);
          break;
 
       case PZZ:
-         (dist.f[DIR_M00])[kw   ] = computeOutflowDistribution(f, f1, DIR_M00, rhoCorrection, cs, c2o27);
-         (dist.f[DIR_MM0])[ksw  ] = computeOutflowDistribution(f, f1, DIR_MM0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_MP0])[knw  ] = computeOutflowDistribution(f, f1, DIR_MP0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_M0M])[kbw  ] = computeOutflowDistribution(f, f1, DIR_M0M, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_M0P])[ktw  ] = computeOutflowDistribution(f, f1, DIR_M0P, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_MMP])[ktsw ] = computeOutflowDistribution(f, f1, DIR_MMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPP])[ktnw ] = computeOutflowDistribution(f, f1, DIR_MPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMM])[kbsw ] = computeOutflowDistribution(f, f1, DIR_MMM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPM])[kbnw ] = computeOutflowDistribution(f, f1, DIR_MPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_M00])[k_M00] = computeOutflowDistribution(f, fN, DIR_M00, rhoCorrection, cs, c2o27);
+         (dist.f[DIR_MM0])[k_MM0] = computeOutflowDistribution(f, fN, DIR_MM0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_MP0])[k_M00] = computeOutflowDistribution(f, fN, DIR_MP0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_M0M])[k_M0M] = computeOutflowDistribution(f, fN, DIR_M0M, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_M0P])[k_M00] = computeOutflowDistribution(f, fN, DIR_M0P, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_MMP])[k_MM0] = computeOutflowDistribution(f, fN, DIR_MMP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPP])[k_M00] = computeOutflowDistribution(f, fN, DIR_MPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MMM])[k_MMM] = computeOutflowDistribution(f, fN, DIR_MMM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPM])[k_M0M] = computeOutflowDistribution(f, fN, DIR_MPM, rhoCorrection, cs, c1o216);
          break;
 
       case ZMZ:
-         (dist.f[DIR_0P0])[kn   ] = computeOutflowDistribution(f, f1, DIR_0P0, rhoCorrection, cs, c2o27);
-         (dist.f[DIR_PP0])[kne  ] = computeOutflowDistribution(f, f1, DIR_PP0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_MP0])[knw  ] = computeOutflowDistribution(f, f1, DIR_MP0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0PP])[ktn  ] = computeOutflowDistribution(f, f1, DIR_0PP, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0PM])[kbn  ] = computeOutflowDistribution(f, f1, DIR_0PM, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PPP])[ktne ] = computeOutflowDistribution(f, f1, DIR_PPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPP])[ktnw ] = computeOutflowDistribution(f, f1, DIR_MPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PPM])[kbne ] = computeOutflowDistribution(f, f1, DIR_PPM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPM])[kbnw ] = computeOutflowDistribution(f, f1, DIR_MPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_0P0])[k_000] = computeOutflowDistribution(f, fN, DIR_0P0, rhoCorrection, cs, c2o27);
+         (dist.f[DIR_PP0])[k_000] = computeOutflowDistribution(f, fN, DIR_PP0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_MP0])[k_M00] = computeOutflowDistribution(f, fN, DIR_MP0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0PP])[k_000] = computeOutflowDistribution(f, fN, DIR_0PP, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0PM])[k_00M] = computeOutflowDistribution(f, fN, DIR_0PM, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PPP])[k_000] = computeOutflowDistribution(f, fN, DIR_PPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPP])[k_M00] = computeOutflowDistribution(f, fN, DIR_MPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PPM])[k_00M] = computeOutflowDistribution(f, fN, DIR_PPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPM])[k_M0M] = computeOutflowDistribution(f, fN, DIR_MPM, rhoCorrection, cs, c1o216);
          break;  
 
       case ZPZ:   
-         (dist.f[DIR_0M0])[ks   ] =computeOutflowDistribution(f, f1, DIR_0M0, rhoCorrection, cs, c2o27);
-         (dist.f[DIR_PM0])[kse  ] =computeOutflowDistribution(f, f1, DIR_PM0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_MM0])[ksw  ] =computeOutflowDistribution(f, f1, DIR_MM0, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0MP])[kts  ] =computeOutflowDistribution(f, f1, DIR_0MP, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0MM])[kbs  ] =computeOutflowDistribution(f, f1, DIR_0MM, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PMP])[ktse ] =computeOutflowDistribution(f, f1, DIR_PMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMP])[ktsw ] =computeOutflowDistribution(f, f1, DIR_MMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PMM])[kbse ] =computeOutflowDistribution(f, f1, DIR_PMM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMM])[kbsw ] =computeOutflowDistribution(f, f1, DIR_MMM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_0M0])[k_0M0] =computeOutflowDistribution(f, fN, DIR_0M0, rhoCorrection, cs, c2o27);
+         (dist.f[DIR_PM0])[k_0M0] =computeOutflowDistribution(f, fN, DIR_PM0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_MM0])[k_MM0] =computeOutflowDistribution(f, fN, DIR_MM0, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0MP])[k_0M0] =computeOutflowDistribution(f, fN, DIR_0MP, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0MM])[k_0MM] =computeOutflowDistribution(f, fN, DIR_0MM, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PMP])[k_0M0] =computeOutflowDistribution(f, fN, DIR_PMP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MMP])[k_MM0] =computeOutflowDistribution(f, fN, DIR_MMP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PMM])[k_0MM] =computeOutflowDistribution(f, fN, DIR_PMM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MMM])[k_MMM] =computeOutflowDistribution(f, fN, DIR_MMM, rhoCorrection, cs, c1o216);
          break;
 
       case ZZM:
-         (dist.f[DIR_00P])[kt   ] = computeOutflowDistribution(f, f1, DIR_00P, rhoCorrection, cs, c2o27);
-         (dist.f[DIR_P0P])[kte  ] = computeOutflowDistribution(f, f1, DIR_P0P, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_M0P])[ktw  ] = computeOutflowDistribution(f, f1, DIR_M0P, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0PP])[ktn  ] = computeOutflowDistribution(f, f1, DIR_0PP, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0MP])[kts  ] = computeOutflowDistribution(f, f1, DIR_0MP, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PPP])[ktne ] = computeOutflowDistribution(f, f1, DIR_PPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPP])[ktnw ] = computeOutflowDistribution(f, f1, DIR_MPP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PMP])[ktse ] = computeOutflowDistribution(f, f1, DIR_PMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMP])[ktsw ] = computeOutflowDistribution(f, f1, DIR_MMP, rhoCorrection, cs, c1o216); 
+         (dist.f[DIR_00P])[k_000] = computeOutflowDistribution(f, fN, DIR_00P, rhoCorrection, cs, c2o27);
+         (dist.f[DIR_P0P])[k_000] = computeOutflowDistribution(f, fN, DIR_P0P, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_M0P])[k_M00] = computeOutflowDistribution(f, fN, DIR_M0P, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0PP])[k_000] = computeOutflowDistribution(f, fN, DIR_0PP, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0MP])[k_0M0] = computeOutflowDistribution(f, fN, DIR_0MP, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PPP])[k_000] = computeOutflowDistribution(f, fN, DIR_PPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPP])[k_M00] = computeOutflowDistribution(f, fN, DIR_MPP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PMP])[k_0M0] = computeOutflowDistribution(f, fN, DIR_PMP, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MMP])[k_MM0] = computeOutflowDistribution(f, fN, DIR_MMP, rhoCorrection, cs, c1o216); 
          break;
 
       case ZZP:
-         (dist.f[DIR_00M])[kb   ] = computeOutflowDistribution(f, f1, DIR_00M, rhoCorrection, cs, c2o27);
-         (dist.f[DIR_P0M])[kbe  ] = computeOutflowDistribution(f, f1, DIR_P0M, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_M0M])[kbw  ] = computeOutflowDistribution(f, f1, DIR_M0M, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0PM])[kbn  ] = computeOutflowDistribution(f, f1, DIR_0PM, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_0MM])[kbs  ] = computeOutflowDistribution(f, f1, DIR_0MM, rhoCorrection, cs, c1o54);
-         (dist.f[DIR_PPM])[kbne ] = computeOutflowDistribution(f, f1, DIR_PPM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MPM])[kbnw ] = computeOutflowDistribution(f, f1, DIR_MPM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_PMM])[kbse ] = computeOutflowDistribution(f, f1, DIR_PMM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMM])[kbsw ] = computeOutflowDistribution(f, f1, DIR_MMM, rhoCorrection, cs, c1o216);     
+         (dist.f[DIR_00M])[k_00M] = computeOutflowDistribution(f, fN, DIR_00M, rhoCorrection, cs, c2o27);
+         (dist.f[DIR_P0M])[k_00M] = computeOutflowDistribution(f, fN, DIR_P0M, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_M0M])[k_M0M] = computeOutflowDistribution(f, fN, DIR_M0M, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0PM])[k_00M] = computeOutflowDistribution(f, fN, DIR_0PM, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_0MM])[k_0MM] = computeOutflowDistribution(f, fN, DIR_0MM, rhoCorrection, cs, c1o54);
+         (dist.f[DIR_PPM])[k_00M] = computeOutflowDistribution(f, fN, DIR_PPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MPM])[k_M0M] = computeOutflowDistribution(f, fN, DIR_MPM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_PMM])[k_0MM] = computeOutflowDistribution(f, fN, DIR_PMM, rhoCorrection, cs, c1o216);
+         (dist.f[DIR_MMM])[k_MMM] = computeOutflowDistribution(f, fN, DIR_MMM, rhoCorrection, cs, c1o216);     
          break;
       default:
          break;
-- 
GitLab


From 62cffd790cfa3dbed5e65b4181840457bfa35f2a Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Mon, 19 Dec 2022 12:57:36 +0100
Subject: [PATCH 139/179] renaming in precursor BC

---
 .../VirtualFluids_GPU/GPU/PrecursorBCs27.cu   | 854 +++++++++---------
 1 file changed, 426 insertions(+), 428 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
index e7b0c6079..78b190e37 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
@@ -19,10 +19,10 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 uint* neighborX, 
                                                 uint* neighborY, 
                                                 uint* neighborZ,
-                                                uint* neighborsNT, 
-                                                uint* neighborsNB,
-                                                uint* neighborsST,
-                                                uint* neighborsSB,
+                                                uint* neighbors0PP, 
+                                                uint* neighbors0PM,
+                                                uint* neighbors0MP,
+                                                uint* neighbors0MM,
                                                 real* weights0PP, 
                                                 real* weights0PM,
                                                 real* weights0MP,
@@ -46,8 +46,8 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     real vxLastInterpd, vyLastInterpd, vzLastInterpd; 
     real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
 
-    uint kNT = neighborsNT[k];
-    real dNT = weights0PP[k];
+    uint kNeighbor0PP = neighbors0PP[k];
+    real d0PP = weights0PP[k];
 
     real* vxLast = vLast;
     real* vyLast = &vLast[numberOfPrecursorNodes];
@@ -57,35 +57,35 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     real* vyCurrent = &vCurrent[numberOfPrecursorNodes];
     real* vzCurrent = &vCurrent[2*numberOfPrecursorNodes];
 
-    if(dNT < 1e6)
+    if(d0PP < 1e6)
     {
-        uint kNB = neighborsNB[k];
-        uint kST = neighborsST[k];
-        uint kSB = neighborsSB[k];
+        uint kNeighbor0PM = neighbors0PM[k];
+        uint kNeighbor0MP = neighbors0MP[k];
+        uint kNeighbor0MM = neighbors0MM[k];
 
-        real dNB = weights0PM[k];
-        real dST = weights0MP[k];
-        real dSB = weights0MM[k];
+        real d0PM = weights0PM[k];
+        real d0MP = weights0MP[k];
+        real d0MM = weights0MM[k];
 
-        real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
+        real invWeightSum = 1.f/(d0PP+d0PM+d0MP+d0MM);
 
-        vxLastInterpd = (vxLast[kNT]*dNT + vxLast[kNB]*dNB + vxLast[kST]*dST + vxLast[kSB]*dSB)*invWeightSum;
-        vyLastInterpd = (vyLast[kNT]*dNT + vyLast[kNB]*dNB + vyLast[kST]*dST + vyLast[kSB]*dSB)*invWeightSum;
-        vzLastInterpd = (vzLast[kNT]*dNT + vzLast[kNB]*dNB + vzLast[kST]*dST + vzLast[kSB]*dSB)*invWeightSum;
+        vxLastInterpd = (vxLast[kNeighbor0PP]*d0PP + vxLast[kNeighbor0PM]*d0PM + vxLast[kNeighbor0MP]*d0MP + vxLast[kNeighbor0MM]*d0MM)*invWeightSum;
+        vyLastInterpd = (vyLast[kNeighbor0PP]*d0PP + vyLast[kNeighbor0PM]*d0PM + vyLast[kNeighbor0MP]*d0MP + vyLast[kNeighbor0MM]*d0MM)*invWeightSum;
+        vzLastInterpd = (vzLast[kNeighbor0PP]*d0PP + vzLast[kNeighbor0PM]*d0PM + vzLast[kNeighbor0MP]*d0MP + vzLast[kNeighbor0MM]*d0MM)*invWeightSum;
 
-        vxNextInterpd = (vxCurrent[kNT]*dNT + vxCurrent[kNB]*dNB + vxCurrent[kST]*dST + vxCurrent[kSB]*dSB)*invWeightSum;
-        vyNextInterpd = (vyCurrent[kNT]*dNT + vyCurrent[kNB]*dNB + vyCurrent[kST]*dST + vyCurrent[kSB]*dSB)*invWeightSum;
-        vzNextInterpd = (vzCurrent[kNT]*dNT + vzCurrent[kNB]*dNB + vzCurrent[kST]*dST + vzCurrent[kSB]*dSB)*invWeightSum;
+        vxNextInterpd = (vxCurrent[kNeighbor0PP]*d0PP + vxCurrent[kNeighbor0PM]*d0PM + vxCurrent[kNeighbor0MP]*d0MP + vxCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
+        vyNextInterpd = (vyCurrent[kNeighbor0PP]*d0PP + vyCurrent[kNeighbor0PM]*d0PM + vyCurrent[kNeighbor0MP]*d0MP + vyCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
+        vzNextInterpd = (vzCurrent[kNeighbor0PP]*d0PP + vzCurrent[kNeighbor0PM]*d0PM + vzCurrent[kNeighbor0MP]*d0MP + vzCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
     }
     else
     {
-        vxLastInterpd = vxLast[kNT];
-        vyLastInterpd = vyLast[kNT];
-        vzLastInterpd = vzLast[kNT];
+        vxLastInterpd = vxLast[kNeighbor0PP];
+        vyLastInterpd = vyLast[kNeighbor0PP];
+        vzLastInterpd = vzLast[kNeighbor0PP];
 
-        vxNextInterpd = vxCurrent[kNT];
-        vyNextInterpd = vyCurrent[kNT];
-        vzNextInterpd = vzCurrent[kNT];
+        vxNextInterpd = vxCurrent[kNeighbor0PP];
+        vyNextInterpd = vyCurrent[kNeighbor0PP];
+        vzNextInterpd = vzCurrent[kNeighbor0PP];
     }
 
     // if(k==16300)s printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
@@ -99,84 +99,84 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);
 
     unsigned int KQK  = subgridDistanceIndices[k];
-    unsigned int kzero= KQK;
-    unsigned int ke   = KQK;
-    unsigned int kw   = neighborX[KQK];
-    unsigned int kn   = KQK;
-    unsigned int ks   = neighborY[KQK];
-    unsigned int kt   = KQK;
-    unsigned int kb   = neighborZ[KQK];
-    unsigned int ksw  = neighborY[kw];
-    unsigned int kne  = KQK;
-    unsigned int kse  = ks;
-    unsigned int knw  = kw;
-    unsigned int kbw  = neighborZ[kw];
-    unsigned int kte  = KQK;
-    unsigned int kbe  = kb;
-    unsigned int ktw  = kw;
-    unsigned int kbs  = neighborZ[ks];
-    unsigned int ktn  = KQK;
-    unsigned int kbn  = kb;
-    unsigned int kts  = ks;
-    unsigned int ktse = ks;
-    unsigned int kbnw = kbw;
-    unsigned int ktnw = kw;
-    unsigned int kbse = kbs;
-    unsigned int ktsw = ksw;
-    unsigned int kbne = kb;
-    unsigned int ktne = KQK;
-    unsigned int kbsw = neighborZ[ksw];
+    unsigned int k000= KQK;
+    unsigned int kP00   = KQK;
+    unsigned int kM00   = neighborX[KQK];
+    unsigned int k0P0   = KQK;
+    unsigned int k0M0   = neighborY[KQK];
+    unsigned int k00P   = KQK;
+    unsigned int k00M   = neighborZ[KQK];
+    unsigned int kMM0  = neighborY[kM00];
+    unsigned int kPP0  = KQK;
+    unsigned int kPM0  = k0M0;
+    unsigned int kMP0  = kM00;
+    unsigned int kM0M  = neighborZ[kM00];
+    unsigned int kP0P  = KQK;
+    unsigned int kP0M  = k00M;
+    unsigned int kM0P  = kM00;
+    unsigned int k0PP  = KQK;
+    unsigned int k0MM  = neighborZ[k0M0];
+    unsigned int k0PM  = k00M;
+    unsigned int k0MP  = k0M0;
+    unsigned int kPMP = k0M0;
+    unsigned int kMPM = kM0M;
+    unsigned int kMPP = kM00;
+    unsigned int kPMM = k0MM;
+    unsigned int kMMP = kMM0;
+    unsigned int kPPM = k00M;
+    unsigned int kPPP = KQK;
+    unsigned int kMMM = neighborZ[kMM0];
 
     ////////////////////////////////////////////////////////////////////////////////
     //! - Set local distributions
     //!
-    real f_W    = (dist.f[DIR_P00   ])[ke   ];
-    real f_E    = (dist.f[DIR_M00   ])[kw   ];
-    real f_S    = (dist.f[DIR_0P0   ])[kn   ];
-    real f_N    = (dist.f[DIR_0M0   ])[ks   ];
-    real f_B    = (dist.f[DIR_00P   ])[kt   ];
-    real f_T    = (dist.f[DIR_00M   ])[kb   ];
-    real f_SW   = (dist.f[DIR_PP0  ])[kne  ];
-    real f_NE   = (dist.f[DIR_MM0  ])[ksw  ];
-    real f_NW   = (dist.f[DIR_PM0  ])[kse  ];
-    real f_SE   = (dist.f[DIR_MP0  ])[knw  ];
-    real f_BW   = (dist.f[DIR_P0P  ])[kte  ];
-    real f_TE   = (dist.f[DIR_M0M  ])[kbw  ];
-    real f_TW   = (dist.f[DIR_P0M  ])[kbe  ];
-    real f_BE   = (dist.f[DIR_M0P  ])[ktw  ];
-    real f_BS   = (dist.f[DIR_0PP  ])[ktn  ];
-    real f_TN   = (dist.f[DIR_0MM  ])[kbs  ];
-    real f_TS   = (dist.f[DIR_0PM  ])[kbn  ];
-    real f_BN   = (dist.f[DIR_0MP  ])[kts  ];
-    real f_BSW  = (dist.f[DIR_PPP ])[ktne ];
-    real f_BNE  = (dist.f[DIR_MMP ])[ktsw ];
-    real f_BNW  = (dist.f[DIR_PMP ])[ktse ];
-    real f_BSE  = (dist.f[DIR_MPP ])[ktnw ];
-    real f_TSW  = (dist.f[DIR_PPM ])[kbne ];
-    real f_TNE  = (dist.f[DIR_MMM ])[kbsw ];
-    real f_TNW  = (dist.f[DIR_PMM ])[kbse ];
-    real f_TSE  = (dist.f[DIR_MPM ])[kbnw ];
+    real f_M00 = (dist.f[DIR_P00])[kP00];
+    real f_P00 = (dist.f[DIR_M00])[kM00];
+    real f_0M0 = (dist.f[DIR_0P0])[k0P0];
+    real f_0P0 = (dist.f[DIR_0M0])[k0M0];
+    real f_00M = (dist.f[DIR_00P])[k00P];
+    real f_00P = (dist.f[DIR_00M])[k00M];
+    real f_MM0 = (dist.f[DIR_PP0])[kPP0];
+    real f_PP0 = (dist.f[DIR_MM0])[kMM0];
+    real f_MP0 = (dist.f[DIR_PM0])[kPM0];
+    real f_PM0 = (dist.f[DIR_MP0])[kMP0];
+    real f_M0M = (dist.f[DIR_P0P])[kP0P];
+    real f_P0P = (dist.f[DIR_M0M])[kM0M];
+    real f_M0P = (dist.f[DIR_P0M])[kP0M];
+    real f_P0M = (dist.f[DIR_M0P])[kM0P];
+    real f_0MM = (dist.f[DIR_0PP])[k0PP];
+    real f_0PP = (dist.f[DIR_0MM])[k0MM];
+    real f_0MP = (dist.f[DIR_0PM])[k0PM];
+    real f_0PM = (dist.f[DIR_0MP])[k0MP];
+    real f_MMM = (dist.f[DIR_PPP])[kPPP];
+    real f_PPM = (dist.f[DIR_MMP])[kMMP];
+    real f_MPM = (dist.f[DIR_PMP])[kPMP];
+    real f_PMM = (dist.f[DIR_MPP])[kMPP];
+    real f_MMP = (dist.f[DIR_PPM])[kPPM];
+    real f_PPP = (dist.f[DIR_MMM])[kMMM];
+    real f_MPP = (dist.f[DIR_PMM])[kPMM];
+    real f_PMP = (dist.f[DIR_MPM])[kMPM];
     
     SubgridDistances27 subgridD;
     getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes);
     
     ////////////////////////////////////////////////////////////////////////////////
-      real drho   =  f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW +
-                     f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + 
-                     f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); 
+      real drho   =  f_PMP + f_MPP + f_PPP + f_MMP + f_PMM + f_MPM + f_PPM + f_MMM +
+                     f_0PM + f_0PP + f_0MP + f_0MM + f_P0M + f_M0P + f_P0P + f_M0M + f_PM0 + f_MP0 + f_PP0 + f_MM0 + 
+                     f_00P + f_00M + f_0P0 + f_0M0 + f_P00 + f_M00 + ((dist.f[DIR_000])[k000]); 
 
-      real vx1    =  (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-                      ((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
-                      (f_E - f_W)) / (c1o1 + drho); 
+      real vx1 =  (((f_PMP - f_MPM) - (f_MPP - f_PMM)) + ((f_PPP - f_MMM) - (f_MMP - f_PPM)) +
+                      ((f_P0M - f_M0P)   + (f_P0P - f_M0M))   + ((f_PM0 - f_MP0)   + (f_PP0 - f_MM0)) +
+                      (f_P00 - f_M00)) / (c1o1 + drho); 
          
 
-      real vx2    =   ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-                       ((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
-                       (f_N - f_S)) / (c1o1 + drho); 
+      real vx2 =   ((-(f_PMP - f_MPM) + (f_MPP - f_PMM)) + ((f_PPP - f_MMM) - (f_MMP - f_PPM)) +
+                       ((f_0PM - f_0MP)   + (f_0PP - f_0MM))    + (-(f_PM0 - f_MP0)  + (f_PP0 - f_MM0)) +
+                       (f_0P0 - f_0M0)) / (c1o1 + drho); 
 
-      real vx3    =   (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
-                       (-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
-                       (f_T - f_B)) / (c1o1 + drho); 
+      real vx3 =   (((f_PMP - f_MPM) + (f_MPP - f_PMM)) + ((f_PPP - f_MMM) + (f_MMP - f_PPM)) +
+                       (-(f_0PM - f_0MP)  + (f_0PP - f_0MM))   + ((f_P0P - f_M0M)   - (f_P0M - f_M0P)) +
+                       (f_00P - f_00M)) / (c1o1 + drho); 
 
     
     // if(k==16383 || k==0) printf("k %d kQ %d drho = %f u %f v %f w %f\n",k, KQK, drho, vx1, vx2, vx3);
@@ -193,7 +193,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = VeloX;
-        (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_E, f_W, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_M00])[kM00] = getInterpolatedDistributionForVeloWithPressureBC(q, f_P00, f_M00, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_M00])[k];
@@ -202,7 +202,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = -VeloX;
-        (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloWithPressureBC(q, f_W, f_E, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_P00])[kP00] = getInterpolatedDistributionForVeloWithPressureBC(q, f_M00, f_P00, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_0P0])[k];
@@ -211,7 +211,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = VeloY;
-        (dist.f[DIR_0M0])[DIR_0M0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_N, f_S, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_0M0])[DIR_0M0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0P0, f_0M0, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_0M0])[k];
@@ -220,7 +220,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = -VeloY;
-        (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_S, f_N, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_0P0])[k0P0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0M0, f_0P0, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_00P])[k];
@@ -229,7 +229,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = VeloZ;
-        (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloWithPressureBC(q, f_T, f_B, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_00M])[k00M] = getInterpolatedDistributionForVeloWithPressureBC(q, f_00P, f_00M, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_00M])[k];
@@ -238,7 +238,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27);
         velocityBC = -VeloZ;
-        (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloWithPressureBC(q, f_B, f_T, feq, omega, drho, velocityBC, c2o27);
+        (dist.f[DIR_00P])[k00P] = getInterpolatedDistributionForVeloWithPressureBC(q, f_00M, f_00P, feq, omega, drho, velocityBC, c2o27);
     }
 
     q = (subgridD.q[DIR_PP0])[k];
@@ -247,7 +247,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 + vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloX + VeloY;
-        (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NE, f_SW, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_MM0])[kMM0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PP0, f_MM0, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_MM0])[k];
@@ -256,7 +256,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 - vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloX - VeloY;
-        (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SW, f_NE, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_PP0])[kPP0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MM0, f_PP0, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_PM0])[k];
@@ -265,7 +265,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 - vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloX - VeloY;
-        (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SE, f_NW, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_MP0])[kMP0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PM0, f_MP0, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_MP0])[k];
@@ -274,7 +274,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 + vx2;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloX + VeloY;
-        (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NW, f_SE, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_PM0])[kPM0] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MP0, f_PM0, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_P0P])[k];
@@ -283,7 +283,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloX + VeloZ;
-        (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TE, f_BW, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_M0M])[kM0M] = getInterpolatedDistributionForVeloWithPressureBC(q, f_P0P, f_M0M, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_M0M])[k];
@@ -292,7 +292,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloX - VeloZ;
-        (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BW, f_TE, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_P0P])[kP0P] = getInterpolatedDistributionForVeloWithPressureBC(q, f_M0M, f_P0P, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_P0M])[k];
@@ -301,7 +301,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloX - VeloZ;
-        (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BE, f_TW, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_M0P])[kM0P] = getInterpolatedDistributionForVeloWithPressureBC(q, f_P0M, f_M0P, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_M0P])[k];
@@ -310,7 +310,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloX + VeloZ;
-        (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TW, f_BE, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_P0M])[kP0M] = getInterpolatedDistributionForVeloWithPressureBC(q, f_M0P, f_P0M, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_0PP])[k];
@@ -319,7 +319,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloY + VeloZ;
-        (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TN, f_BS, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_0MM])[k0MM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0PP, f_0MM, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_0MM])[k];
@@ -328,7 +328,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloY - VeloZ;
-        (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BS, f_TN, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_0PP])[k0PP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0MM, f_0PP, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_0PM])[k];
@@ -337,7 +337,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = VeloY - VeloZ;
-        (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BN, f_TS, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_0MP])[k0MP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0PM, f_0PP, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_0MP])[k];
@@ -346,7 +346,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54);
         velocityBC = -VeloY + VeloZ;
-        (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TS, f_BN, feq, omega, drho, velocityBC, c1o54);
+        (dist.f[DIR_0PM])[k0PM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_0PP, f_0PM, feq, omega, drho, velocityBC, c1o54);
     }
 
     q = (subgridD.q[DIR_PPP])[k];
@@ -355,7 +355,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 + vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = VeloX + VeloY + VeloZ;
-        (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNE, f_BSW, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_MMM])[kMMM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PPP, f_MMM, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_MMM])[k];
@@ -364,7 +364,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 - vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = -VeloX - VeloY - VeloZ;
-        (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSW, f_TNE, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_PPP])[kPPP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MMM, f_PPP, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_PPM])[k];
@@ -373,7 +373,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 + vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = VeloX + VeloY - VeloZ;
-        (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNE, f_TSW, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_MMP])[kMMP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PPM, f_MMP, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_MMP])[k];
@@ -382,7 +382,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 - vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = -VeloX - VeloY + VeloZ;
-        (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSW, f_BNE, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_PPM])[kPPM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MMP, f_PPM, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_PMP])[k];
@@ -391,7 +391,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 - vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = VeloX - VeloY + VeloZ;
-        (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSE, f_BNW, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_MPM])[kMPM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PMP, f_MPM, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_MPM])[k];
@@ -400,7 +400,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 + vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = -VeloX + VeloY - VeloZ;
-        (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNW, f_TSE, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_PMP])[kPMP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MPM, f_PMP, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_PMM])[k];
@@ -409,7 +409,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = vx1 - vx2 - vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = VeloX - VeloY - VeloZ;
-        (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSE, f_TNW, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_MPP])[kMPP] = getInterpolatedDistributionForVeloWithPressureBC(q, f_PMM, f_MPP, feq, omega, drho, velocityBC, c1o216);
     }
 
     q = (subgridD.q[DIR_MPP])[k];
@@ -418,7 +418,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
         velocityLB = -vx1 + vx2 + vx3;
         feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216);
         velocityBC = -VeloX + VeloY + VeloZ;
-        (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNW, f_BSE, feq, omega, drho, velocityBC, c1o216);
+        (dist.f[DIR_PMM])[kPMM] = getInterpolatedDistributionForVeloWithPressureBC(q, f_MPP, f_PMM, feq, omega, drho, velocityBC, c1o216);
     }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -432,10 +432,10 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         uint* neighborX, 
                                         uint* neighborY, 
                                         uint* neighborZ,
-                                        uint* neighborsNT, 
-                                        uint* neighborsNB,
-                                        uint* neighborsST,
-                                        uint* neighborsSB,
+                                        uint* neighbors0PP, 
+                                        uint* neighbors0PM,
+                                        uint* neighbors0MP,
+                                        uint* neighbors0MM,
                                         real* weights0PP, 
                                         real* weights0PM,
                                         real* weights0MP,
@@ -459,8 +459,8 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     real vxLastInterpd, vyLastInterpd, vzLastInterpd; 
     real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
 
-    uint kNT = neighborsNT[k];
-    real dNT = weights0PP[k];
+    uint kNeighbor0PP = neighbors0PP[k];
+    real d0PP = weights0PP[k];
 
     real* vxLast = vLast;
     real* vyLast = &vLast[numberOfPrecursorNodes];
@@ -470,35 +470,35 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     real* vyCurrent = &vCurrent[numberOfPrecursorNodes];
     real* vzCurrent = &vCurrent[2*numberOfPrecursorNodes];
 
-    if(dNT < 1e6)
+    if(d0PP < 1e6)
     {
-        uint kNB = neighborsNB[k];
-        uint kST = neighborsST[k];
-        uint kSB = neighborsSB[k];
+        uint kNeighbor0PM = neighbors0PM[k];
+        uint kNeighbor0MP = neighbors0MP[k];
+        uint kNeighbor0MM = neighbors0MM[k];
 
-        real dNB = weights0PM[k];
-        real dST = weights0MP[k];
-        real dSB = weights0MM[k];
+        real d0PM = weights0PM[k];
+        real d0MP = weights0MP[k];
+        real d0MM = weights0MM[k];
 
-        real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
+        real invWeightSum = 1.f/(d0PP+d0PM+d0MP+d0MM);
 
-        vxLastInterpd = (vxLast[kNT]*dNT + vxLast[kNB]*dNB + vxLast[kST]*dST + vxLast[kSB]*dSB)*invWeightSum;
-        vyLastInterpd = (vyLast[kNT]*dNT + vyLast[kNB]*dNB + vyLast[kST]*dST + vyLast[kSB]*dSB)*invWeightSum;
-        vzLastInterpd = (vzLast[kNT]*dNT + vzLast[kNB]*dNB + vzLast[kST]*dST + vzLast[kSB]*dSB)*invWeightSum;
+        vxLastInterpd = (vxLast[kNeighbor0PP]*d0PP + vxLast[kNeighbor0PM]*d0PM + vxLast[kNeighbor0MP]*d0MP + vxLast[kNeighbor0MM]*d0MM)*invWeightSum;
+        vyLastInterpd = (vyLast[kNeighbor0PP]*d0PP + vyLast[kNeighbor0PM]*d0PM + vyLast[kNeighbor0MP]*d0MP + vyLast[kNeighbor0MM]*d0MM)*invWeightSum;
+        vzLastInterpd = (vzLast[kNeighbor0PP]*d0PP + vzLast[kNeighbor0PM]*d0PM + vzLast[kNeighbor0MP]*d0MP + vzLast[kNeighbor0MM]*d0MM)*invWeightSum;
 
-        vxNextInterpd = (vxCurrent[kNT]*dNT + vxCurrent[kNB]*dNB + vxCurrent[kST]*dST + vxCurrent[kSB]*dSB)*invWeightSum;
-        vyNextInterpd = (vyCurrent[kNT]*dNT + vyCurrent[kNB]*dNB + vyCurrent[kST]*dST + vyCurrent[kSB]*dSB)*invWeightSum;
-        vzNextInterpd = (vzCurrent[kNT]*dNT + vzCurrent[kNB]*dNB + vzCurrent[kST]*dST + vzCurrent[kSB]*dSB)*invWeightSum;
+        vxNextInterpd = (vxCurrent[kNeighbor0PP]*d0PP + vxCurrent[kNeighbor0PM]*d0PM + vxCurrent[kNeighbor0MP]*d0MP + vxCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
+        vyNextInterpd = (vyCurrent[kNeighbor0PP]*d0PP + vyCurrent[kNeighbor0PM]*d0PM + vyCurrent[kNeighbor0MP]*d0MP + vyCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
+        vzNextInterpd = (vzCurrent[kNeighbor0PP]*d0PP + vzCurrent[kNeighbor0PM]*d0PM + vzCurrent[kNeighbor0MP]*d0MP + vzCurrent[kNeighbor0MM]*d0MM)*invWeightSum;
     }
     else
     {
-        vxLastInterpd = vxLast[kNT];
-        vyLastInterpd = vyLast[kNT];
-        vzLastInterpd = vzLast[kNT];
+        vxLastInterpd = vxLast[kNeighbor0PP];
+        vyLastInterpd = vyLast[kNeighbor0PP];
+        vzLastInterpd = vzLast[kNeighbor0PP];
 
-        vxNextInterpd = vxCurrent[kNT];
-        vyNextInterpd = vyCurrent[kNT];
-        vzNextInterpd = vzCurrent[kNT];
+        vxNextInterpd = vxCurrent[kNeighbor0PP];
+        vyNextInterpd = vyCurrent[kNeighbor0PP];
+        vzNextInterpd = vzCurrent[kNeighbor0PP];
     }
 
     // if(k==16300) printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
@@ -511,65 +511,65 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     Distributions27 dist;
     getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep);
 
-    unsigned int KQK  = subgridDistanceIndices[k];
-    unsigned int kzero= KQK;
-    unsigned int ke   = KQK;
-    unsigned int kw   = neighborX[KQK];
-    unsigned int kn   = KQK;
-    unsigned int ks   = neighborY[KQK];
-    unsigned int kt   = KQK;
-    unsigned int kb   = neighborZ[KQK];
-    unsigned int ksw  = neighborY[kw];
-    unsigned int kne  = KQK;
-    unsigned int kse  = ks;
-    unsigned int knw  = kw;
-    unsigned int kbw  = neighborZ[kw];
-    unsigned int kte  = KQK;
-    unsigned int kbe  = kb;
-    unsigned int ktw  = kw;
-    unsigned int kbs  = neighborZ[ks];
-    unsigned int ktn  = KQK;
-    unsigned int kbn  = kb;
-    unsigned int kts  = ks;
-    unsigned int ktse = ks;
-    unsigned int kbnw = kbw;
-    unsigned int ktnw = kw;
-    unsigned int kbse = kbs;
-    unsigned int ktsw = ksw;
-    unsigned int kbne = kb;
-    unsigned int ktne = KQK;
-    unsigned int kbsw = neighborZ[ksw];
+    unsigned int KQK  = subgridDistanceIndices[k]; //QK 
+    unsigned int k000 = KQK; //000
+    unsigned int kP00 = KQK; //P00
+    unsigned int kM00 = neighborX[KQK]; //M00
+    unsigned int k0P0   = KQK; //n  
+    unsigned int k0M0   = neighborY[KQK]; //s  
+    unsigned int k00P   = KQK; //t  
+    unsigned int k00M   = neighborZ[KQK]; //b  
+    unsigned int kMM0  = neighborY[kM00]; //sw 
+    unsigned int kPP0  = KQK; //ne 
+    unsigned int kPM0  = k0M0; //se 
+    unsigned int kMP0  = kM00; //nw 
+    unsigned int kM0M  = neighborZ[kM00]; //bw 
+    unsigned int kP0P  = KQK; //te 
+    unsigned int kP0M  = k00M; //be 
+    unsigned int k0PP  = KQK; //tn 
+    unsigned int k0MM  = neighborZ[k0M0]; //bs 
+    unsigned int kM0P  = kM00; //tw 
+    unsigned int k0PM  = k00M; //bn 
+    unsigned int k0MP  = k0M0; //ts 
+    unsigned int kPMP = k0M0; //tse
+    unsigned int kMPM = kM0M; //bnw
+    unsigned int kMPP = kM00; //tnw
+    unsigned int kPMM = k0MM; //bse
+    unsigned int kMMP = kMM0; //tsw
+    unsigned int kPPM = k00M; //bne
+    unsigned int kPPP = KQK; //tne
+    unsigned int kMMM = neighborZ[kMM0]; //bsw
 
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // based on BGK Plus Comp
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    real f_W    = (dist.f[DIR_P00])[ke   ];
-    real f_E    = (dist.f[DIR_M00])[kw   ];
-    real f_S    = (dist.f[DIR_0P0])[kn   ];
-    real f_N    = (dist.f[DIR_0M0])[ks   ];
-    real f_B    = (dist.f[DIR_00P])[kt   ];
-    real f_T    = (dist.f[DIR_00M])[kb   ];
-    real f_SW   = (dist.f[DIR_PP0])[kne  ];
-    real f_NE   = (dist.f[DIR_MM0])[ksw  ];
-    real f_NW   = (dist.f[DIR_PM0])[kse  ];
-    real f_SE   = (dist.f[DIR_MP0])[knw  ];
-    real f_BW   = (dist.f[DIR_P0P])[kte  ];
-    real f_TE   = (dist.f[DIR_M0M])[kbw  ];
-    real f_TW   = (dist.f[DIR_P0M])[kbe  ];
-    real f_BE   = (dist.f[DIR_M0P])[ktw  ];
-    real f_BS   = (dist.f[DIR_0PP])[ktn  ];
-    real f_TN   = (dist.f[DIR_0MM])[kbs  ];
-    real f_TS   = (dist.f[DIR_0PM])[kbn  ];
-    real f_BN   = (dist.f[DIR_0MP])[kts  ];
-    real f_ZERO = (dist.f[DIR_000])[kzero];
-    real f_BSW  = (dist.f[DIR_PPP])[ktne ];
-    real f_BNE  = (dist.f[DIR_MMP])[ktsw ];
-    real f_BNW  = (dist.f[DIR_PMP])[ktse ];
-    real f_BSE  = (dist.f[DIR_MPP])[ktnw ];
-    real f_TSW  = (dist.f[DIR_PPM])[kbne ];
-    real f_TNE  = (dist.f[DIR_MMM])[kbsw ];
-    real f_TNW  = (dist.f[DIR_PMM])[kbse ];
-    real f_TSE  = (dist.f[DIR_MPM])[kbnw ];
+    real f_M00 = (dist.f[DIR_P00])[kP00];
+    real f_P00 = (dist.f[DIR_M00])[kM00];
+    real f_0M0 = (dist.f[DIR_0P0])[k0P0];
+    real f_0P0 = (dist.f[DIR_0M0])[k0M0];
+    real f_00M = (dist.f[DIR_00P])[k00P];
+    real f_00P = (dist.f[DIR_00M])[k00M];
+    real f_MM0 = (dist.f[DIR_PP0])[kPP0];
+    real f_PP0 = (dist.f[DIR_MM0])[kMM0];
+    real f_MP0 = (dist.f[DIR_PM0])[kPM0];
+    real f_PM0 = (dist.f[DIR_MP0])[kMP0];
+    real f_M0M = (dist.f[DIR_P0P])[kP0P];
+    real f_P0P = (dist.f[DIR_M0M])[kM0M];
+    real f_M0P = (dist.f[DIR_P0M])[kP0M];
+    real f_P0M = (dist.f[DIR_M0P])[kM0P];
+    real f_0MM = (dist.f[DIR_0PP])[k0PP];
+    real f_0PP = (dist.f[DIR_0MM])[k0MM];
+    real f_0PM = (dist.f[DIR_0MP])[k0MP];
+    real f_0MP = (dist.f[DIR_0PM])[k0PM];
+    real f_000 = (dist.f[DIR_000])[k000];
+    real f_MMM = (dist.f[DIR_PPP])[kPPP];
+    real f_PPM = (dist.f[DIR_MMP])[kMMP];
+    real f_MPM = (dist.f[DIR_PMP])[kPMP];
+    real f_PMM = (dist.f[DIR_MPP])[kMPP];
+    real f_MMP = (dist.f[DIR_PPM])[kPPM];
+    real f_PPP = (dist.f[DIR_MMM])[kMMM];
+    real f_MPP = (dist.f[DIR_PMM])[kPMM];
+    real f_PMP = (dist.f[DIR_MPM])[kMPM];
 
       ////////////////////////////////////////////////////////////////////////////////
       //! - Set macroscopic quantities
@@ -585,66 +585,66 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
       real cusq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
       ////////////////////////////////////////////////////////////////////////////////
-      f_ZERO  = c8o27*  (drho-(drho+c1o1)*cusq);
-      f_E     = c2o27*  (drho+(drho+c1o1)*(c3o1*( vx1        )+c9o2*( vx1        )*( vx1        )-cusq));
-      f_W     = c2o27*  (drho+(drho+c1o1)*(c3o1*(-vx1        )+c9o2*(-vx1        )*(-vx1        )-cusq));
-      f_N     = c2o27*  (drho+(drho+c1o1)*(c3o1*(    vx2     )+c9o2*(     vx2    )*(     vx2    )-cusq));
-      f_S     = c2o27*  (drho+(drho+c1o1)*(c3o1*(   -vx2     )+c9o2*(    -vx2    )*(    -vx2    )-cusq));
-      f_T     = c2o27*  (drho+(drho+c1o1)*(c3o1*(         vx3)+c9o2*(         vx3)*(         vx3)-cusq));
-      f_B     = c2o27*  (drho+(drho+c1o1)*(c3o1*(        -vx3)+c9o2*(        -vx3)*(        -vx3)-cusq));
-      f_NE    = c1o54*  (drho+(drho+c1o1)*(c3o1*( vx1+vx2    )+c9o2*( vx1+vx2    )*( vx1+vx2    )-cusq));
-      f_SW    = c1o54*  (drho+(drho+c1o1)*(c3o1*(-vx1-vx2    )+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cusq));
-      f_SE    =  c1o54* (drho+(drho+c1o1)*(c3o1*( vx1-vx2    )+c9o2*( vx1-vx2    )*( vx1-vx2    )-cusq));
-      f_NW    =  c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1+vx2    )+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cusq));
-      f_TE    =  c1o54* (drho+(drho+c1o1)*(c3o1*( vx1    +vx3)+c9o2*( vx1    +vx3)*( vx1    +vx3)-cusq));
-      f_BW    =  c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1    -vx3)+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cusq));
-      f_BE    =  c1o54* (drho+(drho+c1o1)*(c3o1*( vx1    -vx3)+c9o2*( vx1    -vx3)*( vx1    -vx3)-cusq));
-      f_TW    =  c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1    +vx3)+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cusq));
-      f_TN    =  c1o54* (drho+(drho+c1o1)*(c3o1*(     vx2+vx3)+c9o2*(     vx2+vx3)*(     vx2+vx3)-cusq));
-      f_BS    =  c1o54* (drho+(drho+c1o1)*(c3o1*(    -vx2-vx3)+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cusq));
-      f_BN    =  c1o54* (drho+(drho+c1o1)*(c3o1*(     vx2-vx3)+c9o2*(     vx2-vx3)*(     vx2-vx3)-cusq));
-      f_TS    =  c1o54* (drho+(drho+c1o1)*(c3o1*(    -vx2+vx3)+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cusq));
-      f_TNE   =  c1o216*(drho+(drho+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq));
-      f_BSW   =  c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq));
-      f_BNE   =  c1o216*(drho+(drho+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq));
-      f_TSW   =  c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq));
-      f_TSE   =  c1o216*(drho+(drho+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq));
-      f_BNW   =  c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq));
-      f_BSE   =  c1o216*(drho+(drho+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
-      f_TNW   =  c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
+      f_000 = c8o27* (drho-(drho+c1o1)*cusq);
+      f_P00 = c2o27* (drho+(drho+c1o1)*(c3o1*( vx1        )+c9o2*( vx1        )*( vx1        )-cusq));
+      f_M00 = c2o27* (drho+(drho+c1o1)*(c3o1*(-vx1        )+c9o2*(-vx1        )*(-vx1        )-cusq));
+      f_0P0 = c2o27* (drho+(drho+c1o1)*(c3o1*(    vx2     )+c9o2*(     vx2    )*(     vx2    )-cusq));
+      f_0M0 = c2o27* (drho+(drho+c1o1)*(c3o1*(   -vx2     )+c9o2*(    -vx2    )*(    -vx2    )-cusq));
+      f_00P = c2o27* (drho+(drho+c1o1)*(c3o1*(         vx3)+c9o2*(         vx3)*(         vx3)-cusq));
+      f_00M = c2o27* (drho+(drho+c1o1)*(c3o1*(        -vx3)+c9o2*(        -vx3)*(        -vx3)-cusq));
+      f_PP0 = c1o54* (drho+(drho+c1o1)*(c3o1*( vx1+vx2    )+c9o2*( vx1+vx2    )*( vx1+vx2    )-cusq));
+      f_MM0 = c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1-vx2    )+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cusq));
+      f_PM0 = c1o54* (drho+(drho+c1o1)*(c3o1*( vx1-vx2    )+c9o2*( vx1-vx2    )*( vx1-vx2    )-cusq));
+      f_MP0 = c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1+vx2    )+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cusq));
+      f_P0P = c1o54* (drho+(drho+c1o1)*(c3o1*( vx1    +vx3)+c9o2*( vx1    +vx3)*( vx1    +vx3)-cusq));
+      f_M0M = c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1    -vx3)+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cusq));
+      f_P0M = c1o54* (drho+(drho+c1o1)*(c3o1*( vx1    -vx3)+c9o2*( vx1    -vx3)*( vx1    -vx3)-cusq));
+      f_M0P = c1o54* (drho+(drho+c1o1)*(c3o1*(-vx1    +vx3)+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cusq));
+      f_0PP = c1o54* (drho+(drho+c1o1)*(c3o1*(     vx2+vx3)+c9o2*(     vx2+vx3)*(     vx2+vx3)-cusq));
+      f_0MM = c1o54* (drho+(drho+c1o1)*(c3o1*(    -vx2-vx3)+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cusq));
+      f_0PM = c1o54* (drho+(drho+c1o1)*(c3o1*(     vx2-vx3)+c9o2*(     vx2-vx3)*(     vx2-vx3)-cusq));
+      f_0MP = c1o54* (drho+(drho+c1o1)*(c3o1*(    -vx2+vx3)+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cusq));
+      f_PPP = c1o216*(drho+(drho+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq));
+      f_MMM = c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq));
+      f_PPM = c1o216*(drho+(drho+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq));
+      f_MMP = c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq));
+      f_PMP = c1o216*(drho+(drho+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq));
+      f_MPM = c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq));
+      f_PMM = c1o216*(drho+(drho+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
+      f_MPP = c1o216*(drho+(drho+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
 
       ////////////////////////////////////////////////////////////////////////////////
       //! write the new distributions to the bc nodes
       //!
-      (dist.f[DIR_P00   ])[ke  ] = f_W   ;
-      (dist.f[DIR_PP0  ])[kne  ] = f_SW  ;
-      (dist.f[DIR_P0M  ])[kbe  ] = f_TW  ;
-      (dist.f[DIR_PM0  ])[kse  ] = f_NW  ;
-      (dist.f[DIR_PMP ])[ktse ] = f_BNW ;
-      (dist.f[DIR_P0P  ])[kte  ] = f_BW  ;
-      (dist.f[DIR_PPM ])[kbne ] = f_TSW ;
-      (dist.f[DIR_PPP ])[ktne ] = f_BSW ;
-      (dist.f[DIR_PMM ])[kbse ] = f_TNW ;
+      (dist.f[DIR_P00])[kP00] = f_M00;
+      (dist.f[DIR_PP0])[kPP0] = f_MM0;
+      (dist.f[DIR_P0M])[kP0M] = f_M0P;
+      (dist.f[DIR_PM0])[kPM0] = f_MP0;
+      (dist.f[DIR_PMP])[kPMP] = f_MPM;
+      (dist.f[DIR_P0P])[kP0P] = f_M0M;
+      (dist.f[DIR_PPM])[kPPM] = f_MMP;
+      (dist.f[DIR_PPP])[kPPP] = f_MMM;
+      (dist.f[DIR_PMM])[kPMM] = f_MPP;
       
-      (dist.f[DIR_M00   ])[kw  ] = f_E   ;
-      (dist.f[DIR_MM0  ])[ksw  ] = f_NE  ;
-      (dist.f[DIR_M0M  ])[kbw  ] = f_TE  ;
-      (dist.f[DIR_MP0  ])[knw  ] = f_SE  ;
-      (dist.f[DIR_M0P  ])[ktw  ] = f_BE  ;
-      (dist.f[DIR_MMM ])[kbsw ] = f_TNE ;
-      (dist.f[DIR_MMP ])[ktsw ] = f_BNE ;
-      (dist.f[DIR_MPP ])[ktnw ] = f_BSE ;
-      (dist.f[DIR_MPM ])[kbnw ] = f_TSE ;
-
-      (dist.f[DIR_0P0   ])[kn  ] = f_S   ;
-      (dist.f[DIR_0M0   ])[ks  ] = f_N   ;
-      (dist.f[DIR_00P   ])[kt  ] = f_B   ;
-      (dist.f[DIR_00M   ])[kb  ] = f_T   ;
-      (dist.f[DIR_0PP  ])[ktn  ] = f_BS  ;
-      (dist.f[DIR_0MM  ])[kbs  ] = f_TN  ;
-      (dist.f[DIR_0PM  ])[kbn  ] = f_TS  ;
-      (dist.f[DIR_0MP  ])[kts  ] = f_BN  ;
-      (dist.f[DIR_000])[kzero] = f_ZERO;
+      (dist.f[DIR_M00])[kM00] = f_P00;
+      (dist.f[DIR_MM0])[kMM0] = f_PP0;
+      (dist.f[DIR_M0M])[kM0M] = f_P0P;
+      (dist.f[DIR_MP0])[kMP0] = f_PM0;
+      (dist.f[DIR_M0P])[kM0P] = f_P0M;
+      (dist.f[DIR_MMM])[kMMM] = f_PPP;
+      (dist.f[DIR_MMP])[kMMP] = f_PPM;
+      (dist.f[DIR_MPP])[kMPP] = f_PMM;
+      (dist.f[DIR_MPM])[kMPM] = f_PMP;
+
+      (dist.f[DIR_0P0])[k0P0] = f_0M0;
+      (dist.f[DIR_0M0])[k0M0] = f_0P0;
+      (dist.f[DIR_00P])[k00P] = f_00M;
+      (dist.f[DIR_00M])[k00M] = f_00P;
+      (dist.f[DIR_0PP])[k0PP] = f_0MM;
+      (dist.f[DIR_0MM])[k0MM] = f_0PP;
+      (dist.f[DIR_0PM])[k0PM] = f_0MP;
+      (dist.f[DIR_0MP])[k0MP] = f_0PM;
+      (dist.f[DIR_000])[k000] = f_000;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -656,10 +656,10 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborX, 
 												uint* neighborY, 
 												uint* neighborZ,
-												uint* neighborsNT, 
-												uint* neighborsNB,
-												uint* neighborsST,
-												uint* neighborsSB,
+												uint* neighbors0PP, 
+												uint* neighbors0PM,
+												uint* neighbors0MP,
+												uint* neighbors0MM,
 												real* weights0PP, 
 												real* weights0PM,
 												real* weights0MP,
@@ -674,8 +674,8 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 
     if(k>=numberOfBCnodes) return;
 
-    uint kNT = neighborsNT[k];
-    real dNT = weights0PP[k];
+    uint kNeighbor0PP = neighbors0PP[k];
+    real d0PP = weights0PP[k];
 
     real f0LastInterp, f1LastInterp, f2LastInterp, f3LastInterp, f4LastInterp, f5LastInterp, f6LastInterp, f7LastInterp, f8LastInterp;
     real f0NextInterp, f1NextInterp, f2NextInterp, f3NextInterp, f4NextInterp, f5NextInterp, f6NextInterp, f7NextInterp, f8NextInterp;
@@ -701,107 +701,106 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     real* f8Next = &fsNext[8*numberOfPrecursorNodes];
 
 
-    if(dNT<1e6)
+    if(d0PP<1e6)
     {
-        uint kNB = neighborsNB[k];
-        uint kST = neighborsST[k];
-        uint kSB = neighborsSB[k];
+        uint kNeighbor0PM = neighbors0PM[k];
+        uint kNeighbor0MP = neighbors0MP[k];
+        uint kNeighbor0MM = neighbors0MM[k];
 
-        real dNB = weights0PM[k];
-        real dST = weights0MP[k];
-        real dSB = weights0MM[k];
+        real d0PM = weights0PM[k];
+        real d0MP = weights0MP[k];
+        real d0MM = weights0MM[k];
 
-        real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
+        real invWeightSum = 1.f/(d0PP+d0PM+d0MP+d0MM);
 
-        f0LastInterp = (f0Last[kNT]*dNT + f0Last[kNB]*dNB + f0Last[kST]*dST + f0Last[kSB]*dSB)*invWeightSum;
-        f0NextInterp = (f0Next[kNT]*dNT + f0Next[kNB]*dNB + f0Next[kST]*dST + f0Next[kSB]*dSB)*invWeightSum;
+        f0LastInterp = (f0Last[kNeighbor0PP]*d0PP + f0Last[kNeighbor0PM]*d0PM + f0Last[kNeighbor0MP]*d0MP + f0Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f0NextInterp = (f0Next[kNeighbor0PP]*d0PP + f0Next[kNeighbor0PM]*d0PM + f0Next[kNeighbor0MP]*d0MP + f0Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f1LastInterp = (f1Last[kNT]*dNT + f1Last[kNB]*dNB + f1Last[kST]*dST + f1Last[kSB]*dSB)*invWeightSum;
-        f1NextInterp = (f1Next[kNT]*dNT + f1Next[kNB]*dNB + f1Next[kST]*dST + f1Next[kSB]*dSB)*invWeightSum;
+        f1LastInterp = (f1Last[kNeighbor0PP]*d0PP + f1Last[kNeighbor0PM]*d0PM + f1Last[kNeighbor0MP]*d0MP + f1Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f1NextInterp = (f1Next[kNeighbor0PP]*d0PP + f1Next[kNeighbor0PM]*d0PM + f1Next[kNeighbor0MP]*d0MP + f1Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f2LastInterp = (f2Last[kNT]*dNT + f2Last[kNB]*dNB + f2Last[kST]*dST + f2Last[kSB]*dSB)*invWeightSum;
-        f2NextInterp = (f2Next[kNT]*dNT + f2Next[kNB]*dNB + f2Next[kST]*dST + f2Next[kSB]*dSB)*invWeightSum;
+        f2LastInterp = (f2Last[kNeighbor0PP]*d0PP + f2Last[kNeighbor0PM]*d0PM + f2Last[kNeighbor0MP]*d0MP + f2Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f2NextInterp = (f2Next[kNeighbor0PP]*d0PP + f2Next[kNeighbor0PM]*d0PM + f2Next[kNeighbor0MP]*d0MP + f2Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f3LastInterp = (f3Last[kNT]*dNT + f3Last[kNB]*dNB + f3Last[kST]*dST + f3Last[kSB]*dSB)*invWeightSum;
-        f3NextInterp = (f3Next[kNT]*dNT + f3Next[kNB]*dNB + f3Next[kST]*dST + f3Next[kSB]*dSB)*invWeightSum;
+        f3LastInterp = (f3Last[kNeighbor0PP]*d0PP + f3Last[kNeighbor0PM]*d0PM + f3Last[kNeighbor0MP]*d0MP + f3Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f3NextInterp = (f3Next[kNeighbor0PP]*d0PP + f3Next[kNeighbor0PM]*d0PM + f3Next[kNeighbor0MP]*d0MP + f3Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f4LastInterp = (f4Last[kNT]*dNT + f4Last[kNB]*dNB + f4Last[kST]*dST + f4Last[kSB]*dSB)*invWeightSum;
-        f4NextInterp = (f4Next[kNT]*dNT + f4Next[kNB]*dNB + f4Next[kST]*dST + f4Next[kSB]*dSB)*invWeightSum;
+        f4LastInterp = (f4Last[kNeighbor0PP]*d0PP + f4Last[kNeighbor0PM]*d0PM + f4Last[kNeighbor0MP]*d0MP + f4Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f4NextInterp = (f4Next[kNeighbor0PP]*d0PP + f4Next[kNeighbor0PM]*d0PM + f4Next[kNeighbor0MP]*d0MP + f4Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f5LastInterp = (f5Last[kNT]*dNT + f5Last[kNB]*dNB + f5Last[kST]*dST + f5Last[kSB]*dSB)*invWeightSum;
-        f5NextInterp = (f5Next[kNT]*dNT + f5Next[kNB]*dNB + f5Next[kST]*dST + f5Next[kSB]*dSB)*invWeightSum;
+        f5LastInterp = (f5Last[kNeighbor0PP]*d0PP + f5Last[kNeighbor0PM]*d0PM + f5Last[kNeighbor0MP]*d0MP + f5Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f5NextInterp = (f5Next[kNeighbor0PP]*d0PP + f5Next[kNeighbor0PM]*d0PM + f5Next[kNeighbor0MP]*d0MP + f5Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f6LastInterp = (f6Last[kNT]*dNT + f6Last[kNB]*dNB + f6Last[kST]*dST + f6Last[kSB]*dSB)*invWeightSum;
-        f6NextInterp = (f6Next[kNT]*dNT + f6Next[kNB]*dNB + f6Next[kST]*dST + f6Next[kSB]*dSB)*invWeightSum;
+        f6LastInterp = (f6Last[kNeighbor0PP]*d0PP + f6Last[kNeighbor0PM]*d0PM + f6Last[kNeighbor0MP]*d0MP + f6Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f6NextInterp = (f6Next[kNeighbor0PP]*d0PP + f6Next[kNeighbor0PM]*d0PM + f6Next[kNeighbor0MP]*d0MP + f6Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f7LastInterp = (f7Last[kNT]*dNT + f7Last[kNB]*dNB + f7Last[kST]*dST + f7Last[kSB]*dSB)*invWeightSum;
-        f7NextInterp = (f7Next[kNT]*dNT + f7Next[kNB]*dNB + f7Next[kST]*dST + f7Next[kSB]*dSB)*invWeightSum;
+        f7LastInterp = (f7Last[kNeighbor0PP]*d0PP + f7Last[kNeighbor0PM]*d0PM + f7Last[kNeighbor0MP]*d0MP + f7Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f7NextInterp = (f7Next[kNeighbor0PP]*d0PP + f7Next[kNeighbor0PM]*d0PM + f7Next[kNeighbor0MP]*d0MP + f7Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f8LastInterp = (f8Last[kNT]*dNT + f8Last[kNB]*dNB + f8Last[kST]*dST + f8Last[kSB]*dSB)*invWeightSum;
-        f8NextInterp = (f8Next[kNT]*dNT + f8Next[kNB]*dNB + f8Next[kST]*dST + f8Next[kSB]*dSB)*invWeightSum;
+        f8LastInterp = (f8Last[kNeighbor0PP]*d0PP + f8Last[kNeighbor0PM]*d0PM + f8Last[kNeighbor0MP]*d0MP + f8Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f8NextInterp = (f8Next[kNeighbor0PP]*d0PP + f8Next[kNeighbor0PM]*d0PM + f8Next[kNeighbor0MP]*d0MP + f8Next[kNeighbor0MM]*d0MM)*invWeightSum;
     
     } else {
-        f0LastInterp = f0Last[kNT];
-        f1LastInterp = f1Last[kNT];
-        f2LastInterp = f2Last[kNT];
-        f3LastInterp = f3Last[kNT];
-        f4LastInterp = f4Last[kNT];
-        f5LastInterp = f5Last[kNT];
-        f6LastInterp = f6Last[kNT];
-        f7LastInterp = f7Last[kNT];
-        f8LastInterp = f8Last[kNT];
-
-        f0NextInterp = f0Next[kNT];
-        f1NextInterp = f1Next[kNT];
-        f2NextInterp = f2Next[kNT];
-        f3NextInterp = f3Next[kNT];
-        f4NextInterp = f4Next[kNT];
-        f5NextInterp = f5Next[kNT];
-        f6NextInterp = f6Next[kNT];
-        f7NextInterp = f7Next[kNT];
-        f8NextInterp = f8Next[kNT];
+        f0LastInterp = f0Last[kNeighbor0PP];
+        f1LastInterp = f1Last[kNeighbor0PP];
+        f2LastInterp = f2Last[kNeighbor0PP];
+        f3LastInterp = f3Last[kNeighbor0PP];
+        f4LastInterp = f4Last[kNeighbor0PP];
+        f5LastInterp = f5Last[kNeighbor0PP];
+        f6LastInterp = f6Last[kNeighbor0PP];
+        f7LastInterp = f7Last[kNeighbor0PP];
+        f8LastInterp = f8Last[kNeighbor0PP];
+
+        f0NextInterp = f0Next[kNeighbor0PP];
+        f1NextInterp = f1Next[kNeighbor0PP];
+        f2NextInterp = f2Next[kNeighbor0PP];
+        f3NextInterp = f3Next[kNeighbor0PP];
+        f4NextInterp = f4Next[kNeighbor0PP];
+        f5NextInterp = f5Next[kNeighbor0PP];
+        f6NextInterp = f6Next[kNeighbor0PP];
+        f7NextInterp = f7Next[kNeighbor0PP];
+        f8NextInterp = f8Next[kNeighbor0PP];
     }
     Distributions27 dist;
     getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep);
 
     unsigned int KQK  = subgridDistanceIndices[k];
-    // unsigned int kzero= KQK;
-    unsigned int ke   = KQK;
-    // unsigned int kw   = neighborX[KQK];
-    // unsigned int kn   = KQK;
-    unsigned int ks   = neighborY[KQK];
-    // unsigned int kt   = KQK;
-    unsigned int kb   = neighborZ[KQK];
-    // unsigned int ksw  = neighborY[kw];
-    unsigned int kne  = KQK;
-    unsigned int kse  = ks;
-    // unsigned int knw  = kw;
-    // unsigned int kbw  = neighborZ[kw];
-    unsigned int kte  = KQK;
-    unsigned int kbe  = kb;
-    // unsigned int ktw  = kw;
-    unsigned int kbs  = neighborZ[ks];
-    // unsigned int ktn  = KQK;
-    // unsigned int kbn  = kb;
-    // unsigned int kts  = ks;
-    unsigned int ktse = ks;
-    // unsigned int kbnw = kbw;
-    // unsigned int ktnw = kw;
-    unsigned int kbse = kbs;
-    // unsigned int ktsw = ksw;
-    unsigned int kbne = kb;
-    unsigned int ktne = KQK;
-    // unsigned int kbsw = neighborZ[ksw];
-
-    dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
-    dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
-    dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
-    dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
-    dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
-    dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
-    dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
-    dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
-    dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
+    // unsigned int k000= KQK;
+    unsigned int kP00   = KQK;
+    // unsigned int kM00   = neighborX[KQK];
+    // unsigned int k0P0   = KQK;
+    unsigned int k0M0   = neighborY[KQK];
+    // unsigned int k00P   = KQK;
+    unsigned int k00M   = neighborZ[KQK];
+    // unsigned int kMM0  = neighborY[kM00];
+    unsigned int kPP0  = KQK;
+    unsigned int kPM0  = k0M0;
+    // unsigned int kMP0  = kM00;
+    // unsigned int kM0M  = neighborZ[kM00];
+    unsigned int kP0P  = KQK;
+    unsigned int kP0M  = k00M;
+    // unsigned int kM0P  = kM00;
+    unsigned int k0MM  = neighborZ[k0M0];
+    // unsigned int k0PM  = k00M;
+    // unsigned int k0MP  = k0M0;
+    unsigned int kPMP = k0M0;
+    // unsigned int kMPM = kM0M;
+    // unsigned int kMPP = kM00;
+    unsigned int kPMM = k0MM;
+    // unsigned int kMMP = kMM0;
+    unsigned int kPPM = k00M;
+    unsigned int kPPP = KQK;
+    // unsigned int kMMM = neighborZ[kMM0];
+
+    dist.f[DIR_P00][kP00] = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
+    dist.f[DIR_PP0][kPP0] = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
+    dist.f[DIR_PM0][kPM0] = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
+    dist.f[DIR_P0P][kP0P] = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
+    dist.f[DIR_P0M][kP0M] = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
+    dist.f[DIR_PPP][kPPP] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
+    dist.f[DIR_PMP][kPMP] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
+    dist.f[DIR_PPM][kPPM] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
+    dist.f[DIR_PMM][kPMM] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -815,10 +814,10 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 												uint* neighborX, 
 												uint* neighborY, 
 												uint* neighborZ,
-												uint* neighborsNT, 
-												uint* neighborsNB,
-												uint* neighborsST,
-												uint* neighborsSB,
+												uint* neighbors0PP, 
+												uint* neighbors0PM,
+												uint* neighbors0MP,
+												uint* neighbors0MM,
 												real* weights0PP, 
 												real* weights0PM,
 												real* weights0MP,
@@ -833,8 +832,8 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 
     if(k>=numberOfBCnodes) return;
 
-    uint kNT = neighborsNT[k];
-    real dNT = weights0PP[k];
+    uint kNeighbor0PP = neighbors0PP[k];
+    real d0PP = weights0PP[k];
 
     real f0LastInterp, f1LastInterp, f2LastInterp, f3LastInterp, f4LastInterp, f5LastInterp, f6LastInterp, f7LastInterp, f8LastInterp;
     real f0NextInterp, f1NextInterp, f2NextInterp, f3NextInterp, f4NextInterp, f5NextInterp, f6NextInterp, f7NextInterp, f8NextInterp;
@@ -860,110 +859,109 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
     real* f8Next = &fsNext[8*numberOfPrecursorNodes];
 
 
-    if(dNT<1e6)
+    if(d0PP<1e6)
     {
-        uint kNB = neighborsNB[k];
-        uint kST = neighborsST[k];
-        uint kSB = neighborsSB[k];
+        uint kNeighbor0PM = neighbors0PM[k];
+        uint kNeighbor0MP = neighbors0MP[k];
+        uint kNeighbor0MM = neighbors0MM[k];
 
-        real dNB = weights0PM[k];
-        real dST = weights0MP[k];
-        real dSB = weights0MM[k];
+        real d0PM = weights0PM[k];
+        real d0MP = weights0MP[k];
+        real d0MM = weights0MM[k];
 
-        real invWeightSum = 1.f/(dNT+dNB+dST+dSB);
+        real invWeightSum = 1.f/(d0PP+d0PM+d0MP+d0MM);
 
-        f0LastInterp = (f0Last[kNT]*dNT + f0Last[kNB]*dNB + f0Last[kST]*dST + f0Last[kSB]*dSB)*invWeightSum;
-        f0NextInterp = (f0Next[kNT]*dNT + f0Next[kNB]*dNB + f0Next[kST]*dST + f0Next[kSB]*dSB)*invWeightSum;
+        f0LastInterp = (f0Last[kNeighbor0PP]*d0PP + f0Last[kNeighbor0PM]*d0PM + f0Last[kNeighbor0MP]*d0MP + f0Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f0NextInterp = (f0Next[kNeighbor0PP]*d0PP + f0Next[kNeighbor0PM]*d0PM + f0Next[kNeighbor0MP]*d0MP + f0Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f1LastInterp = (f1Last[kNT]*dNT + f1Last[kNB]*dNB + f1Last[kST]*dST + f1Last[kSB]*dSB)*invWeightSum;
-        f1NextInterp = (f1Next[kNT]*dNT + f1Next[kNB]*dNB + f1Next[kST]*dST + f1Next[kSB]*dSB)*invWeightSum;
+        f1LastInterp = (f1Last[kNeighbor0PP]*d0PP + f1Last[kNeighbor0PM]*d0PM + f1Last[kNeighbor0MP]*d0MP + f1Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f1NextInterp = (f1Next[kNeighbor0PP]*d0PP + f1Next[kNeighbor0PM]*d0PM + f1Next[kNeighbor0MP]*d0MP + f1Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f2LastInterp = (f2Last[kNT]*dNT + f2Last[kNB]*dNB + f2Last[kST]*dST + f2Last[kSB]*dSB)*invWeightSum;
-        f2NextInterp = (f2Next[kNT]*dNT + f2Next[kNB]*dNB + f2Next[kST]*dST + f2Next[kSB]*dSB)*invWeightSum;
+        f2LastInterp = (f2Last[kNeighbor0PP]*d0PP + f2Last[kNeighbor0PM]*d0PM + f2Last[kNeighbor0MP]*d0MP + f2Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f2NextInterp = (f2Next[kNeighbor0PP]*d0PP + f2Next[kNeighbor0PM]*d0PM + f2Next[kNeighbor0MP]*d0MP + f2Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f3LastInterp = (f3Last[kNT]*dNT + f3Last[kNB]*dNB + f3Last[kST]*dST + f3Last[kSB]*dSB)*invWeightSum;
-        f3NextInterp = (f3Next[kNT]*dNT + f3Next[kNB]*dNB + f3Next[kST]*dST + f3Next[kSB]*dSB)*invWeightSum;
+        f3LastInterp = (f3Last[kNeighbor0PP]*d0PP + f3Last[kNeighbor0PM]*d0PM + f3Last[kNeighbor0MP]*d0MP + f3Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f3NextInterp = (f3Next[kNeighbor0PP]*d0PP + f3Next[kNeighbor0PM]*d0PM + f3Next[kNeighbor0MP]*d0MP + f3Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f4LastInterp = (f4Last[kNT]*dNT + f4Last[kNB]*dNB + f4Last[kST]*dST + f4Last[kSB]*dSB)*invWeightSum;
-        f4NextInterp = (f4Next[kNT]*dNT + f4Next[kNB]*dNB + f4Next[kST]*dST + f4Next[kSB]*dSB)*invWeightSum;
+        f4LastInterp = (f4Last[kNeighbor0PP]*d0PP + f4Last[kNeighbor0PM]*d0PM + f4Last[kNeighbor0MP]*d0MP + f4Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f4NextInterp = (f4Next[kNeighbor0PP]*d0PP + f4Next[kNeighbor0PM]*d0PM + f4Next[kNeighbor0MP]*d0MP + f4Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f5LastInterp = (f5Last[kNT]*dNT + f5Last[kNB]*dNB + f5Last[kST]*dST + f5Last[kSB]*dSB)*invWeightSum;
-        f5NextInterp = (f5Next[kNT]*dNT + f5Next[kNB]*dNB + f5Next[kST]*dST + f5Next[kSB]*dSB)*invWeightSum;
+        f5LastInterp = (f5Last[kNeighbor0PP]*d0PP + f5Last[kNeighbor0PM]*d0PM + f5Last[kNeighbor0MP]*d0MP + f5Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f5NextInterp = (f5Next[kNeighbor0PP]*d0PP + f5Next[kNeighbor0PM]*d0PM + f5Next[kNeighbor0MP]*d0MP + f5Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f6LastInterp = (f6Last[kNT]*dNT + f6Last[kNB]*dNB + f6Last[kST]*dST + f6Last[kSB]*dSB)*invWeightSum;
-        f6NextInterp = (f6Next[kNT]*dNT + f6Next[kNB]*dNB + f6Next[kST]*dST + f6Next[kSB]*dSB)*invWeightSum;
+        f6LastInterp = (f6Last[kNeighbor0PP]*d0PP + f6Last[kNeighbor0PM]*d0PM + f6Last[kNeighbor0MP]*d0MP + f6Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f6NextInterp = (f6Next[kNeighbor0PP]*d0PP + f6Next[kNeighbor0PM]*d0PM + f6Next[kNeighbor0MP]*d0MP + f6Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f7LastInterp = (f7Last[kNT]*dNT + f7Last[kNB]*dNB + f7Last[kST]*dST + f7Last[kSB]*dSB)*invWeightSum;
-        f7NextInterp = (f7Next[kNT]*dNT + f7Next[kNB]*dNB + f7Next[kST]*dST + f7Next[kSB]*dSB)*invWeightSum;
+        f7LastInterp = (f7Last[kNeighbor0PP]*d0PP + f7Last[kNeighbor0PM]*d0PM + f7Last[kNeighbor0MP]*d0MP + f7Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f7NextInterp = (f7Next[kNeighbor0PP]*d0PP + f7Next[kNeighbor0PM]*d0PM + f7Next[kNeighbor0MP]*d0MP + f7Next[kNeighbor0MM]*d0MM)*invWeightSum;
         
-        f8LastInterp = (f8Last[kNT]*dNT + f8Last[kNB]*dNB + f8Last[kST]*dST + f8Last[kSB]*dSB)*invWeightSum;
-        f8NextInterp = (f8Next[kNT]*dNT + f8Next[kNB]*dNB + f8Next[kST]*dST + f8Next[kSB]*dSB)*invWeightSum;
+        f8LastInterp = (f8Last[kNeighbor0PP]*d0PP + f8Last[kNeighbor0PM]*d0PM + f8Last[kNeighbor0MP]*d0MP + f8Last[kNeighbor0MM]*d0MM)*invWeightSum;
+        f8NextInterp = (f8Next[kNeighbor0PP]*d0PP + f8Next[kNeighbor0PM]*d0PM + f8Next[kNeighbor0MP]*d0MP + f8Next[kNeighbor0MM]*d0MM)*invWeightSum;
     
     } else {
-        f0LastInterp = f0Last[kNT];
-        f1LastInterp = f1Last[kNT];
-        f2LastInterp = f2Last[kNT];
-        f3LastInterp = f3Last[kNT];
-        f4LastInterp = f4Last[kNT];
-        f5LastInterp = f5Last[kNT];
-        f6LastInterp = f6Last[kNT];
-        f7LastInterp = f7Last[kNT];
-        f8LastInterp = f8Last[kNT];
-
-        f0NextInterp = f0Next[kNT];
-        f1NextInterp = f1Next[kNT];
-        f2NextInterp = f2Next[kNT];
-        f3NextInterp = f3Next[kNT];
-        f4NextInterp = f4Next[kNT];
-        f5NextInterp = f5Next[kNT];
-        f6NextInterp = f6Next[kNT];
-        f7NextInterp = f7Next[kNT];
-        f8NextInterp = f8Next[kNT];
+        f0LastInterp = f0Last[kNeighbor0PP];
+        f1LastInterp = f1Last[kNeighbor0PP];
+        f2LastInterp = f2Last[kNeighbor0PP];
+        f3LastInterp = f3Last[kNeighbor0PP];
+        f4LastInterp = f4Last[kNeighbor0PP];
+        f5LastInterp = f5Last[kNeighbor0PP];
+        f6LastInterp = f6Last[kNeighbor0PP];
+        f7LastInterp = f7Last[kNeighbor0PP];
+        f8LastInterp = f8Last[kNeighbor0PP];
+
+        f0NextInterp = f0Next[kNeighbor0PP];
+        f1NextInterp = f1Next[kNeighbor0PP];
+        f2NextInterp = f2Next[kNeighbor0PP];
+        f3NextInterp = f3Next[kNeighbor0PP];
+        f4NextInterp = f4Next[kNeighbor0PP];
+        f5NextInterp = f5Next[kNeighbor0PP];
+        f6NextInterp = f6Next[kNeighbor0PP];
+        f7NextInterp = f7Next[kNeighbor0PP];
+        f8NextInterp = f8Next[kNeighbor0PP];
     }
     Distributions27 dist;
     getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep);
 
     unsigned int KQK  = subgridDistanceIndices[k];
-    // unsigned int kzero= KQK;
-    unsigned int ke   = KQK;
-    // unsigned int kw   = neighborX[KQK];
-    // unsigned int kn   = KQK;
-    unsigned int ks   = neighborY[KQK];
-    // unsigned int kt   = KQK;
-    unsigned int kb   = neighborZ[KQK];
-    // unsigned int ksw  = neighborY[kw];
-    unsigned int kne  = KQK;
-    unsigned int kse  = ks;
-    // unsigned int knw  = kw;
-    // unsigned int kbw  = neighborZ[kw];
-    unsigned int kte  = KQK;
-    unsigned int kbe  = kb;
-    // unsigned int ktw  = kw;
-    unsigned int kbs  = neighborZ[ks];
-    // unsigned int ktn  = KQK;
-    // unsigned int kbn  = kb;
-    // unsigned int kts  = ks;
-    unsigned int ktse = ks;
-    // unsigned int kbnw = kbw;
-    // unsigned int ktnw = kw;
-    unsigned int kbse = kbs;
-    // unsigned int ktsw = ksw;
-    unsigned int kbne = kb;
-    unsigned int ktne = KQK;
-    // unsigned int kbsw = neighborZ[ksw];
+    // unsigned int k000= KQK;
+    unsigned int kP00   = KQK;
+    // unsigned int kM00   = neighborX[KQK];
+    // unsigned int k0P0   = KQK;
+    unsigned int k0M0   = neighborY[KQK];
+    // unsigned int k00P   = KQK;
+    unsigned int k00M   = neighborZ[KQK];
+    // unsigned int kMM0  = neighborY[kM00];
+    unsigned int kPP0  = KQK;
+    unsigned int kPM0  = k0M0;
+    // unsigned int kMP0  = kM00;
+    // unsigned int kM0M  = neighborZ[kM00];
+    unsigned int kP0P  = KQK;
+    unsigned int kP0M  = k00M;
+    // unsigned int kM0P  = kM00;
+    unsigned int k0MM  = neighborZ[k0M0];
+    // unsigned int k0PM  = k00M;
+    // unsigned int k0MP  = k0M0;
+    unsigned int kPMP = k0M0;
+    // unsigned int kMPM = kM0M;
+    // unsigned int kMPP = kM00;
+    unsigned int kPMM = k0MM;
+    // unsigned int kMMP = kMM0;
+    unsigned int kPPM = k00M;
+    unsigned int kPPP = KQK;
+    // unsigned int kMMM = neighborZ[kMM0];
     SubgridDistances27 qs;
     getPointersToSubgridDistances(qs, subgridDistances, sizeQ);
 
     real q;
-    q = qs.q[DIR_P00][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P00][ke]   = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
-    q = qs.q[DIR_PP0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PP0][kne]  = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
-    q = qs.q[DIR_PM0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PM0][kse]  = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
-    q = qs.q[DIR_P0P][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0P][kte]  = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
-    q = qs.q[DIR_P0M][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0M][kbe]  = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
-    q = qs.q[DIR_PPP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPP][ktne] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
-    q = qs.q[DIR_PMP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMP][ktse] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
-    q = qs.q[DIR_PPM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPM][kbne] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
-    q = qs.q[DIR_PMM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMM][kbse] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
+    q = qs.q[DIR_P00][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P00][kP00] = f0LastInterp*(1.f-timeRatio) + f0NextInterp*timeRatio;
+    q = qs.q[DIR_PP0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PP0][kPP0] = f1LastInterp*(1.f-timeRatio) + f1NextInterp*timeRatio;
+    q = qs.q[DIR_PM0][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PM0][kPM0] = f2LastInterp*(1.f-timeRatio) + f2NextInterp*timeRatio;
+    q = qs.q[DIR_P0P][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0P][kP0P] = f3LastInterp*(1.f-timeRatio) + f3NextInterp*timeRatio;
+    q = qs.q[DIR_P0M][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_P0M][kP0M] = f4LastInterp*(1.f-timeRatio) + f4NextInterp*timeRatio;
+    q = qs.q[DIR_PPP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPP][kPPP] = f5LastInterp*(1.f-timeRatio) + f5NextInterp*timeRatio;
+    q = qs.q[DIR_PMP][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMP][kPMP] = f6LastInterp*(1.f-timeRatio) + f6NextInterp*timeRatio;
+    q = qs.q[DIR_PPM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PPM][kPPM] = f7LastInterp*(1.f-timeRatio) + f7NextInterp*timeRatio;
+    q = qs.q[DIR_PMM][k]; if(q>= c0o1 && q <= c1o1) dist.f[DIR_PMM][kPMM] = f8LastInterp*(1.f-timeRatio) + f8NextInterp*timeRatio;
 
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-- 
GitLab


From 404197b5924041277362cd21d9e224363f2fff83 Mon Sep 17 00:00:00 2001
From: HenrikAsmuth <henrik.asmuth@geo.uu.se>
Date: Mon, 19 Dec 2022 13:00:33 +0100
Subject: [PATCH 140/179] Revert gpu.cmake

---
 CMake/cmake_config_files/MULE.config.cmake | 1 -
 gpu.cmake                                  | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/CMake/cmake_config_files/MULE.config.cmake b/CMake/cmake_config_files/MULE.config.cmake
index 91e788d2c..2afbce6cc 100644
--- a/CMake/cmake_config_files/MULE.config.cmake
+++ b/CMake/cmake_config_files/MULE.config.cmake
@@ -1,5 +1,4 @@
 SET(CMAKE_CUDA_ARCHITECTURES "75")
 
 list(APPEND USER_APPS "apps/gpu/LBM/ActuatorLine")
-list(APPEND USER_APPS "apps/gpu/LBM/BoundaryLayer")
 list(APPEND USER_APPS "apps/gpu/LBM/SphereScaling")
diff --git a/gpu.cmake b/gpu.cmake
index 4d7cc9a87..5b175ca2a 100644
--- a/gpu.cmake
+++ b/gpu.cmake
@@ -25,11 +25,9 @@ add_subdirectory(src/gpu/GridGenerator)
 IF (BUILD_VF_GPU)
     add_subdirectory(src/gpu/VirtualFluids_GPU)
 
-    # add_subdirectory(apps/gpu/LBM/DrivenCavity)
-    # add_subdirectory(apps/gpu/LBM/DrivenCavityMultiGPU)
-    # add_subdirectory(apps/gpu/LBM/SphereGPU)
-    # add_subdirectory(apps/gpu/LBM/TGV_3D_MultiGPU)
-    # add_subdirectory(apps/gpu/LBM/BoundaryLayer)
+    add_subdirectory(apps/gpu/LBM/DrivenCavity)
+    add_subdirectory(apps/gpu/LBM/SphereGPU)
+    add_subdirectory(apps/gpu/LBM/BoundaryLayer)
 ELSE()
     MESSAGE( STATUS "exclude Virtual Fluids GPU." )
 ENDIF()
-- 
GitLab


From 84fb3d1d4a8ae059ca91fa0df1fe710f0e374a69 Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Mon, 19 Dec 2022 13:22:06 +0100
Subject: [PATCH 141/179] Rename various symbols in PrecursorWriter

---
 .../GPU/CudaMemoryManager.cpp                 |  12 +-
 .../PreCollisionInteractor/PrecursorWriter.cu | 105 +++++++++---------
 .../PreCollisionInteractor/PrecursorWriter.h  |   6 +-
 3 files changed, 62 insertions(+), 61 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
index d651ac0cb..f59085174 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -3472,15 +3472,15 @@ void CudaMemoryManager::cudaFreeProbeQuantitiesAndOffsets(Probe* probe, int leve
 void CudaMemoryManager::cudaAllocPrecursorWriter(PrecursorWriter* writer, int level)
 {
     auto prec =  writer->getPrecursorStruct(level);
-    size_t indSize = prec->nPoints*sizeof(uint);
+    size_t indSize = prec->numberOfPointsInBC*sizeof(uint);
 
     checkCudaErrors( cudaStreamCreate(&prec->stream) );
 
     checkCudaErrors( cudaMallocHost((void**) &prec->indicesH, indSize));
     checkCudaErrors( cudaMalloc((void**) &prec->indicesD, indSize));
 
-    size_t dataSize  = prec->nPoints*sizeof(real)*prec->nQuantities;
-    size_t dataSizeH = dataSize * prec->timestepsPerFile;
+    size_t dataSize  = prec->numberOfPointsInBC*sizeof(real)*prec->numberOfQuantities;
+    size_t dataSizeH = dataSize * prec->numberOfTimestepsPerFile;
     
     checkCudaErrors( cudaMallocHost((void**) &prec->dataH, dataSizeH));
     checkCudaErrors( cudaMallocHost((void**) &prec->bufferH, dataSizeH));
@@ -3492,16 +3492,16 @@ void CudaMemoryManager::cudaAllocPrecursorWriter(PrecursorWriter* writer, int le
 
 void CudaMemoryManager::cudaCopyPrecursorWriterIndicesHtoD(PrecursorWriter* writer, int level)
 {
-    checkCudaErrors( cudaMemcpy(writer->getPrecursorStruct(level)->indicesD, writer->getPrecursorStruct(level)->indicesH, writer->getPrecursorStruct(level)->nPoints*sizeof(uint), cudaMemcpyHostToDevice) );
+    checkCudaErrors( cudaMemcpy(writer->getPrecursorStruct(level)->indicesD, writer->getPrecursorStruct(level)->indicesH, writer->getPrecursorStruct(level)->numberOfPointsInBC*sizeof(uint), cudaMemcpyHostToDevice) );
 }
 
 void CudaMemoryManager::cudaCopyPrecursorWriterOutputVariablesDtoH(PrecursorWriter* writer, int level)
 {
     auto prec =  writer->getPrecursorStruct(level);
-    int sizeTimestep = prec->nPoints*prec->nQuantities;
+    int sizeTimestep = prec->numberOfPointsInBC*prec->numberOfQuantities;
 
     checkCudaErrors( cudaStreamSynchronize(prec->stream) );
-    checkCudaErrors( cudaMemcpyAsync( &prec->bufferH[prec->timestepsBuffered*sizeTimestep], prec->bufferD, sizeof(real)*sizeTimestep, cudaMemcpyDeviceToHost, prec->stream));
+    checkCudaErrors( cudaMemcpyAsync( &prec->bufferH[prec->numberOfTimestepsBuffered*sizeTimestep], prec->bufferD, sizeof(real)*sizeTimestep, cudaMemcpyDeviceToHost, prec->stream));
 }
 
 void CudaMemoryManager::cudaFreePrecursorWriter(PrecursorWriter* writer, int level)
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
index 875d3f2a0..c607e67c0 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
@@ -30,19 +30,19 @@ void index2d(int idx, int& y, int& z, int ny, int nz)
     y = idx-ny*z;
 }
 
-__inline__ __host__ __device__ uint lIndex(const uint component, const uint node, const uint timestep, const uint nComponents, const uint nNodes)
+__inline__ __host__ __device__ uint linearIdx(const uint component, const uint node, const uint timestep, const uint numberOfComponents, const uint numberOfNodes)
 {
-    return node+nNodes*(component+timestep*nComponents);
+    return node+numberOfNodes*(component+numberOfComponents*timestep);
 }
 
-__inline__ __host__ __device__ uint lIndex(const uint component, const uint node, const uint nNodes)
+__inline__ __host__ __device__ uint linearIdx(const uint component, const uint node, const uint numberOfNodes)
 {
-    return node+component*nNodes;
+    return node+component*numberOfNodes;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-__global__ void fillArrayVelocities(const uint nNodes, 
+__global__ void fillArrayVelocities(const uint numberOfPrecursorNodes, 
                                     uint* indices, 
                                     real *precursorData,
                                     real *vx,
@@ -54,16 +54,17 @@ __global__ void fillArrayVelocities(const uint nNodes,
 {
     const uint node = vf::gpu::getNodeIndex();
 
-    if(node>=nNodes) return;
+    if(node>=numberOfPrecursorNodes) return;
 
-    precursorData[lIndex(0u, node, nNodes)] = vx[indices[node]]*velocityRatio;
-    precursorData[lIndex(1u, node, nNodes)] = vy[indices[node]]*velocityRatio;
-    precursorData[lIndex(2u, node, nNodes)] = vz[indices[node]]*velocityRatio;
+    precursorData[linearIdx(0u, node, numberOfPrecursorNodes)] = vx[indices[node]]*velocityRatio;
+    precursorData[linearIdx(1u, node, numberOfPrecursorNodes)] = vy[indices[node]]*velocityRatio;
+    precursorData[linearIdx(2u, node, numberOfPrecursorNodes)] = vz[indices[node]]*velocityRatio;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-__global__ void fillArrayDistributions( uint nNodes, uint* indices, 
+__global__ void fillArrayDistributions( uint numberOfPrecursorNodes, 
+                                        uint* indices, 
                                         real* precursorData,
                                         real* distributions,
                                         uint* neighborX, uint* neighborY, uint* neighborZ,
@@ -72,7 +73,7 @@ __global__ void fillArrayDistributions( uint nNodes, uint* indices,
 {
     const uint node = vf::gpu::getNodeIndex();
 
-    if(node>=nNodes) return;
+    if(node>=numberOfPrecursorNodes) return;
 
     Distributions27 dist = vf::gpu::getDistributionReferences27(distributions, numberOfLBnodes, isEvenTimestep);
     
@@ -90,15 +91,15 @@ __global__ void fillArrayDistributions( uint nNodes, uint* indices,
     ////////////////////////////////////////////////////////////////////////////////////
     //! - Get local distributions in PX directions
     //!
-    precursorData[lIndex(PrecP00, node, nNodes)] = (dist.f[DIR_P00])[k_000];
-    precursorData[lIndex(PrecPP0, node, nNodes)] = (dist.f[DIR_PP0])[k_000];
-    precursorData[lIndex(PrecPM0, node, nNodes)] = (dist.f[DIR_PM0])[k_0M0];
-    precursorData[lIndex(PrecP0P, node, nNodes)] = (dist.f[DIR_P0P])[k_000];
-    precursorData[lIndex(PrecP0M, node, nNodes)] = (dist.f[DIR_P0M])[k_00M];
-    precursorData[lIndex(PrecPPP, node, nNodes)] = (dist.f[DIR_PPP])[k_000];
-    precursorData[lIndex(PrecPMP, node, nNodes)] = (dist.f[DIR_PMP])[k_0M0];
-    precursorData[lIndex(PrecPPM, node, nNodes)] = (dist.f[DIR_PPM])[k_00M];
-    precursorData[lIndex(PrecPMM, node, nNodes)] = (dist.f[DIR_PMM])[k_0MM];
+    precursorData[linearIdx(PrecP00, node, numberOfPrecursorNodes)] = (dist.f[DIR_P00])[k_000];
+    precursorData[linearIdx(PrecPP0, node, numberOfPrecursorNodes)] = (dist.f[DIR_PP0])[k_000];
+    precursorData[linearIdx(PrecPM0, node, numberOfPrecursorNodes)] = (dist.f[DIR_PM0])[k_0M0];
+    precursorData[linearIdx(PrecP0P, node, numberOfPrecursorNodes)] = (dist.f[DIR_P0P])[k_000];
+    precursorData[linearIdx(PrecP0M, node, numberOfPrecursorNodes)] = (dist.f[DIR_P0M])[k_00M];
+    precursorData[linearIdx(PrecPPP, node, numberOfPrecursorNodes)] = (dist.f[DIR_PPP])[k_000];
+    precursorData[linearIdx(PrecPMP, node, numberOfPrecursorNodes)] = (dist.f[DIR_PMP])[k_0M0];
+    precursorData[linearIdx(PrecPPM, node, numberOfPrecursorNodes)] = (dist.f[DIR_PPM])[k_00M];
+    precursorData[linearIdx(PrecPMM, node, numberOfPrecursorNodes)] = (dist.f[DIR_PMM])[k_0MM];
 }
 
 
@@ -163,23 +164,23 @@ void PrecursorWriter::init(Parameter* para, GridProvider* gridProvider, CudaMemo
         }
 
         precursorStructs[level] = SPtr<PrecursorStruct>(new PrecursorStruct);
-        precursorStructs[level]->nPoints = (uint)indicesOnGrid.size();
-        precursorStructs[level]->indicesOnPlane = (int*) malloc(precursorStructs[level]->nPoints*sizeof(int));
+        precursorStructs[level]->numberOfPointsInBC = (uint)indicesOnGrid.size();
+        precursorStructs[level]->indicesOnPlane = (int*) malloc(precursorStructs[level]->numberOfPointsInBC*sizeof(int));
         precursorStructs[level]->spacing = makeUbTuple(dx, dx, tSave*para->getTimeRatio()*pow(2,-level));
         precursorStructs[level]->origin = makeUbTuple(lowestY, lowestZ);
         precursorStructs[level]->extent = makeUbTuple(0, ny-1, 0, nz-1);
-        precursorStructs[level]->nPointsInPlane = ny*nz;
-        precursorStructs[level]->timestepsPerFile = min(para->getlimitOfNodesForVTK()/(ny*nz), maxtimestepsPerFile);
-        precursorStructs[level]->filesWritten = 0;
-        precursorStructs[level]->timestepsBuffered = 0;
+        precursorStructs[level]->numberOfPointsInData = ny*nz;
+        precursorStructs[level]->numberOfTimestepsPerFile = min(para->getlimitOfNodesForVTK()/(ny*nz), maxtimestepsPerFile);
+        precursorStructs[level]->numberOfFilesWritten = 0;
+        precursorStructs[level]->numberOfTimestepsBuffered = 0;
         
         switch (outputVariable)
         {
         case OutputVariable::Velocities:
-            precursorStructs[level]->nQuantities = 3;
+            precursorStructs[level]->numberOfQuantities = 3;
             break;
         case OutputVariable::Distributions:
-            precursorStructs[level]->nQuantities = 9;
+            precursorStructs[level]->numberOfQuantities = 9;
             break;
         
         default:
@@ -193,7 +194,7 @@ void PrecursorWriter::init(Parameter* para, GridProvider* gridProvider, CudaMemo
 
         cudaManager->cudaCopyPrecursorWriterIndicesHtoD(this, level);
 
-        VF_LOG_INFO("Found {} points in precursor plane on level {}", precursorStructs[level]->nPoints, level);
+        VF_LOG_INFO("Found {} points in precursor plane on level {}", precursorStructs[level]->numberOfPointsInBC, level);
     }
     VF_LOG_INFO("PrecursorWriter: Done initializing.");
 }
@@ -207,11 +208,11 @@ void PrecursorWriter::interact(Parameter* para, CudaMemoryManager* cudaManager,
 
     if(t_level>tStartOut_level && ((t_level-tStartOut_level) % tSave)==0)
     {
-        vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, precursorStructs[level]->nPoints);
+        vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, precursorStructs[level]->numberOfPointsInBC);
 
         if(this->outputVariable==OutputVariable::Velocities)
         {
-            fillArrayVelocities<<<grid.grid, grid.threads>>>(   precursorStructs[level]->nPoints, precursorStructs[level]->indicesD, 
+            fillArrayVelocities<<<grid.grid, grid.threads>>>(   precursorStructs[level]->numberOfPointsInBC, precursorStructs[level]->indicesD, 
                                                                 precursorStructs[level]->bufferD, 
                                                                 para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
                                                                 para->getVelocityRatio());
@@ -219,7 +220,7 @@ void PrecursorWriter::interact(Parameter* para, CudaMemoryManager* cudaManager,
         }
         else if(this->outputVariable==OutputVariable::Distributions)
         {
-            fillArrayDistributions<<<grid.grid, grid.threads>>>(precursorStructs[level]->nPoints, precursorStructs[level]->indicesD, 
+            fillArrayDistributions<<<grid.grid, grid.threads>>>(precursorStructs[level]->numberOfPointsInBC, precursorStructs[level]->indicesD, 
                                                                 precursorStructs[level]->bufferD,
                                                                 para->getParD(level)->distributions.f[0],
                                                                 para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
@@ -233,9 +234,9 @@ void PrecursorWriter::interact(Parameter* para, CudaMemoryManager* cudaManager,
         precursorStructs[level]->bufferD = precursorStructs[level]->dataD;
         precursorStructs[level]->dataD = tmp;
 
-        precursorStructs[level]->timestepsBuffered++;
+        precursorStructs[level]->numberOfTimestepsBuffered++;
 
-        if(precursorStructs[level]->timestepsBuffered >= precursorStructs[level]->timestepsPerFile || t == para->getTimestepEnd())
+        if(precursorStructs[level]->numberOfTimestepsBuffered >= precursorStructs[level]->numberOfTimestepsPerFile || t == para->getTimestepEnd())
         {
         // switch host buffer and data pointer so precursor data is copied in buffer and written from data
 
@@ -244,8 +245,8 @@ void PrecursorWriter::interact(Parameter* para, CudaMemoryManager* cudaManager,
             precursorStructs[level]->dataH = tmp;
 
             writeFuture.wait();
-            writeFuture = std::async(std::launch::async, [this](Parameter* para, uint level, uint timesteps){ this->write(para, level, timesteps); }, para, level, precursorStructs[level]->timestepsBuffered);
-            precursorStructs[level]->timestepsBuffered = 0;
+            writeFuture = std::async(std::launch::async, [this](Parameter* para, uint level, uint timesteps){ this->write(para, level, timesteps); }, para, level, precursorStructs[level]->numberOfTimestepsBuffered);
+            precursorStructs[level]->numberOfTimestepsBuffered = 0;
         }
     }
 }
@@ -256,22 +257,22 @@ void PrecursorWriter::free(Parameter* para, CudaMemoryManager* cudaManager)
     writeFuture.wait();
     for(int level=0; level<=para->getMaxLevel(); level++)
     {
-        if(getPrecursorStruct(level)->timestepsBuffered>0)
-            write(para, level, getPrecursorStruct(level)->timestepsBuffered);
+        if(getPrecursorStruct(level)->numberOfTimestepsBuffered>0)
+            write(para, level, getPrecursorStruct(level)->numberOfTimestepsBuffered);
 
         cudaManager->cudaFreePrecursorWriter(this, level);
     }
 }
 
 
-void PrecursorWriter::write(Parameter* para, int level, uint timestepsBuffered)
+void PrecursorWriter::write(Parameter* para, int level, uint numberOfTimestepsBuffered)
 {
-    std::string fname = this->makeFileName(fileName, level, para->getMyProcessID(), precursorStructs[level]->filesWritten) + getWriter()->getFileExtension();
+    std::string fname = this->makeFileName(fileName, level, para->getMyProcessID(), precursorStructs[level]->numberOfFilesWritten) + getWriter()->getFileExtension();
     std::string wholeName = outputPath + "/" + fname;
 
-    uint nPointsInPlane = precursorStructs[level]->nPointsInPlane;
+    uint numberOfPointsInData = precursorStructs[level]->numberOfPointsInData;
 
-    int startTime = precursorStructs[level]->filesWritten*precursorStructs[level]->timestepsPerFile;
+    int startTime = precursorStructs[level]->numberOfFilesWritten*precursorStructs[level]->numberOfTimestepsPerFile;
 
     UbTupleInt6 extent = makeUbTuple(   val<1>(precursorStructs[level]->extent),    val<2>(precursorStructs[level]->extent), 
                                         val<3>(precursorStructs[level]->extent),    val<4>(precursorStructs[level]->extent), 
@@ -281,15 +282,15 @@ void PrecursorWriter::write(Parameter* para, int level, uint timestepsBuffered)
 
     std::vector<std::vector<double>> nodedata;
     
-    for(uint quant=0; quant<precursorStructs[level]->nQuantities; quant++)
+    for(uint quant=0; quant<precursorStructs[level]->numberOfQuantities; quant++)
     {
-        std::vector<double> doubleArr(nPointsInPlane*timestepsBuffered, NAN);
-        for( uint timestep=0; timestep<timestepsBuffered; timestep++)
+        std::vector<double> doubleArr(numberOfPointsInData*numberOfTimestepsBuffered, NAN);
+        for( uint timestep=0; timestep<numberOfTimestepsBuffered; timestep++)
         {
-            for (uint pos=0; pos < precursorStructs[level]->nPoints; pos++)
+            for (uint pos=0; pos < precursorStructs[level]->numberOfPointsInBC; pos++)
             {
-                int indexOnPlane = precursorStructs[level]->indicesOnPlane[pos]+timestep*nPointsInPlane;
-                doubleArr[indexOnPlane] = double(precursorStructs[level]->dataH[lIndex(quant, pos, timestep, precursorStructs[level]->nQuantities, precursorStructs[level]->nPoints)]);
+                int indexOnPlane = precursorStructs[level]->indicesOnPlane[pos]+timestep*numberOfPointsInData;
+                doubleArr[indexOnPlane] = double(precursorStructs[level]->dataH[linearIdx(quant, pos, timestep, precursorStructs[level]->numberOfQuantities, precursorStructs[level]->numberOfPointsInBC)]);
             }
         }
         nodedata.push_back(doubleArr);
@@ -297,14 +298,14 @@ void PrecursorWriter::write(Parameter* para, int level, uint timestepsBuffered)
 
     std::vector<std::vector<double>> celldata;
     getWriter()->writeData(wholeName, nodedatanames, celldatanames, nodedata, celldata, extent, origin, precursorStructs[level]->spacing, extent, this->writePrecision);
-    precursorStructs[level]->filesWritten++;
+    precursorStructs[level]->numberOfFilesWritten++;
 }
 
-std::string PrecursorWriter::makeFileName(std::string fileName, int level, int id, uint filesWritten)
+std::string PrecursorWriter::makeFileName(std::string fileName, int level, int id, uint numberOfFilesWritten)
 {
     return fileName + "_lev_" + StringUtil::toString<int>(level)
                     + "_ID_" + StringUtil::toString<int>(id)
-                    + "_File_" + StringUtil::toString<int>(filesWritten);
+                    + "_File_" + StringUtil::toString<int>(numberOfFilesWritten);
 }
 
 void PrecursorWriter::getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider)
@@ -313,7 +314,7 @@ void PrecursorWriter::getTaggedFluidNodes(Parameter *para, GridProvider* gridPro
     {
         if(outputVariable==OutputVariable::Velocities)
         {
-            std::vector<uint> indices(precursorStructs[level]->indicesH, precursorStructs[level]->indicesH+precursorStructs[level]->nPoints);
+            std::vector<uint> indices(precursorStructs[level]->indicesH, precursorStructs[level]->indicesH+precursorStructs[level]->numberOfPointsInBC);
             gridProvider->tagFluidNodeIndices(indices, CollisionTemplate::WriteMacroVars, level);
         }
     }
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
index 8dc8e36fe..3959fb2d8 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
@@ -71,11 +71,11 @@ static constexpr uint PrecPMM = 8;
 
 struct PrecursorStruct
 {
-    uint nPoints, nPointsInPlane, timestepsPerFile, filesWritten, timestepsBuffered;
+    uint numberOfPointsInBC, numberOfPointsInData, numberOfTimestepsPerFile, numberOfFilesWritten, numberOfTimestepsBuffered;
     uint *indicesH, *indicesD;
     real *dataH, *dataD;
     real *bufferH, *bufferD;
-    uint nQuantities;
+    uint numberOfQuantities;
     UbTupleInt4 extent;
     UbTupleFloat2 origin;
     UbTupleFloat3 spacing;
@@ -127,7 +127,7 @@ public:
     
 private:
     WbWriterVtkXmlImageBinary* getWriter(){ return WbWriterVtkXmlImageBinary::getInstance(); };
-    void write(Parameter* para, int level, uint timestepsBuffered);
+    void write(Parameter* para, int level, uint numberOfTimestepsBuffered);
 
     std::vector<std::string> determineNodeDataNames()
     {
-- 
GitLab


From cc6e45d245087327cb2842dbd3472d6c689a50f0 Mon Sep 17 00:00:00 2001
From: Henry <henry.korb@geo.uu.se>
Date: Mon, 19 Dec 2022 13:23:36 +0100
Subject: [PATCH 142/179] fix missing renaming from prev commit

---
 .../VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
index c607e67c0..aacb1721a 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu
@@ -276,7 +276,7 @@ void PrecursorWriter::write(Parameter* para, int level, uint numberOfTimestepsBu
 
     UbTupleInt6 extent = makeUbTuple(   val<1>(precursorStructs[level]->extent),    val<2>(precursorStructs[level]->extent), 
                                         val<3>(precursorStructs[level]->extent),    val<4>(precursorStructs[level]->extent), 
-                                        startTime,                          startTime+(int)timestepsBuffered-1);
+                                        startTime,                          startTime+(int)numberOfTimestepsBuffered-1);
 
     UbTupleFloat3 origin = makeUbTuple( val<1>(precursorStructs[level]->origin), val<2>(precursorStructs[level]->origin), 0.f);
 
-- 
GitLab


From b1e44982b7d26bb184de8740234ceffb003307e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Peters?= <soe.peters@tu-braunschweig.de>
Date: Tue, 20 Dec 2022 09:11:29 +0000
Subject: [PATCH 143/179] Use Double Accuracy in python job

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6ef4c9a0..081faa4b2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -133,7 +133,7 @@ gcc_9_python:
     - export CCACHE_DIR=$CI_PROJECT_DIR/cache
 
   script:
-    - python3 setup.py bdist_wheel build_ext --build-temp=_skbuild -- -DBUILD_VF_CPU=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
+    - python3 setup.py bdist_wheel build_ext --build-temp=_skbuild -- -DBUILD_VF_CPU=ON -DBUILD_VF_DOUBLE_ACCURACY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
 
 ###############################################################################
 ##                            Container Upload                               ##
-- 
GitLab


From c4c83b074f2aad21c833c54ac6f1407078081f86 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Tue, 20 Dec 2022 09:45:28 +0000
Subject: [PATCH 144/179] Change name of local variable 'idx' to avoid
 confusion with the outer variable

---
 .../TransientBCSetter/TransientBCSetter.cpp   | 42 ++++++++++---------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
index 3026458c9..5f3c4ad49 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp
@@ -156,7 +156,8 @@ void VTKFile::unloadFile()
     this->loaded = false;
 }
 
-void VTKFile::getData(real* data, uint numberOfNodes, const std::vector<uint>& readIndices, const std::vector<uint>& writeIndices, uint offsetRead, uint offsetWrite)
+void VTKFile::getData(real *data, uint numberOfNodes, const std::vector<uint> &readIndices,
+                      const std::vector<uint> &writeIndices, uint offsetRead, uint offsetWrite)
 {
     if(!this->loaded) loadFile();
 
@@ -305,7 +306,10 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
                     this->planeNeighbor0PM.push_back(writeIdx);
                     this->planeNeighbor0MP.push_back(writeIdx);
                     this->planeNeighbor0MM.push_back(writeIdx);
-                    found0PP = true; found0PM = true; found0MM = true; found0MP = true;
+                    found0PP = true;
+                    found0PM = true;
+                    found0MM = true;
+                    found0MP = true;
                 } 
                 else
                 {
@@ -325,40 +329,40 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords
             
             if(!found0PP) //NT in simulation is EN in precursor
             {
-                int idx = file.findNeighborPPM(posY, posZ, 0.f);
-                if(idx!=-1)
+                int index = file.findNeighborPPM(posY, posZ, 0.f);
+                if(index!=-1)
                 {
                     found0PP = true;
-                    real dy = file.getX(idx)-posY;
-                    real dz = file.getY(idx)-posZ;
+                    real dy = file.getX(index)-posY;
+                    real dz = file.getY(index)-posZ;
                     this->weights0PP.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, index));
                 }
             }
 
             if(!found0PM) //NB in simulation is ES in precursor
             {
-                int idx = file.findNeighborPMM(posY, posZ, 0.f);
-                if(idx!=-1)
+                int index = file.findNeighborPMM(posY, posZ, 0.f);
+                if(index!=-1)
                 {
                     found0PM = true;
-                    real dy = file.getX(idx)-posY;
-                    real dz = file.getY(idx)-posZ;
+                    real dy = file.getX(index)-posY;
+                    real dz = file.getY(index)-posZ;
                     this->weights0PM.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, index));
                 }
             }
 
             if(!found0MP) //ST in simulation is WN in precursor
             {
-                int idx = file.findNeighborMPM(posY, posZ, 0.f);
-                if(idx!=-1)
+                int index = file.findNeighborMPM(posY, posZ, 0.f);
+                if(index!=-1)
                 {
                     found0MP = true;
-                    real dy = file.getX(idx)-posY;
-                    real dz = file.getY(idx)-posZ;
+                    real dy = file.getX(index)-posY;
+                    real dz = file.getY(index)-posZ;
                     this->weights0MP.emplace_back(1.f/(dy*dy+dz*dz+eps));
-                    this->planeNeighbor0MP.emplace_back(getWriteIndex(level, fileId, idx));
+                    this->planeNeighbor0MP.emplace_back(getWriteIndex(level, fileId, index));
                 }
             }
 
@@ -413,7 +417,7 @@ void VTKReader::getNextData(real* data, uint numberOfNodes, real time)
             {
                 numberOfFiles++;
 
-                printf("switching to precursor file no. %zd\n", numberOfFiles);
+                printf("switching to precursor file no. %zu\n", numberOfFiles);
                 if(numberOfFiles == this->fileCollection->files[level][id].size())
                     throw std::runtime_error("Not enough Precursor Files to read");
 
@@ -437,4 +441,4 @@ void VTKReader::getNextData(real* data, uint numberOfNodes, real time)
             this->nFile[level][id] = numberOfFiles;
         }
     // }
-}
\ No newline at end of file
+}
-- 
GitLab


From d3b35f6417f89134f417aa45f4f21af0e29383b9 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Tue, 20 Dec 2022 10:33:09 +0000
Subject: [PATCH 145/179] Fix some Sonarqube code smells

---
 .../writer/WbWriterVtkXmlImageBinary.cpp      |   66 +-
 .../BoundaryConditions/BoundaryCondition.h    |    4 +-
 .../TransientBCSetter/TransientBCSetter.h     |   12 +-
 .../grid/BoundaryConditions/Side.cpp          |   58 +-
 .../grid/GridBuilder/GridBuilder.h            |    2 +-
 .../grid/GridBuilder/LevelGridBuilder.cpp     |  146 +-
 .../grid/GridBuilder/LevelGridBuilder.h       |   67 +-
 src/gpu/GridGenerator/grid/GridImp.cpp        |  551 +-
 .../DataStructureInitializer/GridProvider.h   |    2 +-
 .../GridReaderFiles/GridReader.cpp            |  126 +-
 .../GridReaderFiles/GridReader.h              |   88 +-
 .../GridReaderGenerator/GridGenerator.cpp     |   99 +-
 .../GridReaderGenerator/GridGenerator.h       |    2 +-
 src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh | 2874 ++++-----
 src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu    | 5353 ++++++++---------
 .../VirtualFluids_GPU/GPU/PrecursorBCs27.cu   |  202 +-
 src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu   | 2324 +++----
 .../Compressible/CumulantK17/CumulantK17.cu   |  208 +-
 .../CumulantK17/CumulantK17_Device.cu         |   90 +-
 .../CumulantK17/CumulantK17_Device.cuh        |   36 +-
 .../KernelManager/BCKernelManager.cpp         |    2 +-
 src/gpu/VirtualFluids_GPU/LBM/LB.h            |   81 +-
 .../Output/DistributionDebugInspector.h       |   46 +-
 .../PreCollisionInteractor/ActuatorFarm.h     |    7 +-
 .../PreCollisionInteractor/PrecursorWriter.h  |    2 +-
 25 files changed, 6215 insertions(+), 6233 deletions(-)

diff --git a/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp b/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
index 92434e18b..798b55919 100644
--- a/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
+++ b/src/basics/basics/writer/WbWriterVtkXmlImageBinary.cpp
@@ -40,7 +40,7 @@ using namespace std;
 const std::string WbWriterVtkXmlImageBinary::pvdEndTag = "   </Collection>\n</VTKFile>";
 /*===============================================================================*/
 string WbWriterVtkXmlImageBinary::writeCollection(const string &filename, const vector<string> &filenames,
-                                             const double &timeStep, const bool &sepGroups)
+                                                  const double &timeStep, const bool &sepGroups)
 {
     string vtkfilename = filename + ".pvd";
     ofstream out(vtkfilename.c_str());
@@ -79,7 +79,7 @@ string WbWriterVtkXmlImageBinary::writeCollection(const string &filename, const
 }
 /*===============================================================================*/
 string WbWriterVtkXmlImageBinary::addFilesToCollection(const string &filename, const vector<string> &filenames,
-                                                  const double &timeStep, const bool &sepGroups)
+                                                       const double &timeStep, const bool &sepGroups)
 {
     string vtkfilename = filename;
     fstream test(vtkfilename.c_str(), ios::in);
@@ -106,9 +106,10 @@ string WbWriterVtkXmlImageBinary::addFilesToCollection(const string &filename, c
     return vtkfilename;
 }
 /*===============================================================================*/
-string WbWriterVtkXmlImageBinary::writeParallelFile(const string &filename, const UbTupleInt6 &wholeExtent, const UbTupleFloat3 &origin, const UbTupleFloat3 &spacing, 
-                                                vector<string> &pieceSources, vector<UbTupleInt6> &pieceExtents,
-                                                vector<string> &pointDataNames, vector<string> &cellDataNames)
+string WbWriterVtkXmlImageBinary::writeParallelFile(const string &filename, const UbTupleInt6 &wholeExtent,
+                                                    const UbTupleFloat3 &origin, const UbTupleFloat3 &spacing,
+                                                    vector<string> &pieceSources, vector<UbTupleInt6> &pieceExtents,
+                                                    vector<string> &pointDataNames, vector<string> &cellDataNames)
 {
     string vtkfilename = filename + ".pvti";
     UBLOG(logDEBUG1, "WbWriterVtkXmlImageBinary::writeParallelFile to " << vtkfilename << " - start");
@@ -170,8 +171,8 @@ string WbWriterVtkXmlImageBinary::writeParallelFile(const string &filename, cons
 }
 /*===============================================================================*/
 string WbWriterVtkXmlImageBinary::writeOctsWithCellData(const string &filename, vector<UbTupleFloat3> &nodes,
-                                                   vector<UbTupleInt8> &cells, vector<string> &datanames,
-                                                   vector<vector<double>> &celldata)
+                                                        vector<UbTupleInt8> & /*cells*/, vector<string> &datanames,
+                                                        vector<vector<double>> &celldata)
 {
     string vtkfilename = filename + getFileExtension();
     UBLOG(logDEBUG1, "WbWriterVtkXmlImageBinary::writeOctsWithCellData to " << vtkfilename << " - start");
@@ -191,8 +192,8 @@ string WbWriterVtkXmlImageBinary::writeOctsWithCellData(const string &filename,
 }
 /*===============================================================================*/
 string WbWriterVtkXmlImageBinary::writeOctsWithNodeData(const string &filename, vector<UbTupleFloat3> &nodes,
-                                                   vector<UbTupleUInt8> &cells, vector<string> &datanames,
-                                                   vector<vector<double>> &nodedata)
+                                                        vector<UbTupleUInt8> & /*cells*/, vector<string> &datanames,
+                                                        vector<vector<double>> &nodedata)
 {
     string vtkfilename = filename + getFileExtension();
     UBLOG(logDEBUG1, "WbWriterVtkXmlImageBinary::writeOctsWithNodeData to " << vtkfilename << " - start");
@@ -213,8 +214,7 @@ string WbWriterVtkXmlImageBinary::writeOctsWithNodeData(const string &filename,
 }
 /*===============================================================================*/
 string WbWriterVtkXmlImageBinary::writeNodesWithNodeData(const string &filename, vector<UbTupleFloat3> &nodes,
-                                                    vector<string> &datanames,
-                                                    vector<vector<double>> &nodedata)
+                                                         vector<string> &datanames, vector<vector<double>> &nodedata)
 {
     string vtkfilename = filename + getFileExtension();
     UBLOG(logDEBUG1, "WbWriterVtkXmlImageBinary::writeNodesWithNodeData to " << vtkfilename << " - start");
@@ -231,7 +231,8 @@ string WbWriterVtkXmlImageBinary::writeNodesWithNodeData(const string &filename,
     return vtkfilename;
 }
 
-void WbWriterVtkXmlImageBinary::getMetaDataOfImage(vector<UbTupleFloat3> &nodes, UbTupleFloat3& origin, UbTupleFloat3& spacing, UbTupleInt6& extent)
+void WbWriterVtkXmlImageBinary::getMetaDataOfImage(vector<UbTupleFloat3> &nodes, UbTupleFloat3 &origin,
+                                                   UbTupleFloat3 &spacing, UbTupleInt6 &extent)
 {
     int nofNodes = (int)nodes.size();
     val<1>(origin) = val<1>(nodes[0]);
@@ -247,17 +248,17 @@ void WbWriterVtkXmlImageBinary::getMetaDataOfImage(vector<UbTupleFloat3> &nodes,
     int ny = (l_y) / val<2>(spacing);
     val<3>(spacing) = val<3>(nodes[nx*ny])-val<3>(nodes[0]);
 
-    val<1>(extent) = val<1>(origin)/val<1>(spacing); val<2>(extent) = val<1>(nodes[nofNodes-1])/val<1>(spacing);    
-    val<3>(extent) = val<2>(origin)/val<2>(spacing); val<4>(extent) = val<2>(nodes[nofNodes-1])/val<2>(spacing);    
-    val<5>(extent) = val<3>(origin)/val<3>(spacing); val<6>(extent) = val<3>(nodes[nofNodes-1])/val<3>(spacing);    
+    val<1>(extent) = val<1>(origin) / val<1>(spacing); val<2>(extent) = val<1>(nodes[nofNodes - 1]) / val<1>(spacing);    
+    val<3>(extent) = val<2>(origin) / val<2>(spacing); val<4>(extent) = val<2>(nodes[nofNodes - 1]) / val<2>(spacing);    
+    val<5>(extent) = val<3>(origin) / val<3>(spacing); val<6>(extent) = val<3>(nodes[nofNodes - 1]) / val<3>(spacing);    
 
 }
 
-void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename,
-                                            vector<string> &pointDataNames, vector<string> &cellDataNames,
-                                            vector<vector<double>> &nodedata, vector<vector<double>> &celldata,
-                                            UbTupleInt6& wholeExtent,
-                                            UbTupleFloat3& origin, UbTupleFloat3& spacing, UbTupleInt6& extent, unsigned int precision)
+void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename, vector<string> &pointDataNames,
+                                          vector<string> &cellDataNames, vector<vector<double>> &nodedata,
+                                          vector<vector<double>> &celldata, UbTupleInt6 &wholeExtent,
+                                          UbTupleFloat3 &origin, UbTupleFloat3 &spacing, UbTupleInt6 &extent,
+                                          unsigned int precision)
 {
     ofstream out(vtkfilename.c_str(), ios::out | ios::binary);
     out.precision(precision);
@@ -273,14 +274,14 @@ void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename,
             throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename);
     }
 
-    size_t nPoints = pointDataNames.size()>0 ? nodedata[0].size() : celldata[0].size();
+    size_t nPoints = pointDataNames.size() > 0 ? nodedata[0].size() : celldata[0].size();
 
-    int bytesPerByteVal      = 4; //==sizeof(int)
+    int bytesPerByteVal = 4; //==sizeof(int)
 
-    int bytesScalarData      = 1 /*scalar         */ * (int)nPoints * sizeof(double);
+    int bytesScalarData = 1 /*scalar         */ * (int)nPoints * sizeof(double);
 
     int offset = 0;
-    
+
     // VTK FILE
     out << "<?xml version=\"1.0\"?>\n";
     out << "<VTKFile type=\"ImageData\" version=\"0.1\" byte_order=\"LittleEndian\" >"
@@ -307,23 +308,21 @@ void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename,
                                     << val<6>(extent) << "\">\n";
 
     // DATA SECTION
-    if (pointDataNames.size()>0)
-    {
+    if (pointDataNames.size() > 0) {
         out << "         <PointData>\n";
         for (size_t s = 0; s < pointDataNames.size(); ++s) {
-            out << "            <DataArray type=\"Float64\" Name=\"" << pointDataNames[s] << "\" format=\"appended\" offset=\""
-                << offset << "\" /> \n";
+            out << "            <DataArray type=\"Float64\" Name=\"" << pointDataNames[s]
+                << "\" format=\"appended\" offset=\"" << offset << "\" /> \n";
             offset += (bytesPerByteVal + bytesScalarData);
         }
         out << "         </PointData>\n";
     }
 
-    if (cellDataNames.size()>0)
-    {
+    if (cellDataNames.size() > 0) {
         out << "         <CellData>\n";
         for (size_t s = 0; s < cellDataNames.size(); ++s) {
-            out << "            <DataArray type=\"Float64\" Name=\"" << cellDataNames[s] << "\" format=\"appended\" offset=\""
-                << offset << "\" /> \n";
+            out << "            <DataArray type=\"Float64\" Name=\"" << cellDataNames[s]
+                << "\" format=\"appended\" offset=\"" << offset << "\" /> \n";
             offset += (bytesPerByteVal + bytesScalarData);
         }
         out << "         </CellData>\n";
@@ -336,7 +335,6 @@ void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename,
     out << "   <AppendedData encoding=\"raw\">\n";
     out << "_";
 
-
     // DATA SECTION
     // pointData
     for (size_t s = 0; s < pointDataNames.size(); ++s) {
@@ -359,4 +357,4 @@ void WbWriterVtkXmlImageBinary::writeData(const string &vtkfilename,
     out << "</VTKFile>";
     out << endl;
     out.close();
-}
\ No newline at end of file
+}
diff --git a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h
index fe4078af9..9c3bac9c3 100644
--- a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h
+++ b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h
@@ -47,13 +47,13 @@ struct GKSGPU_EXPORT BoundaryCondition : virtual public BoundaryConditionStruct,
     virtual bool isWall() = 0;
 
     virtual bool isFluxBC();
-    
+
     virtual bool isInsulated();
 
     virtual bool secondCellsNeeded();
 
     virtual void runBoundaryConditionKernel( const SPtr<DataBase> dataBase,
-                                             const Parameters parameters, 
+                                             const Parameters parameters,
                                              const uint level ) = 0;
 
     BoundaryConditionStruct toStruct()
diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
index 5bee61e19..1663a3ff3 100644
--- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
+++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h
@@ -32,7 +32,7 @@ struct Quantity
 class VTKFile
 {
 public: 
-    VTKFile(std::string _fileName): 
+    explicit VTKFile(std::string _fileName): 
     fileName(_fileName)
     {
         readHeader();
@@ -100,9 +100,9 @@ public:
 
     virtual ~FileCollection() = default;
 
-    virtual size_t getNumberOfQuantities()=0;
+    virtual size_t getNumberOfQuantities() = 0;
 
-    virtual FileType getFileType()=0;
+    virtual FileType getFileType() = 0;
 
 protected:
     std::string prefix;
@@ -118,8 +118,8 @@ public:
         findFiles();
     };
 
-    FileType getFileType(){ return FileType::VTK; };
-    size_t getNumberOfQuantities(){ return files[0][0][0].getNumberOfQuantities(); }
+    FileType getFileType() override{ return FileType::VTK; };
+    size_t getNumberOfQuantities() override{ return files[0][0][0].getNumberOfQuantities(); }
     
 
 private:
@@ -198,4 +198,4 @@ private:
 SPtr<FileCollection> createFileCollection(std::string prefix, FileType type);
 SPtr<TransientBCInputFileReader> createReaderForCollection(SPtr<FileCollection> fileCollection, uint readLevel);
 
-#endif //TRANSIENTBCSETTER_H_
\ No newline at end of file
+#endif //TRANSIENTBCSETTER_H_
diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
index 0900c2d58..5b191ee4e 100644
--- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
+++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp
@@ -1,28 +1,28 @@
 //=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -65,14 +65,14 @@ void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition
                                             ||  grid->getFieldEntry(index) == vf::gpu::FLUID_CFC
                                             ||  grid->getFieldEntry(index) == vf::gpu::FLUID_CFF
                                             ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCC
-                                            ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCF 
                                             ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCF
-                                            
+                                            ||  grid->getFieldEntry(index) == vf::gpu::FLUID_FCF
+
                                             //! Enforce overlap of BCs on edge nodes
                                             ||  grid->getFieldEntry(index)  == vf::gpu::BC_PRESSURE
-                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_VELOCITY 
-                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_NOSLIP   
-                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_SLIP     
+                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_VELOCITY
+                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_NOSLIP
+                                            ||  grid->getFieldEntry(index)  == vf::gpu::BC_SLIP
                                             ||  grid->getFieldEntry(index)  == vf::gpu::BC_STRESS ))
             {
                 grid->setFieldEntry(index, boundaryCondition->getType());
@@ -175,7 +175,7 @@ void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uin
         bool alignedWithNormal = (this->getNormal()[0]*grid->getDirection()[dir * DIMENSION + 0]+
                                   this->getNormal()[1]*grid->getDirection()[dir * DIMENSION + 1]+
                                   this->getNormal()[2]*grid->getDirection()[dir * DIMENSION + 2] ) > 0;
-        
+
         uint neighborIndex = grid->transCoordToIndex( neighborX, neighborY, neighborZ );
         if((grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY ||
             grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID          ||
@@ -185,7 +185,7 @@ void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uin
         else
             qNode[dir] = -1.0;
     }
-    
+
     boundaryCondition->qs.push_back(qNode);
 }
 
@@ -214,7 +214,7 @@ void Geometry::addIndices(std::vector<SPtr<Grid> > grids, uint level, SPtr<Bound
 
         for (int dir = 0; dir <= grids[level]->getEndDirection(); dir++)
         {
-			const real q = grids[level]->getQValue(index, dir);
+            const real q = grids[level]->getQValue(index, dir);
 
             qNode[dir] = q;
 
@@ -284,7 +284,7 @@ void MY::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCond
     real coordinateNormal = grid[level]->getStartY() + grid[level]->getDelta();
 
     if( coordinateNormal > grid[0]->getStartY() + grid[0]->getDelta() ) return;
-    
+
     Side::addIndices(grid[level], boundaryCondition, "y", coordinateNormal, startInner, endInner, startOuter, endOuter);
 }
 
@@ -331,6 +331,6 @@ void PZ::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCond
     real coordinateNormal = grid[level]->getEndZ() - grid[level]->getDelta();
 
     if( coordinateNormal < grid[0]->getEndZ() - grid[0]->getDelta() ) return;
-    
+
     Side::addIndices(grid[level], boundaryCondition, "z", coordinateNormal, startInner, endInner, startOuter, endOuter);
 }
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
index 065665d21..f3d850384 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -163,4 +163,4 @@ public:
 
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
index ff6f4913e..003e6dcd2 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -1,28 +1,28 @@
 //=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -105,17 +105,17 @@ void LevelGridBuilder::setSlipGeometryBoundaryCondition(real normalX, real norma
 
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
     {
-		if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
-		{
-			boundaryConditions[level]->geometryBoundaryCondition->normalX = normalX;
-			boundaryConditions[level]->geometryBoundaryCondition->normalY = normalY;
-			boundaryConditions[level]->geometryBoundaryCondition->normalZ = normalZ;
-			boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
+        if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
+        {
+            boundaryConditions[level]->geometryBoundaryCondition->normalX = normalX;
+            boundaryConditions[level]->geometryBoundaryCondition->normalY = normalY;
+            boundaryConditions[level]->geometryBoundaryCondition->normalZ = normalZ;
+            boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
 
             boundaryConditions[level]->geometryBoundaryCondition->fillSlipNormalLists();
 
             *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n";
-		}
+        }
     }
 }
 
@@ -123,10 +123,10 @@ void LevelGridBuilder::setSlipGeometryBoundaryCondition(real normalX, real norma
 //! \brief Set stress boundary concdition using iMEM
 //! \param samplingOffset number of grid points above boundary where velocity for wall model is sampled
 //! \param z0 roughness length [m]
-//! \param dx dx of level 0 [m] 
+//! \param dx dx of level 0 [m]
 //!
-void LevelGridBuilder::setStressBoundaryCondition(  SideType sideType, 
-                                                    real nomalX, real normalY, real normalZ, 
+void LevelGridBuilder::setStressBoundaryCondition(  SideType sideType,
+                                                    real nomalX, real normalY, real normalZ,
                                                     uint samplingOffset, real z0, real dx)
 {
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
@@ -178,17 +178,17 @@ void LevelGridBuilder::setVelocityGeometryBoundaryCondition(real vx, real vy, re
 
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
     {
-		if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
-		{
-			boundaryConditions[level]->geometryBoundaryCondition->vx = vx;
-			boundaryConditions[level]->geometryBoundaryCondition->vy = vy;
-			boundaryConditions[level]->geometryBoundaryCondition->vz = vz;
-			boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
+        if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
+        {
+            boundaryConditions[level]->geometryBoundaryCondition->vx = vx;
+            boundaryConditions[level]->geometryBoundaryCondition->vy = vy;
+            boundaryConditions[level]->geometryBoundaryCondition->vz = vz;
+            boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
 
             boundaryConditions[level]->geometryBoundaryCondition->fillVelocityLists();
 
             *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Velocity BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n";
-		}
+        }
     }
 }
 
@@ -230,7 +230,7 @@ void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType)
             noSlipBoundaryCondition->fillVelocityLists();
 
             // now effectively just a wrapper for velocityBC with zero velocity. No distinction in Gridgenerator.
-            boundaryConditions[level]->velocityBoundaryConditions.push_back(noSlipBoundaryCondition); 
+            boundaryConditions[level]->velocityBoundaryConditions.push_back(noSlipBoundaryCondition);
         }
     }
 }
@@ -241,23 +241,23 @@ void LevelGridBuilder::setNoSlipGeometryBoundaryCondition()
 
     for (uint level = 0; level < getNumberOfGridLevels(); level++)
     {
-		if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
-		{
-			boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
+        if (boundaryConditions[level]->geometryBoundaryCondition != nullptr)
+        {
+            boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition);
 
             *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry No-Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n";
-		}
+        }
     }
 }
 
-void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads, 
+void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads,
                                                         real velocityX, real velocityY, real velocityZ, std::vector<uint> fileLevelToGridLevelMap)
 {
-    if(fileLevelToGridLevelMap.empty())                         
+    if(fileLevelToGridLevelMap.empty())
     {
         *logging::out << logging::Logger::INFO_INTERMEDIATE << "Mapping precursor file levels to the corresponding grid levels" << "\n";
 
-        for (uint level = 0; level < getNumberOfGridLevels(); level++)  
+        for (uint level = 0; level < getNumberOfGridLevels(); level++)
             fileLevelToGridLevelMap.push_back(level);
     }
     else
@@ -413,9 +413,9 @@ std::shared_ptr<Grid> LevelGridBuilder::getGrid(int level, int box)
 void LevelGridBuilder::checkLevel(int level)
 {
     if (level >= (int)grids.size())
-    { 
+    {
         std::cout << "wrong level input... return to caller\n";
-        return; 
+        return;
     }
 }
 
@@ -426,16 +426,16 @@ void LevelGridBuilder::getDimensions(int &nx, int &ny, int &nz, const int level)
     nz = grids[level]->getNumberOfNodesZ();
 }
 
-void LevelGridBuilder::getNodeValues(real *xCoords, real *yCoords, real *zCoords, 
-                                     uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, 
+void LevelGridBuilder::getNodeValues(real *xCoords, real *yCoords, real *zCoords,
+                                     uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative,
                                      uint *geo, const int level) const
 {
     grids[level]->getNodeValues(xCoords, yCoords, zCoords, neighborX, neighborY, neighborZ, neighborNegative, geo);
 }
 
 
-GRIDGENERATOR_EXPORT void LevelGridBuilder::getFluidNodeIndices(uint *fluidNodeIndices, const int level) const 
-{ 
+GRIDGENERATOR_EXPORT void LevelGridBuilder::getFluidNodeIndices(uint *fluidNodeIndices, const int level) const
+{
     grids[level]->getFluidNodeIndices(fluidNodeIndices);
 }
 
@@ -444,9 +444,9 @@ GRIDGENERATOR_EXPORT void LevelGridBuilder::getFluidNodeIndicesBorder(uint *flui
     grids[level]->getFluidNodeIndicesBorder(fluidNodeIndices);
 }
 
-uint LevelGridBuilder::getNumberOfFluidNodes(unsigned int level) const 
+uint LevelGridBuilder::getNumberOfFluidNodes(unsigned int level) const
 {
-    return grids[level]->getNumberOfFluidNodes(); 
+    return grids[level]->getNumberOfFluidNodes();
 }
 
 GRIDGENERATOR_EXPORT uint LevelGridBuilder::getNumberOfFluidNodesBorder(unsigned int level) const
@@ -472,7 +472,7 @@ void LevelGridBuilder::getSlipValues(real* normalX, real* normalY, real* normalZ
         for (uint index = 0; index < boundaryCondition->indices.size(); index++)
         {
             indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[index]) + 1;
-            
+
             normalX[allIndicesCounter] = boundaryCondition->getNormalx(index);
             normalY[allIndicesCounter] = boundaryCondition->getNormaly(index);
             normalZ[allIndicesCounter] = boundaryCondition->getNormalz(index);
@@ -507,9 +507,9 @@ uint LevelGridBuilder::getStressSize(int level) const
     return size;
 }
 
-void LevelGridBuilder::getStressValues( real* normalX, real* normalY, real* normalZ, 
-                                        real* vx,      real* vy,      real* vz, 
-                                        real* vx1,     real* vy1,     real* vz1, 
+void LevelGridBuilder::getStressValues( real* normalX, real* normalY, real* normalZ,
+                                        real* vx,      real* vy,      real* vz,
+                                        real* vx1,     real* vy1,     real* vz1,
                                         int* indices, int* samplingIndices, int* samplingOffset, real* z0, int level) const
 {
 
@@ -565,7 +565,7 @@ void LevelGridBuilder::getVelocityValues(real* vx, real* vy, real* vz, int* indi
     {
         for (uint i = 0; i < (uint)boundaryCondition->indices.size(); i++)
         {
-            indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1;  
+            indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1;
 
             vx[allIndicesCounter] = boundaryCondition->getVx(i);
             vy[allIndicesCounter] = boundaryCondition->getVy(i);
@@ -644,17 +644,17 @@ uint LevelGridBuilder::getPrecursorSize(int level) const
     return size;
 }
 
-void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM, 
+void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM,
                                             real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM,
-                                            int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
-                                            int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads, 
+                                            int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader,
+                                            int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads,
                                             real& velocityX, real& velocityY, real& velocityZ, int level) const
 {
     int allIndicesCounter = 0;
     int allNodesCounter = 0;
     uint tmpTimeStepsBetweenReads = 0;
     size_t tmpNumberOfQuantities = 0;
-    
+
     for (auto boundaryCondition : boundaryConditions[level]->precursorBoundaryConditions)
     {
         if( tmpTimeStepsBetweenReads == 0 )
@@ -680,7 +680,7 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM
         BCreader->getWeights(weights0PP, weights0PM, weights0MP, weights0MM);
         if(tmpNumberOfQuantities == 0)
             tmpNumberOfQuantities = BCreader->getNumberOfQuantities();
-        if(tmpNumberOfQuantities != BCreader->getNumberOfQuantities()) 
+        if(tmpNumberOfQuantities != BCreader->getNumberOfQuantities())
             throw std::runtime_error("All precursor files must have the same quantities.");
         allNodesCounter += BCreader->getNPointsRead();
         velocityX = boundaryCondition->getVelocityX();
@@ -692,7 +692,7 @@ void LevelGridBuilder::getPrecursorValues(  uint* neighbor0PP, uint* neighbor0PM
     if (tmpTimeStepsBetweenReads == 0)
         throw std::runtime_error("timeStepsBetweenReads of precursor needs to be larger than 0.");
     timeStepsBetweenReads = tmpTimeStepsBetweenReads;
-    
+
     if (tmpNumberOfQuantities == 0)
         throw std::runtime_error("Number of quantities in precursor needs to be larger than 0.");
     numberOfQuantities = tmpNumberOfQuantities;
@@ -718,7 +718,7 @@ uint LevelGridBuilder::getGeometrySize(int level) const
 {
     if (boundaryConditions[level]->geometryBoundaryCondition)
         return  (uint)boundaryConditions[level]->geometryBoundaryCondition->indices.size();
-    
+
     return 0;
 }
 
@@ -739,9 +739,9 @@ void LevelGridBuilder::getGeometryValues(real* vx, real* vy, real* vz, int level
 {
     for (uint i = 0; i < boundaryConditions[level]->geometryBoundaryCondition->indices.size(); i++)
     {
-		vx[i] = boundaryConditions[level]->geometryBoundaryCondition->getVx(i);
-		vy[i] = boundaryConditions[level]->geometryBoundaryCondition->getVy(i);
-		vz[i] = boundaryConditions[level]->geometryBoundaryCondition->getVz(i);
+        vx[i] = boundaryConditions[level]->geometryBoundaryCondition->getVx(i);
+        vy[i] = boundaryConditions[level]->geometryBoundaryCondition->getVy(i);
+        vz[i] = boundaryConditions[level]->geometryBoundaryCondition->getVz(i);
     }
 }
 
@@ -756,7 +756,7 @@ void LevelGridBuilder::getGeometryQs(real* qs[27], int level) const
     }
 }
 
-void LevelGridBuilder::writeArrows(std::string fileName) const 
+void LevelGridBuilder::writeArrows(std::string fileName) const
 {
     QLineWriter::writeArrows(fileName, boundaryConditions[getNumberOfGridLevels() - 1]->geometryBoundaryCondition, grids[getNumberOfGridLevels() - 1]);
 }
@@ -797,7 +797,7 @@ void LevelGridBuilder::findFluidNodes(bool splitDomain)
 }
 
 
-void LevelGridBuilder::addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level) 
+void LevelGridBuilder::addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level)
 {
     grids[level]->addFluidNodeIndicesMacroVars(fluidNodeIndicesMacroVars);
 }
@@ -827,17 +827,17 @@ void LevelGridBuilder::sortFluidNodeIndicesAllFeatures(uint level)
     grids[level]->sortFluidNodeIndicesAllFeatures();
 }
 
-uint LevelGridBuilder::getNumberOfFluidNodesMacroVars(unsigned int level) const 
+uint LevelGridBuilder::getNumberOfFluidNodesMacroVars(unsigned int level) const
 {
     return grids[level]->getNumberOfFluidNodeIndicesMacroVars();
 }
 
-void LevelGridBuilder::getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, const int level) const 
+void LevelGridBuilder::getFluidNodeIndicesMacroVars(uint *fluidNodeIndicesMacroVars, const int level) const
 {
     grids[level]->getFluidNodeIndicesMacroVars(fluidNodeIndicesMacroVars);
 }
 
-uint LevelGridBuilder::getNumberOfFluidNodesApplyBodyForce(unsigned int level) const 
+uint LevelGridBuilder::getNumberOfFluidNodesApplyBodyForce(unsigned int level) const
 {
     return grids[level]->getNumberOfFluidNodeIndicesApplyBodyForce();
 }
@@ -855,4 +855,4 @@ uint LevelGridBuilder::getNumberOfFluidNodesAllFeatures(unsigned int level) cons
 void LevelGridBuilder::getFluidNodeIndicesAllFeatures(uint *fluidNodeIndicesAllFeatures, const int level) const
 {
     grids[level]->getFluidNodeIndicesAllFeatures(fluidNodeIndicesAllFeatures);
-}
\ No newline at end of file
+}
diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
index 56ae1e4fc..2e0eaf130 100644
--- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
+++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -1,28 +1,28 @@
 //=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -86,8 +86,8 @@ public:
     GRIDGENERATOR_EXPORT void setPressureBoundaryCondition(SideType sideType, real rho);
     GRIDGENERATOR_EXPORT void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z);
     GRIDGENERATOR_EXPORT void setNoSlipBoundaryCondition(SideType sideType);
-    GRIDGENERATOR_EXPORT void setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads, 
-                                                            real velocityX=c0o1, real velocityY=c0o1, real velocityZ=c0o1,     
+    GRIDGENERATOR_EXPORT void setPrecursorBoundaryCondition(SideType sideType, SPtr<FileCollection> fileCollection, int timeStepsBetweenReads,
+                                                            real velocityX=c0o1, real velocityY=c0o1, real velocityZ=c0o1,
                                                             std::vector<uint> fileLevelToGridLevelMap = {});
 
     GRIDGENERATOR_EXPORT void setEnableFixRefinementIntoTheWall(bool enableFixRefinementIntoTheWall);
@@ -106,7 +106,7 @@ public:
     GRIDGENERATOR_EXPORT virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const override;
 
     GRIDGENERATOR_EXPORT virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords,
-                                         uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, 
+                                         uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative,
                                          uint *geo, const int level) const override;
     GRIDGENERATOR_EXPORT virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const override;
 
@@ -116,12 +116,12 @@ public:
     GRIDGENERATOR_EXPORT virtual void getSlipQs(real* qs[27], int level) const override;
 
     GRIDGENERATOR_EXPORT uint getStressSize(int level) const override;
-    GRIDGENERATOR_EXPORT virtual void getStressValues(  real* normalX, real* normalY, real* normalZ, 
-                                                        real* vx,      real* vy,      real* vz, 
-                                                        real* vx1,     real* vy1,     real* vz1, 
+    GRIDGENERATOR_EXPORT virtual void getStressValues(  real* normalX, real* normalY, real* normalZ,
+                                                        real* vx,      real* vy,      real* vz,
+                                                        real* vx1,     real* vy1,     real* vz1,
                                                         int* indices, int* samplingIndices, int* samplingOffsets, real* z0, int level) const override;
     GRIDGENERATOR_EXPORT virtual void getStressQs(real* qs[27], int level) const override;
-        
+
     GRIDGENERATOR_EXPORT uint getVelocitySize(int level) const override;
     GRIDGENERATOR_EXPORT virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const override;
     GRIDGENERATOR_EXPORT virtual void getVelocityQs(real* qs[27], int level) const override;
@@ -131,9 +131,9 @@ public:
     GRIDGENERATOR_EXPORT virtual void getPressureQs(real* qs[27], int level) const override;
 
     GRIDGENERATOR_EXPORT uint getPrecursorSize(int level) const override;
-    GRIDGENERATOR_EXPORT void getPrecursorValues(   uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM, 
-                                                    real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM, 
-                                                    int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader, 
+    GRIDGENERATOR_EXPORT void getPrecursorValues(   uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM,
+                                                    real* weights0PP, real* weights0PM, real* weights0MP, real* weights0MM,
+                                                    int* indices, std::vector<SPtr<TransientBCInputFileReader>>& reader,
                                                     int& numberOfPrecursorNodes, size_t& numberOfQuantities, uint& timeStepsBetweenReads,
                                                     real& velocityX, real& velocityY, real& velocityZ, int level) const override;
     GRIDGENERATOR_EXPORT virtual void getPrecursorQs(real* qs[27], int level) const override;
@@ -150,11 +150,11 @@ public:
     GRIDGENERATOR_EXPORT SPtr<GeometryBoundaryCondition> getGeometryBoundaryCondition(uint level) const override;
 
 protected:
-    
+
 
     struct BoundaryConditions
     {
-		BoundaryConditions() = default;
+        BoundaryConditions() = default;
 
         std::vector<SPtr<SlipBoundaryCondition>> slipBoundaryConditions;
 
@@ -174,7 +174,7 @@ protected:
 
     std::vector<std::shared_ptr<Grid> > grids;
     std::vector<SPtr<BoundaryConditions> > boundaryConditions;
-    
+
     std::array<uint, 6> communicationProcesses;
 
     void checkLevel(int level);
@@ -217,7 +217,7 @@ public:
     void addFluidNodeIndicesMacroVars(const std::vector<uint>& fluidNodeIndicesMacroVars, uint level) override;
     void addFluidNodeIndicesApplyBodyForce(const std::vector<uint>& fluidNodeIndicesApplyBodyForce, uint level) override;
     void addFluidNodeIndicesAllFeatures(const std::vector<uint>& fluidNodeIndicesAllFeatures, uint level) override;
-    
+
     void sortFluidNodeIndicesMacroVars(uint level) override;
     void sortFluidNodeIndicesApplyBodyForce(uint level) override;
     void sortFluidNodeIndicesAllFeatures(uint level) override;
@@ -231,4 +231,3 @@ public:
 };
 
 #endif
-
diff --git a/src/gpu/GridGenerator/grid/GridImp.cpp b/src/gpu/GridGenerator/grid/GridImp.cpp
index 24dd169e7..05c684410 100644
--- a/src/gpu/GridGenerator/grid/GridImp.cpp
+++ b/src/gpu/GridGenerator/grid/GridImp.cpp
@@ -1,28 +1,28 @@
 //=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -33,7 +33,6 @@
 #include "GridImp.h"
 
 #include <iostream>
-#include <omp.h>
 #include <sstream>
 # include <algorithm>
 #include <cmath>
@@ -61,8 +60,8 @@ int DIRECTIONS[DIR_END_MAX][DIMENSION];
 
 using namespace vf::gpu;
 
-GridImp::GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, Distribution distribution, uint level) 
-            : object(object), 
+GridImp::GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, Distribution distribution, uint level)
+            : object(object),
     startX(startX),
     startY(startY),
     startZ(startZ),
@@ -135,7 +134,7 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers)
 #pragma omp parallel for
     for (int index = 0; index < (int)this->size; index++)
         this->initalNodeToOutOfGrid(index);
-    
+
     if( this->innerRegionFromFinerGrid ){
         *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start setInnerBasedOnFinerGrid()\n";
         this->setInnerBasedOnFinerGrid(fineGrid);
@@ -147,12 +146,12 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers)
 
     *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start addOverlap()\n";
     this->addOverlap();
-    
+
     *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start fixOddCells()\n";
 #pragma omp parallel for
     for (int index = 0; index < (int)this->size; index++)
         this->fixOddCell(index);
-    
+
     if( enableFixRefinementIntoTheWall )
     {
         *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start fixRefinementIntoWall()\n";
@@ -180,12 +179,12 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers)
             }
         }
     }
-    
+
     *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start findEndOfGridStopperNodes()\n";
 #pragma omp parallel for
     for (int index = 0; index < (int)this->size; index++)
         this->findEndOfGridStopperNode(index);
-    
+
     *logging::out << logging::Logger::INFO_INTERMEDIATE
         << "Grid created: " << "from (" << this->startX << ", " << this->startY << ", " << this->startZ << ") to (" << this->endX << ", " << this->endY << ", " << this->endZ << ")\n"
         << "nodes: " << this->nx << " x " << this->ny << " x " << this->nz << " = " << this->size << "\n";
@@ -209,9 +208,9 @@ void GridImp::freeMemory()
     if( this->neighborIndexZ        != nullptr ) { delete[] this->neighborIndexZ;        this->neighborIndexZ        = nullptr; }
     if( this->neighborIndexNegative != nullptr ) { delete[] this->neighborIndexNegative; this->neighborIndexNegative = nullptr; }
     if( this->sparseIndices         != nullptr ) { delete[] this->sparseIndices;         this->sparseIndices         = nullptr; }
-	if( this->qIndices              != nullptr ) { delete[] this->qIndices;              this->qIndices              = nullptr; }
-	if( this->qValues               != nullptr ) { delete[] this->qValues;               this->qValues               = nullptr; }
-	if( this->qPatches              != nullptr ) { delete[] this->qPatches;              this->qPatches              = nullptr; }
+    if( this->qIndices              != nullptr ) { delete[] this->qIndices;              this->qIndices              = nullptr; }
+    if( this->qValues               != nullptr ) { delete[] this->qValues;               this->qValues               = nullptr; }
+    if( this->qPatches              != nullptr ) { delete[] this->qPatches;              this->qPatches              = nullptr; }
 
     field.freeMemory();
 }
@@ -254,7 +253,7 @@ void GridImp::discretize(Object* solidObject, char innerType, char outerType)
         this->sparseIndices[index] = index;
 
         if( this->getFieldEntry(index) == innerType ) continue;
-        
+
         real x, y, z;
         this->transIndexToCoords(index, x, y, z);
 
@@ -279,7 +278,7 @@ bool GridImp::isInside(const Cell& cell) const
 //    |       +-----+-----+-----+           | +-----+-----+-----+
 //    +---------+                           +---------+
 //               0     1     2                   0     1     2
-//              even      even                        even     
+//              even      even                        even
 //                   odd                        odd         odd
 //
 Cell GridImp::getOddCellFromIndex(uint index) const
@@ -349,7 +348,7 @@ void GridImp::addOverlap()
 void GridImp::setOverlapTmp( uint index )
 {
     if( this->field.is( index, INVALID_OUT_OF_GRID ) ){
-        
+
         if( this->hasNeighborOfType(index, FLUID) ){
             this->field.setFieldEntry( index, OVERLAP_TMP );
         }
@@ -380,7 +379,7 @@ void GridImp::fixRefinementIntoWall(uint xIndex, uint yIndex, uint zIndex, int d
     if(  this->xOddStart && ( dir == 1 || dir == -1 ) && ( xIndex % 2 == 0 && xIndex != 0 ) ) return;
     if(  this->yOddStart && ( dir == 2 || dir == -2 ) && ( yIndex % 2 == 0 && yIndex != 0 ) ) return;
     if(  this->zOddStart && ( dir == 3 || dir == -3 ) && ( zIndex % 2 == 0 && zIndex != 0 ) ) return;
-    
+
     //////////////////////////////////////////////////////////////////////////
 
     real dx{ 0.0 }, dy{ 0.0 }, dz{ 0.0 };
@@ -433,31 +432,31 @@ void GridImp::findStopperNode(uint index) // deprecated
 
 void GridImp::findEndOfGridStopperNode(uint index)
 {
-	if (isValidEndOfGridStopper(index)){
+    if (isValidEndOfGridStopper(index)){
         if( this->level != 0 )
-		    this->field.setFieldEntryToStopperOutOfGrid(index);
+            this->field.setFieldEntryToStopperOutOfGrid(index);
         else
             this->field.setFieldEntryToStopperOutOfGridBoundary(index);
     }
-    
-	if (isValidEndOfGridBoundaryStopper(index))
-		this->field.setFieldEntryToStopperOutOfGridBoundary(index);
+
+    if (isValidEndOfGridBoundaryStopper(index))
+        this->field.setFieldEntryToStopperOutOfGridBoundary(index);
 }
 
 void GridImp::findSolidStopperNode(uint index)
 {
-	if (isValidSolidStopper(index))
-		this->field.setFieldEntry(index, STOPPER_SOLID);
+    if (isValidSolidStopper(index))
+        this->field.setFieldEntry(index, STOPPER_SOLID);
 }
 
 void GridImp::findBoundarySolidNode(uint index)
 {
-	if (shouldBeBoundarySolidNode(index)) 
-	{
-		this->field.setFieldEntry(index, BC_SOLID);
-		this->qIndices[index] = this->numberOfSolidBoundaryNodes++;
-		//grid->setNumberOfSolidBoundaryNodes(grid->getNumberOfSolidBoundaryNodes() + 1);
-	}
+    if (shouldBeBoundarySolidNode(index))
+    {
+        this->field.setFieldEntry(index, BC_SOLID);
+        this->qIndices[index] = this->numberOfSolidBoundaryNodes++;
+        //grid->setNumberOfSolidBoundaryNodes(grid->getNumberOfSolidBoundaryNodes() + 1);
+    }
 }
 
 void GridImp::fixOddCell(uint index)
@@ -483,9 +482,9 @@ bool GridImp::isOutSideOfGrid(Cell &cell) const
 bool GridImp::contains(Cell &cell, char type) const
 {
     for (const auto point : cell) {
-		uint index = transCoordToIndex(point.x, point.y, point.z);
-		if (index == INVALID_INDEX)
-			continue;
+        uint index = transCoordToIndex(point.x, point.y, point.z);
+        if (index == INVALID_INDEX)
+            continue;
         if (field.is(index, type))
             return true;
     }
@@ -495,8 +494,8 @@ bool GridImp::contains(Cell &cell, char type) const
 bool GridImp::cellContainsOnly(Cell &cell, char type) const
 {
     for (const auto point : cell) {
-		uint index = transCoordToIndex(point.x, point.y, point.z);
-		if (index == INVALID_INDEX)
+        uint index = transCoordToIndex(point.x, point.y, point.z);
+        if (index == INVALID_INDEX)
             return false;
         if (!field.is(index, type))
             return false;
@@ -507,8 +506,8 @@ bool GridImp::cellContainsOnly(Cell &cell, char type) const
 bool GridImp::cellContainsOnly(Cell &cell, char typeA, char typeB) const
 {
     for (const auto point : cell) {
-		uint index = transCoordToIndex(point.x, point.y, point.z);
-		if (index == INVALID_INDEX)
+        uint index = transCoordToIndex(point.x, point.y, point.z);
+        if (index == INVALID_INDEX)
             return false;
         if (!field.is(index, typeA) && !field.is(index, typeB))
             return false;
@@ -524,91 +523,91 @@ const Object * GridImp::getObject() const
 void GridImp::setNodeTo(Cell &cell, char type)
 {
     for (const auto point : cell) {
-		uint index = transCoordToIndex(point.x, point.y, point.z);
-		if (index == INVALID_INDEX)
-			continue;
-		field.setFieldEntry(index, type);
+        uint index = transCoordToIndex(point.x, point.y, point.z);
+        if (index == INVALID_INDEX)
+            continue;
+        field.setFieldEntry(index, type);
     }
 }
 
 void GridImp::setNodeTo(uint index, char type)
 {
-	if( index != INVALID_INDEX )
-		field.setFieldEntry(index, type);
+    if( index != INVALID_INDEX )
+        field.setFieldEntry(index, type);
 }
 
 bool GridImp::isNode(uint index, char type) const
 {
     if( index != INVALID_INDEX )
-		return field.is(index, type);
+        return field.is(index, type);
 
     throw std::runtime_error("GridImp::isNode() -> index == INVALID_INDEX not supported.");
 }
 
 bool GridImp::isValidEndOfGridStopper(uint index) const
 {
-	// Lenz: also includes corner stopper nodes
-	if (!this->field.is(index, INVALID_OUT_OF_GRID))
-		return false;
+    // Lenz: also includes corner stopper nodes
+    if (!this->field.is(index, INVALID_OUT_OF_GRID))
+        return false;
 
-	return hasNeighborOfType(index, FLUID);
+    return hasNeighborOfType(index, FLUID);
 }
 
 bool GridImp::isValidEndOfGridBoundaryStopper(uint index) const
 {
-	// Lenz: also includes corner stopper nodes
-	if (!this->field.is(index, FLUID))
-		return false;
+    // Lenz: also includes corner stopper nodes
+    if (!this->field.is(index, FLUID))
+        return false;
 
-	return ! hasAllNeighbors(index);
+    return ! hasAllNeighbors(index);
 }
 
 bool GridImp::isValidSolidStopper(uint index) const
 {
-	// Lenz: also includes corner stopper nodes
-	if (!this->field.is(index, INVALID_SOLID))
-		return false;
+    // Lenz: also includes corner stopper nodes
+    if (!this->field.is(index, INVALID_SOLID))
+        return false;
 
-	return hasNeighborOfType(index, FLUID);
+    return hasNeighborOfType(index, FLUID);
 }
 
 bool GridImp::shouldBeBoundarySolidNode(uint index) const
 {
-	if (!this->field.is(index, FLUID))
-		return false;
+    if (!this->field.is(index, FLUID))
+        return false;
 
-	return hasNeighborOfType(index, STOPPER_SOLID);
+    return hasNeighborOfType(index, STOPPER_SOLID);
 }
 
 bool GridImp::hasAllNeighbors(uint index) const
 {
-	// new version by Lenz, utilizes the range based for loop for all directions
-	real x, y, z;
-	this->transIndexToCoords(index, x, y, z);
-	for (const auto dir : this->distribution) {
-		const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
+    // new version by Lenz, utilizes the range based for loop for all directions
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+    for (const auto dir : this->distribution) {
+        const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
 
-		if (neighborIndex == INVALID_INDEX) return false;
-	}
+        if (neighborIndex == INVALID_INDEX) return false;
+    }
 
-	return true;
+    return true;
 }
 
 bool GridImp::hasNeighborOfType(uint index, char type) const
 {
-	// new version by Lenz, utilizes the range based for loop for all directions
-	real x, y, z;
-	this->transIndexToCoords(index, x, y, z);
-	for (const auto dir : this->distribution) {
-		const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
+    // new version by Lenz, utilizes the range based for loop for all directions
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+    for (const auto dir : this->distribution) {
+        const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
 
-		if (neighborIndex == INVALID_INDEX) continue;
+        if (neighborIndex == INVALID_INDEX) continue;
 
-		if (this->field.is(neighborIndex, type))
-			return true;
-	}
+        if (this->field.is(neighborIndex, type))
+            return true;
+    }
 
-	return false;
+    return false;
 }
 
 bool GridImp::nodeInNextCellIs(int index, char type) const
@@ -630,13 +629,13 @@ bool GridImp::nodeInNextCellIs(int index, char type) const
 
     const uint indexXYZ = transCoordToIndex(neighborX, neighborY, neighborZ);
 
-	const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX, type);
-	const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY, type);
-	const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY, type);
-	const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ, type);
-	const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ, type);
-	const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ, type);
-	const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
+    const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX, type);
+    const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY, type);
+    const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY, type);
+    const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ, type);
+    const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ, type);
+    const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ, type);
+    const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
 
     return typeX || typeY || typeXY || typeZ || typeYZ
         || typeXZ || typeXYZ;
@@ -661,13 +660,13 @@ bool GridImp::nodeInPreviousCellIs(int index, char type) const
 
     const uint indexXYZ = transCoordToIndex(neighborX, neighborY, neighborZ);
 
-	const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX  , type);
-	const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY  , type);
-	const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY , type);
-	const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ  , type);
-	const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ , type);
-	const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ , type);
-	const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
+    const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX  , type);
+    const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY  , type);
+    const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY , type);
+    const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ  , type);
+    const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ , type);
+    const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ , type);
+    const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
 
     return typeX || typeY || typeXY || typeZ || typeYZ
         || typeXZ || typeXYZ;
@@ -678,8 +677,8 @@ bool GridImp::nodeInCellIs(Cell& cell, char type) const
     for (const auto node : cell)
     {
         const uint index = transCoordToIndex(node.x, node.y, node.z);
-		if (index == INVALID_INDEX)
-			continue;
+        if (index == INVALID_INDEX)
+            continue;
         if (field.is(index, type))
             return true;
     }
@@ -696,9 +695,9 @@ void GridImp::setCellTo(uint index, char type)
     for (const auto node : cell)
     {
         const uint nodeIndex = transCoordToIndex(node.x, node.y, node.z);
-		if (nodeIndex == INVALID_INDEX)
-			continue;
-		this->field.setFieldEntry(nodeIndex, type);
+        if (nodeIndex == INVALID_INDEX)
+            continue;
+        this->field.setFieldEntry(nodeIndex, type);
     }
 }
 
@@ -712,10 +711,10 @@ void GridImp::setNonStopperOutOfGridCellTo(uint index, char type)
     for (const auto node : cell)
     {
         const uint nodeIndex = transCoordToIndex(node.x, node.y, node.z);
-		if (nodeIndex == INVALID_INDEX)
-			continue;
+        if (nodeIndex == INVALID_INDEX)
+            continue;
 
-        if( this->getFieldEntry( nodeIndex ) != STOPPER_OUT_OF_GRID && 
+        if( this->getFieldEntry( nodeIndex ) != STOPPER_OUT_OF_GRID &&
             this->getFieldEntry( nodeIndex ) != STOPPER_OUT_OF_GRID_BOUNDARY )
             this->field.setFieldEntry(nodeIndex, type);
     }
@@ -770,7 +769,7 @@ uint GridImp::transCoordToIndex(const real &x, const real &y, const real &z) con
     const uint yIndex = getYIndex(y);
     const uint zIndex = getZIndex(z);
 
-	if (xIndex >= nx || yIndex >= ny || zIndex >= nz)
+    if (xIndex >= nx || yIndex >= ny || zIndex >= nz)
         return INVALID_INDEX;
 
     return xIndex + nx * (yIndex + ny * zIndex);
@@ -819,20 +818,20 @@ TriangularMeshDiscretizationStrategy * GridImp::getTriangularMeshDiscretizationS
 
 uint GridImp::getNumberOfSolidBoundaryNodes() const
 {
-	return this->numberOfSolidBoundaryNodes;
+    return this->numberOfSolidBoundaryNodes;
 }
 
 void GridImp::setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes)
 {
-	if (numberOfSolidBoundaryNodes < INVALID_INDEX)
-		this->numberOfSolidBoundaryNodes = numberOfSolidBoundaryNodes;
+    if (numberOfSolidBoundaryNodes < INVALID_INDEX)
+        this->numberOfSolidBoundaryNodes = numberOfSolidBoundaryNodes;
 }
 
 real GridImp::getQValue(const uint index, const uint dir) const
 {
-	const int qIndex = dir * this->numberOfSolidBoundaryNodes + this->qIndices[index];
+    const int qIndex = dir * this->numberOfSolidBoundaryNodes + this->qIndices[index];
 
-	return this->qValues[qIndex];
+    return this->qValues[qIndex];
 }
 
 uint GridImp::getQPatch(const uint index) const
@@ -858,7 +857,7 @@ void GridImp::findSparseIndices(SPtr<Grid> finerGrid)
 {
     *logging::out << logging::Logger::INFO_INTERMEDIATE << "Find sparse indices...";
     auto fineGrid = std::static_pointer_cast<GridImp>(finerGrid);
-    
+
     this->updateSparseIndices();
 
 #pragma omp parallel for
@@ -906,7 +905,7 @@ void GridImp::updateSparseIndices()
     sparseSize = size - removedNodes;
 }
 
-void GridImp::findFluidNodeIndices(bool splitDomain) 
+void GridImp::findFluidNodeIndices(bool splitDomain)
 {
     // find sparse index of all fluid nodes
     this->fluidNodeIndices.clear();
@@ -935,7 +934,7 @@ void GridImp::findFluidNodeIndicesBorder() {
     // resize fluidNodeIndicesBorder (for better performance in copy operation)
     size_t newSize = 0;
     for (CommunicationIndices& ci : this->communicationIndices)
-        newSize += ci.sendIndices.size();    
+        newSize += ci.sendIndices.size();
     this->fluidNodeIndicesBorder.reserve(newSize);
 
     // copy all send indices to fluidNodeIndicesBorder
@@ -968,7 +967,7 @@ void GridImp::setNeighborIndices(uint index)
         this->setStopperNeighborCoords(index);
         return;
     }
-     
+
     if (this->sparseIndices[index] == -1)
         return;
 
@@ -1002,9 +1001,9 @@ void GridImp::setStopperNeighborCoords(uint index)
     if (vf::Math::lessEqual(z + delta, endZ + (0.5 * delta)) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y, z + delta)))
         neighborIndexZ[index] = getSparseIndex(x, y, z + delta);
 
-    if (vf::Math::greaterEqual(x - delta, endX) && 
-        vf::Math::greaterEqual(y - delta, endY) && 
-        vf::Math::greaterEqual(z - delta, endZ) && 
+    if (vf::Math::greaterEqual(x - delta, endX) &&
+        vf::Math::greaterEqual(y - delta, endY) &&
+        vf::Math::greaterEqual(z - delta, endZ) &&
         !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x - delta, y - delta, z - delta)))
     {
         neighborIndexNegative[index] = getSparseIndex(x - delta, y - delta, z - delta);
@@ -1035,7 +1034,7 @@ real GridImp::getNeighborCoord(bool periodicity, real startCoord, real coords[3]
             return coords[direction] + delta;
 
     }
-    
+
     return coords[direction] + delta;
 }
 
@@ -1061,7 +1060,7 @@ real GridImp::getNegativeNeighborCoord(bool periodicity, real startCoord, real c
 
         return getLastFluidNode(coords, direction, startCoord);
     }
-    
+
     return coords[direction] - delta;
 }
 
@@ -1154,15 +1153,15 @@ void GridImp::limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks
             // one layer for receive nodes and one for stoppers
             if( lbmOrGks == LBM )
                 tmpSubDomainBox.extend(this->delta);
-            
-            if (!tmpSubDomainBox.isInside(x, y, z) 
+
+            if (!tmpSubDomainBox.isInside(x, y, z)
                 && ( this->getFieldEntry(index) == FLUID ||
                      this->getFieldEntry(index) == FLUID_CFC ||
                      this->getFieldEntry(index) == FLUID_CFF ||
                      this->getFieldEntry(index) == FLUID_FCC ||
                      this->getFieldEntry(index) == FLUID_FCF ||
                      this->getFieldEntry(index) == BC_SOLID ) )
-            {   
+            {
                 this->setFieldEntry(index, STOPPER_OUT_OF_GRID_BOUNDARY);
             }
         }
@@ -1184,13 +1183,13 @@ void GridImp::limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks
 
 void GridImp::findGridInterfaceCF(uint index, GridImp& finerGrid, LbmOrGks lbmOrGks)
 {
-	if (lbmOrGks == LBM)
-	{
-		gridInterface->findInterfaceCF            (index, this, &finerGrid);
-		gridInterface->findBoundaryGridInterfaceCF(index, this, &finerGrid);
-	}
-	else if (lbmOrGks == GKS)
-		gridInterface->findInterfaceCF_GKS(index, this, &finerGrid);
+    if (lbmOrGks == LBM)
+    {
+        gridInterface->findInterfaceCF            (index, this, &finerGrid);
+        gridInterface->findBoundaryGridInterfaceCF(index, this, &finerGrid);
+    }
+    else if (lbmOrGks == GKS)
+        gridInterface->findInterfaceCF_GKS(index, this, &finerGrid);
 }
 
 void GridImp::findGridInterfaceFC(uint index, GridImp& finerGrid)
@@ -1217,16 +1216,16 @@ void GridImp::mesh(Object* object)
     if (triangularMesh)
         triangularMeshDiscretizationStrategy->discretize(triangularMesh, this, INVALID_SOLID, FLUID);
     else
-		//new method for geometric primitives (not cell based) to be implemented
+        //new method for geometric primitives (not cell based) to be implemented
         this->discretize(object, INVALID_SOLID, FLUID);
 
     this->closeNeedleCells();
 
-	#pragma omp parallel for
+    #pragma omp parallel for
     for (int index = 0; index < (int)this->size; index++)
         this->findSolidStopperNode(index);
 
-	//#pragma omp parallel for
+    //#pragma omp parallel for
     for (int index = 0; index < (int)this->size; index++) {
         this->findBoundarySolidNode(index);
     }
@@ -1359,7 +1358,7 @@ void GridImp::findQs(Object* object) //TODO: enable qs for primitive objects
         findQsPrimitive(object);
 }
 
-void GridImp::allocateQs() 
+void GridImp::allocateQs()
 {
     this->qPatches = new uint[this->getNumberOfSolidBoundaryNodes()];
 
@@ -1379,8 +1378,8 @@ void GridImp::findQs(TriangularMesh &triangularMesh)
 
     if( this->qComputationStage == qComputationStageType::ComputeQs )
         allocateQs();
-    
-    
+
+
 #pragma omp parallel for
     for (int i = 0; i < triangularMesh.size; i++)
         this->findQs(triangularMesh.triangles[i]);
@@ -1406,15 +1405,15 @@ void GridImp::findQs(Triangle &triangle)
                 //if (!field.isFluid(index))
                 //    continue;
 
-				if( index == INVALID_INDEX ) continue;
+                if( index == INVALID_INDEX ) continue;
 
                 const Vertex point(x, y, z);
 
                 if( this->qComputationStage == qComputationStageType::ComputeQs ){
                     if(this->field.is(index, BC_SOLID))
                     {
-					    calculateQs(index, point, triangle);
-				    }
+                        calculateQs(index, point, triangle);
+                    }
                 }
                 else if( this->qComputationStage == qComputationStageType::FindSolidBoundaryNodes )
                 {
@@ -1449,14 +1448,14 @@ void GridImp::findQsPrimitive(Object * object)
         real x,y,z;
 
         this->transIndexToCoords(index,x,y,z);
-        
+
         const Vertex point(x, y, z);
 
         if( this->qComputationStage == qComputationStageType::ComputeQs ){
             if(this->field.is(index, BC_SOLID))
             {
-				calculateQs(index, point, object);
-			}
+                calculateQs(index, point, object);
+            }
         }
         else if( this->qComputationStage == qComputationStageType::FindSolidBoundaryNodes )
         {
@@ -1477,66 +1476,66 @@ void GridImp::calculateQs(const uint index, const Vertex &point, Object* object)
 {
     Vertex pointOnTriangle, direction;
 
-	real subdistance;
-	int error;
-	for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
-	{
-		direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]), 
+    real subdistance;
+    int error;
+    for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
+    {
+        direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]),
                             real(distribution.dirs[i * DIMENSION + 1]),
-			                real(distribution.dirs[i * DIMENSION + 2]) );
+                            real(distribution.dirs[i * DIMENSION + 2]) );
 
-		uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
-													    point.y + direction.y * this->delta,
-													    point.z + direction.z * this->delta);
+        uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
+                                                        point.y + direction.y * this->delta,
+                                                        point.z + direction.z * this->delta);
 
-		if (neighborIndex == INVALID_INDEX) continue;
+        if (neighborIndex == INVALID_INDEX) continue;
 
-		error = object->getIntersection(point, direction, pointOnTriangle, subdistance);
+        error = object->getIntersection(point, direction, pointOnTriangle, subdistance);
 
-		subdistance /= this->delta;
+        subdistance /= this->delta;
 
-		if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
-		{
-			if ( -0.5        > this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] ||
+        if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
+        {
+            if ( -0.5        > this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] ||
                     subdistance < this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] )
-			{
+            {
+
+                this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] = subdistance;
 
-				this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] = subdistance;
-                    
                 this->qPatches[ this->qIndices[index] ] = 0;
 
-			}
-		}
-	}
+            }
+        }
+    }
 }
 
 bool GridImp::checkIfAtLeastOneValidQ(const uint index, const Vertex &point, Object* object) const
 {
     Vertex pointOnTriangle, direction;
 
-	real subdistance;
-	int error;
-	for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
-	{
-		direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]), 
+    real subdistance;
+    int error;
+    for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
+    {
+        direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]),
                             real(distribution.dirs[i * DIMENSION + 1]),
-			                real(distribution.dirs[i * DIMENSION + 2]) );
+                            real(distribution.dirs[i * DIMENSION + 2]) );
 
-		uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
-													 point.y + direction.y * this->delta,
-													 point.z + direction.z * this->delta);
+        uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
+                                                     point.y + direction.y * this->delta,
+                                                     point.z + direction.z * this->delta);
 
-		if (neighborIndex == INVALID_INDEX) continue;
+        if (neighborIndex == INVALID_INDEX) continue;
 
-		error = object->getIntersection(point, direction, pointOnTriangle, subdistance);
+        error = object->getIntersection(point, direction, pointOnTriangle, subdistance);
 
-		subdistance /= this->delta;
+        subdistance /= this->delta;
 
-		if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
-		{
-			return true;
-		}
-	}
+        if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
+        {
+            return true;
+        }
+    }
     return false;
 }
 
@@ -1565,7 +1564,7 @@ void GridImp::calculateQs(const Vertex &point, const Triangle &triangle) const
 
         error = triangle.getTriangleIntersection(point, direction, pointOnTriangle, subdistance);
 
-		subdistance /= this->delta;
+        subdistance /= this->delta;
 
         if (error == 0 && subdistance < 1.0 && subdistance > 0.0)
         {
@@ -1577,71 +1576,71 @@ void GridImp::calculateQs(const Vertex &point, const Triangle &triangle) const
 
 void GridImp::calculateQs(const uint index, const Vertex &point, const Triangle &triangle) const
 {
-	Vertex pointOnTriangle, direction;
-	real subdistance;
-	int error;
-	for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
-	{
+    Vertex pointOnTriangle, direction;
+    real subdistance;
+    int error;
+    for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
+    {
 #if defined(__CUDA_ARCH__)
-		direction = Vertex(DIRECTIONS[i][0], DIRECTIONS[i][1], DIRECTIONS[i][2]);
+        direction = Vertex(DIRECTIONS[i][0], DIRECTIONS[i][1], DIRECTIONS[i][2]);
 #else
-		direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]), 
+        direction = Vertex( real(distribution.dirs[i * DIMENSION + 0]),
                             real(distribution.dirs[i * DIMENSION + 1]),
-			                real(distribution.dirs[i * DIMENSION + 2]) );
+                            real(distribution.dirs[i * DIMENSION + 2]) );
 #endif
 
-		uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
-													 point.y + direction.y * this->delta,
-													 point.z + direction.z * this->delta);
+        uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
+                                                     point.y + direction.y * this->delta,
+                                                     point.z + direction.z * this->delta);
 
-		if (neighborIndex == INVALID_INDEX) continue;
+        if (neighborIndex == INVALID_INDEX) continue;
 
-		error = triangle.getTriangleIntersection(point, direction, pointOnTriangle, subdistance);
+        error = triangle.getTriangleIntersection(point, direction, pointOnTriangle, subdistance);
 
-		subdistance /= this->delta;
+        subdistance /= this->delta;
 
-		if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
-		{
-			if ( -0.5        > this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] ||
+        if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
+        {
+            if ( -0.5        > this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] ||
                  subdistance < this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] )
-			{
-				this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] = subdistance;
+            {
+                this->qValues[i*this->numberOfSolidBoundaryNodes + this->qIndices[index]] = subdistance;
 
                 this->qPatches[ this->qIndices[index] ] = triangle.patchIndex;
-			}
-		}
-	}
+            }
+        }
+    }
 }
 
 bool GridImp::checkIfAtLeastOneValidQ(const uint index, const Vertex & point, const Triangle & triangle) const
 {
-	Vertex pointOnTriangle, direction;
-	real subdistance;
-	int error;
-	for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
-	{
+    Vertex pointOnTriangle, direction;
+    real subdistance;
+    int error;
+    for (int i = distribution.dir_start; i <= distribution.dir_end; i++)
+    {
 #if defined(__CUDA_ARCH__)
-		direction = Vertex(DIRECTIONS[i][0], DIRECTIONS[i][1], DIRECTIONS[i][2]);
+        direction = Vertex(DIRECTIONS[i][0], DIRECTIONS[i][1], DIRECTIONS[i][2]);
 #else
-		direction = Vertex(real(distribution.dirs[i * DIMENSION + 0]), 
+        direction = Vertex(real(distribution.dirs[i * DIMENSION + 0]),
                            real(distribution.dirs[i * DIMENSION + 1]),
-			               real(distribution.dirs[i * DIMENSION + 2]));
+                           real(distribution.dirs[i * DIMENSION + 2]));
 #endif
 
-		uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
-													 point.y + direction.y * this->delta,
-													 point.z + direction.z * this->delta);
-		if (neighborIndex == INVALID_INDEX) continue;
+        uint neighborIndex = this->transCoordToIndex(point.x + direction.x * this->delta,
+                                                     point.y + direction.y * this->delta,
+                                                     point.z + direction.z * this->delta);
+        if (neighborIndex == INVALID_INDEX) continue;
 
-		error = triangle.getTriangleIntersection(point, direction, pointOnTriangle, subdistance);
+        error = triangle.getTriangleIntersection(point, direction, pointOnTriangle, subdistance);
 
-		subdistance /= this->delta;
+        subdistance /= this->delta;
 
-		if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
-		{
-			return true;
-		}
-	}
+        if (error == 0 && vf::Math::lessEqual(subdistance, 1.0) && vf::Math::greaterEqual(subdistance, 0.0))
+        {
+            return true;
+        }
+    }
     return false;
 }
 
@@ -1670,13 +1669,13 @@ void GridImp::findCommunicationIndices(int direction, SPtr<BoundingBox> subDomai
 
 void GridImp::findCommunicationIndex( uint index, real coordinate, real limit, int direction ){
     // negative direction get a negative sign
-    real s = ( direction % 2 == 0 ) ? ( -1.0 ) : ( 1.0 );  
+    real s = ( direction % 2 == 0 ) ? ( -1.0 ) : ( 1.0 );
 
-	if (std::abs(coordinate - (limit + s * 0.5 * this->delta)) < 0.1 * this->delta)
-		this->communicationIndices[direction].receiveIndices.push_back(index);
+    if (std::abs(coordinate - (limit + s * 0.5 * this->delta)) < 0.1 * this->delta)
+        this->communicationIndices[direction].receiveIndices.push_back(index);
 
-	if (std::abs(coordinate - (limit - s * 0.5 * this->delta)) < 0.1 * this->delta) 
-		this->communicationIndices[direction].sendIndices.push_back(index);
+    if (std::abs(coordinate - (limit - s * 0.5 * this->delta)) < 0.1 * this->delta)
+        this->communicationIndices[direction].sendIndices.push_back(index);
 }
 
 bool GridImp::isSendNode(int index) const
@@ -1722,14 +1721,14 @@ uint GridImp::getReceiveIndex(int direction, uint index)
 
 void GridImp::repairCommunicationIndices(int direction)
 {
-    this->communicationIndices[direction].sendIndices.insert( this->communicationIndices[direction].sendIndices.end(), 
-                                                              this->communicationIndices[direction+1].sendIndices.begin(), 
+    this->communicationIndices[direction].sendIndices.insert( this->communicationIndices[direction].sendIndices.end(),
+                                                              this->communicationIndices[direction+1].sendIndices.begin(),
                                                               this->communicationIndices[direction+1].sendIndices.end() );
 
 
 
-    this->communicationIndices[direction+1].receiveIndices.insert( this->communicationIndices[direction+1].receiveIndices.end(), 
-                                                                 this->communicationIndices[direction].receiveIndices.begin(), 
+    this->communicationIndices[direction+1].receiveIndices.insert( this->communicationIndices[direction+1].receiveIndices.end(),
+                                                                 this->communicationIndices[direction].receiveIndices.begin(),
                                                                  this->communicationIndices[direction].receiveIndices.end() );
 
     this->communicationIndices[direction].receiveIndices = this->communicationIndices[direction+1].receiveIndices;
@@ -1834,19 +1833,19 @@ real GridImp::getMaximumOnNodes(const real &maxExact, const real &decimalStart,
     return maxNode;
 }
 
-uint GridImp::getXIndex(real x) const 
-{ 
-    return std::lround((x - startX) / delta); 
+uint GridImp::getXIndex(real x) const
+{
+    return std::lround((x - startX) / delta);
 }
 
 uint GridImp::getYIndex(real y) const
-{ 
-    return std::lround((y - startY) / delta); 
+{
+    return std::lround((y - startY) / delta);
 }
 
 uint GridImp::getZIndex(real z) const
-{ 
-    return std::lround((z - startZ) / delta); 
+{
+    return std::lround((z - startZ) / delta);
 }
 
 real GridImp::getDelta() const
@@ -1861,11 +1860,11 @@ uint GridImp::getSize() const
 
 uint GridImp::getSparseSize() const
 {
-    return this->sparseSize; 
+    return this->sparseSize;
 }
 
-uint GridImp::getNumberOfFluidNodes() const { 
-    return (uint)this->fluidNodeIndices.size(); 
+uint GridImp::getNumberOfFluidNodes() const {
+    return (uint)this->fluidNodeIndices.size();
 }
 
 Field GridImp::getField() const
@@ -2058,18 +2057,18 @@ void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *n
     }
 }
 
-void GridImp::getFluidNodeIndices(uint *fluidNodeIndices) const 
-{ 
+void GridImp::getFluidNodeIndices(uint *fluidNodeIndices) const
+{
     for (uint nodeNumber = 0; nodeNumber < (uint)this->fluidNodeIndices.size(); nodeNumber++)
         fluidNodeIndices[nodeNumber] = this->fluidNodeIndices[nodeNumber];
 }
 
-uint GridImp::getNumberOfFluidNodesBorder() const 
-{ 
-    return (uint)this->fluidNodeIndicesBorder.size(); 
+uint GridImp::getNumberOfFluidNodesBorder() const
+{
+    return (uint)this->fluidNodeIndicesBorder.size();
 }
 
-void GridImp::getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const 
+void GridImp::getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const
 {
     for (uint nodeNumber = 0; nodeNumber < (uint)this->fluidNodeIndicesBorder.size(); nodeNumber++)
         fluidNodeIndicesBorder[nodeNumber] = this->fluidNodeIndicesBorder[nodeNumber];
@@ -2083,14 +2082,14 @@ void GridImp::addFluidNodeIndicesMacroVars(std::vector<uint> _fluidNodeIndicesMa
 }
 
 void GridImp::addFluidNodeIndicesApplyBodyForce(std::vector<uint> _fluidNodeIndicesApplyBodyForce)
-{    
-    
+{
+
     size_t newSize = this->fluidNodeIndicesApplyBodyForce.size()+_fluidNodeIndicesApplyBodyForce.size();
     this->fluidNodeIndicesApplyBodyForce.reserve(newSize);
     std::copy(_fluidNodeIndicesApplyBodyForce.begin(), _fluidNodeIndicesApplyBodyForce.end(), std::back_inserter(this->fluidNodeIndicesApplyBodyForce));
 }
 
-void GridImp::addFluidNodeIndicesAllFeatures(std::vector<uint> _fluidNodeIndicesAllFeatures) 
+void GridImp::addFluidNodeIndicesAllFeatures(std::vector<uint> _fluidNodeIndicesAllFeatures)
 {
 
     size_t newSize = this->fluidNodeIndicesAllFeatures.size()+_fluidNodeIndicesAllFeatures.size();
@@ -2109,14 +2108,14 @@ void GridImp::sortFluidNodeIndicesMacroVars()
          // Remove indices of fluidNodeIndicesAllFeatures from fluidNodeIndicesMacroVars
         if(this->fluidNodeIndicesAllFeatures.size()>0)
         {
-            this->fluidNodeIndicesMacroVars.erase(   std::remove_if(   this->fluidNodeIndicesMacroVars.begin(), this->fluidNodeIndicesMacroVars.end(), 
+            this->fluidNodeIndicesMacroVars.erase(   std::remove_if(   this->fluidNodeIndicesMacroVars.begin(), this->fluidNodeIndicesMacroVars.end(),
                                                         [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ),
                                             this->fluidNodeIndicesMacroVars.end()
                                         );
         }
 
         // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices
-        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), 
+        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(),
                                                         [&](auto x){return binary_search(fluidNodeIndicesMacroVars.begin(),fluidNodeIndicesMacroVars.end(),x);} ),
                                         this->fluidNodeIndices.end()
                                     );
@@ -2134,14 +2133,14 @@ void GridImp::sortFluidNodeIndicesApplyBodyForce()
          // Remove indices of fluidNodeIndicesAllFeatures from fluidNodeIndicesMacroVars
         if(this->fluidNodeIndicesAllFeatures.size()>0)
         {
-            this->fluidNodeIndicesApplyBodyForce.erase(   std::remove_if(   this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end(), 
+            this->fluidNodeIndicesApplyBodyForce.erase(   std::remove_if(   this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end(),
                                                         [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ),
                                             this->fluidNodeIndicesApplyBodyForce.end()
                                         );
         }
 
         // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices
-        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), 
+        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(),
                                                         [&](auto x){return binary_search(fluidNodeIndicesApplyBodyForce.begin(),fluidNodeIndicesApplyBodyForce.end(),x);} ),
                                         this->fluidNodeIndices.end()
                                     );
@@ -2156,34 +2155,34 @@ void GridImp::sortFluidNodeIndicesAllFeatures()
         // Remove duplicates
         this->fluidNodeIndicesAllFeatures.erase( unique( this->fluidNodeIndicesAllFeatures.begin(), this->fluidNodeIndicesAllFeatures.end() ), this->fluidNodeIndicesAllFeatures.end() );
         // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices
-        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), 
+        this->fluidNodeIndices.erase(   std::remove_if(   this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(),
                                                         [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ),
                                         this->fluidNodeIndices.end()
                                     );
     }
 }
 
-uint GridImp::getNumberOfFluidNodeIndicesMacroVars() const { 
-    return (uint)this->fluidNodeIndicesMacroVars.size(); 
+uint GridImp::getNumberOfFluidNodeIndicesMacroVars() const {
+    return (uint)this->fluidNodeIndicesMacroVars.size();
 }
 
-uint GridImp::getNumberOfFluidNodeIndicesApplyBodyForce() const { 
-    return (uint)this->fluidNodeIndicesApplyBodyForce.size(); 
+uint GridImp::getNumberOfFluidNodeIndicesApplyBodyForce() const {
+    return (uint)this->fluidNodeIndicesApplyBodyForce.size();
 }
 
-uint GridImp::getNumberOfFluidNodeIndicesAllFeatures() const { 
-    return (uint)this->fluidNodeIndicesAllFeatures.size(); 
+uint GridImp::getNumberOfFluidNodeIndicesAllFeatures() const {
+    return (uint)this->fluidNodeIndicesAllFeatures.size();
 }
 
-void GridImp::getFluidNodeIndicesMacroVars(uint *_fluidNodeIndicesMacroVars) const 
+void GridImp::getFluidNodeIndicesMacroVars(uint *_fluidNodeIndicesMacroVars) const
 {
-    std::copy(fluidNodeIndicesMacroVars.begin(), fluidNodeIndicesMacroVars.end(), _fluidNodeIndicesMacroVars);       
+    std::copy(fluidNodeIndicesMacroVars.begin(), fluidNodeIndicesMacroVars.end(), _fluidNodeIndicesMacroVars);
 }
-void GridImp::getFluidNodeIndicesApplyBodyForce(uint *_fluidNodeIndicesApplyBodyForce) const 
+void GridImp::getFluidNodeIndicesApplyBodyForce(uint *_fluidNodeIndicesApplyBodyForce) const
 {
     std::copy(fluidNodeIndicesApplyBodyForce.begin(), fluidNodeIndicesApplyBodyForce.end(), _fluidNodeIndicesApplyBodyForce);
 }
-void GridImp::getFluidNodeIndicesAllFeatures(uint *_fluidNodeIndicesAllFeatures) const 
+void GridImp::getFluidNodeIndicesAllFeatures(uint *_fluidNodeIndicesAllFeatures) const
 {
     std::copy(fluidNodeIndicesAllFeatures.begin(), fluidNodeIndicesAllFeatures.end(), _fluidNodeIndicesAllFeatures);
 }
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h
index 42ba7a464..4c50d458c 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h
@@ -30,7 +30,7 @@ public:
     virtual void allocArrays_OffsetScale() = 0;
     virtual void allocArrays_taggedFluidNodes() = 0;
 
-    virtual void tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices, CollisionTemplate tag, uint level) = 0;
+    virtual void tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level) = 0;
     virtual void sortFluidNodeTags() = 0;
 
 	virtual void setDimensions() = 0;
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp
index 793400869..66af0d1c4 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp
@@ -74,11 +74,11 @@ void GridReader::allocArrays_CoordNeighborGeo()
 	uint numberOfNodesGlobal = 0;
 	std::cout << "Number of Nodes: " << std::endl;
 
-	for (uint level = 0; level <= maxLevel; level++) 
-	{		
-		int numberOfNodesPerLevel = coordX.getSize(level) + 1;
-		numberOfNodesGlobal += numberOfNodesPerLevel;
-		std::cout << "Level " << level << " = " << numberOfNodesPerLevel << " Nodes" << std::endl;
+    for (uint level = 0; level <= maxLevel; level++)
+    {
+        int numberOfNodesPerLevel = coordX.getSize(level) + 1;
+        numberOfNodesGlobal += numberOfNodesPerLevel;
+        std::cout << "Level " << level << " = " << numberOfNodesPerLevel << " Nodes" << std::endl;
 
 		setNumberOfNodes(numberOfNodesPerLevel, level);
 
@@ -130,9 +130,9 @@ void GridReader::allocArrays_BoundaryValues()
 
     for (uint i = 0; i < channelBoundaryConditions.size(); i++)
     {
-        if (     this->channelBoundaryConditions[i] == "velocity") { fillVelocityVectors(i); } 
-		else if (this->channelBoundaryConditions[i] == "pressure") { setPressureValues(i); } 
-		else if (this->channelBoundaryConditions[i] == "outflow")  { setOutflowValues(i);  }
+        if (     this->channelBoundaryConditions[i] == "velocity") { fillVelocityVectors(i); }
+        else if (this->channelBoundaryConditions[i] == "pressure") { setPressureValues(i); }
+        else if (this->channelBoundaryConditions[i] == "outflow")  { setOutflowValues(i);  }
     }
 
 	setVelocityValues();
@@ -223,13 +223,13 @@ void GridReader::allocArrays_taggedFluidNodes() {
 	// TODO
 }
 
-void GridReader::tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices, CollisionTemplate tag, uint level){
-	std::cout << "GridReader::tagFluidNodeIndices not implemented" << std::endl;
+void GridReader::tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level){
+    std::cout << "GridReader::tagFluidNodeIndices not implemented" << std::endl;
     // TODO
 }
 
 void GridReader::sortFluidNodeTags(){
-	std::cout << "GridReader::sortFluidNodeTags not implemented" << std::endl;
+    std::cout << "GridReader::sortFluidNodeTags not implemented" << std::endl;
     // TODO
 }
 
@@ -285,23 +285,23 @@ void GridReader::fillVelocityVectors(int channelSide)
 			delete[] veloX_ValuesPerSide;
             delete[] veloY_ValuesPerSide;
             delete[] veloZ_ValuesPerSide;
-        }        
-	}
+        }
+    }
 
 
 }
 
-void GridReader::setVelocityValues() { 
+void GridReader::setVelocityValues() {
     for (int level = 0; level < (int)(velocityX_BCvalues.size()); level++) {
-        
-		int sizePerLevel = (int) velocityX_BCvalues[level].size();
+
+        int sizePerLevel = (int) velocityX_BCvalues[level].size();
         std::cout << "complete size velocity level " << level << " : " << sizePerLevel << std::endl;
         setVelocitySizePerLevel(level, sizePerLevel);
-        
-		if (sizePerLevel > 1) {
+
+        if (sizePerLevel > 1) {
             cudaMemoryManager->cudaAllocVeloBC(level);
             setVelocity(level, sizePerLevel);
-			cudaMemoryManager->cudaCopyVeloBC(level);
+            cudaMemoryManager->cudaCopyVeloBC(level);
         }
     }
 }
@@ -672,8 +672,8 @@ void GridReader::modifyQElement(std::shared_ptr<BoundaryQs> boundaryQ, unsigned
 /*------------------------------------------------------------------------------------------------*/
 /*---------------------------------------private q methods----------------------------------------*/
 /*------------------------------------------------------------------------------------------------*/
-void GridReader::initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &Qs, std::vector<std::vector<int>> &index, 
-										std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const
+void GridReader::initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &Qs, std::vector<std::vector<int>> &index,
+                                        std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const
 {
     boundaryQ->setValuesInVector(Qs, level);
     boundaryQ->setIndexInVector(index, level);
@@ -689,7 +689,7 @@ void GridReader::copyVectorsToQStruct(std::vector<std::vector<real>> &Qs,
 
 	for (int direction = 0; direction < para->getD3Qxx(); direction++) {
         for (size_t indexQ = 0; indexQ < sizeOfValues; indexQ++) {
-            qTemp.q27[direction][indexQ] = Qs[direction][indexQ]; 
+            qTemp.q27[direction][indexQ] = Qs[direction][indexQ];
         }
     }
 
@@ -851,46 +851,46 @@ void GridReader::setBoundingBox()
 
 void GridReader::initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex,  std::string boundaryCondition)
 {
-	std::vector<unsigned int>neighVec;
-	std::vector<unsigned int>indexVec;
-	
-	int counter = 0;
-
-	for(unsigned int i=0; i<neighX->getLevel();i++) {
-		if(boundaryCondition =="periodic_y"){
-			neighVec = neighY->getVec(i);
-		} 
-		else if(boundaryCondition =="periodic_x"){
-			neighVec = neighX->getVec(i);
-		}
-		else if(boundaryCondition =="periodic_z"){
-			neighVec = neighZ->getVec(i);
-		}
-		else {
-			std::cout << "wrong String in periodicValue" << std::endl;
-			exit(1);
-		}
+    std::vector<unsigned int>neighVec;
+    std::vector<unsigned int>indexVec;
 
-		for (std::vector<unsigned int>::iterator it = periodIndex[i].begin(); it != periodIndex[i].end(); it++) {
-			if(periodV[i][0][counter] != 0) {
-				neighVec[*it]=periodV[i][0][counter];
-			}
+    int counter = 0;
 
-			counter++;
-		}
+    for(unsigned int i=0; i<neighX->getLevel();i++) {
+        if(boundaryCondition =="periodic_y"){
+            neighVec = neighY->getVec(i);
+        }
+        else if(boundaryCondition =="periodic_x"){
+            neighVec = neighX->getVec(i);
+        }
+        else if(boundaryCondition =="periodic_z"){
+            neighVec = neighZ->getVec(i);
+        }
+        else {
+            std::cout << "wrong String in periodicValue" << std::endl;
+            exit(1);
+        }
 
+        for (std::vector<unsigned int>::iterator it = periodIndex[i].begin(); it != periodIndex[i].end(); it++) {
+            if(periodV[i][0][counter] != 0) {
+                neighVec[*it]=periodV[i][0][counter];
+            }
 
-		if(boundaryCondition =="periodic_y"){
-			neighY->setVec(i, neighVec);
-		} 
-		else if(boundaryCondition =="periodic_x"){
-			neighX->setVec(i, neighVec);
-		}
-		else if(boundaryCondition =="periodic_z"){
-			neighZ->setVec(i, neighVec);
-		}
+            counter++;
+        }
 
-	}
+
+        if(boundaryCondition =="periodic_y"){
+            neighY->setVec(i, neighVec);
+        }
+        else if(boundaryCondition =="periodic_x"){
+            neighX->setVec(i, neighVec);
+        }
+        else if(boundaryCondition =="periodic_z"){
+            neighZ->setVec(i, neighVec);
+        }
+
+    }
 }
 
 void GridReader::makeReader(std::shared_ptr<Parameter> para)
@@ -921,9 +921,9 @@ void GridReader::makeReader(std::vector<std::shared_ptr<BoundaryQs> > &BC_Qs, st
 
 void GridReader::setChannelBoundaryCondition()
 {
-	for (std::size_t i = 0; i < channelDirections.size(); i++)
-	{
-		this->channelBoundaryConditions[i] = BC_Values[i]->getBoundaryCondition();
-		std::cout << this->channelDirections[i] << " Boundary: " << channelBoundaryConditions[i] << std::endl;
-	}
-}
\ No newline at end of file
+    for (std::size_t i = 0; i < channelDirections.size(); i++)
+    {
+        this->channelBoundaryConditions[i] = BC_Values[i]->getBoundaryCondition();
+        std::cout << this->channelDirections[i] << " Boundary: " << channelBoundaryConditions[i] << std::endl;
+    }
+}
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h
index 2c17c2802..041d2c3ce 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h
@@ -3,9 +3,9 @@
 
 #include "../GridProvider.h"
 
-#include <vector>
-#include <string>
 #include <memory>
+#include <string>
+#include <vector>
 
 #include "LBM/LB.h"
 
@@ -16,15 +16,14 @@ class BoundaryValues;
 class BoundaryQs;
 class CoordNeighborGeoV;
 
-class VIRTUALFLUIDS_GPU_EXPORT GridReader
-	: public GridProvider
+class VIRTUALFLUIDS_GPU_EXPORT GridReader : public GridProvider
 {
 private:
-	bool binaer;
-	std::vector<std::string> channelDirections;
-	std::vector<std::string> channelBoundaryConditions;
-	std::shared_ptr<CoordNeighborGeoV> neighX, neighY, neighZ, neighWSB;
-	std::vector<std::shared_ptr<BoundaryValues> > BC_Values;
+    bool binaer;
+    std::vector<std::string> channelDirections;
+    std::vector<std::string> channelBoundaryConditions;
+    std::shared_ptr<CoordNeighborGeoV> neighX, neighY, neighZ, neighWSB;
+    std::vector<std::shared_ptr<BoundaryValues>> BC_Values;
 
     std::vector<std::vector<real>> velocityX_BCvalues, velocityY_BCvalues, velocityZ_BCvalues;
     std::vector<std::vector<std::vector<real>>> velocityQs;
@@ -34,59 +33,62 @@ private:
     std::vector<std::vector<real>> outflowBCvalues;
 
 public:
-	GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager);
-    ~GridReader();
-	void allocArrays_CoordNeighborGeo() override;
-	void allocArrays_BoundaryValues() override;
+    GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para,
+               std::shared_ptr<CudaMemoryManager> cudaMemoryManager);
+    ~GridReader() override;
+    void allocArrays_CoordNeighborGeo() override;
+    void allocArrays_BoundaryValues() override;
     void allocArrays_OffsetScale() override;
     void allocArrays_taggedFluidNodes() override;
 
-	void tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
-	void sortFluidNodeTags() override;
+    void tagFluidNodeIndices(const std::vector<uint> &taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
 
-	void initalValuesDomainDecompostion(int level);
+    void sortFluidNodeTags() override;
 
-	void setChannelBoundaryCondition();
+    void initalValuesDomainDecompostion(int level);
 
-	void allocArrays_BoundaryQs() override;
-	bool getBinaer();
-	void setDimensions() override;
-	void setBoundingBox() override;
-	void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) override;
+    void setChannelBoundaryCondition();
+
+    void allocArrays_BoundaryQs() override;
+    bool getBinaer();
+    void setDimensions() override;
+    void setBoundingBox() override;
+    void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int>>> periodV,
+                           std::vector<std::vector<unsigned int>> periodIndex, std::string way) override;
 
 private:
-	void makeReader(std::shared_ptr<Parameter> para);
-	void makeReader(std::vector<std::shared_ptr<BoundaryQs> > &BC_Qs, std::shared_ptr<Parameter> para);
+    void makeReader(std::shared_ptr<Parameter> para);
+    void makeReader(std::vector<std::shared_ptr<BoundaryQs>> &BC_Qs, std::shared_ptr<Parameter> para);
 
-	void setPressureValues(int channelSide) const;
-	void setPressRhoBC(int sizePerLevel, int level, int channelSide) const;
+    void setPressureValues(int channelSide) const;
+    void setPressRhoBC(int sizePerLevel, int level, int channelSide) const;
 
-	void fillVelocityVectors(int channelSide);
+    void fillVelocityVectors(int channelSide);
     void setVelocityValues();
-	void setVelocity(int level, int sizePerLevel) const;
-
-	void setOutflowValues(int channelSide) const;
-	void setOutflow(int level, int sizePerLevel, int channelSide) const;
+    void setVelocity(int level, int sizePerLevel) const;
 
+    void setOutflowValues(int channelSide) const;
+    void setOutflow(int level, int sizePerLevel, int channelSide) const;
 
-	//void fillVelocityQVectors(int channelSide);
+    // void fillVelocityQVectors(int channelSide);
     void setPressQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
-	void setVelocityQs(std::shared_ptr<BoundaryQs> boundaryQ);
-	void setOutflowQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
-	void setNoSlipQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
-	void setGeoQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
-	void modifyQElement(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+    void setVelocityQs(std::shared_ptr<BoundaryQs> boundaryQ);
+    void setOutflowQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
+    void setNoSlipQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
+    void setGeoQs(std::shared_ptr<BoundaryQs> boundaryQ) const;
+    void modifyQElement(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
 
-	void initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &Qs, std::vector<std::vector<int>> &index,
+    void initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &Qs, std::vector<std::vector<int>> &index,
                                 std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
     void copyVectorsToQStruct(std::vector<std::vector<real>> &Qs, std::vector<int> &index,
                               QforBoundaryConditions &Q) const;
     void initalQStruct(QforBoundaryConditions &Q, std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
-	void printQSize(std::string bc, std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
-	void setSizeNoSlip(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
-	void setSizeGeoQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
-	void setQ27Size(QforBoundaryConditions &Q, real* QQ, unsigned int sizeQ) const;
-	bool hasQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+    void printQSize(std::string bc, std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+    void setSizeNoSlip(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+    void setSizeGeoQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+    void setQ27Size(QforBoundaryConditions &Q, real *QQ, unsigned int sizeQ) const;
+    bool hasQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const;
+
 public:
     void initalGridInformations() override;
 };
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index d89f4cd85..d14973be7 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -20,13 +20,15 @@
 
 using namespace vf::lbm::dir;
 
-GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator):
-    mpiProcessID(communicator.getPID()), builder(builder)
+GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para,
+                             std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator &communicator)
+    : mpiProcessID(communicator.getPID()), builder(builder)
 {
     this->para = para;
     this->cudaMemoryManager = cudaMemoryManager;
     this->indexRearrangement = std::make_unique<IndexRearrangementForStreams>(para, builder, communicator);
-    this->interpolationGrouper = std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder);
+    this->interpolationGrouper =
+        std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder);
 }
 
 GridGenerator::~GridGenerator() = default;
@@ -59,15 +61,15 @@ void GridGenerator::allocArrays_CoordNeighborGeo()
     std::cout << "Number of Level: " << numberOfLevels << std::endl;
     int numberOfNodesGlobal = 0;
     std::cout << "Number of Nodes: " << std::endl;
-    
-    for (uint level = 0; level < numberOfLevels; level++) 
+
+    for (uint level = 0; level < numberOfLevels; level++)
     {
         const int numberOfNodesPerLevel = builder->getNumberOfNodes(level) + 1;
         numberOfNodesGlobal += numberOfNodesPerLevel;
         std::cout << "Level " << level << " = " << numberOfNodesPerLevel << " Nodes" << std::endl;
-    
+
         setNumberOfNodes(numberOfNodesPerLevel, level);
-    
+
         cudaMemoryManager->cudaAllocCoord(level);
         cudaMemoryManager->cudaAllocSP(level);
         //cudaMemoryManager->cudaAllocF3SP(level);
@@ -75,7 +77,7 @@ void GridGenerator::allocArrays_CoordNeighborGeo()
 
         if(para->getUseTurbulentViscosity())
             cudaMemoryManager->cudaAllocTurbulentViscosity(level);
-        
+
         if(para->getIsBodyForce())
             cudaMemoryManager->cudaAllocBodyForce(level);
 
@@ -106,7 +108,7 @@ void GridGenerator::allocArrays_CoordNeighborGeo()
 
 void GridGenerator::allocArrays_taggedFluidNodes() {
 
-    for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) 
+    for (uint level = 0; level < builder->getNumberOfGridLevels(); level++)
     {
         for ( CollisionTemplate tag: all_CollisionTemplate )
         {   //TODO: Need to add CollisionTemplate to GridBuilder to allow as argument and get rid of indivual get funtions for fluid node indices... and clean up this mess
@@ -155,16 +157,16 @@ void GridGenerator::allocArrays_taggedFluidNodes() {
             }
         }
         VF_LOG_INFO("Number of tagged nodes on level {}:", level);
-        VF_LOG_INFO("Default: {}, Border: {}, WriteMacroVars: {}, ApplyBodyForce: {}, AllFeatures: {}", 
+        VF_LOG_INFO("Default: {}, Border: {}, WriteMacroVars: {}, ApplyBodyForce: {}, AllFeatures: {}",
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::SubDomainBorder],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::WriteMacroVars],
                     para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::ApplyBodyForce],
-                    para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::AllFeatures]    );        
+                    para->getParH(level)->numberOfTaggedFluidNodes[CollisionTemplate::AllFeatures]    );
     }
 }
 
-void GridGenerator::tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices, CollisionTemplate tag, uint level) {
+void GridGenerator::tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level) {
     switch(tag)
     {
         case CollisionTemplate::WriteMacroVars:
@@ -184,7 +186,7 @@ void GridGenerator::tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices
             break;
 
     }
-    
+
 }
 
 void GridGenerator::sortFluidNodeTags() {
@@ -201,7 +203,7 @@ void GridGenerator::sortFluidNodeTags() {
 void GridGenerator::allocArrays_BoundaryValues()
 {
     std::cout << "------read BoundaryValues------" << std::endl;
-    int blocks = 0;
+    int blocks;
 
     for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) {
         const auto numberOfPressureValues = int(builder->getPressureSize(level));
@@ -229,12 +231,12 @@ void GridGenerator::allocArrays_BoundaryValues()
 
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         para->getParH(level)->slipBC.numberOfBCnodes = 0;
-        if (numberOfSlipValues > 1)
-        {
+        if (numberOfSlipValues > 1) {
             blocks = (numberOfSlipValues / para->getParH(level)->numberofthreads) + 1;
             para->getParH(level)->slipBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads;
             cudaMemoryManager->cudaAllocSlipBC(level);
-            builder->getSlipValues(para->getParH(level)->slipBC.normalX, para->getParH(level)->slipBC.normalY, para->getParH(level)->slipBC.normalZ, para->getParH(level)->slipBC.k, level);
+            builder->getSlipValues(para->getParH(level)->slipBC.normalX, para->getParH(level)->slipBC.normalY,
+                                   para->getParH(level)->slipBC.normalZ, para->getParH(level)->slipBC.k, level);
             cudaMemoryManager->cudaCopySlipBC(level);
         }
         para->getParD(level)->slipBC.numberOfBCnodes = para->getParH(level)->slipBC.numberOfBCnodes;
@@ -254,11 +256,11 @@ void GridGenerator::allocArrays_BoundaryValues()
             para->getParH(level)->stressBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads;
             cudaMemoryManager->cudaAllocStressBC(level);
             cudaMemoryManager->cudaAllocWallModel(level, para->getHasWallModelMonitor());
-            builder->getStressValues(   para->getParH(level)->stressBC.normalX,  para->getParH(level)->stressBC.normalY,  para->getParH(level)->stressBC.normalZ, 
+            builder->getStressValues(   para->getParH(level)->stressBC.normalX,  para->getParH(level)->stressBC.normalY,  para->getParH(level)->stressBC.normalZ,
                                         para->getParH(level)->stressBC.Vx,       para->getParH(level)->stressBC.Vy,       para->getParH(level)->stressBC.Vz,
                                         para->getParH(level)->stressBC.Vx1,      para->getParH(level)->stressBC.Vy1,      para->getParH(level)->stressBC.Vz1,
-                                        para->getParH(level)->stressBC.k,        para->getParH(level)->stressBC.kN,       
-                                        para->getParH(level)->wallModel.samplingOffset, para->getParH(level)->wallModel.z0, 
+                                        para->getParH(level)->stressBC.k,        para->getParH(level)->stressBC.kN,
+                                        para->getParH(level)->wallModel.samplingOffset, para->getParH(level)->wallModel.z0,
                                         level);
 
             cudaMemoryManager->cudaCopyStressBC(level);
@@ -268,7 +270,7 @@ void GridGenerator::allocArrays_BoundaryValues()
         para->getParH(level)->numberOfStressBCnodesRead = para->getParH(level)->stressBC.numberOfBCnodes * para->getD3Qxx();
         para->getParD(level)->numberOfStressBCnodesRead = para->getParH(level)->stressBC.numberOfBCnodes * para->getD3Qxx();
     }
-    
+
 
     for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) {
         const auto numberOfVelocityValues = int(builder->getVelocitySize(level));
@@ -285,7 +287,8 @@ void GridGenerator::allocArrays_BoundaryValues()
             cudaMemoryManager->cudaAllocVeloBC(level);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-            builder->getVelocityValues(para->getParH(level)->velocityBC.Vx, para->getParH(level)->velocityBC.Vy, para->getParH(level)->velocityBC.Vz, para->getParH(level)->velocityBC.k, level);
+            builder->getVelocityValues(para->getParH(level)->velocityBC.Vx, para->getParH(level)->velocityBC.Vy,
+                                       para->getParH(level)->velocityBC.Vz, para->getParH(level)->velocityBC.k, level);
 
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -327,7 +330,7 @@ void GridGenerator::allocArrays_BoundaryValues()
         const auto numberOfPrecursorValues = int(builder->getPrecursorSize(level));
         *logging::out << logging::Logger::INFO_INTERMEDIATE << "size precursor level " << level << " : " << numberOfPrecursorValues << "\n";
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-        int blocks = (numberOfPrecursorValues / para->getParH(level)->numberofthreads) + 1;
+        blocks = (numberOfPrecursorValues / para->getParH(level)->numberofthreads) + 1;
         para->getParH(level)->precursorBC.sizeQ = blocks * para->getParH(level)->numberofthreads;
         para->getParD(level)->precursorBC.sizeQ = para->getParH(level)->precursorBC.sizeQ;
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -335,19 +338,19 @@ void GridGenerator::allocArrays_BoundaryValues()
         para->getParD(level)->precursorBC.numberOfBCnodes = numberOfPrecursorValues;
         para->getParH(level)->numberOfPrecursorBCnodesRead = numberOfPrecursorValues * para->getD3Qxx();
         para->getParD(level)->numberOfPrecursorBCnodesRead = numberOfPrecursorValues * para->getD3Qxx();
-        
+
         if (numberOfPrecursorValues > 1)
         {
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             cudaMemoryManager->cudaAllocPrecursorBC(level);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             builder->getPrecursorValues(
-                    para->getParH(level)->precursorBC.planeNeighbor0PP, para->getParH(level)->precursorBC.planeNeighbor0PM, 
-                    para->getParH(level)->precursorBC.planeNeighbor0MP, para->getParH(level)->precursorBC.planeNeighbor0MM, 
-                    para->getParH(level)->precursorBC.weights0PP, para->getParH(level)->precursorBC.weights0PM, 
-                    para->getParH(level)->precursorBC.weights0MP, para->getParH(level)->precursorBC.weights0MM, 
-                    para->getParH(level)->precursorBC.k, para->getParH(level)->transientBCInputFileReader, para->getParH(level)->precursorBC.numberOfPrecursorNodes, 
-                    para->getParH(level)->precursorBC.numberOfQuantities, para->getParH(level)->precursorBC.timeStepsBetweenReads, 
+                    para->getParH(level)->precursorBC.planeNeighbor0PP, para->getParH(level)->precursorBC.planeNeighbor0PM,
+                    para->getParH(level)->precursorBC.planeNeighbor0MP, para->getParH(level)->precursorBC.planeNeighbor0MM,
+                    para->getParH(level)->precursorBC.weights0PP, para->getParH(level)->precursorBC.weights0PM,
+                    para->getParH(level)->precursorBC.weights0MP, para->getParH(level)->precursorBC.weights0MM,
+                    para->getParH(level)->precursorBC.k, para->getParH(level)->transientBCInputFileReader, para->getParH(level)->precursorBC.numberOfPrecursorNodes,
+                    para->getParH(level)->precursorBC.numberOfQuantities, para->getParH(level)->precursorBC.timeStepsBetweenReads,
                     para->getParH(level)->precursorBC.velocityX, para->getParH(level)->precursorBC.velocityY, para->getParH(level)->precursorBC.velocityZ,
                     level);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -360,7 +363,9 @@ void GridGenerator::allocArrays_BoundaryValues()
 
             for(auto reader : para->getParH(level)->transientBCInputFileReader)
             {
-                if(reader->getNumberOfQuantities() != para->getParD(level)->precursorBC.numberOfQuantities) throw std::runtime_error("Number of quantities in reader and number of quantities needed for precursor don't match!");
+                if(reader->getNumberOfQuantities() != para->getParD(level)->precursorBC.numberOfQuantities)
+                    throw std::runtime_error(
+                        "Number of quantities in reader and number of quantities needed for precursor don't match!");
             }
 
             cudaMemoryManager->cudaCopyPrecursorBC(level);
@@ -368,7 +373,7 @@ void GridGenerator::allocArrays_BoundaryValues()
 
             // read first timestep of precursor into next and copy to next on device
             for(auto reader : para->getParH(level)->transientBCInputFileReader)
-            {   
+            {
                 reader->getNextData(para->getParH(level)->precursorBC.next, para->getParH(level)->precursorBC.numberOfPrecursorNodes, 0);
             }
 
@@ -382,7 +387,7 @@ void GridGenerator::allocArrays_BoundaryValues()
             //read second timestep of precursor into next and copy next to device
             real nextTime = para->getParD(level)->precursorBC.timeStepsBetweenReads*pow(2,-((real)level))*para->getTimeRatio();
             for(auto reader : para->getParH(level)->transientBCInputFileReader)
-            {   
+            {
                 reader->getNextData(para->getParH(level)->precursorBC.next, para->getParH(level)->precursorBC.numberOfPrecursorNodes, nextTime);
             }
 
@@ -398,7 +403,7 @@ void GridGenerator::allocArrays_BoundaryValues()
 
             //start usual cycle of loading, i.e. read velocities of timestep after current and copy asynchronously to device
             for(auto reader : para->getParH(level)->transientBCInputFileReader)
-            {   
+            {
                 reader->getNextData(para->getParH(level)->precursorBC.next, para->getParH(level)->precursorBC.numberOfPrecursorNodes, 2*nextTime);
             }
 
@@ -476,7 +481,7 @@ void GridGenerator::initalValuesDomainDecompostion()
     if (para->getNumprocs() < 2)
         return;
     if ((para->getNumprocs() > 1) /*&& (procNeighborsSendX.size() == procNeighborsRecvX.size())*/) {
-        
+
         // direction has to be changed in case of periodic BCs and multiple sub domains
         std::vector<int> fillOrder = { 0, 1, 2, 3, 4, 5 };
 
@@ -556,7 +561,7 @@ void GridGenerator::initalValuesDomainDecompostion()
                         builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborX[indexProcessNeighbor].index, direction,
                                                    level);
                         if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC)
-                            indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseX(level, indexProcessNeighbor, direction);             
+                            indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseX(level, indexProcessNeighbor, direction);
                         ////////////////////////////////////////////////////////////////////////////////////////
                         cudaMemoryManager->cudaCopyProcessNeighborXIndex(level, indexProcessNeighbor);
                         ////////////////////////////////////////////////////////////////////////////////////////
@@ -619,7 +624,7 @@ void GridGenerator::initalValuesDomainDecompostion()
                         ////////////////////////////////////////////////////////////////////////////////////////
                         // malloc on host and device
                         cudaMemoryManager->cudaAllocProcessNeighborY(level, indexProcessNeighbor);
-                        ////////////////////////////////////////////////////////////////////////////////////////                        
+                        ////////////////////////////////////////////////////////////////////////////////////////
                         // init index arrays
                         builder->getSendIndices(para->getParH(level)->sendProcessNeighborY[indexProcessNeighbor].index, direction, level);
                         builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborY[indexProcessNeighbor].index, direction,
@@ -638,7 +643,7 @@ void GridGenerator::initalValuesDomainDecompostion()
 
                     if (tempSend > 0) {
                         int indexProcessNeighbor = (int)para->getParH(level)->sendProcessNeighborZ.size();
-    
+
                         para->getParH(level)->sendProcessNeighborZ.emplace_back();
                         para->getParD(level)->sendProcessNeighborZ.emplace_back();
                         para->getParH(level)->recvProcessNeighborZ.emplace_back();
@@ -930,7 +935,7 @@ void GridGenerator::allocArrays_BoundaryQs()
             unsigned int sizeQ = para->getParH(i)->pressureBC.numberOfBCnodes;
             QforBoundaryConditions Q;
             getPointersToBoundaryConditions(Q, QQ, sizeQ);
-            
+
             builder->getPressureQs(Q.q27, i);
 
 
@@ -977,7 +982,7 @@ void GridGenerator::allocArrays_BoundaryQs()
             unsigned int sizeQ = para->getParH(i)->slipBC.numberOfBCnodes;
             QforBoundaryConditions Q;
             getPointersToBoundaryConditions(Q, QQ, sizeQ);
-            
+
             builder->getSlipQs(Q.q27, i);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             cudaMemoryManager->cudaCopySlipBC(i);
@@ -997,7 +1002,7 @@ void GridGenerator::allocArrays_BoundaryQs()
             unsigned int sizeQ = para->getParH(i)->stressBC.numberOfBCnodes;
             QforBoundaryConditions Q;
             getPointersToBoundaryConditions(Q, QQ, sizeQ);
-            
+
             builder->getStressQs(Q.q27, i);
             ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             cudaMemoryManager->cudaCopyStressBC(i);
@@ -1165,7 +1170,7 @@ void GridGenerator::allocArrays_BoundaryQs()
 
 void GridGenerator::allocArrays_OffsetScale()
 {
-    for (uint level = 0; level < builder->getNumberOfGridLevels() - 1; level++) 
+    for (uint level = 0; level < builder->getNumberOfGridLevels() - 1; level++)
     {
         const uint numberOfNodesPerLevelCF = builder->getNumberOfNodesCF(level);
         const uint numberOfNodesPerLevelFC = builder->getNumberOfNodesFC(level);
@@ -1204,7 +1209,7 @@ void GridGenerator::allocArrays_OffsetScale()
         builder->getOffsetCF(para->getParH(level)->offCF.xOffCF, para->getParH(level)->offCF.yOffCF, para->getParH(level)->offCF.zOffCF, level);
         builder->getOffsetFC(para->getParH(level)->offFC.xOffFC, para->getParH(level)->offFC.yOffFC, para->getParH(level)->offFC.zOffFC, level);
         builder->getGridInterfaceIndices(para->getParH(level)->intCF.ICellCFC, para->getParH(level)->intCF.ICellCFF, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.ICellFCF, level);
-        
+
         if (para->getUseStreams() || para->getNumprocs() > 1) {
             // split fine-to-coarse indices into border and bulk
             interpolationGrouper->splitFineToCoarseIntoBorderAndBulk(level);
@@ -1307,7 +1312,7 @@ std::string GridGenerator::verifyNeighborIndex(int level, int index , int &inval
 
     //std::cout << para->getParH(level)->coordinateX[1] << ", " << para->getParH(level)->coordinateY[1] << ", " << para->getParH(level)->coordinateZ[1] << std::endl;
     //std::cout << para->getParH(level)->coordinateX[para->getParH(level)->numberOfNodes - 1] << ", " << para->getParH(level)->coordinateY[para->getParH(level)->numberOfNodes - 1] << ", " << para->getParH(level)->coordinateZ[para->getParH(level)->numberOfNodes - 1] << std::endl;
-    
+
     real maxX = para->getParH(level)->coordinateX[para->getParH(level)->numberOfNodes - 1] - delta;
     real maxY = para->getParH(level)->coordinateY[para->getParH(level)->numberOfNodes - 1] - delta;
     real maxZ = para->getParH(level)->coordinateZ[para->getParH(level)->numberOfNodes - 1] - delta;
@@ -1348,8 +1353,8 @@ std::string GridGenerator::checkNeighbor(int level, real x, real y, real z, int
 
     if (!neighborValid) {
         oss << "NeighborX invalid from: (" << x << ", " << y << ", " << z << "), index: " << index << ", "
-            << direction << " neighborIndex: " << neighborIndex << 
-            ", actual neighborCoords : (" << neighborCoordX << ", " << neighborCoordY << ", " << neighborCoordZ << 
+            << direction << " neighborIndex: " << neighborIndex <<
+            ", actual neighborCoords : (" << neighborCoordX << ", " << neighborCoordY << ", " << neighborCoordZ <<
             "), expected neighborCoords : (" << neighborX << ", " << neighborY << ", " << neighborZ << ")\n";
         numberOfWrongNeihgbors++;
     }
@@ -1384,4 +1389,4 @@ void GridGenerator::getPointersToBoundaryConditions(QforBoundaryConditions& boun
     boundaryConditionStruct.q27[DIR_MMM] =  &subgridDistances[DIR_MMM * numberOfBCnodes];
     boundaryConditionStruct.q27[DIR_PMM] =  &subgridDistances[DIR_PMM * numberOfBCnodes];
     boundaryConditionStruct.q27[DIR_MPM] =  &subgridDistances[DIR_MPM * numberOfBCnodes];
-}
\ No newline at end of file
+}
diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
index cee661a0c..c97ed02a6 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
@@ -78,7 +78,7 @@ public:
     void allocArrays_OffsetScale() override;
     void allocArrays_taggedFluidNodes() override;
 
-    void tagFluidNodeIndices(std::vector<uint> taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
+    void tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level) override;
     void sortFluidNodeTags() override;
 
     virtual void setDimensions() override;
diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
index a7b22c244..567a4112e 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
+++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
@@ -53,130 +53,130 @@ __global__ void LB_Kernel_Casc_SP_MS_OHM_27(  real s9,
                                                          bool EvenOrOdd);
 
 __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27(
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* DDStart,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* DDStart,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 __global__ void LB_Kernel_Cumulant_D3Q27All4(real omega,
-														unsigned int* bcMatD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														real* DDStart,
-														int size_Mat,
-														int level,
-														real* forces,
-														bool EvenOrOdd);
+                                                        unsigned int* bcMatD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        real* DDStart,
+                                                        int size_Mat,
+                                                        int level,
+                                                        real* forces,
+                                                        bool EvenOrOdd);
 
 
 __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega,
-																unsigned int* bcMatD,
-																unsigned int* neighborX,
-																unsigned int* neighborY,
-																unsigned int* neighborZ,
-																real* DDStart,
-																int size_Mat,
-																int level,
-																real* forces,
-																bool EvenOrOdd);
+                                                                unsigned int* bcMatD,
+                                                                unsigned int* neighborX,
+                                                                unsigned int* neighborY,
+                                                                unsigned int* neighborZ,
+                                                                real* DDStart,
+                                                                int size_Mat,
+                                                                int level,
+                                                                real* forces,
+                                                                bool EvenOrOdd);
 
 
 
 __global__ void LB_Kernel_Kum_1h_SP_27(  real omega,
-													real deltaPhi,
-													real angularVelocity,
-													unsigned int* bcMatD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													real* coordX,
-													real* coordY,
-													real* coordZ,
-													real* DDStart,
-													int size_Mat,
-													bool EvenOrOdd);
+                                                    real deltaPhi,
+                                                    real angularVelocity,
+                                                    unsigned int* bcMatD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    real* coordX,
+                                                    real* coordY,
+                                                    real* coordZ,
+                                                    real* DDStart,
+                                                    int size_Mat,
+                                                    bool EvenOrOdd);
 
 __global__ void LB_Kernel_Cascade_SP_27( real s9,
-													unsigned int* bcMatD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													real* DDStart,
-													int size_Mat,
-													bool EvenOrOdd);
+                                                    unsigned int* bcMatD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    real* DDStart,
+                                                    int size_Mat,
+                                                    bool EvenOrOdd);
 
 __global__ void LB_Kernel_Kum_New_SP_27( real s9,
-													unsigned int* bcMatD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													real* DDStart,
-													int size_Mat,
-													bool EvenOrOdd);
+                                                    unsigned int* bcMatD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    real* DDStart,
+                                                    int size_Mat,
+                                                    bool EvenOrOdd);
 
 __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega,
-														unsigned int* bcMatD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														real* DDStart,
-														real* dxxUx,
-														real* dyyUy,
-														real* dzzUz,
-														int size_Mat,
-														bool EvenOrOdd);
+                                                        unsigned int* bcMatD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        real* DDStart,
+                                                        real* dxxUx,
+                                                        real* dyyUy,
+                                                        real* dzzUz,
+                                                        int size_Mat,
+                                                        bool EvenOrOdd);
 
 __global__ void LB_Kernel_Kum_Comp_SP_27(real s9,
-													unsigned int* bcMatD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													real* DDStart,
-													int size_Mat,
-													bool EvenOrOdd);
+                                                    unsigned int* bcMatD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    real* DDStart,
+                                                    int size_Mat,
+                                                    bool EvenOrOdd);
 
 __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27(
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* DDStart,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* DDStart,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27(
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* DDStart,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* DDStart,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 __global__ void Cumulant_One_chim_Comp_SP_27(
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* DDStart,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* DDStart,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 inline __device__ void forwardChimeraWithK(real &mfa, real &mfb, real &mfc, real vv, real v2, real K);
 
@@ -189,57 +189,57 @@ inline __device__ void backwardChimeraWithK(real &mfa, real &mfb, real &mfc, rea
 
 
 __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27(
-	real omega_in,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int* neighborWSB,
-	real* veloX,
-	real* veloY,
-	real* veloZ,
-	real* DDStart,
-	real* turbulentViscosity,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega_in,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int* neighborWSB,
+    real* veloX,
+    real* veloY,
+    real* veloZ,
+    real* DDStart,
+    real* turbulentViscosity,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 
 __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27( real omega,
-															unsigned int* neighborX,
-															unsigned int* neighborY,
-															unsigned int* neighborZ,
-															real* DDStart,
-															int size_Mat,
-															int level,
-															real* forces,
-															real porosity,
-															real darcy,
-															real forchheimer,
-															unsigned int sizeOfPorousMedia,
-															unsigned int* nodeIdsPorousMedia,
-															bool EvenOrOdd);
+                                                            unsigned int* neighborX,
+                                                            unsigned int* neighborY,
+                                                            unsigned int* neighborZ,
+                                                            real* DDStart,
+                                                            int size_Mat,
+                                                            int level,
+                                                            real* forces,
+                                                            real porosity,
+                                                            real darcy,
+                                                            real forchheimer,
+                                                            unsigned int sizeOfPorousMedia,
+                                                            unsigned int* nodeIdsPorousMedia,
+                                                            bool EvenOrOdd);
 
 __global__ void LB_Kernel_AD_Incomp_7( real diffusivity,
-												  unsigned int* bcMatD,
-												  unsigned int* neighborX,
-												  unsigned int* neighborY,
-												  unsigned int* neighborZ,
-												  real* DDStart,
-												  real* DD7,
-												  int size_Mat,
-												  bool EvenOrOdd);
+                                                  unsigned int* bcMatD,
+                                                  unsigned int* neighborX,
+                                                  unsigned int* neighborY,
+                                                  unsigned int* neighborZ,
+                                                  real* DDStart,
+                                                  real* DD7,
+                                                  int size_Mat,
+                                                  bool EvenOrOdd);
 
 __global__ void LB_Kernel_AD_Incomp_27( real diffusivity,
-												   unsigned int* bcMatD,
-												   unsigned int* neighborX,
-												   unsigned int* neighborY,
-												   unsigned int* neighborZ,
-												   real* DDStart,
-												   real* DD27,
-												   int size_Mat,
-												   bool EvenOrOdd);
+                                                   unsigned int* bcMatD,
+                                                   unsigned int* neighborX,
+                                                   unsigned int* neighborY,
+                                                   unsigned int* neighborZ,
+                                                   real* DDStart,
+                                                   real* DD27,
+                                                   int size_Mat,
+                                                   bool EvenOrOdd);
 
 __global__ void LBInit27( int myid,
                                      int numprocs,
@@ -296,21 +296,21 @@ __global__ void InitAD27(unsigned int* neighborX,
                                        bool EvenOrOdd);
 
 __global__ void LB_PostProcessor_F3_2018_Fehlberg(
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* rhoOut,
-	real* vxOut,
-	real* vyOut,
-	real* vzOut,
-	real* DDStart,
-	real* G6,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd);
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* rhoOut,
+    real* vxOut,
+    real* vyOut,
+    real* vzOut,
+    real* DDStart,
+    real* G6,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd);
 
 __global__ void LBCalcMac27( real* vxD,
                                         real* vyD,
@@ -338,17 +338,17 @@ __global__ void LBCalcMacSP27( real* vxD,
                                           bool isEvenTimestep);
 
 __global__ void LBCalcMacCompSP27( real* vxD,
-											  real* vyD,
-											  real* vzD,
-											  real* rhoD,
-											  real* pressD,
-											  unsigned int* geoD,
-											  unsigned int* neighborX,
-											  unsigned int* neighborY,
-											  unsigned int* neighborZ,
-											  unsigned int size_Mat,
-											  real* DD,
-											  bool isEvenTimestep);
+                                              real* vyD,
+                                              real* vzD,
+                                              real* rhoD,
+                                              real* pressD,
+                                              unsigned int* geoD,
+                                              unsigned int* neighborX,
+                                              unsigned int* neighborY,
+                                              unsigned int* neighborZ,
+                                              unsigned int size_Mat,
+                                              real* DD,
+                                              bool isEvenTimestep);
 
 __global__ void CalcConc7( real* Conc,
                                           unsigned int* geoD,
@@ -360,26 +360,26 @@ __global__ void CalcConc7( real* Conc,
                                           bool isEvenTimestep);
 
 __global__ void GetPlaneConc7(real* Conc,
-								            int* kPC,
-								            unsigned int numberOfPointskPC,
-											unsigned int* geoD,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											real* DD7,
-											bool isEvenTimestep);
+                                            int* kPC,
+                                            unsigned int numberOfPointskPC,
+                                            unsigned int* geoD,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            real* DD7,
+                                            bool isEvenTimestep);
 
 __global__ void GetPlaneConc27(real* Conc,
-								             int* kPC,
-								             unsigned int numberOfPointskPC,
-											 unsigned int* geoD,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 real* DD27,
-											 bool isEvenTimestep);
+                                             int* kPC,
+                                             unsigned int numberOfPointskPC,
+                                             unsigned int* geoD,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             real* DD27,
+                                             bool isEvenTimestep);
 
 __global__ void CalcConc27(real* Conc,
                                           unsigned int* geoD,
@@ -404,33 +404,33 @@ __global__ void LBCalcMedSP27( real* vxD,
                                           bool isEvenTimestep);
 
 __global__ void LBCalcMedCompSP27( real* vxD,
-											  real* vyD,
-											  real* vzD,
-											  real* rhoD,
-											  real* pressD,
-											  unsigned int* geoD,
-											  unsigned int* neighborX,
-											  unsigned int* neighborY,
-											  unsigned int* neighborZ,
-											  unsigned int size_Mat,
-											  real* DD,
-											  bool isEvenTimestep);
+                                              real* vyD,
+                                              real* vzD,
+                                              real* rhoD,
+                                              real* pressD,
+                                              unsigned int* geoD,
+                                              unsigned int* neighborX,
+                                              unsigned int* neighborY,
+                                              unsigned int* neighborZ,
+                                              unsigned int size_Mat,
+                                              real* DD,
+                                              bool isEvenTimestep);
 
 __global__ void LBCalcMedCompAD27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	real* concD,
-	unsigned int* geoD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	real* DD,
-	real* DD_AD,
-	bool isEvenTimestep);
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    real* concD,
+    unsigned int* geoD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    real* DD,
+    real* DD_AD,
+    bool isEvenTimestep);
 
 __global__ void LBCalcMacMedSP27( real* vxD,
                                              real* vyD,
@@ -446,115 +446,115 @@ __global__ void LBCalcMacMedSP27( real* vxD,
                                              bool isEvenTimestep);
 
 __global__ void LBResetMedianValuesSP27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	unsigned int size_Mat,
-	bool isEvenTimestep);
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    unsigned int size_Mat,
+    bool isEvenTimestep);
 
 __global__ void LBResetMedianValuesAD27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	real* concD,
-	unsigned int size_Mat,
-	bool isEvenTimestep);
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    real* concD,
+    unsigned int size_Mat,
+    bool isEvenTimestep);
 
 __global__ void LBCalc2ndMomentsIncompSP27(  real* kxyFromfcNEQ,
-														real* kyzFromfcNEQ,
-														real* kxzFromfcNEQ,
-														real* kxxMyyFromfcNEQ,
-														real* kxxMzzFromfcNEQ,
-														unsigned int* geoD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														unsigned int size_Mat,
-														real* DD,
-														bool isEvenTimestep);
+                                                        real* kyzFromfcNEQ,
+                                                        real* kxzFromfcNEQ,
+                                                        real* kxxMyyFromfcNEQ,
+                                                        real* kxxMzzFromfcNEQ,
+                                                        unsigned int* geoD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        unsigned int size_Mat,
+                                                        real* DD,
+                                                        bool isEvenTimestep);
 
 __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ,
-													real* kyzFromfcNEQ,
-													real* kxzFromfcNEQ,
-													real* kxxMyyFromfcNEQ,
-													real* kxxMzzFromfcNEQ,
-													unsigned int* geoD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat,
-													real* DD,
-													bool isEvenTimestep);
+                                                    real* kyzFromfcNEQ,
+                                                    real* kxzFromfcNEQ,
+                                                    real* kxxMyyFromfcNEQ,
+                                                    real* kxxMzzFromfcNEQ,
+                                                    unsigned int* geoD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    unsigned int size_Mat,
+                                                    real* DD,
+                                                    bool isEvenTimestep);
 
 __global__ void LBCalc3rdMomentsIncompSP27(  real* CUMbbb,
-														real* CUMabc,
-														real* CUMbac,
-														real* CUMbca,
-														real* CUMcba,
-														real* CUMacb,
-														real* CUMcab,
-														unsigned int* bcMatD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														real* DDStart,
-														int size_Mat,
-														bool EvenOrOdd);
+                                                        real* CUMabc,
+                                                        real* CUMbac,
+                                                        real* CUMbca,
+                                                        real* CUMcba,
+                                                        real* CUMacb,
+                                                        real* CUMcab,
+                                                        unsigned int* bcMatD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        real* DDStart,
+                                                        int size_Mat,
+                                                        bool EvenOrOdd);
 
 __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb,
-													real* CUMabc,
-													real* CUMbac,
-													real* CUMbca,
-													real* CUMcba,
-													real* CUMacb,
-													real* CUMcab,
-													unsigned int* bcMatD,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													real* DDStart,
-													int size_Mat,
-													bool EvenOrOdd);
+                                                    real* CUMabc,
+                                                    real* CUMbac,
+                                                    real* CUMbca,
+                                                    real* CUMcba,
+                                                    real* CUMacb,
+                                                    real* CUMcab,
+                                                    unsigned int* bcMatD,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    real* DDStart,
+                                                    int size_Mat,
+                                                    bool EvenOrOdd);
 
 __global__ void LBCalcHigherMomentsIncompSP27(   real* CUMcbb,
-															real* CUMbcb,
-															real* CUMbbc,
-															real* CUMcca,
-															real* CUMcac,
-															real* CUMacc,
-															real* CUMbcc,
-															real* CUMcbc,
-															real* CUMccb,
-															real* CUMccc,
-															unsigned int* bcMatD,
-															unsigned int* neighborX,
-															unsigned int* neighborY,
-															unsigned int* neighborZ,
-															real* DDStart,
-															int size_Mat,
-															bool EvenOrOdd);
+                                                            real* CUMbcb,
+                                                            real* CUMbbc,
+                                                            real* CUMcca,
+                                                            real* CUMcac,
+                                                            real* CUMacc,
+                                                            real* CUMbcc,
+                                                            real* CUMcbc,
+                                                            real* CUMccb,
+                                                            real* CUMccc,
+                                                            unsigned int* bcMatD,
+                                                            unsigned int* neighborX,
+                                                            unsigned int* neighborY,
+                                                            unsigned int* neighborZ,
+                                                            real* DDStart,
+                                                            int size_Mat,
+                                                            bool EvenOrOdd);
 
 __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb,
-														real* CUMbcb,
-														real* CUMbbc,
-														real* CUMcca,
-														real* CUMcac,
-														real* CUMacc,
-														real* CUMbcc,
-														real* CUMcbc,
-														real* CUMccb,
-														real* CUMccc,
-														unsigned int* bcMatD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														real* DDStart,
-														int size_Mat,
-														bool EvenOrOdd);
+                                                        real* CUMbcb,
+                                                        real* CUMbbc,
+                                                        real* CUMcca,
+                                                        real* CUMcac,
+                                                        real* CUMacc,
+                                                        real* CUMbcc,
+                                                        real* CUMcbc,
+                                                        real* CUMccb,
+                                                        real* CUMccc,
+                                                        unsigned int* bcMatD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        real* DDStart,
+                                                        int size_Mat,
+                                                        bool EvenOrOdd);
 
 __global__ void LBCalcMeasurePoints(real* vxMP,
                                                real* vyMP,
@@ -612,60 +612,60 @@ __global__ void QDevice27(real* distributions,
                                      bool isEvenTimestep);
 
 __global__ void QDeviceComp27(
-										 real* distributions,
-										 int* subgridDistanceIndices,
-										 real* subgridDistances,
-										 unsigned int numberOfBCnodes,
-										 real omega,
-										 unsigned int* neighborX,
-										 unsigned int* neighborY,
-										 unsigned int* neighborZ,
-										 unsigned int numberOfLBnodes,
-										 bool isEvenTimestep);
+                                         real* distributions,
+                                         int* subgridDistanceIndices,
+                                         real* subgridDistances,
+                                         unsigned int numberOfBCnodes,
+                                         real omega,
+                                         unsigned int* neighborX,
+                                         unsigned int* neighborY,
+                                         unsigned int* neighborZ,
+                                         unsigned int numberOfLBnodes,
+                                         bool isEvenTimestep);
 
 __global__ void QDeviceCompThinWallsPartOne27(real* DD,
-														 int* k_Q,
-														 real* QQ,
-														 unsigned int numberOfBCnodes,
-														 real om1,
-														 unsigned int* neighborX,
-														 unsigned int* neighborY,
-														 unsigned int* neighborZ,
-														 unsigned int size_Mat,
-														 bool isEvenTimestep);
-
-__global__ void QDevice3rdMomentsComp27(	 real* distributions, 
-													 int* subgridDistanceIndices, 
-													 real* subgridDistances,
-													 unsigned int numberOfBCnodes, 
-													 real omega, 
-													 unsigned int* neighborX,
-													 unsigned int* neighborY,
-													 unsigned int* neighborZ,
-													 unsigned int numberOfLBnodes, 
-													 bool isEvenTimestep);
+                                                         int* k_Q,
+                                                         real* QQ,
+                                                         unsigned int numberOfBCnodes,
+                                                         real om1,
+                                                         unsigned int* neighborX,
+                                                         unsigned int* neighborY,
+                                                         unsigned int* neighborZ,
+                                                         unsigned int size_Mat,
+                                                         bool isEvenTimestep);
+
+__global__ void QDevice3rdMomentsComp27(	 real* distributions,
+                                                     int* subgridDistanceIndices,
+                                                     real* subgridDistances,
+                                                     unsigned int numberOfBCnodes,
+                                                     real omega,
+                                                     unsigned int* neighborX,
+                                                     unsigned int* neighborY,
+                                                     unsigned int* neighborZ,
+                                                     unsigned int numberOfLBnodes,
+                                                     bool isEvenTimestep);
 
 __global__ void QDeviceIncompHighNu27(real* DD,
-												 int* k_Q,
-												 real* QQ,
-												 unsigned int numberOfBCnodes,
-												 real om1,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int numberOfLBnodes,
-												 bool isEvenTimestep);
+                                                 int* k_Q,
+                                                 real* QQ,
+                                                 unsigned int numberOfBCnodes,
+                                                 real om1,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int numberOfLBnodes,
+                                                 bool isEvenTimestep);
 
 __global__ void QDeviceCompHighNu27(	 real* DD,
-												 int* k_Q,
-												 real* QQ,
-												 unsigned int numberOfBCnodes,
-												 real om1,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat,
-												 bool isEvenTimestep);
+                                                 int* k_Q,
+                                                 real* QQ,
+                                                 unsigned int numberOfBCnodes,
+                                                 real om1,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int size_Mat,
+                                                 bool isEvenTimestep);
 
 //Velocity BCs
 __global__ void QVelDevPlainBB27(
@@ -683,39 +683,39 @@ __global__ void QVelDevPlainBB27(
     bool isEvenTimestep);
 
 __global__ void QVelDevCouette27(real* vx,
-											real* vy,
-											real* vz,
-											real* DD,
-											int* k_Q,
-											real* QQ,
-											unsigned int numberOfBCnodes,
-											real om1,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            real* vy,
+                                            real* vz,
+                                            real* DD,
+                                            int* k_Q,
+                                            real* QQ,
+                                            unsigned int numberOfBCnodes,
+                                            real om1,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void QVelDev1h27( int inx,
-										int iny,
-										real* vx,
-										real* vy,
-										real* vz,
-										real* DD,
-										int* k_Q,
-										real* QQ,
-										unsigned int numberOfBCnodes,
-										real om1,
-										real Phi,
-										real angularVelocity,
-										unsigned int* neighborX,
-										unsigned int* neighborY,
-										unsigned int* neighborZ,
-										real* coordX,
-										real* coordY,
-										real* coordZ,
-										unsigned int size_Mat,
-										bool isEvenTimestep);
+                                        int iny,
+                                        real* vx,
+                                        real* vy,
+                                        real* vz,
+                                        real* DD,
+                                        int* k_Q,
+                                        real* QQ,
+                                        unsigned int numberOfBCnodes,
+                                        real om1,
+                                        real Phi,
+                                        real angularVelocity,
+                                        unsigned int* neighborX,
+                                        unsigned int* neighborY,
+                                        unsigned int* neighborZ,
+                                        real* coordX,
+                                        real* coordY,
+                                        real* coordZ,
+                                        unsigned int size_Mat,
+                                        bool isEvenTimestep);
 
 __global__ void QVelDevice27(int inx,
                                         int iny,
@@ -734,107 +734,107 @@ __global__ void QVelDevice27(int inx,
                                         bool isEvenTimestep);
 
 __global__ void QVelDeviceCompPlusSlip27(real* vx,
-													real* vy,
-													real* vz,
-													real* DD,
-													int* k_Q,
-													real* QQ,
-													unsigned int numberOfBCnodes,
-													real om1,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat,
-													bool isEvenTimestep);
+                                                    real* vy,
+                                                    real* vz,
+                                                    real* DD,
+                                                    int* k_Q,
+                                                    real* QQ,
+                                                    unsigned int numberOfBCnodes,
+                                                    real om1,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    unsigned int size_Mat,
+                                                    bool isEvenTimestep);
 
 __global__ void QVelDeviceComp27(real* velocityX,
-											real* velocityY,
-											real* velocityZ,
-											real* distribution,
-											int* subgridDistanceIndices,
-											real* subgridDistances,
-											unsigned int numberOfBCnodes,
-											real omega,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int numberOfLBnodes,
-											bool isEvenTimestep);
+                                            real* velocityY,
+                                            real* velocityZ,
+                                            real* distribution,
+                                            int* subgridDistanceIndices,
+                                            real* subgridDistances,
+                                            unsigned int numberOfBCnodes,
+                                            real omega,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int numberOfLBnodes,
+                                            bool isEvenTimestep);
 
 __global__ void QVelDeviceCompThinWallsPartOne27(
-	real* vx,
-	real* vy,
-	real* vz,
-	real* DD,
-	int* k_Q,
-	real* QQ,
-	uint numberOfBCnodes,
-	real om1,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	uint size_Mat,
-	bool isEvenTimestep);
+    real* vx,
+    real* vy,
+    real* vz,
+    real* DD,
+    int* k_Q,
+    real* QQ,
+    uint numberOfBCnodes,
+    real om1,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    uint size_Mat,
+    bool isEvenTimestep);
 
 __global__ void QThinWallsPartTwo27(
-	real* DD,
-	int* k_Q,
-	real* QQ,
-	uint numberOfBCnodes,
-	uint* geom,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	uint* neighborWSB,
-	uint size_Mat,
-	bool isEvenTimestep);
+    real* DD,
+    int* k_Q,
+    real* QQ,
+    uint numberOfBCnodes,
+    uint* geom,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    uint* neighborWSB,
+    uint size_Mat,
+    bool isEvenTimestep);
 
 __global__ void QVelDeviceCompZeroPress27(
-	real* velocityX,
-	real* velocityY,
-	real* velocityZ,
-	real* distribution,
-	int* subgridDistanceIndices,
-	real* subgridDistances,
-	unsigned int numberOfBCnodes,
-	real omega,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int numberOfLBnodes,
-	bool isEvenTimestep);
+    real* velocityX,
+    real* velocityY,
+    real* velocityZ,
+    real* distribution,
+    int* subgridDistanceIndices,
+    real* subgridDistances,
+    unsigned int numberOfBCnodes,
+    real omega,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int numberOfLBnodes,
+    bool isEvenTimestep);
 
 __global__ void QVelDeviceIncompHighNu27(real* vx,
-													real* vy,
-													real* vz,
-													real* DD,
-													int* k_Q,
-													real* QQ,
-													unsigned int numberOfBCnodes,
-													real om1,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat,
-													bool isEvenTimestep);
+                                                    real* vy,
+                                                    real* vz,
+                                                    real* DD,
+                                                    int* k_Q,
+                                                    real* QQ,
+                                                    unsigned int numberOfBCnodes,
+                                                    real om1,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    unsigned int size_Mat,
+                                                    bool isEvenTimestep);
 
 __global__ void QVelDeviceCompHighNu27(	real* vx,
-													real* vy,
-													real* vz,
-													real* DD,
-													int* k_Q,
-													real* QQ,
-													unsigned int numberOfBCnodes,
-													real om1,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat,
-													bool isEvenTimestep);
+                                                    real* vy,
+                                                    real* vz,
+                                                    real* DD,
+                                                    int* k_Q,
+                                                    real* QQ,
+                                                    unsigned int numberOfBCnodes,
+                                                    real om1,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    unsigned int size_Mat,
+                                                    bool isEvenTimestep);
 
 __global__ void QVeloDeviceEQ27(real* VeloX,
-										   real* VeloY,
-										   real* VeloZ,
+                                           real* VeloY,
+                                           real* VeloZ,
                                            real* DD,
                                            int* k_Q,
                                            int numberOfBCnodes,
@@ -846,18 +846,18 @@ __global__ void QVeloDeviceEQ27(real* VeloX,
                                            bool isEvenTimestep);
 
 __global__ void QVeloStreetDeviceEQ27(
-	real* veloXfraction,
-	real* veloYfraction,
-	int*  naschVelo,
-	real* DD,
-	int*  naschIndex,
-	int   numberOfStreetNodes,
-	real  velocityRatio,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	uint  size_Mat,
-	bool  isEvenTimestep);
+    real* veloXfraction,
+    real* veloYfraction,
+    int*  naschVelo,
+    real* DD,
+    int*  naschIndex,
+    int   numberOfStreetNodes,
+    real  velocityRatio,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    uint  size_Mat,
+    bool  isEvenTimestep);
 
 //Slip BCs
 __global__ void QSlipDevice27(real* DD,
@@ -872,135 +872,135 @@ __global__ void QSlipDevice27(real* DD,
                                          bool isEvenTimestep);
 
 __global__ void QSlipDeviceComp27(real* DD,
-											 int* k_Q,
-											 real* QQ,
-											 unsigned int numberOfBCnodes,
-											 real om1,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 bool isEvenTimestep);
+                                             int* k_Q,
+                                             real* QQ,
+                                             unsigned int numberOfBCnodes,
+                                             real om1,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             bool isEvenTimestep);
 
 __global__ void QSlipDeviceComp27TurbViscosity(
-                                    real* distributions, 
-                                    int* subgridDistanceIndices, 
+                                    real* distributions,
+                                    int* subgridDistanceIndices,
                                     real* subgridDistances,
                                     unsigned int numberOfBCnodes,
-                                    real omega, 
+                                    real omega,
                                     unsigned int* neighborX,
                                     unsigned int* neighborY,
                                     unsigned int* neighborZ,
                                     real* turbViscosity,
-                                    unsigned int numberOfLBnodes, 
+                                    unsigned int numberOfLBnodes,
                                     bool isEvenTimestep);
 
 __global__ void QSlipPressureDeviceComp27TurbViscosity(
-                                    real* distributions, 
-                                    int* subgridDistanceIndices, 
+                                    real* distributions,
+                                    int* subgridDistanceIndices,
                                     real* subgridDistances,
                                     unsigned int numberOfBCnodes,
-                                    real omega, 
+                                    real omega,
                                     unsigned int* neighborX,
                                     unsigned int* neighborY,
                                     unsigned int* neighborZ,
                                     real* turbViscosity,
-                                    unsigned int numberOfLBnodes, 
+                                    unsigned int numberOfLBnodes,
                                     bool isEvenTimestep);
 
 __global__ void QSlipGeomDeviceComp27(real* DD,
-												 int* k_Q,
-												 real* QQ,
-												 unsigned int numberOfBCnodes,
-												 real om1,
-												 real* NormalX,
-												 real* NormalY,
-												 real* NormalZ,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat,
-												 bool isEvenTimestep);
+                                                 int* k_Q,
+                                                 real* QQ,
+                                                 unsigned int numberOfBCnodes,
+                                                 real om1,
+                                                 real* NormalX,
+                                                 real* NormalY,
+                                                 real* NormalZ,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int size_Mat,
+                                                 bool isEvenTimestep);
 
 __global__ void QSlipNormDeviceComp27(real* DD,
-												 int* k_Q,
-												 real* QQ,
-												 unsigned int numberOfBCnodes,
-												 real om1,
-												 real* NormalX,
-												 real* NormalY,
-												 real* NormalZ,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat,
-												 bool isEvenTimestep);
+                                                 int* k_Q,
+                                                 real* QQ,
+                                                 unsigned int numberOfBCnodes,
+                                                 real om1,
+                                                 real* NormalX,
+                                                 real* NormalY,
+                                                 real* NormalZ,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int size_Mat,
+                                                 bool isEvenTimestep);
 
 // Stress BCs (wall model)
 __global__ void QStressDeviceComp27(real* DD,
-											   int* k_Q,
-											 int* k_N,
-											 real* QQ,
-											 unsigned int numberOfBCnodes,
-											 real om1,
-											 real* turbViscosity,
-										     real* vx,
-											 real* vy,
-                                    	     real* vz,
-											 real* normalX,
-											 real* normalY,
-                                    	     real* normalZ,
-											 real* vx_bc,
-											 real* vy_bc,
-                                    	     real* vz_bc,
-											 real* vx1,
-                                    		 real* vy1,
-                                    		 real* vz1,
-											 int* samplingOffset,
-											 real* z0,
-											 bool  hasWallModelMonitor,
-											real* u_star_monitor,
-											real* Fx_monitor,
-											real* Fy_monitor,
-											real* Fz_monitor,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 bool isEvenTimestep);
+                                               int* k_Q,
+                                             int* k_N,
+                                             real* QQ,
+                                             unsigned int numberOfBCnodes,
+                                             real om1,
+                                             real* turbViscosity,
+                                             real* vx,
+                                             real* vy,
+                                             real* vz,
+                                             real* normalX,
+                                             real* normalY,
+                                             real* normalZ,
+                                             real* vx_bc,
+                                             real* vy_bc,
+                                             real* vz_bc,
+                                             real* vx1,
+                                             real* vy1,
+                                             real* vz1,
+                                             int* samplingOffset,
+                                             real* z0,
+                                             bool  hasWallModelMonitor,
+                                            real* u_star_monitor,
+                                            real* Fx_monitor,
+                                            real* Fy_monitor,
+                                            real* Fz_monitor,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             bool isEvenTimestep);
 
 __global__ void BBStressDevice27( real* DD,
-												int* k_Q,
-												int* k_N,
-												real* QQ,
-												unsigned int numberOfBCnodes,
-												real* vx,
-												real* vy,
-												real* vz,
-												real* normalX,
-												real* normalY,
-												real* normalZ,
-												real* vx_bc,
-												real* vy_bc,
-												real* vz_bc,
-												real* vx1,
-												real* vy1,
-												real* vz1,
-												int* samplingOffset,
-												real* z0,
-												bool  hasWallModelMonitor,
-												real* u_star_monitor,
-												real* Fx_monitor,
-												real* Fy_monitor,
-												real* Fz_monitor,
-												unsigned int* neighborX,
-												unsigned int* neighborY,
-												unsigned int* neighborZ,
-												unsigned int size_Mat,
-												bool isEvenTimestep);
+                                                int* k_Q,
+                                                int* k_N,
+                                                real* QQ,
+                                                unsigned int numberOfBCnodes,
+                                                real* vx,
+                                                real* vy,
+                                                real* vz,
+                                                real* normalX,
+                                                real* normalY,
+                                                real* normalZ,
+                                                real* vx_bc,
+                                                real* vy_bc,
+                                                real* vz_bc,
+                                                real* vx1,
+                                                real* vy1,
+                                                real* vz1,
+                                                int* samplingOffset,
+                                                real* z0,
+                                                bool  hasWallModelMonitor,
+                                                real* u_star_monitor,
+                                                real* Fx_monitor,
+                                                real* Fy_monitor,
+                                                real* Fz_monitor,
+                                                unsigned int* neighborX,
+                                                unsigned int* neighborY,
+                                                unsigned int* neighborZ,
+                                                unsigned int size_Mat,
+                                                bool isEvenTimestep);
 
 __global__ void BBStressPressureDevice27( real* DD,
-											            int* k_Q,
+                                                        int* k_Q,
                                              int* k_N,
                                              real* QQ,
                                              unsigned int  numberOfBCnodes,
@@ -1043,19 +1043,19 @@ __global__ void QPressDevice27( real* rhoBC,
                                            bool isEvenTimestep);
 
 __global__ void QPressDeviceAntiBB27(   real* rhoBC,
-												   real* vx,
-												   real* vy,
-												   real* vz,
-												   real* DD,
-												   int* k_Q,
-												   real* QQ,
-												   int numberOfBCnodes,
-												   real om1,
-												   unsigned int* neighborX,
-												   unsigned int* neighborY,
-												   unsigned int* neighborZ,
-												   unsigned int size_Mat,
-												   bool isEvenTimestep);
+                                                   real* vx,
+                                                   real* vy,
+                                                   real* vz,
+                                                   real* DD,
+                                                   int* k_Q,
+                                                   real* QQ,
+                                                   int numberOfBCnodes,
+                                                   real om1,
+                                                   unsigned int* neighborX,
+                                                   unsigned int* neighborY,
+                                                   unsigned int* neighborZ,
+                                                   unsigned int size_Mat,
+                                                   bool isEvenTimestep);
 
 __global__ void QPressDeviceFixBackflow27( real* rhoBC,
                                                       real* DD,
@@ -1080,43 +1080,43 @@ __global__ void QPressDeviceDirDepBot27(  real* rhoBC,
                                                      bool isEvenTimestep);
 
 __global__ void QPressNoRhoDevice27(  real* rhoBC,
-												 real* distributions,
-												 int* k_Q,
-												 int* k_N,
-												 int numberOfBCnodes,
-												 real om1,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int numberOfLBnodes,
-												 bool isEvenTimestep,
-												 int direction);
+                                                 real* distributions,
+                                                 int* k_Q,
+                                                 int* k_N,
+                                                 int numberOfBCnodes,
+                                                 real om1,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int numberOfLBnodes,
+                                                 bool isEvenTimestep,
+                                                 int direction);
 
 __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
-											real* distributions, 
-											int* k_Q, 
-											int* k_N, 
-											int numberOfBCnodes, 
-											real om1, 
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int numberOfLBnodes, 
-											bool isEvenTimestep,
-											int direction,
-											real densityCorrectionFactor);
+                                            real* distributions,
+                                            int* k_Q,
+                                            int* k_N,
+                                            int numberOfBCnodes,
+                                            real om1,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int numberOfLBnodes,
+                                            bool isEvenTimestep,
+                                            int direction,
+                                            real densityCorrectionFactor);
 
 __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
-														 real* DD,
-														 int* k_Q,
-														 int* k_N,
-														 int numberOfBCnodes,
-														 real om1,
-														 unsigned int* neighborX,
-														 unsigned int* neighborY,
-														 unsigned int* neighborZ,
-														 unsigned int size_Mat,
-														 bool isEvenTimestep);
+                                                         real* DD,
+                                                         int* k_Q,
+                                                         int* k_N,
+                                                         int numberOfBCnodes,
+                                                         real om1,
+                                                         unsigned int* neighborX,
+                                                         unsigned int* neighborY,
+                                                         unsigned int* neighborZ,
+                                                         unsigned int size_Mat,
+                                                         bool isEvenTimestep);
 
 __global__ void QPressDeviceOld27(real* rhoBC,
                                              real* DD,
@@ -1131,16 +1131,16 @@ __global__ void QPressDeviceOld27(real* rhoBC,
                                              bool isEvenTimestep);
 
 __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
-													real* DD,
-													int* k_Q,
-													int* k_N,
-													int numberOfBCnodes,
-													real om1,
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat,
-													bool isEvenTimestep);
+                                                    real* DD,
+                                                    int* k_Q,
+                                                    int* k_N,
+                                                    int numberOfBCnodes,
+                                                    real om1,
+                                                    unsigned int* neighborX,
+                                                    unsigned int* neighborY,
+                                                    unsigned int* neighborZ,
+                                                    unsigned int size_Mat,
+                                                    bool isEvenTimestep);
 
 __global__ void QPressDeviceNEQ27(real* rhoBC,
                                              real* distribution,
@@ -1168,13 +1168,13 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
                                              bool isEvenTimestep);
 
 __global__ void QPressDeviceZero27(  real* DD,
-												int* k_Q,
-												unsigned int numberOfBCnodes,
-												unsigned int* neighborX,
-												unsigned int* neighborY,
-												unsigned int* neighborZ,
-												unsigned int size_Mat,
-												bool isEvenTimestep);
+                                                int* k_Q,
+                                                unsigned int numberOfBCnodes,
+                                                unsigned int* neighborX,
+                                                unsigned int* neighborY,
+                                                unsigned int* neighborZ,
+                                                unsigned int size_Mat,
+                                                bool isEvenTimestep);
 
 __global__ void QPressDeviceFake27(real* rhoBC,
                                              real* DD,
@@ -1199,16 +1199,16 @@ __global__ void BBDevice27(real* distributions,
                                      bool isEvenTimestep);
 
 __global__ void QPressDevice27_IntBB(real* rho,
-												real* DD,
-												int* k_Q,
-												real* QQ,
-												unsigned int numberOfBCnodes,
-												real om1,
-												unsigned int* neighborX,
-												unsigned int* neighborY,
-												unsigned int* neighborZ,
-												unsigned int size_Mat,
-												bool isEvenTimestep);
+                                                real* DD,
+                                                int* k_Q,
+                                                real* QQ,
+                                                unsigned int numberOfBCnodes,
+                                                real om1,
+                                                unsigned int* neighborX,
+                                                unsigned int* neighborY,
+                                                unsigned int* neighborZ,
+                                                unsigned int size_Mat,
+                                                bool isEvenTimestep);
 
 // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29
 //Schlaffer BCs
@@ -1250,18 +1250,18 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 real omega,
                                                 real* distributions,
                                                 real* subgridDistances,
-                                                uint* neighborX, 
-                                                uint* neighborY, 
+                                                uint* neighborX,
+                                                uint* neighborY,
                                                 uint* neighborZ,
-                                                uint* neighborsNT, 
+                                                uint* neighborsNT,
                                                 uint* neighborsNB,
                                                 uint* neighborsST,
                                                 uint* neighborsSB,
-                                                real* weights0PP, 
+                                                real* weights0PP,
                                                 real* weights0PM,
                                                 real* weights0MP,
                                                 real* weights0MM,
-                                                real* vLast, 
+                                                real* vLast,
                                                 real* vCurrent,
                                                 real velocityX,
                                                 real velocityY,
@@ -1276,18 +1276,18 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         int numberOfPrecursorNodes,
                                         real omega,
                                         real* distributions,
-                                        uint* neighborX, 
-                                        uint* neighborY, 
+                                        uint* neighborX,
+                                        uint* neighborY,
                                         uint* neighborZ,
-                                        uint* neighborsNT, 
+                                        uint* neighborsNT,
                                         uint* neighborsNB,
                                         uint* neighborsST,
                                         uint* neighborsSB,
-                                        real* weights0PP, 
+                                        real* weights0PP,
                                         real* weights0PM,
                                         real* weights0MP,
                                         real* weights0MM,
-                                        real* vLast, 
+                                        real* vLast,
                                         real* vCurrent,
                                         real velocityX,
                                         real velocityY,
@@ -1298,48 +1298,48 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         bool isEvenTimestep);
 
 __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
-												int numberOfBCNodes,
-												int numberOfPrecursorNodes,
-												real* distributions,
-												uint* neighborX, 
-												uint* neighborY, 
-												uint* neighborZ,
-												uint* neighborsNT, 
-												uint* neighborsNB,
-												uint* neighborsST,
-												uint* neighborsSB,
-												real* weights0PP, 
-												real* weights0PM,
-												real* weights0MP,
-												real* weights0MM,
-												real* fsLast, 
-												real* fsNext,
-												real timeRatio,
-												unsigned long long numberOfLBnodes,
-												bool isEvenTimestep);
+                                                int numberOfBCNodes,
+                                                int numberOfPrecursorNodes,
+                                                real* distributions,
+                                                uint* neighborX,
+                                                uint* neighborY,
+                                                uint* neighborZ,
+                                                uint* neighborsNT,
+                                                uint* neighborsNB,
+                                                uint* neighborsST,
+                                                uint* neighborsSB,
+                                                real* weights0PP,
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
+                                                real* fsLast,
+                                                real* fsNext,
+                                                real timeRatio,
+                                                unsigned long long numberOfLBnodes,
+                                                bool isEvenTimestep);
 __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
-												real* subgridDistances,
-												int sizeQ,
-												int numberOfBCNodes,
-												int numberOfPrecursorNodes,
-												real* distributions,
-												uint* neighborX, 
-												uint* neighborY, 
-												uint* neighborZ,
-												uint* neighborsNT, 
-												uint* neighborsNB,
-												uint* neighborsST,
-												uint* neighborsSB,
-												real* weights0PP, 
-												real* weights0PM,
-												real* weights0MP,
-												real* weights0MM,
-												real* fsLast, 
-												real* fsNext,
-												real timeRatio,
-												unsigned long long numberOfLBnodes,
-												bool isEvenTimestep);
-												
+                                                real* subgridDistances,
+                                                int sizeQ,
+                                                int numberOfBCNodes,
+                                                int numberOfPrecursorNodes,
+                                                real* distributions,
+                                                uint* neighborX,
+                                                uint* neighborY,
+                                                uint* neighborZ,
+                                                uint* neighborsNT,
+                                                uint* neighborsNB,
+                                                uint* neighborsST,
+                                                uint* neighborsSB,
+                                                real* weights0PP,
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
+                                                real* fsLast,
+                                                real* fsNext,
+                                                real timeRatio,
+                                                unsigned long long numberOfLBnodes,
+                                                bool isEvenTimestep);
+
 //Advection / Diffusion BCs
 __global__ void QAD7( real* DD,
                                  real* DD7,
@@ -1358,62 +1358,62 @@ __global__ void QAD7( real* DD,
 //////////////////////////////////////////////////////////////////////////
 //! \brief \ref Advection_Diffusion_Device_Kernel : Factorized central moments for Advection Diffusion Equation
 __global__ void Factorized_Central_Moments_Advection_Diffusion_Device_Kernel(
-	real omegaDiffusivity,
-	uint* typeOfGridNode,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	real* distributions,
-	real* distributionsAD,
-	int size_Mat,
-	real* forces,
-	bool isEvenTimestep);
+    real omegaDiffusivity,
+    uint* typeOfGridNode,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    real* distributions,
+    real* distributionsAD,
+    int size_Mat,
+    real* forces,
+    bool isEvenTimestep);
 
 //////////////////////////////////////////////////////////////////////////
 //! \brief \ref AD_SlipVelDeviceComp : device function for the slip-AD boundary condition
 __global__ void AD_SlipVelDeviceComp(
-	real * normalX,
-	real * normalY,
-	real * normalZ,
-	real * distributions,
-	real * distributionsAD,
-	int* QindexArray,
-	real * Qarrays,
-	uint numberOfBCnodes,
-	real omegaDiffusivity,
-	uint * neighborX,
-	uint * neighborY,
-	uint * neighborZ,
-	uint size_Mat,
-	bool isEvenTimestep);
+    real * normalX,
+    real * normalY,
+    real * normalZ,
+    real * distributions,
+    real * distributionsAD,
+    int* QindexArray,
+    real * Qarrays,
+    uint numberOfBCnodes,
+    real omegaDiffusivity,
+    uint * neighborX,
+    uint * neighborY,
+    uint * neighborZ,
+    uint size_Mat,
+    bool isEvenTimestep);
 
 __global__ void QADDirichlet27(   real* DD,
-											 real* DD27,
-											 real* temp,
-											 real diffusivity,
-											 int* k_Q,
-											 real* QQ,
-											 unsigned int numberOfBCnodes,
-											 real om1,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 bool isEvenTimestep);
+                                             real* DD27,
+                                             real* temp,
+                                             real diffusivity,
+                                             int* k_Q,
+                                             real* QQ,
+                                             unsigned int numberOfBCnodes,
+                                             real om1,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             bool isEvenTimestep);
 
 __global__ void QADBB27(  real* DD,
-									 real* DD27,
-									 real* temp,
-									 real diffusivity,
-									 int* k_Q,
-									 real* QQ,
-									 unsigned int numberOfBCnodes,
-									 real om1,
-									 unsigned int* neighborX,
-									 unsigned int* neighborY,
-									 unsigned int* neighborZ,
-									 unsigned int size_Mat,
-									 bool isEvenTimestep);
+                                     real* DD27,
+                                     real* temp,
+                                     real diffusivity,
+                                     int* k_Q,
+                                     real* QQ,
+                                     unsigned int numberOfBCnodes,
+                                     real om1,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     unsigned int size_Mat,
+                                     bool isEvenTimestep);
 
 __global__ void QADVel7( real* DD,
                                     real* DD7,
@@ -1476,105 +1476,105 @@ __global__ void QADPress27( real* DD,
                                        bool isEvenTimestep);
 
 __global__ void QADPressNEQNeighbor27(
-												 real* DD,
-												 real* DD27,
-												 int* k_Q,
-												 int* k_N,
-												 int numberOfBCnodes,
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat,
-												 bool isEvenTimestep
-												);
+                                                 real* DD,
+                                                 real* DD27,
+                                                 int* k_Q,
+                                                 int* k_N,
+                                                 int numberOfBCnodes,
+                                                 unsigned int* neighborX,
+                                                 unsigned int* neighborY,
+                                                 unsigned int* neighborZ,
+                                                 unsigned int size_Mat,
+                                                 bool isEvenTimestep
+                                                );
 
 __global__ void QNoSlipADincomp7( real* DD,
-											 real* DD7,
-											 real* temp,
-											 real diffusivity,
-											 int* k_Q,
-											 real* QQ,
-											 unsigned int numberOfBCnodes,
-											 real om1,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 bool isEvenTimestep);
+                                             real* DD7,
+                                             real* temp,
+                                             real diffusivity,
+                                             int* k_Q,
+                                             real* QQ,
+                                             unsigned int numberOfBCnodes,
+                                             real om1,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             bool isEvenTimestep);
 
 __global__ void QNoSlipADincomp27( real* DD,
-											 real* DD27,
-											 real* temp,
-											 real diffusivity,
-											 int* k_Q,
-											 real* QQ,
-											 unsigned int numberOfBCnodes,
-											 real om1,
-											 unsigned int* neighborX,
-											 unsigned int* neighborY,
-											 unsigned int* neighborZ,
-											 unsigned int size_Mat,
-											 bool isEvenTimestep);
+                                             real* DD27,
+                                             real* temp,
+                                             real diffusivity,
+                                             int* k_Q,
+                                             real* QQ,
+                                             unsigned int numberOfBCnodes,
+                                             real om1,
+                                             unsigned int* neighborX,
+                                             unsigned int* neighborY,
+                                             unsigned int* neighborZ,
+                                             unsigned int size_Mat,
+                                             bool isEvenTimestep);
 
 __global__ void QADVeloIncomp7(  real* DD,
-											real* DD7,
-											real* temp,
-											real* velo,
-											real diffusivity,
-											int* k_Q,
-											real* QQ,
-											unsigned int numberOfBCnodes,
-											real om1,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            real* DD7,
+                                            real* temp,
+                                            real* velo,
+                                            real diffusivity,
+                                            int* k_Q,
+                                            real* QQ,
+                                            unsigned int numberOfBCnodes,
+                                            real om1,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void QADVeloIncomp27( real* DD,
-											real* DD27,
-											real* temp,
-											real* velo,
-											real diffusivity,
-											int* k_Q,
-											real* QQ,
-											unsigned int numberOfBCnodes,
-											real om1,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            real* DD27,
+                                            real* temp,
+                                            real* velo,
+                                            real diffusivity,
+                                            int* k_Q,
+                                            real* QQ,
+                                            unsigned int numberOfBCnodes,
+                                            real om1,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void QADPressIncomp7(real* DD,
-										   real* DD7,
-										   real* temp,
-										   real* velo,
-										   real diffusivity,
-										   int* k_Q,
-										   real* QQ,
-										   unsigned int numberOfBCnodes,
-										   real om1,
-										   unsigned int* neighborX,
-										   unsigned int* neighborY,
-										   unsigned int* neighborZ,
-										   unsigned int size_Mat,
-										   bool isEvenTimestep);
+                                           real* DD7,
+                                           real* temp,
+                                           real* velo,
+                                           real diffusivity,
+                                           int* k_Q,
+                                           real* QQ,
+                                           unsigned int numberOfBCnodes,
+                                           real om1,
+                                           unsigned int* neighborX,
+                                           unsigned int* neighborY,
+                                           unsigned int* neighborZ,
+                                           unsigned int size_Mat,
+                                           bool isEvenTimestep);
 
 __global__ void QADPressIncomp27(   real* DD,
-											   real* DD27,
-											   real* temp,
-											   real* velo,
-											   real diffusivity,
-											   int* k_Q,
-											   real* QQ,
-											   unsigned int numberOfBCnodes,
-											   real om1,
-											   unsigned int* neighborX,
-											   unsigned int* neighborY,
-											   unsigned int* neighborZ,
-											   unsigned int size_Mat,
-											   bool isEvenTimestep);
+                                               real* DD27,
+                                               real* temp,
+                                               real* velo,
+                                               real diffusivity,
+                                               int* k_Q,
+                                               real* QQ,
+                                               unsigned int numberOfBCnodes,
+                                               real om1,
+                                               unsigned int* neighborX,
+                                               unsigned int* neighborY,
+                                               unsigned int* neighborZ,
+                                               unsigned int size_Mat,
+                                               bool isEvenTimestep);
 
 //Propeller BC
 __global__ void PropellerBC(unsigned int* neighborX,
@@ -1585,7 +1585,7 @@ __global__ void PropellerBC(unsigned int* neighborX,
                                        real* uy,
                                        real* uz,
                                        int* k_Q,
-									   unsigned int size_Prop,
+                                       unsigned int size_Prop,
                                        unsigned int size_Mat,
                                        unsigned int* bcMatD,
                                        real* DD,
@@ -1602,19 +1602,19 @@ __global__ void scaleCF27(real* DC,
                                     unsigned int* neighborFX,
                                     unsigned int* neighborFY,
                                     unsigned int* neighborFZ,
-										       unsigned int size_MatC,
-										       unsigned int size_MatF,
-										       bool isEvenTimestep,
+                                               unsigned int size_MatC,
+                                               unsigned int size_MatF,
+                                               bool isEvenTimestep,
                                      unsigned int* posCSWB,
                                      unsigned int* posFSWB,
                                      unsigned int kCF,
-										       real omCoarse,
-										       real omFine,
-										       real nu,
-										       unsigned int nxC,
-										       unsigned int nyC,
-										       unsigned int nxF,
-										       unsigned int nyF);
+                                               real omCoarse,
+                                               real omFine,
+                                               real nu,
+                                               unsigned int nxC,
+                                               unsigned int nyC,
+                                               unsigned int nxF,
+                                               unsigned int nyF);
 
 __global__ void scaleCFEff27(real* DC,
                                         real* DF,
@@ -1624,18 +1624,18 @@ __global__ void scaleCFEff27(real* DC,
                                         unsigned int* neighborFX,
                                         unsigned int* neighborFY,
                                         unsigned int* neighborFZ,
-									             unsigned int size_MatC,
-									             unsigned int size_MatF,
-									             bool isEvenTimestep,
+                                                 unsigned int size_MatC,
+                                                 unsigned int size_MatF,
+                                                 bool isEvenTimestep,
                                         unsigned int* posCSWB,
                                         unsigned int* posFSWB,
                                         unsigned int kCF,
-									             real omCoarse,
-									             real omFine,
-									             real nu,
-									             unsigned int nxC,
-									             unsigned int nyC,
-									             unsigned int nxF,
+                                                 real omCoarse,
+                                                 real omFine,
+                                                 real nu,
+                                                 unsigned int nxC,
+                                                 unsigned int nyC,
+                                                 unsigned int nxF,
                                         unsigned int nyF,
                                         OffCF offCF);
 
@@ -1709,233 +1709,233 @@ __global__ void scaleCF_Fix_27(real* DC,
                                           OffCF offCF);
 
 __global__ void scaleCF_Fix_comp_27(   real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posCSWB,
-												  unsigned int* posFSWB,
-												  unsigned int kCF,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffCF offCF);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posCSWB,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kCF,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffCF offCF);
 
 __global__ void scaleCF_0817_comp_27(  real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posCSWB,
-												  unsigned int* posFSWB,
-												  unsigned int kCF,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffCF offCF);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posCSWB,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kCF,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffCF offCF);
 
 __global__ void scaleCF_comp_D3Q27F3_2018( real* DC,
-													  real* DF,
-													  real* G6,
-													  unsigned int* neighborCX,
-													  unsigned int* neighborCY,
-													  unsigned int* neighborCZ,
-													  unsigned int* neighborFX,
-													  unsigned int* neighborFY,
-													  unsigned int* neighborFZ,
-													  unsigned int size_MatC,
-													  unsigned int size_MatF,
-													  bool isEvenTimestep,
-													  unsigned int* posCSWB,
-													  unsigned int* posFSWB,
-													  unsigned int kCF,
-													  real omCoarse,
-													  real omFine,
-													  real nu,
-													  unsigned int nxC,
-													  unsigned int nyC,
-													  unsigned int nxF,
-													  unsigned int nyF,
-													  OffCF offCF);
+                                                      real* DF,
+                                                      real* G6,
+                                                      unsigned int* neighborCX,
+                                                      unsigned int* neighborCY,
+                                                      unsigned int* neighborCZ,
+                                                      unsigned int* neighborFX,
+                                                      unsigned int* neighborFY,
+                                                      unsigned int* neighborFZ,
+                                                      unsigned int size_MatC,
+                                                      unsigned int size_MatF,
+                                                      bool isEvenTimestep,
+                                                      unsigned int* posCSWB,
+                                                      unsigned int* posFSWB,
+                                                      unsigned int kCF,
+                                                      real omCoarse,
+                                                      real omFine,
+                                                      real nu,
+                                                      unsigned int nxC,
+                                                      unsigned int nyC,
+                                                      unsigned int nxF,
+                                                      unsigned int nyF,
+                                                      OffCF offCF);
 
 __global__ void scaleCF_comp_D3Q27F3( real* DC,
-												 real* DF,
-												 real* G6,
-												 unsigned int* neighborCX,
-												 unsigned int* neighborCY,
-												 unsigned int* neighborCZ,
-												 unsigned int* neighborFX,
-												 unsigned int* neighborFY,
-												 unsigned int* neighborFZ,
-												 unsigned int size_MatC,
-												 unsigned int size_MatF,
-												 bool isEvenTimestep,
-												 unsigned int* posCSWB,
-												 unsigned int* posFSWB,
-												 unsigned int kCF,
-												 real omCoarse,
-												 real omFine,
-												 real nu,
-												 unsigned int nxC,
-												 unsigned int nyC,
-												 unsigned int nxF,
-												 unsigned int nyF,
-												 OffCF offCF);
+                                                 real* DF,
+                                                 real* G6,
+                                                 unsigned int* neighborCX,
+                                                 unsigned int* neighborCY,
+                                                 unsigned int* neighborCZ,
+                                                 unsigned int* neighborFX,
+                                                 unsigned int* neighborFY,
+                                                 unsigned int* neighborFZ,
+                                                 unsigned int size_MatC,
+                                                 unsigned int size_MatF,
+                                                 bool isEvenTimestep,
+                                                 unsigned int* posCSWB,
+                                                 unsigned int* posFSWB,
+                                                 unsigned int kCF,
+                                                 real omCoarse,
+                                                 real omFine,
+                                                 real nu,
+                                                 unsigned int nxC,
+                                                 unsigned int nyC,
+                                                 unsigned int nxF,
+                                                 unsigned int nyF,
+                                                 OffCF offCF);
 
 
 __global__ void scaleCF_staggered_time_comp_27(real* DC,
-														  real* DF,
-														  unsigned int* neighborCX,
-														  unsigned int* neighborCY,
-														  unsigned int* neighborCZ,
-														  unsigned int* neighborFX,
-														  unsigned int* neighborFY,
-														  unsigned int* neighborFZ,
-														  unsigned int size_MatC,
-														  unsigned int size_MatF,
-														  bool isEvenTimestep,
-														  unsigned int* posCSWB,
-														  unsigned int* posFSWB,
-														  unsigned int kCF,
-														  real omCoarse,
-														  real omFine,
-														  real nu,
-														  unsigned int nxC,
-														  unsigned int nyC,
-														  unsigned int nxF,
-														  unsigned int nyF,
-														  OffCF offCF);
+                                                          real* DF,
+                                                          unsigned int* neighborCX,
+                                                          unsigned int* neighborCY,
+                                                          unsigned int* neighborCZ,
+                                                          unsigned int* neighborFX,
+                                                          unsigned int* neighborFY,
+                                                          unsigned int* neighborFZ,
+                                                          unsigned int size_MatC,
+                                                          unsigned int size_MatF,
+                                                          bool isEvenTimestep,
+                                                          unsigned int* posCSWB,
+                                                          unsigned int* posFSWB,
+                                                          unsigned int kCF,
+                                                          real omCoarse,
+                                                          real omFine,
+                                                          real nu,
+                                                          unsigned int nxC,
+                                                          unsigned int nyC,
+                                                          unsigned int nxF,
+                                                          unsigned int nyF,
+                                                          OffCF offCF);
 
 __global__ void scaleCF_RhoSq_comp_27( real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posCSWB,
-												  unsigned int* posFSWB,
-												  unsigned int kCF,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffCF offCF);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posCSWB,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kCF,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffCF offCF);
 
 __global__ void scaleCF_compressible(
-    real* distributionsCoarse, 
-    real* distributionsFine, 
+    real* distributionsCoarse,
+    real* distributionsFine,
     unsigned int* neighborXcoarse,
     unsigned int* neighborYcoarse,
     unsigned int* neighborZcoarse,
     unsigned int* neighborXfine,
     unsigned int* neighborYfine,
     unsigned int* neighborZfine,
-    unsigned int numberOfLBnodesCoarse, 
-    unsigned int numberOfLBnodesFine, 
+    unsigned int numberOfLBnodesCoarse,
+    unsigned int numberOfLBnodesFine,
     bool isEvenTimestep,
-    unsigned int* indicesCoarseMMM, 
-    unsigned int* indicesFineMMM, 
-    unsigned int numberOfInterfaceNodes, 
-    real omegaCoarse, 
-    real omegaFine, 
+    unsigned int* indicesCoarseMMM,
+    unsigned int* indicesFineMMM,
+    unsigned int numberOfInterfaceNodes,
+    real omegaCoarse,
+    real omegaFine,
     OffCF offsetCF);
 
 __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC,
-														real* DF,
-														unsigned int* neighborCX,
-														unsigned int* neighborCY,
-														unsigned int* neighborCZ,
-														unsigned int* neighborFX,
-														unsigned int* neighborFY,
-														unsigned int* neighborFZ,
-														unsigned int size_MatC,
-														unsigned int size_MatF,
-														bool isEvenTimestep,
-														unsigned int* posCSWB,
-														unsigned int* posFSWB,
-														unsigned int kCF,
-														real omCoarse,
-														real omFine,
-														real nu,
-														unsigned int nxC,
-														unsigned int nyC,
-														unsigned int nxF,
-														unsigned int nyF,
-														OffCF offCF);
+                                                        real* DF,
+                                                        unsigned int* neighborCX,
+                                                        unsigned int* neighborCY,
+                                                        unsigned int* neighborCZ,
+                                                        unsigned int* neighborFX,
+                                                        unsigned int* neighborFY,
+                                                        unsigned int* neighborFZ,
+                                                        unsigned int size_MatC,
+                                                        unsigned int size_MatF,
+                                                        bool isEvenTimestep,
+                                                        unsigned int* posCSWB,
+                                                        unsigned int* posFSWB,
+                                                        unsigned int kCF,
+                                                        real omCoarse,
+                                                        real omFine,
+                                                        real nu,
+                                                        unsigned int nxC,
+                                                        unsigned int nyC,
+                                                        unsigned int nxF,
+                                                        unsigned int nyF,
+                                                        OffCF offCF);
 
 __global__ void scaleCF_AA2016_comp_27(real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posCSWB,
-												  unsigned int* posFSWB,
-												  unsigned int kCF,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffCF offCF);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posCSWB,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kCF,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffCF offCF);
 
 __global__ void scaleCF_NSPress_27(real* DC,
-											  real* DF,
-											  unsigned int* neighborCX,
-											  unsigned int* neighborCY,
-											  unsigned int* neighborCZ,
-											  unsigned int* neighborFX,
-											  unsigned int* neighborFY,
-											  unsigned int* neighborFZ,
-											  unsigned int size_MatC,
-											  unsigned int size_MatF,
-											  bool isEvenTimestep,
-											  unsigned int* posCSWB,
-											  unsigned int* posFSWB,
-											  unsigned int kCF,
-											  real omCoarse,
-											  real omFine,
-											  real nu,
-											  unsigned int nxC,
-											  unsigned int nyC,
-											  unsigned int nxF,
-											  unsigned int nyF,
-											  OffCF offCF);
+                                              real* DF,
+                                              unsigned int* neighborCX,
+                                              unsigned int* neighborCY,
+                                              unsigned int* neighborCZ,
+                                              unsigned int* neighborFX,
+                                              unsigned int* neighborFY,
+                                              unsigned int* neighborFZ,
+                                              unsigned int size_MatC,
+                                              unsigned int size_MatF,
+                                              bool isEvenTimestep,
+                                              unsigned int* posCSWB,
+                                              unsigned int* posFSWB,
+                                              unsigned int kCF,
+                                              real omCoarse,
+                                              real omFine,
+                                              real nu,
+                                              unsigned int nxC,
+                                              unsigned int nyC,
+                                              unsigned int nxF,
+                                              unsigned int nyF,
+                                              OffCF offCF);
 
 __global__ void scaleCFThSMG7( real* DC,
                                           real* DF,
@@ -1994,7 +1994,7 @@ __global__ void scaleCFThS27(real* DC,
                                         unsigned int kCF,
                                         real nu,
                                         real diffusivity_fine,
-										OffCF offCF);
+                                        OffCF offCF);
 
 //fine to coarse
 __global__ void scaleFC27(real* DC,
@@ -2005,18 +2005,18 @@ __global__ void scaleFC27(real* DC,
                                     unsigned int* neighborFX,
                                     unsigned int* neighborFY,
                                     unsigned int* neighborFZ,
-										       unsigned int size_MatC,
-										       unsigned int size_MatF,
-										       bool isEvenTimestep,
+                                               unsigned int size_MatC,
+                                               unsigned int size_MatF,
+                                               bool isEvenTimestep,
                                      unsigned int* posC,
                                      unsigned int* posFSWB,
                                      unsigned int kFC,
-										       real omCoarse,
-										       real omFine,
-										       real nu,
-										       unsigned int nxC,
-										       unsigned int nyC,
-										       unsigned int nxF,
+                                               real omCoarse,
+                                               real omFine,
+                                               real nu,
+                                               unsigned int nxC,
+                                               unsigned int nyC,
+                                               unsigned int nxF,
                                      unsigned int nyF);
 
 __global__ void scaleFCEff27(real* DC,
@@ -2112,145 +2112,145 @@ __global__ void scaleFC_Fix_27( real* DC,
                                           OffFC offFC);
 
 __global__ void scaleFC_Fix_comp_27(   real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posC,
-												  unsigned int* posFSWB,
-												  unsigned int kFC,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffFC offFC);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posC,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kFC,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffFC offFC);
 
 __global__ void scaleFC_0817_comp_27(  real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posC,
-												  unsigned int* posFSWB,
-												  unsigned int kFC,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffFC offFC);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posC,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kFC,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffFC offFC);
 
 __global__ void scaleFC_comp_D3Q27F3_2018( real* DC,
-													  real* DF,
-													  real* G6,
-													  unsigned int* neighborCX,
-													  unsigned int* neighborCY,
-													  unsigned int* neighborCZ,
-													  unsigned int* neighborFX,
-													  unsigned int* neighborFY,
-													  unsigned int* neighborFZ,
-													  unsigned int size_MatC,
-													  unsigned int size_MatF,
-													  bool isEvenTimestep,
-													  unsigned int* posC,
-													  unsigned int* posFSWB,
-													  unsigned int kFC,
-													  real omCoarse,
-													  real omFine,
-													  real nu,
-													  unsigned int nxC,
-													  unsigned int nyC,
-													  unsigned int nxF,
-													  unsigned int nyF,
-													  OffFC offFC);
+                                                      real* DF,
+                                                      real* G6,
+                                                      unsigned int* neighborCX,
+                                                      unsigned int* neighborCY,
+                                                      unsigned int* neighborCZ,
+                                                      unsigned int* neighborFX,
+                                                      unsigned int* neighborFY,
+                                                      unsigned int* neighborFZ,
+                                                      unsigned int size_MatC,
+                                                      unsigned int size_MatF,
+                                                      bool isEvenTimestep,
+                                                      unsigned int* posC,
+                                                      unsigned int* posFSWB,
+                                                      unsigned int kFC,
+                                                      real omCoarse,
+                                                      real omFine,
+                                                      real nu,
+                                                      unsigned int nxC,
+                                                      unsigned int nyC,
+                                                      unsigned int nxF,
+                                                      unsigned int nyF,
+                                                      OffFC offFC);
 
 __global__ void scaleFC_comp_D3Q27F3( real* DC,
-												 real* DF,
-												 real* G6,
-												 unsigned int* neighborCX,
-												 unsigned int* neighborCY,
-												 unsigned int* neighborCZ,
-												 unsigned int* neighborFX,
-												 unsigned int* neighborFY,
-												 unsigned int* neighborFZ,
-												 unsigned int size_MatC,
-												 unsigned int size_MatF,
-												 bool isEvenTimestep,
-												 unsigned int* posC,
-												 unsigned int* posFSWB,
-												 unsigned int kFC,
-												 real omCoarse,
-												 real omFine,
-												 real nu,
-												 unsigned int nxC,
-												 unsigned int nyC,
-												 unsigned int nxF,
-												 unsigned int nyF,
-												 OffFC offFC);
+                                                 real* DF,
+                                                 real* G6,
+                                                 unsigned int* neighborCX,
+                                                 unsigned int* neighborCY,
+                                                 unsigned int* neighborCZ,
+                                                 unsigned int* neighborFX,
+                                                 unsigned int* neighborFY,
+                                                 unsigned int* neighborFZ,
+                                                 unsigned int size_MatC,
+                                                 unsigned int size_MatF,
+                                                 bool isEvenTimestep,
+                                                 unsigned int* posC,
+                                                 unsigned int* posFSWB,
+                                                 unsigned int kFC,
+                                                 real omCoarse,
+                                                 real omFine,
+                                                 real nu,
+                                                 unsigned int nxC,
+                                                 unsigned int nyC,
+                                                 unsigned int nxF,
+                                                 unsigned int nyF,
+                                                 OffFC offFC);
 
 
 __global__ void scaleFC_staggered_time_comp_27(real* DC,
-														  real* DF,
-														  unsigned int* neighborCX,
-														  unsigned int* neighborCY,
-														  unsigned int* neighborCZ,
-														  unsigned int* neighborFX,
-														  unsigned int* neighborFY,
-														  unsigned int* neighborFZ,
-														  unsigned int size_MatC,
-														  unsigned int size_MatF,
-														  bool isEvenTimestep,
-														  unsigned int* posC,
-														  unsigned int* posFSWB,
-														  unsigned int kFC,
-														  real omCoarse,
-														  real omFine,
-														  real nu,
-														  unsigned int nxC,
-														  unsigned int nyC,
-														  unsigned int nxF,
-														  unsigned int nyF,
-														  OffFC offFC);
+                                                          real* DF,
+                                                          unsigned int* neighborCX,
+                                                          unsigned int* neighborCY,
+                                                          unsigned int* neighborCZ,
+                                                          unsigned int* neighborFX,
+                                                          unsigned int* neighborFY,
+                                                          unsigned int* neighborFZ,
+                                                          unsigned int size_MatC,
+                                                          unsigned int size_MatF,
+                                                          bool isEvenTimestep,
+                                                          unsigned int* posC,
+                                                          unsigned int* posFSWB,
+                                                          unsigned int kFC,
+                                                          real omCoarse,
+                                                          real omFine,
+                                                          real nu,
+                                                          unsigned int nxC,
+                                                          unsigned int nyC,
+                                                          unsigned int nxF,
+                                                          unsigned int nyF,
+                                                          OffFC offFC);
 
 __global__ void scaleFC_RhoSq_comp_27( real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posC,
-												  unsigned int* posFSWB,
-												  unsigned int kFC,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffFC offFC);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posC,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kFC,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffFC offFC);
 
 __global__ void scaleFC_compressible(
     real *distributionsCoarse,
@@ -2272,73 +2272,73 @@ __global__ void scaleFC_compressible(
     OffFC offsetFC);
 
 __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC,
-														real* DF,
-														unsigned int* neighborCX,
-														unsigned int* neighborCY,
-														unsigned int* neighborCZ,
-														unsigned int* neighborFX,
-														unsigned int* neighborFY,
-														unsigned int* neighborFZ,
-														unsigned int size_MatC,
-														unsigned int size_MatF,
-														bool isEvenTimestep,
-														unsigned int* posC,
-														unsigned int* posFSWB,
-														unsigned int kFC,
-														real omCoarse,
-														real omFine,
-														real nu,
-														unsigned int nxC,
-														unsigned int nyC,
-														unsigned int nxF,
-														unsigned int nyF,
-														OffFC offFC);
+                                                        real* DF,
+                                                        unsigned int* neighborCX,
+                                                        unsigned int* neighborCY,
+                                                        unsigned int* neighborCZ,
+                                                        unsigned int* neighborFX,
+                                                        unsigned int* neighborFY,
+                                                        unsigned int* neighborFZ,
+                                                        unsigned int size_MatC,
+                                                        unsigned int size_MatF,
+                                                        bool isEvenTimestep,
+                                                        unsigned int* posC,
+                                                        unsigned int* posFSWB,
+                                                        unsigned int kFC,
+                                                        real omCoarse,
+                                                        real omFine,
+                                                        real nu,
+                                                        unsigned int nxC,
+                                                        unsigned int nyC,
+                                                        unsigned int nxF,
+                                                        unsigned int nyF,
+                                                        OffFC offFC);
 
 __global__ void scaleFC_AA2016_comp_27(real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posC,
-												  unsigned int* posFSWB,
-												  unsigned int kFC,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  OffFC offFC);
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posC,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kFC,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  OffFC offFC);
 
 __global__ void scaleFC_NSPress_27(real* DC,
-											  real* DF,
-											  unsigned int* neighborCX,
-											  unsigned int* neighborCY,
-											  unsigned int* neighborCZ,
-											  unsigned int* neighborFX,
-											  unsigned int* neighborFY,
-											  unsigned int* neighborFZ,
-											  unsigned int size_MatC,
-											  unsigned int size_MatF,
-											  bool isEvenTimestep,
-											  unsigned int* posC,
-											  unsigned int* posFSWB,
-											  unsigned int kFC,
-											  real omCoarse,
-											  real omFine,
-											  real nu,
-											  unsigned int nxC,
-											  unsigned int nyC,
-											  unsigned int nxF,
-											  unsigned int nyF,
-											  OffFC offFC);
+                                              real* DF,
+                                              unsigned int* neighborCX,
+                                              unsigned int* neighborCY,
+                                              unsigned int* neighborCZ,
+                                              unsigned int* neighborFX,
+                                              unsigned int* neighborFY,
+                                              unsigned int* neighborFZ,
+                                              unsigned int size_MatC,
+                                              unsigned int size_MatF,
+                                              bool isEvenTimestep,
+                                              unsigned int* posC,
+                                              unsigned int* posFSWB,
+                                              unsigned int kFC,
+                                              real omCoarse,
+                                              real omFine,
+                                              real nu,
+                                              unsigned int nxC,
+                                              unsigned int nyC,
+                                              unsigned int nxF,
+                                              unsigned int nyF,
+                                              OffFC offFC);
 
 __global__ void scaleFCThSMG7( real* DC,
                                           real* DF,
@@ -2397,47 +2397,47 @@ __global__ void scaleFCThS27(  real* DC,
                                           unsigned int kFC,
                                           real nu,
                                           real diffusivity_coarse,
-										  OffFC offFC);
+                                          OffFC offFC);
 
 __global__ void DragLiftPost27(  real* DD,
-											int* k_Q,
-											real* QQ,
-											int numberOfBCnodes,
-											double *DragX,
-											double *DragY,
-											double *DragZ,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            int* k_Q,
+                                            real* QQ,
+                                            int numberOfBCnodes,
+                                            double *DragX,
+                                            double *DragY,
+                                            double *DragZ,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void DragLiftPre27(   real* DD,
-											int* k_Q,
-											real* QQ,
-											int numberOfBCnodes,
-											double *DragX,
-											double *DragY,
-											double *DragZ,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            int* k_Q,
+                                            real* QQ,
+                                            int numberOfBCnodes,
+                                            double *DragX,
+                                            double *DragY,
+                                            double *DragZ,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void CalcCP27(real* DD,
-									int* cpIndex,
-									int nonCp,
-									double *cpPress,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep);
+                                    int* cpIndex,
+                                    int nonCp,
+                                    double *cpPress,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep);
 
 __global__ void getSendFsPre27(real* DD,
-										  real* bufferFs,
-										  int* sendIndex,
+                                          real* bufferFs,
+                                          int* sendIndex,
                                           int buffmax,
                                           unsigned int* neighborX,
                                           unsigned int* neighborY,
@@ -2446,8 +2446,8 @@ __global__ void getSendFsPre27(real* DD,
                                           bool isEvenTimestep);
 
 __global__ void getSendFsPost27(real* DD,
-										   real* bufferFs,
-										   int* sendIndex,
+                                           real* bufferFs,
+                                           int* sendIndex,
                                            int buffmax,
                                            unsigned int* neighborX,
                                            unsigned int* neighborY,
@@ -2456,8 +2456,8 @@ __global__ void getSendFsPost27(real* DD,
                                            bool isEvenTimestep);
 
 __global__ void setRecvFsPre27(real* DD,
-										  real* bufferFs,
-										  int* recvIndex,
+                                          real* bufferFs,
+                                          int* recvIndex,
                                           int buffmax,
                                           unsigned int* neighborX,
                                           unsigned int* neighborY,
@@ -2466,8 +2466,8 @@ __global__ void setRecvFsPre27(real* DD,
                                           bool isEvenTimestep);
 
 __global__ void setRecvFsPost27(real* DD,
-										   real* bufferFs,
-										   int* recvIndex,
+                                           real* bufferFs,
+                                           int* recvIndex,
                                            int buffmax,
                                            unsigned int* neighborX,
                                            unsigned int* neighborY,
@@ -2476,155 +2476,155 @@ __global__ void setRecvFsPost27(real* DD,
                                            bool isEvenTimestep);
 
 __global__ void getSendGsF3(
-	real* G6,
-	real* bufferGs,
-	int* sendIndex,
-	int buffmax,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	bool isEvenTimestep);
+    real* G6,
+    real* bufferGs,
+    int* sendIndex,
+    int buffmax,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    bool isEvenTimestep);
 
 __global__ void setRecvGsF3(
-	real* G6,
-	real* bufferGs,
-	int* recvIndex,
-	int buffmax,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	bool isEvenTimestep);
+    real* G6,
+    real* bufferGs,
+    int* recvIndex,
+    int buffmax,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    bool isEvenTimestep);
 
 __global__ void WallFunction27( 	real* vx,
-											real* vy,
-											real* vz,
-											real* DD,
-											int* k_Q,
-											real* QQ,
-											unsigned int numberOfBCnodes,
-											real om1,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep);
+                                            real* vy,
+                                            real* vz,
+                                            real* DD,
+                                            int* k_Q,
+                                            real* QQ,
+                                            unsigned int numberOfBCnodes,
+                                            real om1,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep);
 
 __global__ void LBSetOutputWallVelocitySP27( real* vxD,
-														real* vyD,
-														real* vzD,
-														real* vxWall,
-														real* vyWall,
-														real* vzWall,
-														int numberOfWallNodes,
-														int* kWallNodes,
-														real* rhoD,
-														real* pressD,
-														unsigned int* geoD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														unsigned int size_Mat,
-														real* DD,
-														bool isEvenTimestep);
+                                                        real* vyD,
+                                                        real* vzD,
+                                                        real* vxWall,
+                                                        real* vyWall,
+                                                        real* vzWall,
+                                                        int numberOfWallNodes,
+                                                        int* kWallNodes,
+                                                        real* rhoD,
+                                                        real* pressD,
+                                                        unsigned int* geoD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        unsigned int size_Mat,
+                                                        real* DD,
+                                                        bool isEvenTimestep);
 
 __global__ void GetVeloforForcing27( real* DD,
-												int* bcIndex,
-												int nonAtBC,
-												real* Vx,
-												real* Vy,
-												real* Vz,
-												unsigned int* neighborX,
-												unsigned int* neighborY,
-												unsigned int* neighborZ,
-												unsigned int size_Mat,
-												bool isEvenTimestep);
+                                                int* bcIndex,
+                                                int nonAtBC,
+                                                real* Vx,
+                                                real* Vy,
+                                                real* Vz,
+                                                unsigned int* neighborX,
+                                                unsigned int* neighborY,
+                                                unsigned int* neighborZ,
+                                                unsigned int size_Mat,
+                                                bool isEvenTimestep);
 
 __global__ void InitParticles( real* coordX,
-										  real* coordY,
-										  real* coordZ,
-										  real* coordParticleXlocal,
-										  real* coordParticleYlocal,
-										  real* coordParticleZlocal,
-										  real* coordParticleXglobal,
-										  real* coordParticleYglobal,
-										  real* coordParticleZglobal,
-										  real* veloParticleX,
-										  real* veloParticleY,
-										  real* veloParticleZ,
-										  real* randArray,
-										  unsigned int* particleID,
-										  unsigned int* cellBaseID,
-										  unsigned int* bcMatD,
-										  unsigned int* neighborX,
-										  unsigned int* neighborY,
-										  unsigned int* neighborZ,
-										  unsigned int* neighborWSB,
-										  int level,
-									      unsigned int numberOfParticles,
-										  unsigned int size_Mat);
+                                          real* coordY,
+                                          real* coordZ,
+                                          real* coordParticleXlocal,
+                                          real* coordParticleYlocal,
+                                          real* coordParticleZlocal,
+                                          real* coordParticleXglobal,
+                                          real* coordParticleYglobal,
+                                          real* coordParticleZglobal,
+                                          real* veloParticleX,
+                                          real* veloParticleY,
+                                          real* veloParticleZ,
+                                          real* randArray,
+                                          unsigned int* particleID,
+                                          unsigned int* cellBaseID,
+                                          unsigned int* bcMatD,
+                                          unsigned int* neighborX,
+                                          unsigned int* neighborY,
+                                          unsigned int* neighborZ,
+                                          unsigned int* neighborWSB,
+                                          int level,
+                                          unsigned int numberOfParticles,
+                                          unsigned int size_Mat);
 
 __global__ void MoveParticles( real* coordX,
-										  real* coordY,
-										  real* coordZ,
-										  real* coordParticleXlocal,
-										  real* coordParticleYlocal,
-										  real* coordParticleZlocal,
-										  real* coordParticleXglobal,
-										  real* coordParticleYglobal,
-										  real* coordParticleZglobal,
-										  real* veloParticleX,
-										  real* veloParticleY,
-										  real* veloParticleZ,
-										  real* DD,
-										  real  omega,
-										  unsigned int* particleID,
-										  unsigned int* cellBaseID,
-										  unsigned int* bcMatD,
-										  unsigned int* neighborX,
-										  unsigned int* neighborY,
-										  unsigned int* neighborZ,
-										  unsigned int* neighborWSB,
-										  int level,
-										  unsigned int timestep,
-										  unsigned int numberOfTimesteps,
-									      unsigned int numberOfParticles,
-										  unsigned int size_Mat,
-										  bool isEvenTimestep);
+                                          real* coordY,
+                                          real* coordZ,
+                                          real* coordParticleXlocal,
+                                          real* coordParticleYlocal,
+                                          real* coordParticleZlocal,
+                                          real* coordParticleXglobal,
+                                          real* coordParticleYglobal,
+                                          real* coordParticleZglobal,
+                                          real* veloParticleX,
+                                          real* veloParticleY,
+                                          real* veloParticleZ,
+                                          real* DD,
+                                          real  omega,
+                                          unsigned int* particleID,
+                                          unsigned int* cellBaseID,
+                                          unsigned int* bcMatD,
+                                          unsigned int* neighborX,
+                                          unsigned int* neighborY,
+                                          unsigned int* neighborZ,
+                                          unsigned int* neighborWSB,
+                                          int level,
+                                          unsigned int timestep,
+                                          unsigned int numberOfTimesteps,
+                                          unsigned int numberOfParticles,
+                                          unsigned int size_Mat,
+                                          bool isEvenTimestep);
 
 __global__ void MoveParticlesWithoutBCs(   real* coordX,
-													  real* coordY,
-													  real* coordZ,
-													  real* coordParticleXlocal,
-													  real* coordParticleYlocal,
-													  real* coordParticleZlocal,
-													  real* coordParticleXglobal,
-													  real* coordParticleYglobal,
-													  real* coordParticleZglobal,
-													  real* veloParticleX,
-													  real* veloParticleY,
-													  real* veloParticleZ,
-													  real* DD,
-													  real  omega,
-													  unsigned int* particleID,
-													  unsigned int* cellBaseID,
-													  unsigned int* bcMatD,
-													  unsigned int* neighborX,
-													  unsigned int* neighborY,
-													  unsigned int* neighborZ,
-													  unsigned int* neighborWSB,
-													  int level,
-													  unsigned int timestep,
-													  unsigned int numberOfTimesteps,
-													  unsigned int numberOfParticles,
-													  unsigned int size_Mat,
-													  bool isEvenTimestep);
+                                                      real* coordY,
+                                                      real* coordZ,
+                                                      real* coordParticleXlocal,
+                                                      real* coordParticleYlocal,
+                                                      real* coordParticleZlocal,
+                                                      real* coordParticleXglobal,
+                                                      real* coordParticleYglobal,
+                                                      real* coordParticleZglobal,
+                                                      real* veloParticleX,
+                                                      real* veloParticleY,
+                                                      real* veloParticleZ,
+                                                      real* DD,
+                                                      real  omega,
+                                                      unsigned int* particleID,
+                                                      unsigned int* cellBaseID,
+                                                      unsigned int* bcMatD,
+                                                      unsigned int* neighborX,
+                                                      unsigned int* neighborY,
+                                                      unsigned int* neighborZ,
+                                                      unsigned int* neighborWSB,
+                                                      int level,
+                                                      unsigned int timestep,
+                                                      unsigned int numberOfTimesteps,
+                                                      unsigned int numberOfParticles,
+                                                      unsigned int size_Mat,
+                                                      bool isEvenTimestep);
 
 __global__ void initRandom(curandState* state);
 
 __global__ void generateRandomValues(curandState* state,
-												real* randArray);
+                                                real* randArray);
 
 __global__ void CalcTurbulenceIntensity(
    real* vxx,
diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
index 363fb7662..ebab2b3e8 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -114,429 +114,429 @@ void KernelCasSPMSOHM27( unsigned int numberOfThreads,
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKumCompSRTSP27(
-	unsigned int numberOfThreads,
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* DDStart,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd)
+    unsigned int numberOfThreads,
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* DDStart,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
    LB_Kernel_Kum_New_Comp_SRT_SP_27 <<< grid.grid, grid.threads >>>(
-	   omega,
-	   bcMatD,
-	   neighborX,
-	   neighborY,
-	   neighborZ,
-	   DDStart,
-	   size_Mat,
-	   level,
-	   forces,
-	   EvenOrOdd);
+       omega,
+       bcMatD,
+       neighborX,
+       neighborY,
+       neighborZ,
+       DDStart,
+       size_Mat,
+       level,
+       forces,
+       EvenOrOdd);
       getLastCudaError("LB_Kernel_Kum_New_Comp_SRT_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKum1hSP27(    unsigned int numberOfThreads,
-									real omega,
-									real deltaPhi,
-									real angularVelocity,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									real* coordX,
-									real* coordY,
-									real* coordZ,
-									real* DDStart,
-									int size_Mat,
-									bool EvenOrOdd)
+                                    real omega,
+                                    real deltaPhi,
+                                    real angularVelocity,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    real* coordX,
+                                    real* coordY,
+                                    real* coordZ,
+                                    real* DDStart,
+                                    int size_Mat,
+                                    bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-		LB_Kernel_Kum_1h_SP_27<<< grid.grid, grid.threads >>>(omega,
-													deltaPhi,
-													angularVelocity,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													coordX,
-													coordY,
-													coordZ,
-													DDStart,
-													size_Mat,
-													EvenOrOdd);
-		getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed");
+        LB_Kernel_Kum_1h_SP_27<<< grid.grid, grid.threads >>>(omega,
+                                                    deltaPhi,
+                                                    angularVelocity,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    coordX,
+                                                    coordY,
+                                                    coordZ,
+                                                    DDStart,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+        getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelCascadeSP27(  unsigned int numberOfThreads,
-									real s9,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									real* DD,
-									int size_Mat,
-									bool EvenOrOdd)
+                                    real s9,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    real* DD,
+                                    int size_Mat,
+                                    bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-		LB_Kernel_Cascade_SP_27<<< grid.grid, grid.threads >>>(s9,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													DD,
-													size_Mat,
-													EvenOrOdd);
-		getLastCudaError("LB_Kernel_Cascade_SP_27 execution failed");
+        LB_Kernel_Cascade_SP_27<<< grid.grid, grid.threads >>>(s9,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    DD,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+        getLastCudaError("LB_Kernel_Cascade_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKumNewSP27(   unsigned int numberOfThreads,
-									real s9,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									real* DD,
-									int size_Mat,
-									bool EvenOrOdd)
+                                    real s9,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    real* DD,
+                                    int size_Mat,
+                                    bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-		LB_Kernel_Kum_New_SP_27<<< grid.grid, grid.threads >>>(s9,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													DD,
-													size_Mat,
-													EvenOrOdd);
-		getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed");
+        LB_Kernel_Kum_New_SP_27<<< grid.grid, grid.threads >>>(s9,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    DD,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+        getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKumNewCompSP27(unsigned int numberOfThreads,
-									real s9,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									real* DD,
-									int size_Mat,
-									int size_Array,
-									int level,
-									real* forces,
-									bool EvenOrOdd)
-{
-	//int Grid = size_Array / numberOfThreads;
-	//dim3 grid(Grid, 1, 1);
-	//dim3 threads(numberOfThreads, 1, 1 );
+                                    real s9,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    real* DD,
+                                    int size_Mat,
+                                    int size_Array,
+                                    int level,
+                                    real* forces,
+                                    bool EvenOrOdd)
+{
+    //int Grid = size_Array / numberOfThreads;
+    //dim3 grid(Grid, 1, 1);
+    //dim3 threads(numberOfThreads, 1, 1 );
 
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-		//LB_Kernel_Kum_New_Comp_SP_27<<< grid.grid, grid.threads >>>(	s9,
-		//													bcMatD,
-		//													neighborX,
-		//													neighborY,
-		//													neighborZ,
-		//													DD,
-		//													size_Mat,
-		//													level,
-		//													forces,
-		//													EvenOrOdd);
-		//getLastCudaError("LB_Kernel_Kum_New_Comp_SP_27 execution failed");
+        //LB_Kernel_Kum_New_Comp_SP_27<<< grid.grid, grid.threads >>>(	s9,
+        //													bcMatD,
+        //													neighborX,
+        //													neighborY,
+        //													neighborZ,
+        //													DD,
+        //													size_Mat,
+        //													level,
+        //													forces,
+        //													EvenOrOdd);
+        //getLastCudaError("LB_Kernel_Kum_New_Comp_SP_27 execution failed");
 }
 
 //////////////////////////////////////////////////////////////////////////
 void CumulantOnePreconditionedErrorDiffusionChimCompSP27(unsigned int numberOfThreads,
-																	real s9,
-																	unsigned int* bcMatD,
-																	unsigned int* neighborX,
-																	unsigned int* neighborY,
-																	unsigned int* neighborZ,
-																	real* DD,
-																	int size_Mat,
-																	int size_Array,
-																	int level,
-																	real* forces,
-																	bool EvenOrOdd)
-{
-	//int Grid = size_Array / numberOfThreads;
-	//dim3 grid(Grid, 1, 1);
-	//dim3 threads(numberOfThreads, 1, 1 );
+                                                                    real s9,
+                                                                    unsigned int* bcMatD,
+                                                                    unsigned int* neighborX,
+                                                                    unsigned int* neighborY,
+                                                                    unsigned int* neighborZ,
+                                                                    real* DD,
+                                                                    int size_Mat,
+                                                                    int size_Array,
+                                                                    int level,
+                                                                    real* forces,
+                                                                    bool EvenOrOdd)
+{
+    //int Grid = size_Array / numberOfThreads;
+    //dim3 grid(Grid, 1, 1);
+    //dim3 threads(numberOfThreads, 1, 1 );
 
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
-																						bcMatD,
-																						neighborX,
-																						neighborY,
-																						neighborZ,
-																						DD,
-																						size_Mat,
-																						level,
-																						forces,
-																						EvenOrOdd);
-		getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed");
+    Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
+                                                                                        bcMatD,
+                                                                                        neighborX,
+                                                                                        neighborY,
+                                                                                        neighborZ,
+                                                                                        DD,
+                                                                                        size_Mat,
+                                                                                        level,
+                                                                                        forces,
+                                                                                        EvenOrOdd);
+        getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CumulantOnePreconditionedChimCompSP27(  unsigned int numberOfThreads,
-														real s9,
-														unsigned int* bcMatD,
-														unsigned int* neighborX,
-														unsigned int* neighborY,
-														unsigned int* neighborZ,
-														real* DD,
-														int size_Mat,
-														int size_Array,
-														int level,
-														real* forces,
-														bool EvenOrOdd)
-{
-	//int Grid = size_Array / numberOfThreads;
-	//dim3 grid(Grid, 1, 1);
-	//dim3 threads(numberOfThreads, 1, 1 );
+                                                        real s9,
+                                                        unsigned int* bcMatD,
+                                                        unsigned int* neighborX,
+                                                        unsigned int* neighborY,
+                                                        unsigned int* neighborZ,
+                                                        real* DD,
+                                                        int size_Mat,
+                                                        int size_Array,
+                                                        int level,
+                                                        real* forces,
+                                                        bool EvenOrOdd)
+{
+    //int Grid = size_Array / numberOfThreads;
+    //dim3 grid(Grid, 1, 1);
+    //dim3 threads(numberOfThreads, 1, 1 );
 
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	Cumulant_One_preconditioned_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
-																		bcMatD,
-																		neighborX,
-																		neighborY,
-																		neighborZ,
-																		DD,
-																		size_Mat,
-																		level,
-																		forces,
-																		EvenOrOdd);
-		getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed");
+    Cumulant_One_preconditioned_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
+                                                                        bcMatD,
+                                                                        neighborX,
+                                                                        neighborY,
+                                                                        neighborZ,
+                                                                        DD,
+                                                                        size_Mat,
+                                                                        level,
+                                                                        forces,
+                                                                        EvenOrOdd);
+        getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CumulantOneChimCompSP27(unsigned int numberOfThreads,
-										real s9,
-										unsigned int* bcMatD,
-										unsigned int* neighborX,
-										unsigned int* neighborY,
-										unsigned int* neighborZ,
-										real* DD,
-										int size_Mat,
-										int size_Array,
-										int level,
-										real* forces,
-										bool EvenOrOdd)
-{
-	//int Grid = size_Array / numberOfThreads;
-	//dim3 grid(Grid, 1, 1);
-	//dim3 threads(numberOfThreads, 1, 1 );
+                                        real s9,
+                                        unsigned int* bcMatD,
+                                        unsigned int* neighborX,
+                                        unsigned int* neighborY,
+                                        unsigned int* neighborZ,
+                                        real* DD,
+                                        int size_Mat,
+                                        int size_Array,
+                                        int level,
+                                        real* forces,
+                                        bool EvenOrOdd)
+{
+    //int Grid = size_Array / numberOfThreads;
+    //dim3 grid(Grid, 1, 1);
+    //dim3 threads(numberOfThreads, 1, 1 );
 
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	Cumulant_One_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
-														bcMatD,
-														neighborX,
-														neighborY,
-														neighborZ,
-														DD,
-														size_Mat,
-														level,
-														forces,
-														EvenOrOdd);
-		getLastCudaError("Cumulant_One_chim_Comp_SP_27 execution failed");
+    Cumulant_One_chim_Comp_SP_27 <<< grid.grid, grid.threads >>>(	s9,
+                                                        bcMatD,
+                                                        neighborX,
+                                                        neighborY,
+                                                        neighborZ,
+                                                        DD,
+                                                        size_Mat,
+                                                        level,
+                                                        forces,
+                                                        EvenOrOdd);
+        getLastCudaError("Cumulant_One_chim_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKumIsoTestSP27(unsigned int numberOfThreads,
-									 real s9,
-									 unsigned int* bcMatD,
-									 unsigned int* neighborX,
-									 unsigned int* neighborY,
-									 unsigned int* neighborZ,
-									 real* DD,
-									 real* dxxUx,
-									 real* dyyUy,
-									 real* dzzUz,
-									 int size_Mat,
-									 bool EvenOrOdd)
+                                     real s9,
+                                     unsigned int* bcMatD,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     real* DD,
+                                     real* dxxUx,
+                                     real* dyyUy,
+                                     real* dzzUz,
+                                     int size_Mat,
+                                     bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	LB_Kernel_Kum_IsoTest_SP_27<<< grid.grid, grid.threads >>>(s9,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													DD,
-													dxxUx,
-													dyyUy,
-													dzzUz,
-													size_Mat,
-													EvenOrOdd);
-	getLastCudaError("LB_Kernel_Kum_IsoTest_SP_27 execution failed");
+    LB_Kernel_Kum_IsoTest_SP_27<<< grid.grid, grid.threads >>>(s9,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    DD,
+                                                    dxxUx,
+                                                    dyyUy,
+                                                    dzzUz,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+    getLastCudaError("LB_Kernel_Kum_IsoTest_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelKumCompSP27(  unsigned int numberOfThreads,
-									real s9,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									real* DD,
-									int size_Mat,
-									bool EvenOrOdd)
+                                    real s9,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    real* DD,
+                                    int size_Mat,
+                                    bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-		LB_Kernel_Kum_Comp_SP_27<<< grid.grid, grid.threads >>>(s9,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													DD,
-													size_Mat,
-													EvenOrOdd);
-		getLastCudaError("LB_Kernel_Kum_Comp_SP_27 execution failed");
+        LB_Kernel_Kum_Comp_SP_27<<< grid.grid, grid.threads >>>(s9,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    DD,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+        getLastCudaError("LB_Kernel_Kum_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelPMCumOneCompSP27(unsigned int numberOfThreads,
-									   real omega,
-									   unsigned int* neighborX,
-									   unsigned int* neighborY,
-									   unsigned int* neighborZ,
-									   real* DD,
-									   int size_Mat,
-									   int level,
-									   real* forces,
-									   real porosity,
-									   real darcy,
-									   real forchheimer,
-									   unsigned int sizeOfPorousMedia,
-									   unsigned int* nodeIdsPorousMedia,
-									   bool EvenOrOdd)
+                                       real omega,
+                                       unsigned int* neighborX,
+                                       unsigned int* neighborY,
+                                       unsigned int* neighborZ,
+                                       real* DD,
+                                       int size_Mat,
+                                       int level,
+                                       real* forces,
+                                       real porosity,
+                                       real darcy,
+                                       real forchheimer,
+                                       unsigned int sizeOfPorousMedia,
+                                       unsigned int* nodeIdsPorousMedia,
+                                       bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	LB_Kernel_PM_Cum_One_Comp_SP_27 <<< grid.grid, grid.threads >>>(omega,
-														  neighborX,
-														  neighborY,
-														  neighborZ,
-														  DD,
-														  size_Mat,
-														  level,
-														  forces,
-														  porosity,
-														  darcy,
-														  forchheimer,
-														  sizeOfPorousMedia,
-														  nodeIdsPorousMedia,
-														  EvenOrOdd);
-	getLastCudaError("LB_Kernel_PM_Cum_One_Comp_SP_27 execution failed");
+    LB_Kernel_PM_Cum_One_Comp_SP_27 <<< grid.grid, grid.threads >>>(omega,
+                                                          neighborX,
+                                                          neighborY,
+                                                          neighborZ,
+                                                          DD,
+                                                          size_Mat,
+                                                          level,
+                                                          forces,
+                                                          porosity,
+                                                          darcy,
+                                                          forchheimer,
+                                                          sizeOfPorousMedia,
+                                                          nodeIdsPorousMedia,
+                                                          EvenOrOdd);
+    getLastCudaError("LB_Kernel_PM_Cum_One_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelWaleBySoniMalavCumAA2016CompSP27(
-	unsigned int numberOfThreads,
-	real s9,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int* neighborWSB,
-	real* veloX,
-	real* veloY,
-	real* veloZ,
-	real* DD,
-	real* turbulentViscosity,
-	int size_Mat,
-	int size_Array,
-	int level,
-	real* forces,
-	bool EvenOrOdd)
-{
-	//int Grid = size_Array / numberOfThreads;
-	//dim3 grid(Grid, 1, 1);
-	//dim3 threads(numberOfThreads, 1, 1 );
+    unsigned int numberOfThreads,
+    real s9,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int* neighborWSB,
+    real* veloX,
+    real* veloY,
+    real* veloZ,
+    real* DD,
+    real* turbulentViscosity,
+    int size_Mat,
+    int size_Array,
+    int level,
+    real* forces,
+    bool EvenOrOdd)
+{
+    //int Grid = size_Array / numberOfThreads;
+    //dim3 grid(Grid, 1, 1);
+    //dim3 threads(numberOfThreads, 1, 1 );
 
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27 << < grid.grid, grid.threads >> >(
-		s9,
-		bcMatD,
-		neighborX,
-		neighborY,
-		neighborZ,
-		neighborWSB,
-		veloX,
-		veloY,
-		veloZ,
-		DD,
-		turbulentViscosity,
-		size_Mat,
-		level,
-		forces,
-		EvenOrOdd);
-	getLastCudaError("LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27 execution failed");
+    LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27 << < grid.grid, grid.threads >> >(
+        s9,
+        bcMatD,
+        neighborX,
+        neighborY,
+        neighborZ,
+        neighborWSB,
+        veloX,
+        veloY,
+        veloZ,
+        DD,
+        turbulentViscosity,
+        size_Mat,
+        level,
+        forces,
+        EvenOrOdd);
+    getLastCudaError("LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelADincomp7(   unsigned int numberOfThreads,
-								   real diffusivity,
-								   unsigned int* bcMatD,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   real* DD,
-								   real* DD7,
-								   int size_Mat,
-								   bool EvenOrOdd)
+                                   real diffusivity,
+                                   unsigned int* bcMatD,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   real* DD,
+                                   real* DD7,
+                                   int size_Mat,
+                                   bool EvenOrOdd)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
       LB_Kernel_AD_Incomp_7<<< grid.grid, grid.threads >>>( diffusivity,
-												  bcMatD,
-												  neighborX,
-												  neighborY,
-												  neighborZ,
-												  DD,
-												  DD7,
-												  size_Mat,
-												  EvenOrOdd);
+                                                  bcMatD,
+                                                  neighborX,
+                                                  neighborY,
+                                                  neighborZ,
+                                                  DD,
+                                                  DD7,
+                                                  size_Mat,
+                                                  EvenOrOdd);
       getLastCudaError("LB_Kernel_AD_Incomp_7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void KernelADincomp27( unsigned int numberOfThreads,
-								  real diffusivity,
-								  unsigned int* bcMatD,
-								  unsigned int* neighborX,
-								  unsigned int* neighborY,
-								  unsigned int* neighborZ,
-								  real* DD,
-								  real* DD27,
-								  int size_Mat,
-								  bool EvenOrOdd)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LB_Kernel_AD_Incomp_27<<< grid.grid, grid.threads >>>( diffusivity,
-													bcMatD,
-													neighborX,
-													neighborY,
-													neighborZ,
-													DD,
-													DD27,
-													size_Mat,
-													EvenOrOdd);
-	getLastCudaError("LB_Kernel_AD_Incomp_27 execution failed");
+                                  real diffusivity,
+                                  unsigned int* bcMatD,
+                                  unsigned int* neighborX,
+                                  unsigned int* neighborY,
+                                  unsigned int* neighborZ,
+                                  real* DD,
+                                  real* DD27,
+                                  int size_Mat,
+                                  bool EvenOrOdd)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LB_Kernel_AD_Incomp_27<<< grid.grid, grid.threads >>>( diffusivity,
+                                                    bcMatD,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    DD,
+                                                    DD27,
+                                                    size_Mat,
+                                                    EvenOrOdd);
+    getLastCudaError("LB_Kernel_AD_Incomp_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void Init27( int myid,
@@ -558,7 +558,7 @@ void Init27( int myid,
    dim3 threads       ( grid_nx, 1, 1 );
    dim3 grid          ( grid_ny, grid_nz );   // Gitter fuer Kollision und Propagation
 
-	LBInit27<<< grid, threads >>> (  myid,
+    LBInit27<<< grid, threads >>> (  myid,
                                        numprocs,
                                        u0,
                                        geoD,
@@ -573,7 +573,7 @@ void Init27( int myid,
                                        DD,
                                        level,
                                        maxlevel);
-	getLastCudaError("LBInit27 execution failed");
+    getLastCudaError("LBInit27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void InitNonEqPartSP27( unsigned int numberOfThreads,
@@ -591,9 +591,9 @@ void InitNonEqPartSP27( unsigned int numberOfThreads,
                                    real omega,
                                    bool EvenOrOdd)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	LBInitNonEqPartSP27<<< grid.grid, grid.threads >>>( neighborX,
+    LBInitNonEqPartSP27<<< grid.grid, grid.threads >>>( neighborX,
                                                 neighborY,
                                                 neighborZ,
                                                 neighborWSB,
@@ -606,7 +606,7 @@ void InitNonEqPartSP27( unsigned int numberOfThreads,
                                                 DD,
                                                 omega,
                                                 EvenOrOdd);
-	getLastCudaError("LBInitNonEqPartSP27 execution failed");
+    getLastCudaError("LBInitNonEqPartSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void InitThS7(     unsigned int numberOfThreads,
@@ -622,9 +622,9 @@ void InitThS7(     unsigned int numberOfThreads,
                               real* DD7,
                               bool EvenOrOdd)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	InitAD7<<< grid.grid, grid.threads >>>( neighborX,
+    InitAD7<<< grid.grid, grid.threads >>>( neighborX,
                                        neighborY,
                                        neighborZ,
                                        geoD,
@@ -635,7 +635,7 @@ void InitThS7(     unsigned int numberOfThreads,
                                        size_Mat,
                                        DD7,
                                        EvenOrOdd);
-	getLastCudaError("InitAD7 execution failed");
+    getLastCudaError("InitAD7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void InitADDev27( unsigned int numberOfThreads,
@@ -651,9 +651,9 @@ void InitADDev27( unsigned int numberOfThreads,
                            real* DD27,
                            bool EvenOrOdd)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	InitAD27<<< grid.grid, grid.threads >>>(neighborX,
+    InitAD27<<< grid.grid, grid.threads >>>(neighborX,
                                        neighborY,
                                        neighborZ,
                                        geoD,
@@ -664,45 +664,45 @@ void InitADDev27( unsigned int numberOfThreads,
                                        size_Mat,
                                        DD27,
                                        EvenOrOdd);
-	getLastCudaError("InitAD27 execution failed");
+    getLastCudaError("InitAD27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void PostProcessorF3_2018Fehlberg(
-	unsigned int numberOfThreads,
-	real omega,
-	unsigned int* bcMatD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	real* rhoOut,
-	real* vxOut,
-	real* vyOut,
-	real* vzOut,
-	real* DDStart,
-	real* G6,
-	int size_Mat,
-	int level,
-	real* forces,
-	bool EvenOrOdd)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LB_PostProcessor_F3_2018_Fehlberg <<< grid.grid, grid.threads >>> (   omega,
-																  bcMatD,
-																  neighborX,
-																  neighborY,
-																  neighborZ,
-																  rhoOut,
-																  vxOut,
-																  vyOut,
-																  vzOut,
-																  DDStart,
-																  G6,
-																  size_Mat,
-																  level,
-																  forces,
-																  EvenOrOdd);
-	getLastCudaError("LB_PostProcessor_F3_2018_Fehlberg execution failed");
+    unsigned int numberOfThreads,
+    real omega,
+    unsigned int* bcMatD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    real* rhoOut,
+    real* vxOut,
+    real* vyOut,
+    real* vzOut,
+    real* DDStart,
+    real* G6,
+    int size_Mat,
+    int level,
+    real* forces,
+    bool EvenOrOdd)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LB_PostProcessor_F3_2018_Fehlberg <<< grid.grid, grid.threads >>> (   omega,
+                                                                  bcMatD,
+                                                                  neighborX,
+                                                                  neighborY,
+                                                                  neighborZ,
+                                                                  rhoOut,
+                                                                  vxOut,
+                                                                  vyOut,
+                                                                  vzOut,
+                                                                  DDStart,
+                                                                  G6,
+                                                                  size_Mat,
+                                                                  level,
+                                                                  forces,
+                                                                  EvenOrOdd);
+    getLastCudaError("LB_PostProcessor_F3_2018_Fehlberg execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMac27( real* vxD,
@@ -723,7 +723,7 @@ void CalcMac27( real* vxD,
    dim3 threads       ( grid_nx, 1, 1 );
    dim3 grid          ( grid_ny, grid_nz );
 
-	LBCalcMac27<<< grid, threads >>> (  vxD,
+    LBCalcMac27<<< grid, threads >>> (  vxD,
                                           vyD,
                                           vzD,
                                           rhoD,
@@ -734,7 +734,7 @@ void CalcMac27( real* vxD,
                                           size_Mat,
                                           DD,
                                           isEvenTimestep);
-	getLastCudaError("LBCalcMac27 execution failed");
+    getLastCudaError("LBCalcMac27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMacSP27( real* vxD,
@@ -751,9 +751,9 @@ void CalcMacSP27( real* vxD,
                              real* DD,
                              bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	LBCalcMacSP27<<< grid.grid, grid.threads >>> (   vxD,
+    LBCalcMacSP27<<< grid.grid, grid.threads >>> (   vxD,
                                              vyD,
                                              vzD,
                                              rhoD,
@@ -765,38 +765,38 @@ void CalcMacSP27( real* vxD,
                                              size_Mat,
                                              DD,
                                              isEvenTimestep);
-	getLastCudaError("LBCalcMacSP27 execution failed");
+    getLastCudaError("LBCalcMacSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMacCompSP27( real* vxD,
-								 real* vyD,
-								 real* vzD,
-								 real* rhoD,
-								 real* pressD,
-								 unsigned int* geoD,
-								 unsigned int* neighborX,
-								 unsigned int* neighborY,
-								 unsigned int* neighborZ,
-								 unsigned int size_Mat,
-								 unsigned int numberOfThreads,
-								 real* DD,
-								 bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalcMacCompSP27<<< grid.grid, grid.threads >>> (   vxD,
-												 vyD,
-												 vzD,
-												 rhoD,
-												 pressD,
-												 geoD,
-												 neighborX,
-												 neighborY,
-												 neighborZ,
-												 size_Mat,
-												 DD,
-												 isEvenTimestep);
-	getLastCudaError("LBCalcMacSP27 execution failed");
+                                 real* vyD,
+                                 real* vzD,
+                                 real* rhoD,
+                                 real* pressD,
+                                 unsigned int* geoD,
+                                 unsigned int* neighborX,
+                                 unsigned int* neighborY,
+                                 unsigned int* neighborZ,
+                                 unsigned int size_Mat,
+                                 unsigned int numberOfThreads,
+                                 real* DD,
+                                 bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalcMacCompSP27<<< grid.grid, grid.threads >>> (   vxD,
+                                                 vyD,
+                                                 vzD,
+                                                 rhoD,
+                                                 pressD,
+                                                 geoD,
+                                                 neighborX,
+                                                 neighborY,
+                                                 neighborZ,
+                                                 size_Mat,
+                                                 DD,
+                                                 isEvenTimestep);
+    getLastCudaError("LBCalcMacSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMacThS7(  real* Conc,
@@ -809,9 +809,9 @@ void CalcMacThS7(  real* Conc,
                               real* DD7,
                               bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	CalcConc7<<< grid.grid, grid.threads >>> (Conc,
+    CalcConc7<<< grid.grid, grid.threads >>> (Conc,
                                           geoD,
                                           neighborX,
                                           neighborY,
@@ -819,61 +819,61 @@ void CalcMacThS7(  real* Conc,
                                           size_Mat,
                                           DD7,
                                           isEvenTimestep);
-	getLastCudaError("CalcConc7 execution failed");
+    getLastCudaError("CalcConc7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void PlaneConcThS7(real* Conc,
-							  int* kPC,
-							  unsigned int numberOfPointskPC,
-							  unsigned int* geoD,
-							  unsigned int* neighborX,
-							  unsigned int* neighborY,
-							  unsigned int* neighborZ,
-							  unsigned int size_Mat,
+                              int* kPC,
+                              unsigned int numberOfPointskPC,
+                              unsigned int* geoD,
+                              unsigned int* neighborX,
+                              unsigned int* neighborY,
+                              unsigned int* neighborZ,
+                              unsigned int size_Mat,
                               unsigned int numberOfThreads,
-							  real* DD7,
-							  bool isEvenTimestep)
+                              real* DD7,
+                              bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskPC);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskPC);
 
-	GetPlaneConc7<<< grid.grid, grid.threads >>> (	Conc,
-												kPC,
-												numberOfPointskPC,
-												geoD,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												DD7,
-												isEvenTimestep);
-	getLastCudaError("GetPlaneConc7 execution failed");
+    GetPlaneConc7<<< grid.grid, grid.threads >>> (	Conc,
+                                                kPC,
+                                                numberOfPointskPC,
+                                                geoD,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                DD7,
+                                                isEvenTimestep);
+    getLastCudaError("GetPlaneConc7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void PlaneConcThS27(real* Conc,
-							   int* kPC,
-							   unsigned int numberOfPointskPC,
-							   unsigned int* geoD,
-							   unsigned int* neighborX,
-							   unsigned int* neighborY,
-							   unsigned int* neighborZ,
-							   unsigned int size_Mat,
+                               int* kPC,
+                               unsigned int numberOfPointskPC,
+                               unsigned int* geoD,
+                               unsigned int* neighborX,
+                               unsigned int* neighborY,
+                               unsigned int* neighborZ,
+                               unsigned int size_Mat,
                                unsigned int numberOfThreads,
-							   real* DD27,
-							   bool isEvenTimestep)
+                               real* DD27,
+                               bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskPC);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskPC);
 
-	GetPlaneConc27<<< grid.grid, grid.threads >>> (	Conc,
-												kPC,
-												numberOfPointskPC,
-												geoD,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												DD27,
-												isEvenTimestep);
-	getLastCudaError("GetPlaneConc27 execution failed");
+    GetPlaneConc27<<< grid.grid, grid.threads >>> (	Conc,
+                                                kPC,
+                                                numberOfPointskPC,
+                                                geoD,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                DD27,
+                                                isEvenTimestep);
+    getLastCudaError("GetPlaneConc27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcConcentration27( unsigned int numberOfThreads,
@@ -886,9 +886,9 @@ void CalcConcentration27( unsigned int numberOfThreads,
                                      real* DD27,
                                      bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	CalcConc27<<< grid.grid, grid.threads >>> (  Conc,
+    CalcConc27<<< grid.grid, grid.threads >>> (  Conc,
                                              geoD,
                                              neighborX,
                                              neighborY,
@@ -896,7 +896,7 @@ void CalcConcentration27( unsigned int numberOfThreads,
                                              size_Mat,
                                              DD27,
                                              isEvenTimestep);
-	getLastCudaError("CalcConc27 execution failed");
+    getLastCudaError("CalcConc27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMedSP27(  real* vxD,
@@ -913,9 +913,9 @@ void CalcMedSP27(  real* vxD,
                               real* DD,
                               bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	LBCalcMedSP27<<< grid.grid, grid.threads >>> (   vxD,
+    LBCalcMedSP27<<< grid.grid, grid.threads >>> (   vxD,
                                              vyD,
                                              vzD,
                                              rhoD,
@@ -927,75 +927,75 @@ void CalcMedSP27(  real* vxD,
                                              size_Mat,
                                              DD,
                                              isEvenTimestep);
-	getLastCudaError("LBCalcMedSP27 execution failed");
+    getLastCudaError("LBCalcMedSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMedCompSP27(  real* vxD,
-								  real* vyD,
-								  real* vzD,
-								  real* rhoD,
-								  real* pressD,
-								  unsigned int* geoD,
-								  unsigned int* neighborX,
-								  unsigned int* neighborY,
-								  unsigned int* neighborZ,
-								  unsigned int size_Mat,
-								  unsigned int numberOfThreads,
-								  real* DD,
-								  bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalcMedCompSP27<<< grid.grid, grid.threads >>> (   vxD,
-												 vyD,
-												 vzD,
-												 rhoD,
-												 pressD,
-												 geoD,
-												 neighborX,
-												 neighborY,
-												 neighborZ,
-												 size_Mat,
-												 DD,
-												 isEvenTimestep);
-	getLastCudaError("LBCalcMedSP27 execution failed");
+                                  real* vyD,
+                                  real* vzD,
+                                  real* rhoD,
+                                  real* pressD,
+                                  unsigned int* geoD,
+                                  unsigned int* neighborX,
+                                  unsigned int* neighborY,
+                                  unsigned int* neighborZ,
+                                  unsigned int size_Mat,
+                                  unsigned int numberOfThreads,
+                                  real* DD,
+                                  bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalcMedCompSP27<<< grid.grid, grid.threads >>> (   vxD,
+                                                 vyD,
+                                                 vzD,
+                                                 rhoD,
+                                                 pressD,
+                                                 geoD,
+                                                 neighborX,
+                                                 neighborY,
+                                                 neighborZ,
+                                                 size_Mat,
+                                                 DD,
+                                                 isEvenTimestep);
+    getLastCudaError("LBCalcMedSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMedCompAD27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	real* concD,
-	unsigned int* geoD,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	unsigned int numberOfThreads,
-	real* DD,
-	real* DD_AD,
-	bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalcMedCompAD27 <<< grid.grid, grid.threads >>> (
-		vxD,
-		vyD,
-		vzD,
-		rhoD,
-		pressD,
-		concD,
-		geoD,
-		neighborX,
-		neighborY,
-		neighborZ,
-		size_Mat,
-		DD,
-		DD_AD,
-		isEvenTimestep);
-	getLastCudaError("LBCalcMedAD27 execution failed");
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    real* concD,
+    unsigned int* geoD,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    unsigned int numberOfThreads,
+    real* DD,
+    real* DD_AD,
+    bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalcMedCompAD27 <<< grid.grid, grid.threads >>> (
+        vxD,
+        vyD,
+        vzD,
+        rhoD,
+        pressD,
+        concD,
+        geoD,
+        neighborX,
+        neighborY,
+        neighborZ,
+        size_Mat,
+        DD,
+        DD_AD,
+        isEvenTimestep);
+    getLastCudaError("LBCalcMedAD27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcMacMedSP27(  real* vxD,
@@ -1012,9 +1012,9 @@ void CalcMacMedSP27(  real* vxD,
                                  unsigned int numberOfThreads,
                                  bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
-	LBCalcMacMedSP27<<< grid.grid, grid.threads >>> (   vxD,
+    LBCalcMacMedSP27<<< grid.grid, grid.threads >>> (   vxD,
                                                 vyD,
                                                 vzD,
                                                 rhoD,
@@ -1026,270 +1026,270 @@ void CalcMacMedSP27(  real* vxD,
                                                 tdiff,
                                                 size_Mat,
                                                 isEvenTimestep);
-	getLastCudaError("LBCalcMacMedSP27 execution failed");
+    getLastCudaError("LBCalcMacMedSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ResetMedianValuesSP27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	unsigned int size_Mat,
-	unsigned int numberOfThreads,
-	bool isEvenTimestep)
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    unsigned int size_Mat,
+    unsigned int numberOfThreads,
+    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
 
 
-	LBResetMedianValuesSP27 << < grid.grid, grid.threads >> > (
-		vxD,
-		vyD,
-		vzD,
-		rhoD,
-		pressD,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("LBResetMedianValuesSP27 execution failed");
+    LBResetMedianValuesSP27 << < grid.grid, grid.threads >> > (
+        vxD,
+        vyD,
+        vzD,
+        rhoD,
+        pressD,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("LBResetMedianValuesSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ResetMedianValuesAD27(
-	real* vxD,
-	real* vyD,
-	real* vzD,
-	real* rhoD,
-	real* pressD,
-	real* concD,
-	unsigned int size_Mat,
-	unsigned int numberOfThreads,
-	bool isEvenTimestep)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBResetMedianValuesAD27 << < grid.grid, grid.threads >> > (
-		vxD,
-		vyD,
-		vzD,
-		rhoD,
-		pressD,
-		concD,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("LBResetMedianValuesAD27 execution failed");
+    real* vxD,
+    real* vyD,
+    real* vzD,
+    real* rhoD,
+    real* pressD,
+    real* concD,
+    unsigned int size_Mat,
+    unsigned int numberOfThreads,
+    bool isEvenTimestep)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBResetMedianValuesAD27 << < grid.grid, grid.threads >> > (
+        vxD,
+        vyD,
+        vzD,
+        rhoD,
+        pressD,
+        concD,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("LBResetMedianValuesAD27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ,
-										 real* kyzFromfcNEQ,
-										 real* kxzFromfcNEQ,
-										 real* kxxMyyFromfcNEQ,
-										 real* kxxMzzFromfcNEQ,
-										 unsigned int* geoD,
-										 unsigned int* neighborX,
-										 unsigned int* neighborY,
-										 unsigned int* neighborZ,
-										 unsigned int size_Mat,
-										 unsigned int numberOfThreads,
-										 real* DD,
-										 bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalc2ndMomentsIncompSP27<<< grid.grid, grid.threads >>> (  kxyFromfcNEQ,
-														 kyzFromfcNEQ,
-														 kxzFromfcNEQ,
-														 kxxMyyFromfcNEQ,
-														 kxxMzzFromfcNEQ,
-														 geoD,
-														 neighborX,
-														 neighborY,
-														 neighborZ,
-														 size_Mat,
-														 DD,
-														 isEvenTimestep);
-	getLastCudaError("LBCalc2ndMomentsIncompSP27 execution failed");
+                                         real* kyzFromfcNEQ,
+                                         real* kxzFromfcNEQ,
+                                         real* kxxMyyFromfcNEQ,
+                                         real* kxxMzzFromfcNEQ,
+                                         unsigned int* geoD,
+                                         unsigned int* neighborX,
+                                         unsigned int* neighborY,
+                                         unsigned int* neighborZ,
+                                         unsigned int size_Mat,
+                                         unsigned int numberOfThreads,
+                                         real* DD,
+                                         bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalc2ndMomentsIncompSP27<<< grid.grid, grid.threads >>> (  kxyFromfcNEQ,
+                                                         kyzFromfcNEQ,
+                                                         kxzFromfcNEQ,
+                                                         kxxMyyFromfcNEQ,
+                                                         kxxMzzFromfcNEQ,
+                                                         geoD,
+                                                         neighborX,
+                                                         neighborY,
+                                                         neighborZ,
+                                                         size_Mat,
+                                                         DD,
+                                                         isEvenTimestep);
+    getLastCudaError("LBCalc2ndMomentsIncompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void Calc2ndMomentsCompSP27( real* kxyFromfcNEQ,
-										real* kyzFromfcNEQ,
-										real* kxzFromfcNEQ,
-										real* kxxMyyFromfcNEQ,
-										real* kxxMzzFromfcNEQ,
-										unsigned int* geoD,
-										unsigned int* neighborX,
-										unsigned int* neighborY,
-										unsigned int* neighborZ,
-										unsigned int size_Mat,
-										unsigned int numberOfThreads,
-										real* DD,
-										bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalc2ndMomentsCompSP27<<< grid.grid, grid.threads >>> (kxyFromfcNEQ,
-													 kyzFromfcNEQ,
-													 kxzFromfcNEQ,
-													 kxxMyyFromfcNEQ,
-													 kxxMzzFromfcNEQ,
-													 geoD,
-													 neighborX,
-													 neighborY,
-													 neighborZ,
-													 size_Mat,
-													 DD,
-													 isEvenTimestep);
-	getLastCudaError("LBCalc2ndMomentsCompSP27 execution failed");
+                                        real* kyzFromfcNEQ,
+                                        real* kxzFromfcNEQ,
+                                        real* kxxMyyFromfcNEQ,
+                                        real* kxxMzzFromfcNEQ,
+                                        unsigned int* geoD,
+                                        unsigned int* neighborX,
+                                        unsigned int* neighborY,
+                                        unsigned int* neighborZ,
+                                        unsigned int size_Mat,
+                                        unsigned int numberOfThreads,
+                                        real* DD,
+                                        bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalc2ndMomentsCompSP27<<< grid.grid, grid.threads >>> (kxyFromfcNEQ,
+                                                     kyzFromfcNEQ,
+                                                     kxzFromfcNEQ,
+                                                     kxxMyyFromfcNEQ,
+                                                     kxxMzzFromfcNEQ,
+                                                     geoD,
+                                                     neighborX,
+                                                     neighborY,
+                                                     neighborZ,
+                                                     size_Mat,
+                                                     DD,
+                                                     isEvenTimestep);
+    getLastCudaError("LBCalc2ndMomentsCompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void Calc3rdMomentsIncompSP27(real* CUMbbb,
-										 real* CUMabc,
-										 real* CUMbac,
-										 real* CUMbca,
-										 real* CUMcba,
-										 real* CUMacb,
-										 real* CUMcab,
-										 unsigned int* geoD,
-										 unsigned int* neighborX,
-										 unsigned int* neighborY,
-										 unsigned int* neighborZ,
-										 unsigned int size_Mat,
-										 unsigned int numberOfThreads,
-										 real* DD,
-										 bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalc3rdMomentsIncompSP27<<< grid.grid, grid.threads >>> (  CUMbbb,
-														 CUMabc,
-														 CUMbac,
-														 CUMbca,
-														 CUMcba,
-														 CUMacb,
-														 CUMcab,
-														 geoD,
-														 neighborX,
-														 neighborY,
-														 neighborZ,
-														 DD,
-														 size_Mat,
-														 isEvenTimestep);
-	getLastCudaError("LBCalc3rdMomentsIncompSP27 execution failed");
+                                         real* CUMabc,
+                                         real* CUMbac,
+                                         real* CUMbca,
+                                         real* CUMcba,
+                                         real* CUMacb,
+                                         real* CUMcab,
+                                         unsigned int* geoD,
+                                         unsigned int* neighborX,
+                                         unsigned int* neighborY,
+                                         unsigned int* neighborZ,
+                                         unsigned int size_Mat,
+                                         unsigned int numberOfThreads,
+                                         real* DD,
+                                         bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalc3rdMomentsIncompSP27<<< grid.grid, grid.threads >>> (  CUMbbb,
+                                                         CUMabc,
+                                                         CUMbac,
+                                                         CUMbca,
+                                                         CUMcba,
+                                                         CUMacb,
+                                                         CUMcab,
+                                                         geoD,
+                                                         neighborX,
+                                                         neighborY,
+                                                         neighborZ,
+                                                         DD,
+                                                         size_Mat,
+                                                         isEvenTimestep);
+    getLastCudaError("LBCalc3rdMomentsIncompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void Calc3rdMomentsCompSP27( real* CUMbbb,
-										real* CUMabc,
-										real* CUMbac,
-										real* CUMbca,
-										real* CUMcba,
-										real* CUMacb,
-										real* CUMcab,
-										unsigned int* geoD,
-										unsigned int* neighborX,
-										unsigned int* neighborY,
-										unsigned int* neighborZ,
-										unsigned int size_Mat,
-										unsigned int numberOfThreads,
-										real* DD,
-										bool isEvenTimestep)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalc3rdMomentsCompSP27<<< grid.grid, grid.threads >>> (CUMbbb,
-													 CUMabc,
-													 CUMbac,
-													 CUMbca,
-													 CUMcba,
-													 CUMacb,
-													 CUMcab,
-													 geoD,
-													 neighborX,
-													 neighborY,
-													 neighborZ,
-													 DD,
-													 size_Mat,
-													 isEvenTimestep);
-	getLastCudaError("LBCalc3rdMomentsCompSP27 execution failed");
+                                        real* CUMabc,
+                                        real* CUMbac,
+                                        real* CUMbca,
+                                        real* CUMcba,
+                                        real* CUMacb,
+                                        real* CUMcab,
+                                        unsigned int* geoD,
+                                        unsigned int* neighborX,
+                                        unsigned int* neighborY,
+                                        unsigned int* neighborZ,
+                                        unsigned int size_Mat,
+                                        unsigned int numberOfThreads,
+                                        real* DD,
+                                        bool isEvenTimestep)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalc3rdMomentsCompSP27<<< grid.grid, grid.threads >>> (CUMbbb,
+                                                     CUMabc,
+                                                     CUMbac,
+                                                     CUMbca,
+                                                     CUMcba,
+                                                     CUMacb,
+                                                     CUMcab,
+                                                     geoD,
+                                                     neighborX,
+                                                     neighborY,
+                                                     neighborZ,
+                                                     DD,
+                                                     size_Mat,
+                                                     isEvenTimestep);
+    getLastCudaError("LBCalc3rdMomentsCompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcHigherMomentsIncompSP27(real* CUMcbb,
-											real* CUMbcb,
-											real* CUMbbc,
-											real* CUMcca,
-											real* CUMcac,
-											real* CUMacc,
-											real* CUMbcc,
-											real* CUMcbc,
-											real* CUMccb,
-											real* CUMccc,
-											unsigned int* geoD,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											unsigned int numberOfThreads,
-											real* DD,
-											bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalcHigherMomentsIncompSP27<<< grid.grid, grid.threads >>> (CUMcbb,
-														  CUMbcb,
-														  CUMbbc,
-														  CUMcca,
-														  CUMcac,
-														  CUMacc,
-														  CUMbcc,
-														  CUMcbc,
-														  CUMccb,
-														  CUMccc,
-														  geoD,
-														  neighborX,
-														  neighborY,
-														  neighborZ,
-														  DD,
-														  size_Mat,
-														  isEvenTimestep);
-	getLastCudaError("LBCalcHigherMomentsIncompSP27 execution failed");
+                                            real* CUMbcb,
+                                            real* CUMbbc,
+                                            real* CUMcca,
+                                            real* CUMcac,
+                                            real* CUMacc,
+                                            real* CUMbcc,
+                                            real* CUMcbc,
+                                            real* CUMccb,
+                                            real* CUMccc,
+                                            unsigned int* geoD,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            unsigned int numberOfThreads,
+                                            real* DD,
+                                            bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalcHigherMomentsIncompSP27<<< grid.grid, grid.threads >>> (CUMcbb,
+                                                          CUMbcb,
+                                                          CUMbbc,
+                                                          CUMcca,
+                                                          CUMcac,
+                                                          CUMacc,
+                                                          CUMbcc,
+                                                          CUMcbc,
+                                                          CUMccb,
+                                                          CUMccc,
+                                                          geoD,
+                                                          neighborX,
+                                                          neighborY,
+                                                          neighborZ,
+                                                          DD,
+                                                          size_Mat,
+                                                          isEvenTimestep);
+    getLastCudaError("LBCalcHigherMomentsIncompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcHigherMomentsCompSP27(  real* CUMcbb,
-											real* CUMbcb,
-											real* CUMbbc,
-											real* CUMcca,
-											real* CUMcac,
-											real* CUMacc,
-											real* CUMbcc,
-											real* CUMcbc,
-											real* CUMccb,
-											real* CUMccc,
-											unsigned int* geoD,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											unsigned int numberOfThreads,
-											real* DD,
-											bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
-
-	LBCalcHigherMomentsCompSP27<<< grid.grid, grid.threads >>> (  CUMcbb,
-														  CUMbcb,
-														  CUMbbc,
-														  CUMcca,
-														  CUMcac,
-														  CUMacc,
-														  CUMbcc,
-														  CUMcbc,
-														  CUMccb,
-														  CUMccc,
-														  geoD,
-														  neighborX,
-														  neighborY,
-														  neighborZ,
-														  DD,
-														  size_Mat,
-														  isEvenTimestep);
-	getLastCudaError("LBCalcHigherMomentsCompSP27 execution failed");
+                                            real* CUMbcb,
+                                            real* CUMbbc,
+                                            real* CUMcca,
+                                            real* CUMcac,
+                                            real* CUMacc,
+                                            real* CUMbcc,
+                                            real* CUMcbc,
+                                            real* CUMccb,
+                                            real* CUMccc,
+                                            unsigned int* geoD,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            unsigned int numberOfThreads,
+                                            real* DD,
+                                            bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
+
+    LBCalcHigherMomentsCompSP27<<< grid.grid, grid.threads >>> (  CUMcbb,
+                                                          CUMbcb,
+                                                          CUMbbc,
+                                                          CUMcca,
+                                                          CUMcac,
+                                                          CUMacc,
+                                                          CUMbcc,
+                                                          CUMcbc,
+                                                          CUMccb,
+                                                          CUMccc,
+                                                          geoD,
+                                                          neighborX,
+                                                          neighborY,
+                                                          neighborZ,
+                                                          DD,
+                                                          size_Mat,
+                                                          isEvenTimestep);
+    getLastCudaError("LBCalcHigherMomentsCompSP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void LBCalcMeasurePoints27(real* vxMP,
@@ -1309,9 +1309,9 @@ void LBCalcMeasurePoints27(real* vxMP,
                                       unsigned int numberOfThreads,
                                       bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskMP);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfPointskMP);
 
-	LBCalcMeasurePoints<<< grid.grid, grid.threads >>> (vxMP,
+    LBCalcMeasurePoints<<< grid.grid, grid.threads >>> (vxMP,
                                                 vyMP,
                                                 vzMP,
                                                 rhoMP,
@@ -1326,7 +1326,7 @@ void LBCalcMeasurePoints27(real* vxMP,
                                                 size_Mat,
                                                 DD,
                                                 isEvenTimestep);
-	getLastCudaError("LBCalcMeasurePoints execution failed");
+    getLastCudaError("LBCalcMeasurePoints execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void BcPress27( int nx,
@@ -1342,10 +1342,10 @@ void BcPress27( int nx,
                            unsigned int size_Mat,
                            bool isEvenTimestep)
 {
-	dim3 threads       ( grid_nx, 1, 1 );
-	dim3 grid          ( grid_ny, 1 );
+    dim3 threads       ( grid_nx, 1, 1 );
+    dim3 grid          ( grid_ny, 1 );
 
-	LB_BC_Press_East27<<< grid, threads >>> ( nx,
+    LB_BC_Press_East27<<< grid, threads >>> ( nx,
                                                 ny,
                                                 tz,
                                                 bcMatD,
@@ -1355,7 +1355,7 @@ void BcPress27( int nx,
                                                 DD,
                                                 size_Mat,
                                                 isEvenTimestep);
-	getLastCudaError("LB_BC_Press_East27 execution failed");
+    getLastCudaError("LB_BC_Press_East27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void BcVel27(int nx,
@@ -1374,10 +1374,10 @@ void BcVel27(int nx,
                         real u0x,
                         real om)
 {
-	dim3 threads       ( grid_nx, 1, 1 );
-	dim3 grid          ( grid_ny, 1 );
+    dim3 threads       ( grid_nx, 1, 1 );
+    dim3 grid          ( grid_ny, 1 );
 
-	LB_BC_Vel_West_27<<< grid, threads >>> (  nx,
+    LB_BC_Vel_West_27<<< grid, threads >>> (  nx,
                                                 ny,
                                                 nz,
                                                 itz,
@@ -1392,7 +1392,7 @@ void BcVel27(int nx,
                                                 grid_nx,
                                                 grid_ny,
                                                 om);
-	getLastCudaError("LB_BC_Vel_West_27 execution failed");
+    getLastCudaError("LB_BC_Vel_West_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADPressDev7( unsigned int numberOfThreads,
@@ -1411,7 +1411,7 @@ void QADPressDev7( unsigned int numberOfThreads,
                               unsigned int size_Mat,
                               bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADPress7<<< grid.grid, grid.threads >>>( DD,
                                        DD7,
@@ -1427,7 +1427,7 @@ void QADPressDev7( unsigned int numberOfThreads,
                                        neighborZ,
                                        size_Mat,
                                        isEvenTimestep);
-	getLastCudaError("QADPress7 execution failed");
+    getLastCudaError("QADPress7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADPressDev27(unsigned int numberOfThreads,
@@ -1446,7 +1446,7 @@ void QADPressDev27(unsigned int numberOfThreads,
                               unsigned int size_Mat,
                               bool isEvenTimestep)
 {
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADPress27<<< grid.grid, grid.threads >>>(   DD,
                                           DD27,
@@ -1462,39 +1462,39 @@ void QADPressDev27(unsigned int numberOfThreads,
                                           neighborZ,
                                           size_Mat,
                                           isEvenTimestep);
-	getLastCudaError("QADPress27 execution failed");
+    getLastCudaError("QADPress27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADPressNEQNeighborDev27(
-											unsigned int numberOfThreads,
-											real* DD,
-											real* DD27,
-											int* k_Q,
-											int* k_N,
-											int numberOfBCnodes,
-											unsigned int* neighborX,
-											unsigned int* neighborY,
-											unsigned int* neighborZ,
-											unsigned int size_Mat,
-											bool isEvenTimestep
-										)
-{
-
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
-
-	QADPressNEQNeighbor27<<< grid.grid, grid.threads >>>(
-												DD,
-												DD27,
-												k_Q,
-												k_N,
-												numberOfBCnodes,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												isEvenTimestep
-											  );
-   	getLastCudaError("QADPressNEQNeighbor27 execution failed");
+                                            unsigned int numberOfThreads,
+                                            real* DD,
+                                            real* DD27,
+                                            int* k_Q,
+                                            int* k_N,
+                                            int numberOfBCnodes,
+                                            unsigned int* neighborX,
+                                            unsigned int* neighborY,
+                                            unsigned int* neighborZ,
+                                            unsigned int size_Mat,
+                                            bool isEvenTimestep
+                                        )
+{
+
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+
+    QADPressNEQNeighbor27<<< grid.grid, grid.threads >>>(
+                                                DD,
+                                                DD27,
+                                                k_Q,
+                                                k_N,
+                                                numberOfBCnodes,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                isEvenTimestep
+                                              );
+       getLastCudaError("QADPressNEQNeighbor27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADVelDev7(unsigned int numberOfThreads,
@@ -1513,9 +1513,9 @@ void QADVelDev7(unsigned int numberOfThreads,
                            unsigned int size_Mat,
                            bool isEvenTimestep)
 {
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
-      QADVel7<<< grid.grid, grid.threads >>> (  
+      QADVel7<<< grid.grid, grid.threads >>> (
                                        DD,
                                        DD7,
                                        temp,
@@ -1530,7 +1530,7 @@ void QADVelDev7(unsigned int numberOfThreads,
                                        neighborZ,
                                        size_Mat,
                                        isEvenTimestep);
-	getLastCudaError("QADVel7 execution failed");
+    getLastCudaError("QADVel7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADVelDev27(  unsigned int numberOfThreads,
@@ -1583,7 +1583,7 @@ void QADDev7(unsigned int numberOfThreads,
                         unsigned int size_Mat,
                         bool isEvenTimestep)
 {
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QAD7<<< grid.grid, grid.threads >>> (     DD,
                                        DD7,
@@ -1637,74 +1637,74 @@ void FactorizedCentralMomentsAdvectionDiffusionDeviceKernel(
 
 //////////////////////////////////////////////////////////////////////////
 void ADSlipVelDevComp(
-	uint numberOfThreads,
-	real * normalX,
-	real * normalY,
-	real * normalZ,
-	real * distributions,
-	real * distributionsAD,
-	int* QindexArray,
-	real * Qarrays,
-	uint numberOfBCnodes,
-	real omegaDiffusivity,
-	uint * neighborX,
-	uint * neighborY,
-	uint * neighborZ,
-	uint size_Mat,
-	bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
-
-	AD_SlipVelDeviceComp << < grid.grid, grid.threads >> > (
-		normalX,
-		normalY,
-		normalZ,
-		distributions,
-		distributionsAD,
-		QindexArray,
-		Qarrays,
-		numberOfBCnodes,
-		omegaDiffusivity,
-		neighborX,
-		neighborY,
-		neighborZ,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("AD_SlipVelDeviceComp execution failed");
+    uint numberOfThreads,
+    real * normalX,
+    real * normalY,
+    real * normalZ,
+    real * distributions,
+    real * distributionsAD,
+    int* QindexArray,
+    real * Qarrays,
+    uint numberOfBCnodes,
+    real omegaDiffusivity,
+    uint * neighborX,
+    uint * neighborY,
+    uint * neighborZ,
+    uint size_Mat,
+    bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+
+    AD_SlipVelDeviceComp << < grid.grid, grid.threads >> > (
+        normalX,
+        normalY,
+        normalZ,
+        distributions,
+        distributionsAD,
+        QindexArray,
+        Qarrays,
+        numberOfBCnodes,
+        omegaDiffusivity,
+        neighborX,
+        neighborY,
+        neighborZ,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("AD_SlipVelDeviceComp execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 
 void QADDirichletDev27( unsigned int numberOfThreads,
-								   real* DD,
-								   real* DD27,
-								   real* temp,
-								   real diffusivity,
-								   int* k_Q,
-								   real* QQ,
-								   unsigned int numberOfBCnodes,
-								   real om1,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep)
-{
-   	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+                                   real* DD,
+                                   real* DD27,
+                                   real* temp,
+                                   real diffusivity,
+                                   int* k_Q,
+                                   real* QQ,
+                                   unsigned int numberOfBCnodes,
+                                   real om1,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep)
+{
+       vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADDirichlet27<<< grid.grid, grid.threads >>> (
-											   DD,
-											   DD27,
-											   temp,
-											   diffusivity,
-											   k_Q,
-											   QQ,
-											   numberOfBCnodes,
-											   om1,
-											   neighborX,
-											   neighborY,
-											   neighborZ,
-											   size_Mat,
-											   isEvenTimestep);
+                                               DD,
+                                               DD27,
+                                               temp,
+                                               diffusivity,
+                                               k_Q,
+                                               QQ,
+                                               numberOfBCnodes,
+                                               om1,
+                                               neighborX,
+                                               neighborY,
+                                               neighborZ,
+                                               size_Mat,
+                                               isEvenTimestep);
       getLastCudaError("QADDirichletDev27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -1742,212 +1742,212 @@ void QADBBDev27(unsigned int numberOfThreads,
 }
 //////////////////////////////////////////////////////////////////////////
 void QNoSlipADincompDev7(unsigned int numberOfThreads,
-									real* DD,
-									real* DD7,
-									real* temp,
-									real diffusivity,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* DD,
+                                    real* DD7,
+                                    real* temp,
+                                    real diffusivity,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QNoSlipADincomp7<<< grid.grid, grid.threads >>> (
-											   DD,
-											   DD7,
-											   temp,
-											   diffusivity,
-											   k_Q,
-											   QQ,
-											   numberOfBCnodes,
-											   om1,
-											   neighborX,
-											   neighborY,
-											   neighborZ,
-											   size_Mat,
-											   isEvenTimestep);
+                                               DD,
+                                               DD7,
+                                               temp,
+                                               diffusivity,
+                                               k_Q,
+                                               QQ,
+                                               numberOfBCnodes,
+                                               om1,
+                                               neighborX,
+                                               neighborY,
+                                               neighborZ,
+                                               size_Mat,
+                                               isEvenTimestep);
       getLastCudaError("QNoSlipADincomp7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QNoSlipADincompDev27(  unsigned int numberOfThreads,
-									   real* DD,
-									   real* DD27,
-									   real* temp,
-									   real diffusivity,
-									   int* k_Q,
-									   real* QQ,
-									   unsigned int numberOfBCnodes,
-									   real om1,
-									   unsigned int* neighborX,
-									   unsigned int* neighborY,
-									   unsigned int* neighborZ,
-									   unsigned int size_Mat,
-									   bool isEvenTimestep)
+                                       real* DD,
+                                       real* DD27,
+                                       real* temp,
+                                       real diffusivity,
+                                       int* k_Q,
+                                       real* QQ,
+                                       unsigned int numberOfBCnodes,
+                                       real om1,
+                                       unsigned int* neighborX,
+                                       unsigned int* neighborY,
+                                       unsigned int* neighborZ,
+                                       unsigned int size_Mat,
+                                       bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QNoSlipADincomp27<<< grid.grid, grid.threads >>> (
-											   DD,
-											   DD27,
-											   temp,
-											   diffusivity,
-											   k_Q,
-											   QQ,
-											   numberOfBCnodes,
-											   om1,
-											   neighborX,
-											   neighborY,
-											   neighborZ,
-											   size_Mat,
-											   isEvenTimestep);
+                                               DD,
+                                               DD27,
+                                               temp,
+                                               diffusivity,
+                                               k_Q,
+                                               QQ,
+                                               numberOfBCnodes,
+                                               om1,
+                                               neighborX,
+                                               neighborY,
+                                               neighborZ,
+                                               size_Mat,
+                                               isEvenTimestep);
       getLastCudaError("QNoSlipADincomp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADVeloIncompDev7( unsigned int numberOfThreads,
-								   real* DD,
-								   real* DD7,
-								   real* temp,
-								   real* velo,
-								   real diffusivity,
-								   int* k_Q,
-								   real* QQ,
-								   unsigned int numberOfBCnodes,
-								   real om1,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep)
+                                   real* DD,
+                                   real* DD7,
+                                   real* temp,
+                                   real* velo,
+                                   real diffusivity,
+                                   int* k_Q,
+                                   real* QQ,
+                                   unsigned int numberOfBCnodes,
+                                   real om1,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADVeloIncomp7<<< grid.grid, grid.threads >>> ( DD,
-	  										   DD7,
-											   temp,
-											   velo,
-											   diffusivity,
-											   k_Q,
-											   QQ,
-											   numberOfBCnodes,
-											   om1,
-											   neighborX,
-											   neighborY,
-											   neighborZ,
-											   size_Mat,
-											   isEvenTimestep);
+                                                 DD7,
+                                               temp,
+                                               velo,
+                                               diffusivity,
+                                               k_Q,
+                                               QQ,
+                                               numberOfBCnodes,
+                                               om1,
+                                               neighborX,
+                                               neighborY,
+                                               neighborZ,
+                                               size_Mat,
+                                               isEvenTimestep);
       getLastCudaError("QADVeloIncomp7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADVeloIncompDev27(   unsigned int numberOfThreads,
-									  real* DD,
-									  real* DD27,
-									  real* temp,
-									  real* velo,
-									  real diffusivity,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* DD,
+                                      real* DD27,
+                                      real* temp,
+                                      real* velo,
+                                      real diffusivity,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADVeloIncomp27<<< grid.grid, grid.threads >>> (
-											  DD,
-											  DD27,
-											  temp,
-											  velo,
-											  diffusivity,
-											  k_Q,
-											  QQ,
-											  numberOfBCnodes,
-											  om1,
-											  neighborX,
-											  neighborY,
-											  neighborZ,
-											  size_Mat,
-											  isEvenTimestep);
+                                              DD,
+                                              DD27,
+                                              temp,
+                                              velo,
+                                              diffusivity,
+                                              k_Q,
+                                              QQ,
+                                              numberOfBCnodes,
+                                              om1,
+                                              neighborX,
+                                              neighborY,
+                                              neighborZ,
+                                              size_Mat,
+                                              isEvenTimestep);
       getLastCudaError("QADVeloIncomp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADPressIncompDev7( unsigned int numberOfThreads,
-									  real* DD,
-									  real* DD7,
-									  real* temp,
-									  real* velo,
-									  real diffusivity,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* DD,
+                                      real* DD7,
+                                      real* temp,
+                                      real* velo,
+                                      real diffusivity,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QADPressIncomp7<<< grid.grid, grid.threads >>>(
-											   DD,
-											   DD7,
-											   temp,
-											   velo,
-											   diffusivity,
-											   k_Q,
-											   QQ,
-											   numberOfBCnodes,
-											   om1,
-											   neighborX,
-											   neighborY,
-											   neighborZ,
-											   size_Mat,
-											   isEvenTimestep);
+                                               DD,
+                                               DD7,
+                                               temp,
+                                               velo,
+                                               diffusivity,
+                                               k_Q,
+                                               QQ,
+                                               numberOfBCnodes,
+                                               om1,
+                                               neighborX,
+                                               neighborY,
+                                               neighborZ,
+                                               size_Mat,
+                                               isEvenTimestep);
       getLastCudaError("QADPressIncomp7 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QADPressIncompDev27(  unsigned int numberOfThreads,
-									  real* DD,
-									  real* DD27,
-									  real* temp,
-									  real* velo,
-									  real diffusivity,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* DD,
+                                      real* DD27,
+                                      real* temp,
+                                      real* velo,
+                                      real diffusivity,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
-      QADPressIncomp27<<< grid.grid, grid.threads >>>(DD, 
-	  										  DD27, 
-											  temp,
-											  velo,
-											  diffusivity,
-											  k_Q,
-											  QQ,
-											  numberOfBCnodes,
-											  om1,
-											  neighborX,
-											  neighborY,
-											  neighborZ,
-											  size_Mat,
-											  isEvenTimestep);
+      QADPressIncomp27<<< grid.grid, grid.threads >>>(DD,
+                                                DD27,
+                                              temp,
+                                              velo,
+                                              diffusivity,
+                                              k_Q,
+                                              QQ,
+                                              numberOfBCnodes,
+                                              om1,
+                                              neighborX,
+                                              neighborY,
+                                              neighborZ,
+                                              size_Mat,
+                                              isEvenTimestep);
       getLastCudaError("QADPressIncomp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -1991,44 +1991,44 @@ void QDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions*
 }
 //////////////////////////////////////////////////////////////////////////
 void QDevCompThinWalls27(unsigned int numberOfThreads,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* geom,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int* neighborWSB,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* geom,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int* neighborWSB,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
    QDeviceCompThinWallsPartOne27 <<< grid.grid, grid.threads >>> (DD,
-														 k_Q,
-														 QQ,
-														 numberOfBCnodes,
-														 om1,
-														 neighborX,
-														 neighborY,
-														 neighborZ,
-														 size_Mat,
-														 isEvenTimestep);
+                                                         k_Q,
+                                                         QQ,
+                                                         numberOfBCnodes,
+                                                         om1,
+                                                         neighborX,
+                                                         neighborY,
+                                                         neighborZ,
+                                                         size_Mat,
+                                                         isEvenTimestep);
    getLastCudaError("QDeviceCompThinWallsPartOne27 execution failed");
 
    QThinWallsPartTwo27 <<< grid.grid, grid.threads >>> ( DD,
-												k_Q,
-												QQ,
-												numberOfBCnodes,
-												geom,
-												neighborX,
-												neighborY,
-												neighborZ,
-												neighborWSB,
-												size_Mat,
-												isEvenTimestep);
+                                                k_Q,
+                                                QQ,
+                                                numberOfBCnodes,
+                                                geom,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                neighborWSB,
+                                                size_Mat,
+                                                isEvenTimestep);
    getLastCudaError("QThinWallsPartTwo27 execution failed");
 
 }
@@ -2053,58 +2053,58 @@ void QDev3rdMomentsComp27(LBMSimulationParameter* parameterDevice, QforBoundaryC
 }
 //////////////////////////////////////////////////////////////////////////
 void QDevIncompHighNu27( unsigned int numberOfThreads,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QDeviceIncompHighNu27<<< grid.grid, grid.threads >>> (
-												   DD,
-												   k_Q,
-												   QQ,
-												   numberOfBCnodes,
-												   om1,
-												   neighborX,
-												   neighborY,
-												   neighborZ,
-												   size_Mat,
-												   isEvenTimestep);
+                                                   DD,
+                                                   k_Q,
+                                                   QQ,
+                                                   numberOfBCnodes,
+                                                   om1,
+                                                   neighborX,
+                                                   neighborY,
+                                                   neighborZ,
+                                                   size_Mat,
+                                                   isEvenTimestep);
       getLastCudaError("QDeviceIncompHighNu27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QDevCompHighNu27(   unsigned int numberOfThreads,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QDeviceCompHighNu27<<< grid.grid, grid.threads >>> (
-												   DD,
-												   k_Q,
-												   QQ,
-												   numberOfBCnodes,
-												   om1,
-												   neighborX,
-												   neighborY,
-												   neighborZ,
-												   size_Mat,
-												   isEvenTimestep);
+                                                   DD,
+                                                   k_Q,
+                                                   QQ,
+                                                   numberOfBCnodes,
+                                                   om1,
+                                                   neighborX,
+                                                   neighborY,
+                                                   neighborZ,
+                                                   size_Mat,
+                                                   isEvenTimestep);
       getLastCudaError("QDevice27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -2130,59 +2130,59 @@ void QVelDevicePlainBB27(LBMSimulationParameter* parameterDevice, QforBoundaryCo
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDeviceCouette27(unsigned int numberOfThreads,
-									real* vx,
-									real* vy,
-									real* vz,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* vx,
+                                    real* vy,
+                                    real* vz,
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QVelDevCouette27<<< grid.grid, grid.threads >>> ( vx,
-												vy,
-												vz,
-												DD,
-												k_Q,
-												QQ,
-												numberOfBCnodes,
-												om1,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												isEvenTimestep);
+                                                vy,
+                                                vz,
+                                                DD,
+                                                k_Q,
+                                                QQ,
+                                                numberOfBCnodes,
+                                                om1,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                isEvenTimestep);
       getLastCudaError("QVelDevicePlainBB27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDevice1h27(   unsigned int numberOfThreads,
-								  int nx,
-								  int ny,
-								  real* vx,
-								  real* vy,
-								  real* vz,
-								  real* DD,
-								  int* k_Q,
-								  real* QQ,
-								  unsigned int numberOfBCnodes,
-								  real om1,
-								  real Phi,
-								  real angularVelocity,
-								  unsigned int* neighborX,
-								  unsigned int* neighborY,
-								  unsigned int* neighborZ,
-								  real* coordX,
-								  real* coordY,
-								  real* coordZ,
-								  unsigned int size_Mat,
-								  bool isEvenTimestep)
+                                  int nx,
+                                  int ny,
+                                  real* vx,
+                                  real* vy,
+                                  real* vz,
+                                  real* DD,
+                                  int* k_Q,
+                                  real* QQ,
+                                  unsigned int numberOfBCnodes,
+                                  real om1,
+                                  real Phi,
+                                  real angularVelocity,
+                                  unsigned int* neighborX,
+                                  unsigned int* neighborY,
+                                  unsigned int* neighborZ,
+                                  real* coordX,
+                                  real* coordY,
+                                  real* coordZ,
+                                  unsigned int size_Mat,
+                                  bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
@@ -2196,14 +2196,14 @@ void QVelDevice1h27(   unsigned int numberOfThreads,
                                           QQ,
                                           numberOfBCnodes,
                                           om1,
-										  Phi,
-										  angularVelocity,
+                                          Phi,
+                                          angularVelocity,
                                           neighborX,
                                           neighborY,
                                           neighborZ,
-										  coordX,
-										  coordY,
-										  coordZ,
+                                          coordX,
+                                          coordY,
+                                          coordZ,
                                           size_Mat,
                                           isEvenTimestep);
       getLastCudaError("QVelDevice27 execution failed");
@@ -2234,36 +2234,36 @@ void QVelDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions*
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDevCompPlusSlip27(unsigned int numberOfThreads,
-									  real* vx,
-									  real* vy,
-									  real* vz,
-									  real* DD,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* vx,
+                                      real* vy,
+                                      real* vz,
+                                      real* DD,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QVelDeviceCompPlusSlip27<<< grid.grid, grid.threads >>> (
-													  vx,
-													  vy,
-													  vz,
-													  DD,
-													  k_Q,
-													  QQ,
-													  numberOfBCnodes,
-													  om1,
-													  neighborX,
-													  neighborY,
-													  neighborZ,
-													  size_Mat,
-													  isEvenTimestep);
+                                                      vx,
+                                                      vy,
+                                                      vz,
+                                                      DD,
+                                                      k_Q,
+                                                      QQ,
+                                                      numberOfBCnodes,
+                                                      om1,
+                                                      neighborX,
+                                                      neighborY,
+                                                      neighborZ,
+                                                      size_Mat,
+                                                      isEvenTimestep);
       getLastCudaError("QVelDeviceCompPlusSlip27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -2277,7 +2277,7 @@ void QVelDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditio
             boundaryCondition->Vy,
             boundaryCondition->Vz,
             parameterDevice->distributions.f[0],
-            boundaryCondition->k,        
+            boundaryCondition->k,
             boundaryCondition->q27[0],
             boundaryCondition->numberOfBCnodes,
             parameterDevice->omega,
@@ -2290,40 +2290,40 @@ void QVelDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditio
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDevCompThinWalls27(unsigned int numberOfThreads,
-							           real* vx,
-							           real* vy,
-							           real* vz,
-							           real* DD,
-							           int* k_Q,
-							           real* QQ,
-							           unsigned int numberOfBCnodes,
-							           real om1,
-									     unsigned int* geom,
-							           unsigned int* neighborX,
-							           unsigned int* neighborY,
-							           unsigned int* neighborZ,
-									     unsigned int* neighborWSB,
-							           unsigned int size_Mat,
-							           bool isEvenTimestep)
+                                       real* vx,
+                                       real* vy,
+                                       real* vz,
+                                       real* DD,
+                                       int* k_Q,
+                                       real* QQ,
+                                       unsigned int numberOfBCnodes,
+                                       real om1,
+                                         unsigned int* geom,
+                                       unsigned int* neighborX,
+                                       unsigned int* neighborY,
+                                       unsigned int* neighborZ,
+                                         unsigned int* neighborWSB,
+                                       unsigned int size_Mat,
+                                       bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
    QVelDeviceCompThinWallsPartOne27<<< grid.grid, grid.threads >>> (vx,
-											                  vy,
-											                  vz,
-											                  DD,
-											                  k_Q,
-											                  QQ,
-											                  numberOfBCnodes,
-											                  om1,
-											                  neighborX,
-											                  neighborY,
-											                  neighborZ,
-											                  size_Mat,
-											                  isEvenTimestep);
+                                                              vy,
+                                                              vz,
+                                                              DD,
+                                                              k_Q,
+                                                              QQ,
+                                                              numberOfBCnodes,
+                                                              om1,
+                                                              neighborX,
+                                                              neighborY,
+                                                              neighborZ,
+                                                              size_Mat,
+                                                              isEvenTimestep);
    getLastCudaError("QVelDeviceCompThinWallsPartOne27 execution failed");
 
-	QThinWallsPartTwo27 <<< grid.grid, grid.threads >>> (
+    QThinWallsPartTwo27 <<< grid.grid, grid.threads >>> (
        DD,
        k_Q,
        QQ,
@@ -2361,135 +2361,135 @@ void QVelDevCompZeroPress27(LBMSimulationParameter* parameterDevice, QforBoundar
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDevIncompHighNu27(unsigned int numberOfThreads,
-									  real* vx,
-									  real* vy,
-									  real* vz,
-									  real* DD,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* vx,
+                                      real* vy,
+                                      real* vz,
+                                      real* DD,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QVelDeviceIncompHighNu27<<< grid.grid, grid.threads >>> (
-													  vx,
-													  vy,
-													  vz,
-													  DD,
-													  k_Q,
-													  QQ,
-													  numberOfBCnodes,
-													  om1,
-													  neighborX,
-													  neighborY,
-													  neighborZ,
-													  size_Mat,
-													  isEvenTimestep);
+                                                      vx,
+                                                      vy,
+                                                      vz,
+                                                      DD,
+                                                      k_Q,
+                                                      QQ,
+                                                      numberOfBCnodes,
+                                                      om1,
+                                                      neighborX,
+                                                      neighborY,
+                                                      neighborZ,
+                                                      size_Mat,
+                                                      isEvenTimestep);
       getLastCudaError("QVelDeviceIncompHighNu27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QVelDevCompHighNu27(  unsigned int numberOfThreads,
-									  real* vx,
-									  real* vy,
-									  real* vz,
-									  real* DD,
-									  int* k_Q,
-									  real* QQ,
-									  unsigned int numberOfBCnodes,
-									  real om1,
-									  unsigned int* neighborX,
-									  unsigned int* neighborY,
-									  unsigned int* neighborZ,
-									  unsigned int size_Mat,
-									  bool isEvenTimestep)
+                                      real* vx,
+                                      real* vy,
+                                      real* vz,
+                                      real* DD,
+                                      int* k_Q,
+                                      real* QQ,
+                                      unsigned int numberOfBCnodes,
+                                      real om1,
+                                      unsigned int* neighborX,
+                                      unsigned int* neighborY,
+                                      unsigned int* neighborZ,
+                                      unsigned int size_Mat,
+                                      bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       QVelDeviceCompHighNu27<<< grid.grid, grid.threads >>> (
-													  vx,
-													  vy,
-													  vz,
-													  DD,
-													  k_Q,
-													  QQ,
-													  numberOfBCnodes,
-													  om1,
-													  neighborX,
-													  neighborY,
-													  neighborZ,
-													  size_Mat,
-													  isEvenTimestep);
+                                                      vx,
+                                                      vy,
+                                                      vz,
+                                                      DD,
+                                                      k_Q,
+                                                      QQ,
+                                                      numberOfBCnodes,
+                                                      om1,
+                                                      neighborX,
+                                                      neighborY,
+                                                      neighborZ,
+                                                      size_Mat,
+                                                      isEvenTimestep);
       getLastCudaError("QVelDeviceComp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QVeloDevEQ27(unsigned int numberOfThreads,
-							 real* VeloX,
-							 real* VeloY,
-							 real* VeloZ,
-							 real* DD,
-							 int* k_Q,
-							 int numberOfBCnodes,
-							 real om1,
-							 unsigned int* neighborX,
-							 unsigned int* neighborY,
-							 unsigned int* neighborZ,
-							 unsigned int size_Mat,
-							 bool isEvenTimestep)
+                             real* VeloX,
+                             real* VeloY,
+                             real* VeloZ,
+                             real* DD,
+                             int* k_Q,
+                             int numberOfBCnodes,
+                             real om1,
+                             unsigned int* neighborX,
+                             unsigned int* neighborY,
+                             unsigned int* neighborZ,
+                             unsigned int size_Mat,
+                             bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
    QVeloDeviceEQ27<<< grid.grid, grid.threads >>> (VeloX,
-											 VeloY,
-											 VeloZ,
-											 DD,
-											 k_Q,
-											 numberOfBCnodes,
-											 om1,
-											 neighborX,
-											 neighborY,
-											 neighborZ,
-											 size_Mat,
-											 isEvenTimestep);
+                                             VeloY,
+                                             VeloZ,
+                                             DD,
+                                             k_Q,
+                                             numberOfBCnodes,
+                                             om1,
+                                             neighborX,
+                                             neighborY,
+                                             neighborZ,
+                                             size_Mat,
+                                             isEvenTimestep);
       getLastCudaError("QVeloDeviceEQ27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QVeloStreetDevEQ27(
-	uint  numberOfThreads,
-	real* veloXfraction,
-	real* veloYfraction,
-	int*  naschVelo,
-	real* DD,
-	int*  naschIndex,
-	int   numberOfStreetNodes,
-	real  velocityRatio,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	uint  size_Mat,
-	bool  isEvenTimestep)
+    uint  numberOfThreads,
+    real* veloXfraction,
+    real* veloYfraction,
+    int*  naschVelo,
+    real* DD,
+    int*  naschIndex,
+    int   numberOfStreetNodes,
+    real  velocityRatio,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    uint  size_Mat,
+    bool  isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfStreetNodes);
 
-	QVeloStreetDeviceEQ27 << < grid.grid, grid.threads >> > (
-		veloXfraction,
-		veloYfraction,
-		naschVelo,
-		DD,
-		naschIndex,
-		numberOfStreetNodes,
-		velocityRatio,
-		neighborX,
-		neighborY,
-		neighborZ,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("QVeloStreetDeviceEQ27 execution failed");
+    QVeloStreetDeviceEQ27 << < grid.grid, grid.threads >> > (
+        veloXfraction,
+        veloYfraction,
+        naschVelo,
+        DD,
+        naschIndex,
+        numberOfStreetNodes,
+        velocityRatio,
+        neighborX,
+        neighborY,
+        neighborZ,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("QVeloStreetDeviceEQ27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QSlipDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition)
@@ -2515,7 +2515,7 @@ void QSlipDevCompTurbulentViscosity27(LBMSimulationParameter* parameterDevice, Q
 {
    dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
    dim3 threads(parameterDevice->numberofthreads, 1, 1 );
-   
+
    QSlipDeviceComp27TurbViscosity<<< grid, threads >>> (
          parameterDevice->distributions.f[0],
          boundaryCondition->k,
@@ -2555,7 +2555,7 @@ void QSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditi
 {
    dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
    dim3 threads(parameterDevice->numberofthreads, 1, 1 );
-   
+
    QSlipDeviceComp27<<< grid, threads >>> (
          parameterDevice->distributions.f[0],
          boundaryCondition->k,
@@ -2590,68 +2590,68 @@ void BBSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryCondit
 }
 //////////////////////////////////////////////////////////////////////////
 void QSlipGeomDevComp27(unsigned int numberOfThreads,
-								   real* DD,
-								   int* k_Q,
-								   real* QQ,
-								   unsigned int numberOfBCnodes,
-								   real om1,
-								   real* NormalX,
-								   real* NormalY,
-								   real* NormalZ,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep)
-{
-	vf::cuda::CudaGrid grid(numberOfThreads, numberOfBCnodes);
+                                   real* DD,
+                                   int* k_Q,
+                                   real* QQ,
+                                   unsigned int numberOfBCnodes,
+                                   real om1,
+                                   real* NormalX,
+                                   real* NormalY,
+                                   real* NormalZ,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep)
+{
+    vf::cuda::CudaGrid grid(numberOfThreads, numberOfBCnodes);
 
    QSlipGeomDeviceComp27<<< grid.grid, grid.threads >>> (DD,
-												   k_Q,
-												   QQ,
-												   numberOfBCnodes,
-												   om1,
-												   NormalX,
-												   NormalY,
-												   NormalZ,
-												   neighborX,
-												   neighborY,
-												   neighborZ,
-												   size_Mat,
-												   isEvenTimestep);
+                                                   k_Q,
+                                                   QQ,
+                                                   numberOfBCnodes,
+                                                   om1,
+                                                   NormalX,
+                                                   NormalY,
+                                                   NormalZ,
+                                                   neighborX,
+                                                   neighborY,
+                                                   neighborZ,
+                                                   size_Mat,
+                                                   isEvenTimestep);
    getLastCudaError("QSlipGeomDeviceComp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void QSlipNormDevComp27(unsigned int numberOfThreads,
-								   real* DD,
-								   int* k_Q,
-								   real* QQ,
-								   unsigned int numberOfBCnodes,
-								   real om1,
-								   real* NormalX,
-								   real* NormalY,
-								   real* NormalZ,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep)
+                                   real* DD,
+                                   int* k_Q,
+                                   real* QQ,
+                                   unsigned int numberOfBCnodes,
+                                   real om1,
+                                   real* NormalX,
+                                   real* NormalY,
+                                   real* NormalZ,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
    QSlipNormDeviceComp27<<< grid.grid, grid.threads >>> (DD,
-												   k_Q,
-												   QQ,
-												   numberOfBCnodes,
-												   om1,
-												   NormalX,
-												   NormalY,
-												   NormalZ,
-												   neighborX,
-												   neighborY,
-												   neighborZ,
-												   size_Mat,
-												   isEvenTimestep);
+                                                   k_Q,
+                                                   QQ,
+                                                   numberOfBCnodes,
+                                                   om1,
+                                                   NormalX,
+                                                   NormalY,
+                                                   NormalZ,
+                                                   neighborX,
+                                                   neighborY,
+                                                   neighborZ,
+                                                   size_Mat,
+                                                   isEvenTimestep);
       getLastCudaError("QSlipGeomDeviceComp27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -2796,36 +2796,36 @@ void QPressDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions
 //////////////////////////////////////////////////////////////////////////
 void QPressDevAntiBB27(  unsigned int numberOfThreads,
                                     real* rhoBC,
-									real* vx,
-									real* vy,
-									real* vz,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* vx,
+                                    real* vy,
+                                    real* vz,
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
    QPressDeviceAntiBB27<<< grid.grid, grid.threads >>>( rhoBC,
-												vx,
-												vy,
-												vz,
-												DD,
-												k_Q,
-												QQ,
-												numberOfBCnodes,
-												om1,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												isEvenTimestep);
+                                                vx,
+                                                vy,
+                                                vz,
+                                                DD,
+                                                k_Q,
+                                                QQ,
+                                                numberOfBCnodes,
+                                                om1,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                isEvenTimestep);
    getLastCudaError("QPressDeviceAntiBB27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -3108,32 +3108,32 @@ void BBDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* bo
 }
 //////////////////////////////////////////////////////////////////////////
 void QPressDev27_IntBB(  unsigned int numberOfThreads,
-									real* rho,
-									real* DD,
-									int* k_Q,
-									real* QQ,
-									unsigned int numberOfBCnodes,
-									real om1,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int size_Mat,
-									bool isEvenTimestep)
+                                    real* rho,
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
-	QPressDevice27_IntBB<<< grid.grid, grid.threads >>> (rho,
-													DD,
-													k_Q,
-													QQ,
-													numberOfBCnodes,
-													om1,
-													neighborX,
-													neighborY,
-													neighborZ,
-													size_Mat,
-													isEvenTimestep);
-	getLastCudaError("QPressDevice27_IntBB execution failed");
+    QPressDevice27_IntBB<<< grid.grid, grid.threads >>> (rho,
+                                                    DD,
+                                                    k_Q,
+                                                    QQ,
+                                                    numberOfBCnodes,
+                                                    om1,
+                                                    neighborX,
+                                                    neighborY,
+                                                    neighborZ,
+                                                    size_Mat,
+                                                    isEvenTimestep);
+    getLastCudaError("QPressDevice27_IntBB execution failed");
 }
 // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29
 //////////////////////////////////////////////////////////////////////////
@@ -3208,146 +3208,146 @@ void VelSchlaffer27(  unsigned int numberOfThreads,
       getLastCudaError("VelSchlaff27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
-void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice, 
-								QforPrecursorBoundaryConditions* boundaryCondition, 
-								real timeRatio, 
-								real velocityRatio)
-{
-
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
-
-	QPrecursorDeviceCompZeroPress<<< grid.grid, grid.threads >>>(boundaryCondition->k,
-																boundaryCondition->numberOfBCnodes,
-																boundaryCondition->numberOfPrecursorNodes,
-																boundaryCondition->sizeQ,
-																parameterDevice->omega,
-																parameterDevice->distributions.f[0],
-																boundaryCondition->q27[0],
-																parameterDevice->neighborX,
-																parameterDevice->neighborY,
-																parameterDevice->neighborZ,
-																boundaryCondition->planeNeighbor0PP,
-																boundaryCondition->planeNeighbor0PM,
-																boundaryCondition->planeNeighbor0MP,
-																boundaryCondition->planeNeighbor0MM,
-																boundaryCondition->weights0PP,
-																boundaryCondition->weights0PM,
-																boundaryCondition->weights0MP,
-																boundaryCondition->weights0MM,
-																boundaryCondition->last,
-																boundaryCondition->current,
-																boundaryCondition->velocityX,
-																boundaryCondition->velocityY,
-																boundaryCondition->velocityZ,
-																timeRatio,
-																velocityRatio,
-																parameterDevice->numberOfNodes,
-																parameterDevice->isEvenTimestep);
-	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
+void QPrecursorDevCompZeroPress(LBMSimulationParameter* parameterDevice,
+                                QforPrecursorBoundaryConditions* boundaryCondition,
+                                real timeRatio,
+                                real velocityRatio)
+{
+
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
+
+    QPrecursorDeviceCompZeroPress<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+                                                                boundaryCondition->numberOfBCnodes,
+                                                                boundaryCondition->numberOfPrecursorNodes,
+                                                                boundaryCondition->sizeQ,
+                                                                parameterDevice->omega,
+                                                                parameterDevice->distributions.f[0],
+                                                                boundaryCondition->q27[0],
+                                                                parameterDevice->neighborX,
+                                                                parameterDevice->neighborY,
+                                                                parameterDevice->neighborZ,
+                                                                boundaryCondition->planeNeighbor0PP,
+                                                                boundaryCondition->planeNeighbor0PM,
+                                                                boundaryCondition->planeNeighbor0MP,
+                                                                boundaryCondition->planeNeighbor0MM,
+                                                                boundaryCondition->weights0PP,
+                                                                boundaryCondition->weights0PM,
+                                                                boundaryCondition->weights0MP,
+                                                                boundaryCondition->weights0MM,
+                                                                boundaryCondition->last,
+                                                                boundaryCondition->current,
+                                                                boundaryCondition->velocityX,
+                                                                boundaryCondition->velocityY,
+                                                                boundaryCondition->velocityZ,
+                                                                timeRatio,
+                                                                velocityRatio,
+                                                                parameterDevice->numberOfNodes,
+                                                                parameterDevice->isEvenTimestep);
+    getLastCudaError("QPrecursorDeviceCompZeroPress execution failed");
 
 }
 //////////////////////////////////////////////////////////////////////////
 void PrecursorDevEQ27( LBMSimulationParameter* parameterDevice,
-						QforPrecursorBoundaryConditions* boundaryCondition,
-						real timeRatio,
-						real velocityRatio)
-{
-
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
-
-	PrecursorDeviceEQ27<<< grid.grid, grid.threads >>>(boundaryCondition->k,
-													boundaryCondition->numberOfBCnodes,
-													boundaryCondition->numberOfPrecursorNodes,
-													parameterDevice->omega,
-													parameterDevice->distributions.f[0],
-													parameterDevice->neighborX,
-													parameterDevice->neighborX,
-													parameterDevice->neighborX,
-													boundaryCondition->planeNeighbor0PP,
-													boundaryCondition->planeNeighbor0PM,
-													boundaryCondition->planeNeighbor0MP,
-													boundaryCondition->planeNeighbor0MM,
-													boundaryCondition->weights0PP,
-													boundaryCondition->weights0PM,
-													boundaryCondition->weights0MP,
-													boundaryCondition->weights0MM,
-													boundaryCondition->last,
-													boundaryCondition->current,
-													boundaryCondition->velocityX,
-													boundaryCondition->velocityY,
-													boundaryCondition->velocityZ,
-													timeRatio,
-													velocityRatio,
-													parameterDevice->numberOfNodes,
-													parameterDevice->isEvenTimestep);
-	getLastCudaError("PrecursorDeviceEQ27 execution failed"); 
+                        QforPrecursorBoundaryConditions* boundaryCondition,
+                        real timeRatio,
+                        real velocityRatio)
+{
+
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
+
+    PrecursorDeviceEQ27<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+                                                    boundaryCondition->numberOfBCnodes,
+                                                    boundaryCondition->numberOfPrecursorNodes,
+                                                    parameterDevice->omega,
+                                                    parameterDevice->distributions.f[0],
+                                                    parameterDevice->neighborX,
+                                                    parameterDevice->neighborX,
+                                                    parameterDevice->neighborX,
+                                                    boundaryCondition->planeNeighbor0PP,
+                                                    boundaryCondition->planeNeighbor0PM,
+                                                    boundaryCondition->planeNeighbor0MP,
+                                                    boundaryCondition->planeNeighbor0MM,
+                                                    boundaryCondition->weights0PP,
+                                                    boundaryCondition->weights0PM,
+                                                    boundaryCondition->weights0MP,
+                                                    boundaryCondition->weights0MM,
+                                                    boundaryCondition->last,
+                                                    boundaryCondition->current,
+                                                    boundaryCondition->velocityX,
+                                                    boundaryCondition->velocityY,
+                                                    boundaryCondition->velocityZ,
+                                                    timeRatio,
+                                                    velocityRatio,
+                                                    parameterDevice->numberOfNodes,
+                                                    parameterDevice->isEvenTimestep);
+    getLastCudaError("PrecursorDeviceEQ27 execution failed");
 
 }
 //////////////////////////////////////////////////////////////////////////
 void PrecursorDevDistributions( LBMSimulationParameter* parameterDevice,
-								QforPrecursorBoundaryConditions* boundaryCondition,
-								real timeRatio,
-								real velocityRatio)
-{
-
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
-
-	PrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
-															boundaryCondition->numberOfBCnodes,
-															boundaryCondition->numberOfPrecursorNodes,
-															parameterDevice->distributions.f[0],
-															parameterDevice->neighborX,
-															parameterDevice->neighborY,
-															parameterDevice->neighborZ,
-															boundaryCondition->planeNeighbor0PP,
-															boundaryCondition->planeNeighbor0PM,
-															boundaryCondition->planeNeighbor0MP,
-															boundaryCondition->planeNeighbor0MM,
-															boundaryCondition->weights0PP,
-															boundaryCondition->weights0PM,
-															boundaryCondition->weights0MP,
-															boundaryCondition->weights0MM,
-															boundaryCondition->last,
-															boundaryCondition->current,
-															timeRatio,
-															parameterDevice->numberOfNodes,
-															parameterDevice->isEvenTimestep);
-	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
+                                QforPrecursorBoundaryConditions* boundaryCondition,
+                                real timeRatio,
+                                real velocityRatio)
+{
+
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
+
+    PrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+                                                            boundaryCondition->numberOfBCnodes,
+                                                            boundaryCondition->numberOfPrecursorNodes,
+                                                            parameterDevice->distributions.f[0],
+                                                            parameterDevice->neighborX,
+                                                            parameterDevice->neighborY,
+                                                            parameterDevice->neighborZ,
+                                                            boundaryCondition->planeNeighbor0PP,
+                                                            boundaryCondition->planeNeighbor0PM,
+                                                            boundaryCondition->planeNeighbor0MP,
+                                                            boundaryCondition->planeNeighbor0MM,
+                                                            boundaryCondition->weights0PP,
+                                                            boundaryCondition->weights0PM,
+                                                            boundaryCondition->weights0MP,
+                                                            boundaryCondition->weights0MM,
+                                                            boundaryCondition->last,
+                                                            boundaryCondition->current,
+                                                            timeRatio,
+                                                            parameterDevice->numberOfNodes,
+                                                            parameterDevice->isEvenTimestep);
+    getLastCudaError("QPrecursorDeviceCompZeroPress execution failed");
 
 }
 
 //////////////////////////////////////////////////////////////////////////
 void QPrecursorDevDistributions( LBMSimulationParameter* parameterDevice,
-								QforPrecursorBoundaryConditions* boundaryCondition,
-								real timeRatio,
-								real velocityRatio)
-{
-
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
-
-	QPrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
-																boundaryCondition->q27[0],
-																boundaryCondition->sizeQ,
-																boundaryCondition->numberOfBCnodes,
-																boundaryCondition->numberOfPrecursorNodes,
-																parameterDevice->distributions.f[0],
-																parameterDevice->neighborX,
-																parameterDevice->neighborY,
-																parameterDevice->neighborZ,
-																boundaryCondition->planeNeighbor0PP,
-																boundaryCondition->planeNeighbor0PM,
-																boundaryCondition->planeNeighbor0MP,
-																boundaryCondition->planeNeighbor0MM,
-																boundaryCondition->weights0PP,
-																boundaryCondition->weights0PM,
-																boundaryCondition->weights0MP,
-																boundaryCondition->weights0MM,
-																boundaryCondition->last,
-																boundaryCondition->current,
-																timeRatio,
-																parameterDevice->numberOfNodes,
-																parameterDevice->isEvenTimestep);
-	getLastCudaError("QPrecursorDeviceCompZeroPress execution failed"); 
+                                QforPrecursorBoundaryConditions* boundaryCondition,
+                                real timeRatio,
+                                real velocityRatio)
+{
+
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes);
+
+    QPrecursorDeviceDistributions<<< grid.grid, grid.threads >>>(boundaryCondition->k,
+                                                                boundaryCondition->q27[0],
+                                                                boundaryCondition->sizeQ,
+                                                                boundaryCondition->numberOfBCnodes,
+                                                                boundaryCondition->numberOfPrecursorNodes,
+                                                                parameterDevice->distributions.f[0],
+                                                                parameterDevice->neighborX,
+                                                                parameterDevice->neighborY,
+                                                                parameterDevice->neighborZ,
+                                                                boundaryCondition->planeNeighbor0PP,
+                                                                boundaryCondition->planeNeighbor0PM,
+                                                                boundaryCondition->planeNeighbor0MP,
+                                                                boundaryCondition->planeNeighbor0MM,
+                                                                boundaryCondition->weights0PP,
+                                                                boundaryCondition->weights0PM,
+                                                                boundaryCondition->weights0MP,
+                                                                boundaryCondition->weights0MM,
+                                                                boundaryCondition->last,
+                                                                boundaryCondition->current,
+                                                                timeRatio,
+                                                                parameterDevice->numberOfNodes,
+                                                                parameterDevice->isEvenTimestep);
+    getLastCudaError("QPrecursorDeviceCompZeroPress execution failed");
 
 }
 //////////////////////////////////////////////////////////////////////////
@@ -3360,7 +3360,7 @@ extern "C" void PropVelo(   unsigned int numberOfThreads,
                             real* uy,
                             real* uz,
                             int* k_Q,
-							unsigned int size_Prop,
+                            unsigned int size_Prop,
                             unsigned int size_Mat,
                             unsigned int* bcMatD,
                             real* DD,
@@ -3375,10 +3375,10 @@ extern "C" void PropVelo(   unsigned int numberOfThreads,
                                        ux,
                                        uy,
                                        uz,
-									   k_Q,
-									   size_Prop,
+                                       k_Q,
+                                       size_Prop,
                                        size_Mat,
-									   bcMatD,
+                                       bcMatD,
                                        DD,
                                        EvenOrOdd);
       getLastCudaError("PropellerBC execution failed");
@@ -3408,7 +3408,7 @@ void ScaleCF27( real* DC,
                         unsigned int numberOfThreads)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
-   
+
       scaleCF27<<< grid.grid, grid.threads >>> ( DC,
                                              DF,
                                              neighborCX,
@@ -3638,263 +3638,263 @@ void ScaleCF_Fix_27(  real* DC,
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_Fix_comp_27( real* DC,
-									 real* DF,
-									 unsigned int* neighborCX,
-									 unsigned int* neighborCY,
-									 unsigned int* neighborCZ,
-									 unsigned int* neighborFX,
-									 unsigned int* neighborFY,
-									 unsigned int* neighborFZ,
-									 unsigned int size_MatC,
-									 unsigned int size_MatF,
-									 bool isEvenTimestep,
-									 unsigned int* posCSWB,
-									 unsigned int* posFSWB,
-									 unsigned int kCF,
-									 real omCoarse,
-									 real omFine,
-									 real nu,
-									 unsigned int nxC,
-									 unsigned int nyC,
-									 unsigned int nxF,
-									 unsigned int nyF,
-									 unsigned int numberOfThreads,
-									 OffCF offCF)
+                                     real* DF,
+                                     unsigned int* neighborCX,
+                                     unsigned int* neighborCY,
+                                     unsigned int* neighborCZ,
+                                     unsigned int* neighborFX,
+                                     unsigned int* neighborFY,
+                                     unsigned int* neighborFZ,
+                                     unsigned int size_MatC,
+                                     unsigned int size_MatF,
+                                     bool isEvenTimestep,
+                                     unsigned int* posCSWB,
+                                     unsigned int* posFSWB,
+                                     unsigned int kCF,
+                                     real omCoarse,
+                                     real omFine,
+                                     real nu,
+                                     unsigned int nxC,
+                                     unsigned int nyC,
+                                     unsigned int nxF,
+                                     unsigned int nyF,
+                                     unsigned int numberOfThreads,
+                                     OffCF offCF)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_Fix_comp_27<<< grid.grid, grid.threads >>>(   DC,
-														DF,
-														neighborCX,
-														neighborCY,
-														neighborCZ,
-														neighborFX,
-														neighborFY,
-														neighborFZ,
-														size_MatC,
-														size_MatF,
-														isEvenTimestep,
-														posCSWB,
-														posFSWB,
-														kCF,
-														omCoarse,
-														omFine,
-														nu,
-														nxC,
-														nyC,
-														nxF,
-														nyF,
-														offCF);
+                                                        DF,
+                                                        neighborCX,
+                                                        neighborCY,
+                                                        neighborCZ,
+                                                        neighborFX,
+                                                        neighborFY,
+                                                        neighborFZ,
+                                                        size_MatC,
+                                                        size_MatF,
+                                                        isEvenTimestep,
+                                                        posCSWB,
+                                                        posFSWB,
+                                                        kCF,
+                                                        omCoarse,
+                                                        omFine,
+                                                        nu,
+                                                        nxC,
+                                                        nyC,
+                                                        nxF,
+                                                        nyF,
+                                                        offCF);
       getLastCudaError("scaleCF_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_0817_comp_27(real* DC,
-									 real* DF,
-									 unsigned int* neighborCX,
-									 unsigned int* neighborCY,
-									 unsigned int* neighborCZ,
-									 unsigned int* neighborFX,
-									 unsigned int* neighborFY,
-									 unsigned int* neighborFZ,
-									 unsigned int size_MatC,
-									 unsigned int size_MatF,
-									 bool isEvenTimestep,
-									 unsigned int* posCSWB,
-									 unsigned int* posFSWB,
-									 unsigned int kCF,
-									 real omCoarse,
-									 real omFine,
-									 real nu,
-									 unsigned int nxC,
-									 unsigned int nyC,
-									 unsigned int nxF,
-									 unsigned int nyF,
-									 unsigned int numberOfThreads,
-									 OffCF offCF,
+                                     real* DF,
+                                     unsigned int* neighborCX,
+                                     unsigned int* neighborCY,
+                                     unsigned int* neighborCZ,
+                                     unsigned int* neighborFX,
+                                     unsigned int* neighborFY,
+                                     unsigned int* neighborFZ,
+                                     unsigned int size_MatC,
+                                     unsigned int size_MatF,
+                                     bool isEvenTimestep,
+                                     unsigned int* posCSWB,
+                                     unsigned int* posFSWB,
+                                     unsigned int kCF,
+                                     real omCoarse,
+                                     real omFine,
+                                     real nu,
+                                     unsigned int nxC,
+                                     unsigned int nyC,
+                                     unsigned int nxF,
+                                     unsigned int nyF,
+                                     unsigned int numberOfThreads,
+                                     OffCF offCF,
                             CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_0817_comp_27<<< grid.grid, grid.threads, 0, stream >>>(  DC,
-														DF,
-														neighborCX,
-														neighborCY,
-														neighborCZ,
-														neighborFX,
-														neighborFY,
-														neighborFZ,
-														size_MatC,
-														size_MatF,
-														isEvenTimestep,
-														posCSWB,
-														posFSWB,
-														kCF,
-														omCoarse,
-														omFine,
-														nu,
-														nxC,
-														nyC,
-														nxF,
-														nyF,
-														offCF);
+                                                        DF,
+                                                        neighborCX,
+                                                        neighborCY,
+                                                        neighborCZ,
+                                                        neighborFX,
+                                                        neighborFY,
+                                                        neighborFZ,
+                                                        size_MatC,
+                                                        size_MatF,
+                                                        isEvenTimestep,
+                                                        posCSWB,
+                                                        posFSWB,
+                                                        kCF,
+                                                        omCoarse,
+                                                        omFine,
+                                                        nu,
+                                                        nxC,
+                                                        nyC,
+                                                        nxF,
+                                                        nyF,
+                                                        offCF);
       getLastCudaError("scaleCF_0817_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_comp_D3Q27F3_2018(real* DC,
-										  real* DF,
-										  real* G6,
-										  unsigned int* neighborCX,
-										  unsigned int* neighborCY,
-										  unsigned int* neighborCZ,
-										  unsigned int* neighborFX,
-										  unsigned int* neighborFY,
-										  unsigned int* neighborFZ,
-										  unsigned int size_MatC,
-										  unsigned int size_MatF,
-										  bool isEvenTimestep,
-										  unsigned int* posCSWB,
-										  unsigned int* posFSWB,
-										  unsigned int kCF,
-										  real omCoarse,
-										  real omFine,
-										  real nu,
-										  unsigned int nxC,
-										  unsigned int nyC,
-										  unsigned int nxF,
-										  unsigned int nyF,
-										  unsigned int numberOfThreads,
-										  OffCF offCF)
+                                          real* DF,
+                                          real* G6,
+                                          unsigned int* neighborCX,
+                                          unsigned int* neighborCY,
+                                          unsigned int* neighborCZ,
+                                          unsigned int* neighborFX,
+                                          unsigned int* neighborFY,
+                                          unsigned int* neighborFZ,
+                                          unsigned int size_MatC,
+                                          unsigned int size_MatF,
+                                          bool isEvenTimestep,
+                                          unsigned int* posCSWB,
+                                          unsigned int* posFSWB,
+                                          unsigned int kCF,
+                                          real omCoarse,
+                                          real omFine,
+                                          real nu,
+                                          unsigned int nxC,
+                                          unsigned int nyC,
+                                          unsigned int nxF,
+                                          unsigned int nyF,
+                                          unsigned int numberOfThreads,
+                                          OffCF offCF)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_comp_D3Q27F3_2018 <<< grid.grid, grid.threads >>>(DC,
-															DF,
-															G6,
-															neighborCX,
-															neighborCY,
-															neighborCZ,
-															neighborFX,
-															neighborFY,
-															neighborFZ,
-															size_MatC,
-															size_MatF,
-															isEvenTimestep,
-															posCSWB,
-															posFSWB,
-															kCF,
-															omCoarse,
-															omFine,
-															nu,
-															nxC,
-															nyC,
-															nxF,
-															nyF,
-															offCF);
+                                                            DF,
+                                                            G6,
+                                                            neighborCX,
+                                                            neighborCY,
+                                                            neighborCZ,
+                                                            neighborFX,
+                                                            neighborFY,
+                                                            neighborFZ,
+                                                            size_MatC,
+                                                            size_MatF,
+                                                            isEvenTimestep,
+                                                            posCSWB,
+                                                            posFSWB,
+                                                            kCF,
+                                                            omCoarse,
+                                                            omFine,
+                                                            nu,
+                                                            nxC,
+                                                            nyC,
+                                                            nxF,
+                                                            nyF,
+                                                            offCF);
       getLastCudaError("scaleCF_comp_D3Q27F3_2018 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_comp_D3Q27F3(real* DC,
-									 real* DF,
-									 real* G6,
-									 unsigned int* neighborCX,
-									 unsigned int* neighborCY,
-									 unsigned int* neighborCZ,
-									 unsigned int* neighborFX,
-									 unsigned int* neighborFY,
-									 unsigned int* neighborFZ,
-									 unsigned int size_MatC,
-									 unsigned int size_MatF,
-									 bool isEvenTimestep,
-									 unsigned int* posCSWB,
-									 unsigned int* posFSWB,
-									 unsigned int kCF,
-									 real omCoarse,
-									 real omFine,
-									 real nu,
-									 unsigned int nxC,
-									 unsigned int nyC,
-									 unsigned int nxF,
-									 unsigned int nyF,
-									 unsigned int numberOfThreads,
-									 OffCF offCF,
+                                     real* DF,
+                                     real* G6,
+                                     unsigned int* neighborCX,
+                                     unsigned int* neighborCY,
+                                     unsigned int* neighborCZ,
+                                     unsigned int* neighborFX,
+                                     unsigned int* neighborFY,
+                                     unsigned int* neighborFZ,
+                                     unsigned int size_MatC,
+                                     unsigned int size_MatF,
+                                     bool isEvenTimestep,
+                                     unsigned int* posCSWB,
+                                     unsigned int* posFSWB,
+                                     unsigned int kCF,
+                                     real omCoarse,
+                                     real omFine,
+                                     real nu,
+                                     unsigned int nxC,
+                                     unsigned int nyC,
+                                     unsigned int nxF,
+                                     unsigned int nyF,
+                                     unsigned int numberOfThreads,
+                                     OffCF offCF,
                             CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_comp_D3Q27F3 <<< grid.grid, grid.threads, 0, stream >>>( DC,
-														DF,
-														G6,
-														neighborCX,
-														neighborCY,
-														neighborCZ,
-														neighborFX,
-														neighborFY,
-														neighborFZ,
-														size_MatC,
-														size_MatF,
-														isEvenTimestep,
-														posCSWB,
-														posFSWB,
-														kCF,
-														omCoarse,
-														omFine,
-														nu,
-														nxC,
-														nyC,
-														nxF,
-														nyF,
-														offCF);
+                                                        DF,
+                                                        G6,
+                                                        neighborCX,
+                                                        neighborCY,
+                                                        neighborCZ,
+                                                        neighborFX,
+                                                        neighborFY,
+                                                        neighborFZ,
+                                                        size_MatC,
+                                                        size_MatF,
+                                                        isEvenTimestep,
+                                                        posCSWB,
+                                                        posFSWB,
+                                                        kCF,
+                                                        omCoarse,
+                                                        omFine,
+                                                        nu,
+                                                        nxC,
+                                                        nyC,
+                                                        nxF,
+                                                        nyF,
+                                                        offCF);
       getLastCudaError("scaleCF_comp_D3Q27F3 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_staggered_time_comp_27(  real* DC,
-												 real* DF,
-												 unsigned int* neighborCX,
-												 unsigned int* neighborCY,
-												 unsigned int* neighborCZ,
-												 unsigned int* neighborFX,
-												 unsigned int* neighborFY,
-												 unsigned int* neighborFZ,
-												 unsigned int size_MatC,
-												 unsigned int size_MatF,
-												 bool isEvenTimestep,
-												 unsigned int* posCSWB,
-												 unsigned int* posFSWB,
-												 unsigned int kCF,
-												 real omCoarse,
-												 real omFine,
-												 real nu,
-												 unsigned int nxC,
-												 unsigned int nyC,
-												 unsigned int nxF,
-												 unsigned int nyF,
-												 unsigned int numberOfThreads,
-												 OffCF offCF)
+                                                 real* DF,
+                                                 unsigned int* neighborCX,
+                                                 unsigned int* neighborCY,
+                                                 unsigned int* neighborCZ,
+                                                 unsigned int* neighborFX,
+                                                 unsigned int* neighborFY,
+                                                 unsigned int* neighborFZ,
+                                                 unsigned int size_MatC,
+                                                 unsigned int size_MatF,
+                                                 bool isEvenTimestep,
+                                                 unsigned int* posCSWB,
+                                                 unsigned int* posFSWB,
+                                                 unsigned int kCF,
+                                                 real omCoarse,
+                                                 real omFine,
+                                                 real nu,
+                                                 unsigned int nxC,
+                                                 unsigned int nyC,
+                                                 unsigned int nxF,
+                                                 unsigned int nyF,
+                                                 unsigned int numberOfThreads,
+                                                 OffCF offCF)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_staggered_time_comp_27<<< grid.grid, grid.threads >>>(    DC,
-																	DF,
-																	neighborCX,
-																	neighborCY,
-																	neighborCZ,
-																	neighborFX,
-																	neighborFY,
-																	neighborFZ,
-																	size_MatC,
-																	size_MatF,
-																	isEvenTimestep,
-																	posCSWB,
-																	posFSWB,
-																	kCF,
-																	omCoarse,
-																	omFine,
-																	nu,
-																	nxC,
-																	nyC,
-																	nxF,
-																	nyF,
-																	offCF);
+                                                                    DF,
+                                                                    neighborCX,
+                                                                    neighborCY,
+                                                                    neighborCZ,
+                                                                    neighborFX,
+                                                                    neighborFY,
+                                                                    neighborFZ,
+                                                                    size_MatC,
+                                                                    size_MatF,
+                                                                    isEvenTimestep,
+                                                                    posCSWB,
+                                                                    posFSWB,
+                                                                    kCF,
+                                                                    omCoarse,
+                                                                    omFine,
+                                                                    nu,
+                                                                    nxC,
+                                                                    nyC,
+                                                                    nxF,
+                                                                    nyF,
+                                                                    offCF);
       getLastCudaError("scaleCF_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -3958,157 +3958,157 @@ void ScaleCF_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulati
 
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_RhoSq_3rdMom_comp_27(real* DC,
-											 real* DF,
-											 unsigned int* neighborCX,
-											 unsigned int* neighborCY,
-											 unsigned int* neighborCZ,
-											 unsigned int* neighborFX,
-											 unsigned int* neighborFY,
-											 unsigned int* neighborFZ,
-											 unsigned int size_MatC,
-											 unsigned int size_MatF,
-											 bool isEvenTimestep,
-											 unsigned int* posCSWB,
-											 unsigned int* posFSWB,
-											 unsigned int kCF,
-											 real omCoarse,
-											 real omFine,
-											 real nu,
-											 unsigned int nxC,
-											 unsigned int nyC,
-											 unsigned int nxF,
-											 unsigned int nyF,
-											 unsigned int numberOfThreads,
-											 OffCF offCF,
+                                             real* DF,
+                                             unsigned int* neighborCX,
+                                             unsigned int* neighborCY,
+                                             unsigned int* neighborCZ,
+                                             unsigned int* neighborFX,
+                                             unsigned int* neighborFY,
+                                             unsigned int* neighborFZ,
+                                             unsigned int size_MatC,
+                                             unsigned int size_MatF,
+                                             bool isEvenTimestep,
+                                             unsigned int* posCSWB,
+                                             unsigned int* posFSWB,
+                                             unsigned int kCF,
+                                             real omCoarse,
+                                             real omFine,
+                                             real nu,
+                                             unsigned int nxC,
+                                             unsigned int nyC,
+                                             unsigned int nxF,
+                                             unsigned int nyF,
+                                             unsigned int numberOfThreads,
+                                             OffCF offCF,
                                   CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_RhoSq_3rdMom_comp_27<<< grid.grid, grid.threads, 0, stream >>>(  DC,
-																DF,
-																neighborCX,
-																neighborCY,
-																neighborCZ,
-																neighborFX,
-																neighborFY,
-																neighborFZ,
-																size_MatC,
-																size_MatF,
-																isEvenTimestep,
-																posCSWB,
-																posFSWB,
-																kCF,
-																omCoarse,
-																omFine,
-																nu,
-																nxC,
-																nyC,
-																nxF,
-																nyF,
-																offCF);
+                                                                DF,
+                                                                neighborCX,
+                                                                neighborCY,
+                                                                neighborCZ,
+                                                                neighborFX,
+                                                                neighborFY,
+                                                                neighborFZ,
+                                                                size_MatC,
+                                                                size_MatF,
+                                                                isEvenTimestep,
+                                                                posCSWB,
+                                                                posFSWB,
+                                                                kCF,
+                                                                omCoarse,
+                                                                omFine,
+                                                                nu,
+                                                                nxC,
+                                                                nyC,
+                                                                nxF,
+                                                                nyF,
+                                                                offCF);
       getLastCudaError("scaleCF_RhoSq_3rdMom_comp_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_AA2016_comp_27(real* DC,
-									   real* DF,
-									   unsigned int* neighborCX,
-									   unsigned int* neighborCY,
-									   unsigned int* neighborCZ,
-									   unsigned int* neighborFX,
-									   unsigned int* neighborFY,
-									   unsigned int* neighborFZ,
-									   unsigned int size_MatC,
-									   unsigned int size_MatF,
-									   bool isEvenTimestep,
-									   unsigned int* posCSWB,
-									   unsigned int* posFSWB,
-									   unsigned int kCF,
-									   real omCoarse,
-									   real omFine,
-									   real nu,
-									   unsigned int nxC,
-									   unsigned int nyC,
-									   unsigned int nxF,
-									   unsigned int nyF,
-									   unsigned int numberOfThreads,
-									   OffCF offCF,
+                                       real* DF,
+                                       unsigned int* neighborCX,
+                                       unsigned int* neighborCY,
+                                       unsigned int* neighborCZ,
+                                       unsigned int* neighborFX,
+                                       unsigned int* neighborFY,
+                                       unsigned int* neighborFZ,
+                                       unsigned int size_MatC,
+                                       unsigned int size_MatF,
+                                       bool isEvenTimestep,
+                                       unsigned int* posCSWB,
+                                       unsigned int* posFSWB,
+                                       unsigned int kCF,
+                                       real omCoarse,
+                                       real omFine,
+                                       real nu,
+                                       unsigned int nxC,
+                                       unsigned int nyC,
+                                       unsigned int nxF,
+                                       unsigned int nyF,
+                                       unsigned int numberOfThreads,
+                                       OffCF offCF,
                               CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_AA2016_comp_27<<< grid.grid, grid.threads, 0, stream >>>(DC,
-														DF,
-														neighborCX,
-														neighborCY,
-														neighborCZ,
-														neighborFX,
-														neighborFY,
-														neighborFZ,
-														size_MatC,
-														size_MatF,
-														isEvenTimestep,
-														posCSWB,
-														posFSWB,
-														kCF,
-														omCoarse,
-														omFine,
-														nu,
-														nxC,
-														nyC,
-														nxF,
-														nyF,
-														offCF);
+                                                        DF,
+                                                        neighborCX,
+                                                        neighborCY,
+                                                        neighborCZ,
+                                                        neighborFX,
+                                                        neighborFY,
+                                                        neighborFZ,
+                                                        size_MatC,
+                                                        size_MatF,
+                                                        isEvenTimestep,
+                                                        posCSWB,
+                                                        posFSWB,
+                                                        kCF,
+                                                        omCoarse,
+                                                        omFine,
+                                                        nu,
+                                                        nxC,
+                                                        nyC,
+                                                        nxF,
+                                                        nyF,
+                                                        offCF);
       getLastCudaError("scaleCF_AA2016_comp_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleCF_NSPress_27(  real* DC,
-									 real* DF,
-									 unsigned int* neighborCX,
-									 unsigned int* neighborCY,
-									 unsigned int* neighborCZ,
-									 unsigned int* neighborFX,
-									 unsigned int* neighborFY,
-									 unsigned int* neighborFZ,
-									 unsigned int size_MatC,
-									 unsigned int size_MatF,
-									 bool isEvenTimestep,
-									 unsigned int* posCSWB,
-									 unsigned int* posFSWB,
-									 unsigned int kCF,
-									 real omCoarse,
-									 real omFine,
-									 real nu,
-									 unsigned int nxC,
-									 unsigned int nyC,
-									 unsigned int nxF,
-									 unsigned int nyF,
-									 unsigned int numberOfThreads,
-									 OffCF offCF)
+                                     real* DF,
+                                     unsigned int* neighborCX,
+                                     unsigned int* neighborCY,
+                                     unsigned int* neighborCZ,
+                                     unsigned int* neighborFX,
+                                     unsigned int* neighborFY,
+                                     unsigned int* neighborFZ,
+                                     unsigned int size_MatC,
+                                     unsigned int size_MatF,
+                                     bool isEvenTimestep,
+                                     unsigned int* posCSWB,
+                                     unsigned int* posFSWB,
+                                     unsigned int kCF,
+                                     real omCoarse,
+                                     real omFine,
+                                     real nu,
+                                     unsigned int nxC,
+                                     unsigned int nyC,
+                                     unsigned int nxF,
+                                     unsigned int nyF,
+                                     unsigned int numberOfThreads,
+                                     OffCF offCF)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
       scaleCF_NSPress_27<<< grid.grid, grid.threads >>>(DC,
-													DF,
-													neighborCX,
-													neighborCY,
-													neighborCZ,
-													neighborFX,
-													neighborFY,
-													neighborFZ,
-													size_MatC,
-													size_MatF,
-													isEvenTimestep,
-													posCSWB,
-													posFSWB,
-													kCF,
-													omCoarse,
-													omFine,
-													nu,
-													nxC,
-													nyC,
-													nxF,
-													nyF,
-													offCF);
+                                                    DF,
+                                                    neighborCX,
+                                                    neighborCY,
+                                                    neighborCZ,
+                                                    neighborFX,
+                                                    neighborFY,
+                                                    neighborFZ,
+                                                    size_MatC,
+                                                    size_MatF,
+                                                    isEvenTimestep,
+                                                    posCSWB,
+                                                    posFSWB,
+                                                    kCF,
+                                                    omCoarse,
+                                                    omFine,
+                                                    nu,
+                                                    nxC,
+                                                    nyC,
+                                                    nxF,
+                                                    nyF,
+                                                    offCF);
       getLastCudaError("scaleCF_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -4219,7 +4219,7 @@ void ScaleCFThS27( real* DC,
                               real nu,
                               real diffusivity_fine,
                               unsigned int numberOfThreads,
-							  OffCF offCF)
+                              OffCF offCF)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kCF);
 
@@ -4241,7 +4241,7 @@ void ScaleCFThS27( real* DC,
                                                 kCF,
                                                 nu,
                                                 diffusivity_fine,
-										        offCF);
+                                                offCF);
       getLastCudaError("scaleCFThS27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -4268,7 +4268,7 @@ void ScaleFC27( real* DC,
                            unsigned int nyF,
                            unsigned int numberOfThreads)
 {
-   
+
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC27<<< grid.grid, grid.threads >>> ( DC,
@@ -4500,263 +4500,263 @@ void ScaleFC_Fix_27(real* DC,
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_Fix_comp_27(  real* DC,
-									  real* DF,
-									  unsigned int* neighborCX,
-									  unsigned int* neighborCY,
-									  unsigned int* neighborCZ,
-									  unsigned int* neighborFX,
-									  unsigned int* neighborFY,
-									  unsigned int* neighborFZ,
-									  unsigned int size_MatC,
-									  unsigned int size_MatF,
-									  bool isEvenTimestep,
-									  unsigned int* posC,
-									  unsigned int* posFSWB,
-									  unsigned int kFC,
-									  real omCoarse,
-									  real omFine,
-									  real nu,
-									  unsigned int nxC,
-									  unsigned int nyC,
-									  unsigned int nxF,
-									  unsigned int nyF,
-									  unsigned int numberOfThreads,
-									  OffFC offFC)
+                                      real* DF,
+                                      unsigned int* neighborCX,
+                                      unsigned int* neighborCY,
+                                      unsigned int* neighborCZ,
+                                      unsigned int* neighborFX,
+                                      unsigned int* neighborFY,
+                                      unsigned int* neighborFZ,
+                                      unsigned int size_MatC,
+                                      unsigned int size_MatF,
+                                      bool isEvenTimestep,
+                                      unsigned int* posC,
+                                      unsigned int* posFSWB,
+                                      unsigned int kFC,
+                                      real omCoarse,
+                                      real omFine,
+                                      real nu,
+                                      unsigned int nxC,
+                                      unsigned int nyC,
+                                      unsigned int nxF,
+                                      unsigned int nyF,
+                                      unsigned int numberOfThreads,
+                                      OffFC offFC)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_Fix_comp_27<<< grid.grid, grid.threads >>> ( DC,
-													   DF,
-													   neighborCX,
-													   neighborCY,
-													   neighborCZ,
-													   neighborFX,
-													   neighborFY,
-													   neighborFZ,
-													   size_MatC,
-													   size_MatF,
-													   isEvenTimestep,
-													   posC,
-													   posFSWB,
-													   kFC,
-													   omCoarse,
-													   omFine,
-													   nu,
-													   nxC,
-													   nyC,
-													   nxF,
-													   nyF,
-													   offFC);
+                                                       DF,
+                                                       neighborCX,
+                                                       neighborCY,
+                                                       neighborCZ,
+                                                       neighborFX,
+                                                       neighborFY,
+                                                       neighborFZ,
+                                                       size_MatC,
+                                                       size_MatF,
+                                                       isEvenTimestep,
+                                                       posC,
+                                                       posFSWB,
+                                                       kFC,
+                                                       omCoarse,
+                                                       omFine,
+                                                       nu,
+                                                       nxC,
+                                                       nyC,
+                                                       nxF,
+                                                       nyF,
+                                                       offFC);
       getLastCudaError("scaleFC_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_0817_comp_27( real* DC,
-									  real* DF,
-									  unsigned int* neighborCX,
-									  unsigned int* neighborCY,
-									  unsigned int* neighborCZ,
-									  unsigned int* neighborFX,
-									  unsigned int* neighborFY,
-									  unsigned int* neighborFZ,
-									  unsigned int size_MatC,
-									  unsigned int size_MatF,
-									  bool isEvenTimestep,
-									  unsigned int* posC,
-									  unsigned int* posFSWB,
-									  unsigned int kFC,
-									  real omCoarse,
-									  real omFine,
-									  real nu,
-									  unsigned int nxC,
-									  unsigned int nyC,
-									  unsigned int nxF,
-									  unsigned int nyF,
-									  unsigned int numberOfThreads,
-									  OffFC offFC,
+                                      real* DF,
+                                      unsigned int* neighborCX,
+                                      unsigned int* neighborCY,
+                                      unsigned int* neighborCZ,
+                                      unsigned int* neighborFX,
+                                      unsigned int* neighborFY,
+                                      unsigned int* neighborFZ,
+                                      unsigned int size_MatC,
+                                      unsigned int size_MatF,
+                                      bool isEvenTimestep,
+                                      unsigned int* posC,
+                                      unsigned int* posFSWB,
+                                      unsigned int kFC,
+                                      real omCoarse,
+                                      real omFine,
+                                      real nu,
+                                      unsigned int nxC,
+                                      unsigned int nyC,
+                                      unsigned int nxF,
+                                      unsigned int nyF,
+                                      unsigned int numberOfThreads,
+                                      OffFC offFC,
                              CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_0817_comp_27<<< grid.grid, grid.threads, 0, stream >>> (DC,
-													   DF,
-													   neighborCX,
-													   neighborCY,
-													   neighborCZ,
-													   neighborFX,
-													   neighborFY,
-													   neighborFZ,
-													   size_MatC,
-													   size_MatF,
-													   isEvenTimestep,
-													   posC,
-													   posFSWB,
-													   kFC,
-													   omCoarse,
-													   omFine,
-													   nu,
-													   nxC,
-													   nyC,
-													   nxF,
-													   nyF,
-													   offFC);
+                                                       DF,
+                                                       neighborCX,
+                                                       neighborCY,
+                                                       neighborCZ,
+                                                       neighborFX,
+                                                       neighborFY,
+                                                       neighborFZ,
+                                                       size_MatC,
+                                                       size_MatF,
+                                                       isEvenTimestep,
+                                                       posC,
+                                                       posFSWB,
+                                                       kFC,
+                                                       omCoarse,
+                                                       omFine,
+                                                       nu,
+                                                       nxC,
+                                                       nyC,
+                                                       nxF,
+                                                       nyF,
+                                                       offFC);
       getLastCudaError("scaleFC_0817_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_comp_D3Q27F3_2018( real* DC,
-										   real* DF,
-										   real* G6,
-										   unsigned int* neighborCX,
-										   unsigned int* neighborCY,
-										   unsigned int* neighborCZ,
-										   unsigned int* neighborFX,
-										   unsigned int* neighborFY,
-										   unsigned int* neighborFZ,
-										   unsigned int size_MatC,
-										   unsigned int size_MatF,
-										   bool isEvenTimestep,
-										   unsigned int* posC,
-										   unsigned int* posFSWB,
-										   unsigned int kFC,
-										   real omCoarse,
-										   real omFine,
-										   real nu,
-										   unsigned int nxC,
-										   unsigned int nyC,
-										   unsigned int nxF,
-										   unsigned int nyF,
-										   unsigned int numberOfThreads,
-										   OffFC offFC)
+                                           real* DF,
+                                           real* G6,
+                                           unsigned int* neighborCX,
+                                           unsigned int* neighborCY,
+                                           unsigned int* neighborCZ,
+                                           unsigned int* neighborFX,
+                                           unsigned int* neighborFY,
+                                           unsigned int* neighborFZ,
+                                           unsigned int size_MatC,
+                                           unsigned int size_MatF,
+                                           bool isEvenTimestep,
+                                           unsigned int* posC,
+                                           unsigned int* posFSWB,
+                                           unsigned int kFC,
+                                           real omCoarse,
+                                           real omFine,
+                                           real nu,
+                                           unsigned int nxC,
+                                           unsigned int nyC,
+                                           unsigned int nxF,
+                                           unsigned int nyF,
+                                           unsigned int numberOfThreads,
+                                           OffFC offFC)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
      scaleFC_comp_D3Q27F3_2018 <<< grid.grid, grid.threads >>> (DC,
-															DF,
-															G6,
-															neighborCX,
-															neighborCY,
-															neighborCZ,
-															neighborFX,
-															neighborFY,
-															neighborFZ,
-															size_MatC,
-															size_MatF,
-															isEvenTimestep,
-															posC,
-															posFSWB,
-															kFC,
-															omCoarse,
-															omFine,
-															nu,
-															nxC,
-															nyC,
-															nxF,
-															nyF,
-															offFC);
+                                                            DF,
+                                                            G6,
+                                                            neighborCX,
+                                                            neighborCY,
+                                                            neighborCZ,
+                                                            neighborFX,
+                                                            neighborFY,
+                                                            neighborFZ,
+                                                            size_MatC,
+                                                            size_MatF,
+                                                            isEvenTimestep,
+                                                            posC,
+                                                            posFSWB,
+                                                            kFC,
+                                                            omCoarse,
+                                                            omFine,
+                                                            nu,
+                                                            nxC,
+                                                            nyC,
+                                                            nxF,
+                                                            nyF,
+                                                            offFC);
       getLastCudaError("scaleFC_comp_D3Q27F3_2018 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_comp_D3Q27F3( real* DC,
-									  real* DF,
-									  real* G6,
-									  unsigned int* neighborCX,
-									  unsigned int* neighborCY,
-									  unsigned int* neighborCZ,
-									  unsigned int* neighborFX,
-									  unsigned int* neighborFY,
-									  unsigned int* neighborFZ,
-									  unsigned int size_MatC,
-									  unsigned int size_MatF,
-									  bool isEvenTimestep,
-									  unsigned int* posC,
-									  unsigned int* posFSWB,
-									  unsigned int kFC,
-									  real omCoarse,
-									  real omFine,
-									  real nu,
-									  unsigned int nxC,
-									  unsigned int nyC,
-									  unsigned int nxF,
-									  unsigned int nyF,
-									  unsigned int numberOfThreads,
-									  OffFC offFC,
+                                      real* DF,
+                                      real* G6,
+                                      unsigned int* neighborCX,
+                                      unsigned int* neighborCY,
+                                      unsigned int* neighborCZ,
+                                      unsigned int* neighborFX,
+                                      unsigned int* neighborFY,
+                                      unsigned int* neighborFZ,
+                                      unsigned int size_MatC,
+                                      unsigned int size_MatF,
+                                      bool isEvenTimestep,
+                                      unsigned int* posC,
+                                      unsigned int* posFSWB,
+                                      unsigned int kFC,
+                                      real omCoarse,
+                                      real omFine,
+                                      real nu,
+                                      unsigned int nxC,
+                                      unsigned int nyC,
+                                      unsigned int nxF,
+                                      unsigned int nyF,
+                                      unsigned int numberOfThreads,
+                                      OffFC offFC,
                              CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
      scaleFC_comp_D3Q27F3 <<< grid.grid, grid.threads, 0, stream >>> (DC,
-													   DF,
-													   G6,
-													   neighborCX,
-													   neighborCY,
-													   neighborCZ,
-													   neighborFX,
-													   neighborFY,
-													   neighborFZ,
-													   size_MatC,
-													   size_MatF,
-													   isEvenTimestep,
-													   posC,
-													   posFSWB,
-													   kFC,
-													   omCoarse,
-													   omFine,
-													   nu,
-													   nxC,
-													   nyC,
-													   nxF,
-													   nyF,
-													   offFC);
+                                                       DF,
+                                                       G6,
+                                                       neighborCX,
+                                                       neighborCY,
+                                                       neighborCZ,
+                                                       neighborFX,
+                                                       neighborFY,
+                                                       neighborFZ,
+                                                       size_MatC,
+                                                       size_MatF,
+                                                       isEvenTimestep,
+                                                       posC,
+                                                       posFSWB,
+                                                       kFC,
+                                                       omCoarse,
+                                                       omFine,
+                                                       nu,
+                                                       nxC,
+                                                       nyC,
+                                                       nxF,
+                                                       nyF,
+                                                       offFC);
       getLastCudaError("scaleFC_0817_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_staggered_time_comp_27(   real* DC,
-												  real* DF,
-												  unsigned int* neighborCX,
-												  unsigned int* neighborCY,
-												  unsigned int* neighborCZ,
-												  unsigned int* neighborFX,
-												  unsigned int* neighborFY,
-												  unsigned int* neighborFZ,
-												  unsigned int size_MatC,
-												  unsigned int size_MatF,
-												  bool isEvenTimestep,
-												  unsigned int* posC,
-												  unsigned int* posFSWB,
-												  unsigned int kFC,
-												  real omCoarse,
-												  real omFine,
-												  real nu,
-												  unsigned int nxC,
-												  unsigned int nyC,
-												  unsigned int nxF,
-												  unsigned int nyF,
-												  unsigned int numberOfThreads,
-												  OffFC offFC)
+                                                  real* DF,
+                                                  unsigned int* neighborCX,
+                                                  unsigned int* neighborCY,
+                                                  unsigned int* neighborCZ,
+                                                  unsigned int* neighborFX,
+                                                  unsigned int* neighborFY,
+                                                  unsigned int* neighborFZ,
+                                                  unsigned int size_MatC,
+                                                  unsigned int size_MatF,
+                                                  bool isEvenTimestep,
+                                                  unsigned int* posC,
+                                                  unsigned int* posFSWB,
+                                                  unsigned int kFC,
+                                                  real omCoarse,
+                                                  real omFine,
+                                                  real nu,
+                                                  unsigned int nxC,
+                                                  unsigned int nyC,
+                                                  unsigned int nxF,
+                                                  unsigned int nyF,
+                                                  unsigned int numberOfThreads,
+                                                  OffFC offFC)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_staggered_time_comp_27<<< grid.grid, grid.threads >>> (  DC,
-																   DF,
-																   neighborCX,
-																   neighborCY,
-																   neighborCZ,
-																   neighborFX,
-																   neighborFY,
-																   neighborFZ,
-																   size_MatC,
-																   size_MatF,
-																   isEvenTimestep,
-																   posC,
-																   posFSWB,
-																   kFC,
-																   omCoarse,
-																   omFine,
-																   nu,
-																   nxC,
-																   nyC,
-																   nxF,
-																   nyF,
-																   offFC);
+                                                                   DF,
+                                                                   neighborCX,
+                                                                   neighborCY,
+                                                                   neighborCZ,
+                                                                   neighborFX,
+                                                                   neighborFY,
+                                                                   neighborFZ,
+                                                                   size_MatC,
+                                                                   size_MatF,
+                                                                   isEvenTimestep,
+                                                                   posC,
+                                                                   posFSWB,
+                                                                   kFC,
+                                                                   omCoarse,
+                                                                   omFine,
+                                                                   nu,
+                                                                   nxC,
+                                                                   nyC,
+                                                                   nxF,
+                                                                   nyF,
+                                                                   offFC);
       getLastCudaError("scaleFC_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -4818,157 +4818,157 @@ void ScaleFC_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulati
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_RhoSq_3rdMom_comp_27( real* DC,
-											  real* DF,
-											  unsigned int* neighborCX,
-											  unsigned int* neighborCY,
-											  unsigned int* neighborCZ,
-											  unsigned int* neighborFX,
-											  unsigned int* neighborFY,
-											  unsigned int* neighborFZ,
-											  unsigned int size_MatC,
-											  unsigned int size_MatF,
-											  bool isEvenTimestep,
-											  unsigned int* posC,
-											  unsigned int* posFSWB,
-											  unsigned int kFC,
-											  real omCoarse,
-											  real omFine,
-											  real nu,
-											  unsigned int nxC,
-											  unsigned int nyC,
-											  unsigned int nxF,
-											  unsigned int nyF,
-											  unsigned int numberOfThreads,
-											  OffFC offFC,
+                                              real* DF,
+                                              unsigned int* neighborCX,
+                                              unsigned int* neighborCY,
+                                              unsigned int* neighborCZ,
+                                              unsigned int* neighborFX,
+                                              unsigned int* neighborFY,
+                                              unsigned int* neighborFZ,
+                                              unsigned int size_MatC,
+                                              unsigned int size_MatF,
+                                              bool isEvenTimestep,
+                                              unsigned int* posC,
+                                              unsigned int* posFSWB,
+                                              unsigned int kFC,
+                                              real omCoarse,
+                                              real omFine,
+                                              real nu,
+                                              unsigned int nxC,
+                                              unsigned int nyC,
+                                              unsigned int nxF,
+                                              unsigned int nyF,
+                                              unsigned int numberOfThreads,
+                                              OffFC offFC,
                                    CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_RhoSq_3rdMom_comp_27<<< grid.grid, grid.threads, 0, stream >>>(DC,
-															  DF,
-															  neighborCX,
-															  neighborCY,
-															  neighborCZ,
-															  neighborFX,
-															  neighborFY,
-															  neighborFZ,
-															  size_MatC,
-															  size_MatF,
-															  isEvenTimestep,
-															  posC,
-															  posFSWB,
-															  kFC,
-															  omCoarse,
-															  omFine,
-															  nu,
-															  nxC,
-															  nyC,
-															  nxF,
-															  nyF,
-															  offFC);
+                                                              DF,
+                                                              neighborCX,
+                                                              neighborCY,
+                                                              neighborCZ,
+                                                              neighborFX,
+                                                              neighborFY,
+                                                              neighborFZ,
+                                                              size_MatC,
+                                                              size_MatF,
+                                                              isEvenTimestep,
+                                                              posC,
+                                                              posFSWB,
+                                                              kFC,
+                                                              omCoarse,
+                                                              omFine,
+                                                              nu,
+                                                              nxC,
+                                                              nyC,
+                                                              nxF,
+                                                              nyF,
+                                                              offFC);
       getLastCudaError("scaleFC_RhoSq_3rdMom_comp_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_AA2016_comp_27( real* DC,
-										real* DF,
-										unsigned int* neighborCX,
-										unsigned int* neighborCY,
-										unsigned int* neighborCZ,
-										unsigned int* neighborFX,
-										unsigned int* neighborFY,
-										unsigned int* neighborFZ,
-										unsigned int size_MatC,
-										unsigned int size_MatF,
-										bool isEvenTimestep,
-										unsigned int* posC,
-										unsigned int* posFSWB,
-										unsigned int kFC,
-										real omCoarse,
-										real omFine,
-										real nu,
-										unsigned int nxC,
-										unsigned int nyC,
-										unsigned int nxF,
-										unsigned int nyF,
-										unsigned int numberOfThreads,
-										OffFC offFC,
+                                        real* DF,
+                                        unsigned int* neighborCX,
+                                        unsigned int* neighborCY,
+                                        unsigned int* neighborCZ,
+                                        unsigned int* neighborFX,
+                                        unsigned int* neighborFY,
+                                        unsigned int* neighborFZ,
+                                        unsigned int size_MatC,
+                                        unsigned int size_MatF,
+                                        bool isEvenTimestep,
+                                        unsigned int* posC,
+                                        unsigned int* posFSWB,
+                                        unsigned int kFC,
+                                        real omCoarse,
+                                        real omFine,
+                                        real nu,
+                                        unsigned int nxC,
+                                        unsigned int nyC,
+                                        unsigned int nxF,
+                                        unsigned int nyF,
+                                        unsigned int numberOfThreads,
+                                        OffFC offFC,
                               CUstream_st *stream)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_AA2016_comp_27<<< grid.grid, grid.threads, 0, stream >>>(DC,
-														DF,
-														neighborCX,
-														neighborCY,
-														neighborCZ,
-														neighborFX,
-														neighborFY,
-														neighborFZ,
-														size_MatC,
-														size_MatF,
-														isEvenTimestep,
-														posC,
-														posFSWB,
-														kFC,
-														omCoarse,
-														omFine,
-														nu,
-														nxC,
-														nyC,
-														nxF,
-														nyF,
-														offFC);
+                                                        DF,
+                                                        neighborCX,
+                                                        neighborCY,
+                                                        neighborCZ,
+                                                        neighborFX,
+                                                        neighborFY,
+                                                        neighborFZ,
+                                                        size_MatC,
+                                                        size_MatF,
+                                                        isEvenTimestep,
+                                                        posC,
+                                                        posFSWB,
+                                                        kFC,
+                                                        omCoarse,
+                                                        omFine,
+                                                        nu,
+                                                        nxC,
+                                                        nyC,
+                                                        nxF,
+                                                        nyF,
+                                                        offFC);
       getLastCudaError("scaleFC_AA2016_comp_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void ScaleFC_NSPress_27(real* DC,
-								  real* DF,
-								  unsigned int* neighborCX,
-								  unsigned int* neighborCY,
-								  unsigned int* neighborCZ,
-								  unsigned int* neighborFX,
-								  unsigned int* neighborFY,
-								  unsigned int* neighborFZ,
-								  unsigned int size_MatC,
-								  unsigned int size_MatF,
-								  bool isEvenTimestep,
-								  unsigned int* posC,
-								  unsigned int* posFSWB,
-								  unsigned int kFC,
-								  real omCoarse,
-								  real omFine,
-								  real nu,
-								  unsigned int nxC,
-								  unsigned int nyC,
-								  unsigned int nxF,
-								  unsigned int nyF,
-								  unsigned int numberOfThreads,
-								  OffFC offFC)
+                                  real* DF,
+                                  unsigned int* neighborCX,
+                                  unsigned int* neighborCY,
+                                  unsigned int* neighborCZ,
+                                  unsigned int* neighborFX,
+                                  unsigned int* neighborFY,
+                                  unsigned int* neighborFZ,
+                                  unsigned int size_MatC,
+                                  unsigned int size_MatF,
+                                  bool isEvenTimestep,
+                                  unsigned int* posC,
+                                  unsigned int* posFSWB,
+                                  unsigned int kFC,
+                                  real omCoarse,
+                                  real omFine,
+                                  real nu,
+                                  unsigned int nxC,
+                                  unsigned int nyC,
+                                  unsigned int nxF,
+                                  unsigned int nyF,
+                                  unsigned int numberOfThreads,
+                                  OffFC offFC)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
       scaleFC_NSPress_27<<< grid.grid, grid.threads >>> (  DC,
-													   DF,
-													   neighborCX,
-													   neighborCY,
-													   neighborCZ,
-													   neighborFX,
-													   neighborFY,
-													   neighborFZ,
-													   size_MatC,
-													   size_MatF,
-													   isEvenTimestep,
-													   posC,
-													   posFSWB,
-													   kFC,
-													   omCoarse,
-													   omFine,
-													   nu,
-													   nxC,
-													   nyC,
-													   nxF,
-													   nyF,
-													   offFC);
+                                                       DF,
+                                                       neighborCX,
+                                                       neighborCY,
+                                                       neighborCZ,
+                                                       neighborFX,
+                                                       neighborFY,
+                                                       neighborFZ,
+                                                       size_MatC,
+                                                       size_MatF,
+                                                       isEvenTimestep,
+                                                       posC,
+                                                       posFSWB,
+                                                       kFC,
+                                                       omCoarse,
+                                                       omFine,
+                                                       nu,
+                                                       nxC,
+                                                       nyC,
+                                                       nxF,
+                                                       nyF,
+                                                       offFC);
       getLastCudaError("scaleFC_Fix_27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
@@ -5079,7 +5079,7 @@ void ScaleFCThS27( real* DC,
                               real nu,
                               real diffusivity_coarse,
                               unsigned int numberOfThreads,
-							  OffFC offFC)
+                              OffFC offFC)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, kFC);
 
@@ -5101,501 +5101,501 @@ void ScaleFCThS27( real* DC,
                                                 kFC,
                                                 nu,
                                                 diffusivity_coarse,
-												offFC);
+                                                offFC);
       getLastCudaError("scaleFCThS27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void DragLiftPostD27(real* DD,
-								int* k_Q,
-								real* QQ,
-								int numberOfBCnodes,
-								double *DragX,
-								double *DragY,
-								double *DragZ,
-								unsigned int* neighborX,
-								unsigned int* neighborY,
-								unsigned int* neighborZ,
-								unsigned int size_Mat,
-								bool isEvenTimestep,
-								unsigned int numberOfThreads)
+                                int* k_Q,
+                                real* QQ,
+                                int numberOfBCnodes,
+                                double *DragX,
+                                double *DragY,
+                                double *DragZ,
+                                unsigned int* neighborX,
+                                unsigned int* neighborY,
+                                unsigned int* neighborZ,
+                                unsigned int size_Mat,
+                                bool isEvenTimestep,
+                                unsigned int numberOfThreads)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
-	DragLiftPost27<<< grid.grid, grid.threads >>>(DD,
-										k_Q,
-										QQ,
-										numberOfBCnodes,
-										DragX,
-										DragY,
-										DragZ,
-										neighborX,
-										neighborY,
-										neighborZ,
-										size_Mat,
-										isEvenTimestep);
-	getLastCudaError("DragLift27 execution failed");
+    DragLiftPost27<<< grid.grid, grid.threads >>>(DD,
+                                        k_Q,
+                                        QQ,
+                                        numberOfBCnodes,
+                                        DragX,
+                                        DragY,
+                                        DragZ,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        size_Mat,
+                                        isEvenTimestep);
+    getLastCudaError("DragLift27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void DragLiftPreD27( real* DD,
-								int* k_Q,
-								real* QQ,
-								int numberOfBCnodes,
-								double *DragX,
-								double *DragY,
-								double *DragZ,
-								unsigned int* neighborX,
-								unsigned int* neighborY,
-								unsigned int* neighborZ,
-								unsigned int size_Mat,
-								bool isEvenTimestep,
-								unsigned int numberOfThreads)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
-
-	DragLiftPre27<<< grid.grid, grid.threads >>>( DD,
-										k_Q,
-										QQ,
-										numberOfBCnodes,
-										DragX,
-										DragY,
-										DragZ,
-										neighborX,
-										neighborY,
-										neighborZ,
-										size_Mat,
-										isEvenTimestep);
-	getLastCudaError("DragLift27 execution failed");
+                                int* k_Q,
+                                real* QQ,
+                                int numberOfBCnodes,
+                                double *DragX,
+                                double *DragY,
+                                double *DragZ,
+                                unsigned int* neighborX,
+                                unsigned int* neighborY,
+                                unsigned int* neighborZ,
+                                unsigned int size_Mat,
+                                bool isEvenTimestep,
+                                unsigned int numberOfThreads)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
+
+    DragLiftPre27<<< grid.grid, grid.threads >>>( DD,
+                                        k_Q,
+                                        QQ,
+                                        numberOfBCnodes,
+                                        DragX,
+                                        DragY,
+                                        DragZ,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        size_Mat,
+                                        isEvenTimestep);
+    getLastCudaError("DragLift27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcCPtop27(real* DD,
-							int* cpIndex,
-							int nonCp,
-							double *cpPress,
-							unsigned int* neighborX,
-							unsigned int* neighborY,
-							unsigned int* neighborZ,
-							unsigned int size_Mat,
-							bool isEvenTimestep,
-							unsigned int numberOfThreads)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, nonCp);
-
-	CalcCP27<<< grid.grid, grid.threads >>>(DD,
-								  cpIndex,
-								  nonCp,
-								  cpPress,
-								  neighborX,
-								  neighborY,
-								  neighborZ,
-								  size_Mat,
-								  isEvenTimestep);
-	getLastCudaError("CalcCP27 execution failed");
+                            int* cpIndex,
+                            int nonCp,
+                            double *cpPress,
+                            unsigned int* neighborX,
+                            unsigned int* neighborY,
+                            unsigned int* neighborZ,
+                            unsigned int size_Mat,
+                            bool isEvenTimestep,
+                            unsigned int numberOfThreads)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, nonCp);
+
+    CalcCP27<<< grid.grid, grid.threads >>>(DD,
+                                  cpIndex,
+                                  nonCp,
+                                  cpPress,
+                                  neighborX,
+                                  neighborY,
+                                  neighborZ,
+                                  size_Mat,
+                                  isEvenTimestep);
+    getLastCudaError("CalcCP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void CalcCPbottom27( real* DD,
-								int* cpIndex,
-								int nonCp,
-								double *cpPress,
-								unsigned int* neighborX,
-								unsigned int* neighborY,
-								unsigned int* neighborZ,
-								unsigned int size_Mat,
-								bool isEvenTimestep,
-								unsigned int numberOfThreads)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, nonCp);
-
-	CalcCP27<<< grid.grid, grid.threads >>>(DD,
-								  cpIndex,
-								  nonCp,
-								  cpPress,
-								  neighborX,
-								  neighborY,
-								  neighborZ,
-								  size_Mat,
-								  isEvenTimestep);
-	getLastCudaError("CalcCP27 execution failed");
+                                int* cpIndex,
+                                int nonCp,
+                                double *cpPress,
+                                unsigned int* neighborX,
+                                unsigned int* neighborY,
+                                unsigned int* neighborZ,
+                                unsigned int size_Mat,
+                                bool isEvenTimestep,
+                                unsigned int numberOfThreads)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, nonCp);
+
+    CalcCP27<<< grid.grid, grid.threads >>>(DD,
+                                  cpIndex,
+                                  nonCp,
+                                  cpPress,
+                                  neighborX,
+                                  neighborY,
+                                  neighborZ,
+                                  size_Mat,
+                                  isEvenTimestep);
+    getLastCudaError("CalcCP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void GetSendFsPreDev27(real* DD,
-								  real* bufferFs,
-								  int* sendIndex,
-								  int buffmax,
-								  unsigned int* neighborX,
-								  unsigned int* neighborY,
-								  unsigned int* neighborZ,
-								  unsigned int size_Mat,
-								  bool isEvenTimestep,
-								  unsigned int numberOfThreads,
-								  cudaStream_t stream)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	getSendFsPre27<<< grid.grid, grid.threads, 0, stream >>>(DD,
-										bufferFs,
-										sendIndex,
-										buffmax,
-										neighborX,
-										neighborY,
-										neighborZ,
-										size_Mat,
-										isEvenTimestep);
-	getLastCudaError("getSendFsPre27 execution failed");
+                                  real* bufferFs,
+                                  int* sendIndex,
+                                  int buffmax,
+                                  unsigned int* neighborX,
+                                  unsigned int* neighborY,
+                                  unsigned int* neighborZ,
+                                  unsigned int size_Mat,
+                                  bool isEvenTimestep,
+                                  unsigned int numberOfThreads,
+                                  cudaStream_t stream)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    getSendFsPre27<<< grid.grid, grid.threads, 0, stream >>>(DD,
+                                        bufferFs,
+                                        sendIndex,
+                                        buffmax,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        size_Mat,
+                                        isEvenTimestep);
+    getLastCudaError("getSendFsPre27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void GetSendFsPostDev27(real* DD,
-								   real* bufferFs,
-								   int* sendIndex,
-								   int buffmax,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep,
-								   unsigned int numberOfThreads,
-								   cudaStream_t stream)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	getSendFsPost27<<< grid.grid, grid.threads, 0, stream >>>(DD,
-										 bufferFs,
-										 sendIndex,
-										 buffmax,
-										 neighborX,
-										 neighborY,
-										 neighborZ,
-										 size_Mat,
-										 isEvenTimestep);
-	getLastCudaError("getSendFsPost27 execution failed");
+                                   real* bufferFs,
+                                   int* sendIndex,
+                                   int buffmax,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep,
+                                   unsigned int numberOfThreads,
+                                   cudaStream_t stream)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    getSendFsPost27<<< grid.grid, grid.threads, 0, stream >>>(DD,
+                                         bufferFs,
+                                         sendIndex,
+                                         buffmax,
+                                         neighborX,
+                                         neighborY,
+                                         neighborZ,
+                                         size_Mat,
+                                         isEvenTimestep);
+    getLastCudaError("getSendFsPost27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void SetRecvFsPreDev27(real* DD,
-								  real* bufferFs,
-								  int* recvIndex,
-								  int buffmax,
-								  unsigned int* neighborX,
-								  unsigned int* neighborY,
-								  unsigned int* neighborZ,
-								  unsigned int size_Mat,
-								  bool isEvenTimestep,
-								  unsigned int numberOfThreads,
-	                              cudaStream_t stream)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	setRecvFsPre27<<< grid.grid, grid.threads, 0, stream >>>(DD,
-										bufferFs,
-										recvIndex,
-										buffmax,
-										neighborX,
-										neighborY,
-										neighborZ,
-										size_Mat,
-										isEvenTimestep);
-	getLastCudaError("setRecvFsPre27 execution failed");
+                                  real* bufferFs,
+                                  int* recvIndex,
+                                  int buffmax,
+                                  unsigned int* neighborX,
+                                  unsigned int* neighborY,
+                                  unsigned int* neighborZ,
+                                  unsigned int size_Mat,
+                                  bool isEvenTimestep,
+                                  unsigned int numberOfThreads,
+                                  cudaStream_t stream)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    setRecvFsPre27<<< grid.grid, grid.threads, 0, stream >>>(DD,
+                                        bufferFs,
+                                        recvIndex,
+                                        buffmax,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        size_Mat,
+                                        isEvenTimestep);
+    getLastCudaError("setRecvFsPre27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void SetRecvFsPostDev27(real* DD,
-								   real* bufferFs,
-								   int* recvIndex,
-								   int buffmax,
-								   unsigned int* neighborX,
-								   unsigned int* neighborY,
-								   unsigned int* neighborZ,
-								   unsigned int size_Mat,
-								   bool isEvenTimestep,
-	                               unsigned int numberOfThreads,
-	                               cudaStream_t stream)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	setRecvFsPost27<<< grid.grid, grid.threads, 0, stream >>>(DD,
-										 bufferFs,
-										 recvIndex,
-										 buffmax,
-										 neighborX,
-										 neighborY,
-										 neighborZ,
-										 size_Mat,
-										 isEvenTimestep);
-	getLastCudaError("setRecvFsPost27 execution failed");
+                                   real* bufferFs,
+                                   int* recvIndex,
+                                   int buffmax,
+                                   unsigned int* neighborX,
+                                   unsigned int* neighborY,
+                                   unsigned int* neighborZ,
+                                   unsigned int size_Mat,
+                                   bool isEvenTimestep,
+                                   unsigned int numberOfThreads,
+                                   cudaStream_t stream)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    setRecvFsPost27<<< grid.grid, grid.threads, 0, stream >>>(DD,
+                                         bufferFs,
+                                         recvIndex,
+                                         buffmax,
+                                         neighborX,
+                                         neighborY,
+                                         neighborZ,
+                                         size_Mat,
+                                         isEvenTimestep);
+    getLastCudaError("setRecvFsPost27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void getSendGsDevF3(
-	real* G6,
-	real* bufferGs,
-	int* sendIndex,
-	int buffmax,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	bool isEvenTimestep,
-	unsigned int numberOfThreads)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	getSendGsF3 <<< grid.grid, grid.threads >>> (
-		G6,
-		bufferGs,
-		sendIndex,
-		buffmax,
-		neighborX,
-		neighborY,
-		neighborZ,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("getSendGsF3 execution failed");
+    real* G6,
+    real* bufferGs,
+    int* sendIndex,
+    int buffmax,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    bool isEvenTimestep,
+    unsigned int numberOfThreads)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    getSendGsF3 <<< grid.grid, grid.threads >>> (
+        G6,
+        bufferGs,
+        sendIndex,
+        buffmax,
+        neighborX,
+        neighborY,
+        neighborZ,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("getSendGsF3 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void setRecvGsDevF3(
-	real* G6,
-	real* bufferGs,
-	int* recvIndex,
-	int buffmax,
-	unsigned int* neighborX,
-	unsigned int* neighborY,
-	unsigned int* neighborZ,
-	unsigned int size_Mat,
-	bool isEvenTimestep,
-	unsigned int numberOfThreads)
-{
-	vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
-
-	setRecvGsF3 <<< grid.grid, grid.threads >>> (
-		G6,
-		bufferGs,
-		recvIndex,
-		buffmax,
-		neighborX,
-		neighborY,
-		neighborZ,
-		size_Mat,
-		isEvenTimestep);
-	getLastCudaError("setRecvGsF3 execution failed");
+    real* G6,
+    real* bufferGs,
+    int* recvIndex,
+    int buffmax,
+    unsigned int* neighborX,
+    unsigned int* neighborY,
+    unsigned int* neighborZ,
+    unsigned int size_Mat,
+    bool isEvenTimestep,
+    unsigned int numberOfThreads)
+{
+    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, buffmax);
+
+    setRecvGsF3 <<< grid.grid, grid.threads >>> (
+        G6,
+        bufferGs,
+        recvIndex,
+        buffmax,
+        neighborX,
+        neighborY,
+        neighborZ,
+        size_Mat,
+        isEvenTimestep);
+    getLastCudaError("setRecvGsF3 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void WallFuncDev27(unsigned int numberOfThreads,
-							  real* vx,
-							  real* vy,
-							  real* vz,
-							  real* DD,
-							  int* k_Q,
-							  real* QQ,
-							  unsigned int numberOfBCnodes,
-							  real om1,
-							  unsigned int* neighborX,
-							  unsigned int* neighborY,
-							  unsigned int* neighborZ,
-							  unsigned int size_Mat,
-							  bool isEvenTimestep)
+                              real* vx,
+                              real* vy,
+                              real* vz,
+                              real* DD,
+                              int* k_Q,
+                              real* QQ,
+                              unsigned int numberOfBCnodes,
+                              real om1,
+                              unsigned int* neighborX,
+                              unsigned int* neighborY,
+                              unsigned int* neighborZ,
+                              unsigned int size_Mat,
+                              bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfBCnodes);
 
       WallFunction27<<< grid.grid, grid.threads >>> (
-											  vx,
-											  vy,
-											  vz,
-											  DD,
-											  k_Q,
-											  QQ,
-											  numberOfBCnodes,
-											  om1,
-											  neighborX,
-											  neighborY,
-											  neighborZ,
-											  size_Mat,
-											  isEvenTimestep);
+                                              vx,
+                                              vy,
+                                              vz,
+                                              DD,
+                                              k_Q,
+                                              QQ,
+                                              numberOfBCnodes,
+                                              om1,
+                                              neighborX,
+                                              neighborY,
+                                              neighborZ,
+                                              size_Mat,
+                                              isEvenTimestep);
       getLastCudaError("WallFunction27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void SetOutputWallVelocitySP27(unsigned int numberOfThreads,
-										  real* vxD,
-										  real* vyD,
-										  real* vzD,
-										  real* vxWall,
-										  real* vyWall,
-										  real* vzWall,
-										  int numberOfWallNodes,
-										  int* kWallNodes,
-										  real* rhoD,
-										  real* pressD,
-										  unsigned int* geoD,
-										  unsigned int* neighborX,
-										  unsigned int* neighborY,
-										  unsigned int* neighborZ,
-										  unsigned int size_Mat,
-										  real* DD,
-										  bool isEvenTimestep)
+                                          real* vxD,
+                                          real* vyD,
+                                          real* vzD,
+                                          real* vxWall,
+                                          real* vyWall,
+                                          real* vzWall,
+                                          int numberOfWallNodes,
+                                          int* kWallNodes,
+                                          real* rhoD,
+                                          real* pressD,
+                                          unsigned int* geoD,
+                                          unsigned int* neighborX,
+                                          unsigned int* neighborY,
+                                          unsigned int* neighborZ,
+                                          unsigned int size_Mat,
+                                          real* DD,
+                                          bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfWallNodes);
 
       LBSetOutputWallVelocitySP27<<< grid.grid, grid.threads >>> (	vxD,
-															vyD,
-															vzD,
-															vxWall,
-															vyWall,
-															vzWall,
-															numberOfWallNodes,
-															kWallNodes,
-															rhoD,
-															pressD,
-															geoD,
-															neighborX,
-															neighborY,
-															neighborZ,
-															size_Mat,
-															DD,
-															isEvenTimestep);
+                                                            vyD,
+                                                            vzD,
+                                                            vxWall,
+                                                            vyWall,
+                                                            vzWall,
+                                                            numberOfWallNodes,
+                                                            kWallNodes,
+                                                            rhoD,
+                                                            pressD,
+                                                            geoD,
+                                                            neighborX,
+                                                            neighborY,
+                                                            neighborZ,
+                                                            size_Mat,
+                                                            DD,
+                                                            isEvenTimestep);
       getLastCudaError("LBSetOutputWallVelocitySP27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void GetVelotoForce27(unsigned int numberOfThreads,
-								 real* DD,
-								 int* bcIndex,
-								 int nonAtBC,
-								 real* Vx,
-								 real* Vy,
-								 real* Vz,
-								 unsigned int* neighborX,
-								 unsigned int* neighborY,
-								 unsigned int* neighborZ,
-								 unsigned int size_Mat,
-								 bool isEvenTimestep)
+                                 real* DD,
+                                 int* bcIndex,
+                                 int nonAtBC,
+                                 real* Vx,
+                                 real* Vy,
+                                 real* Vz,
+                                 unsigned int* neighborX,
+                                 unsigned int* neighborY,
+                                 unsigned int* neighborZ,
+                                 unsigned int size_Mat,
+                                 bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, nonAtBC);
 
       GetVeloforForcing27<<< grid.grid, grid.threads >>> (DD,
-												bcIndex,
-												nonAtBC,
-												Vx,
-												Vy,
-												Vz,
-												neighborX,
-												neighborY,
-												neighborZ,
-												size_Mat,
-												isEvenTimestep);
+                                                bcIndex,
+                                                nonAtBC,
+                                                Vx,
+                                                Vy,
+                                                Vz,
+                                                neighborX,
+                                                neighborY,
+                                                neighborZ,
+                                                size_Mat,
+                                                isEvenTimestep);
       getLastCudaError("GetVeloforForcing27 execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void InitParticlesDevice(real* coordX,
-									real* coordY,
-									real* coordZ,
-									real* coordParticleXlocal,
-									real* coordParticleYlocal,
-									real* coordParticleZlocal,
-									real* coordParticleXglobal,
-									real* coordParticleYglobal,
-									real* coordParticleZglobal,
-									real* veloParticleX,
-									real* veloParticleY,
-									real* veloParticleZ,
-									real* randArray,
-									unsigned int* particleID,
-									unsigned int* cellBaseID,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int* neighborWSB,
-									int level,
-									unsigned int numberOfParticles,
-									unsigned int size_Mat,
-									unsigned int numberOfThreads)
+                                    real* coordY,
+                                    real* coordZ,
+                                    real* coordParticleXlocal,
+                                    real* coordParticleYlocal,
+                                    real* coordParticleZlocal,
+                                    real* coordParticleXglobal,
+                                    real* coordParticleYglobal,
+                                    real* coordParticleZglobal,
+                                    real* veloParticleX,
+                                    real* veloParticleY,
+                                    real* veloParticleZ,
+                                    real* randArray,
+                                    unsigned int* particleID,
+                                    unsigned int* cellBaseID,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int* neighborWSB,
+                                    int level,
+                                    unsigned int numberOfParticles,
+                                    unsigned int size_Mat,
+                                    unsigned int numberOfThreads)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfParticles);
 
    InitParticles<<< grid.grid, grid.threads >>> (coordX,
-										coordY,
-										coordZ,
-										coordParticleXlocal,
-										coordParticleYlocal,
-										coordParticleZlocal,
-										coordParticleXglobal,
-										coordParticleYglobal,
-										coordParticleZglobal,
-										veloParticleX,
-										veloParticleY,
-										veloParticleZ,
-										randArray,
-										particleID,
-										cellBaseID,
-										bcMatD,
-										neighborX,
-										neighborY,
-										neighborZ,
-										neighborWSB,
-										level,
-										numberOfParticles,
-										size_Mat);
+                                        coordY,
+                                        coordZ,
+                                        coordParticleXlocal,
+                                        coordParticleYlocal,
+                                        coordParticleZlocal,
+                                        coordParticleXglobal,
+                                        coordParticleYglobal,
+                                        coordParticleZglobal,
+                                        veloParticleX,
+                                        veloParticleY,
+                                        veloParticleZ,
+                                        randArray,
+                                        particleID,
+                                        cellBaseID,
+                                        bcMatD,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        neighborWSB,
+                                        level,
+                                        numberOfParticles,
+                                        size_Mat);
       getLastCudaError("InitParticles execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void MoveParticlesDevice(real* coordX,
-									real* coordY,
-									real* coordZ,
-									real* coordParticleXlocal,
-									real* coordParticleYlocal,
-									real* coordParticleZlocal,
-									real* coordParticleXglobal,
-									real* coordParticleYglobal,
-									real* coordParticleZglobal,
-									real* veloParticleX,
-									real* veloParticleY,
-									real* veloParticleZ,
-									real* DD,
-									real  omega,
-									unsigned int* particleID,
-									unsigned int* cellBaseID,
-									unsigned int* bcMatD,
-									unsigned int* neighborX,
-									unsigned int* neighborY,
-									unsigned int* neighborZ,
-									unsigned int* neighborWSB,
-							        int level,
-									unsigned int timestep,
-									unsigned int numberOfTimesteps,
-									unsigned int numberOfParticles,
-									unsigned int size_Mat,
-									unsigned int numberOfThreads,
-									bool isEvenTimestep)
+                                    real* coordY,
+                                    real* coordZ,
+                                    real* coordParticleXlocal,
+                                    real* coordParticleYlocal,
+                                    real* coordParticleZlocal,
+                                    real* coordParticleXglobal,
+                                    real* coordParticleYglobal,
+                                    real* coordParticleZglobal,
+                                    real* veloParticleX,
+                                    real* veloParticleY,
+                                    real* veloParticleZ,
+                                    real* DD,
+                                    real  omega,
+                                    unsigned int* particleID,
+                                    unsigned int* cellBaseID,
+                                    unsigned int* bcMatD,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int* neighborWSB,
+                                    int level,
+                                    unsigned int timestep,
+                                    unsigned int numberOfTimesteps,
+                                    unsigned int numberOfParticles,
+                                    unsigned int size_Mat,
+                                    unsigned int numberOfThreads,
+                                    bool isEvenTimestep)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, numberOfParticles);
 
    MoveParticles<<< grid.grid, grid.threads >>> (coordX,
-										coordY,
-										coordZ,
-										coordParticleXlocal,
-										coordParticleYlocal,
-										coordParticleZlocal,
-										coordParticleXglobal,
-										coordParticleYglobal,
-										coordParticleZglobal,
-										veloParticleX,
-										veloParticleY,
-										veloParticleZ,
-										DD,
-										omega,
-										particleID,
-										cellBaseID,
-										bcMatD,
-										neighborX,
-										neighborY,
-										neighborZ,
-										neighborWSB,
-										level,
-										timestep,
-										numberOfTimesteps,
-										numberOfParticles,
-										size_Mat,
-										isEvenTimestep);
+                                        coordY,
+                                        coordZ,
+                                        coordParticleXlocal,
+                                        coordParticleYlocal,
+                                        coordParticleZlocal,
+                                        coordParticleXglobal,
+                                        coordParticleYglobal,
+                                        coordParticleZglobal,
+                                        veloParticleX,
+                                        veloParticleY,
+                                        veloParticleZ,
+                                        DD,
+                                        omega,
+                                        particleID,
+                                        cellBaseID,
+                                        bcMatD,
+                                        neighborX,
+                                        neighborY,
+                                        neighborZ,
+                                        neighborWSB,
+                                        level,
+                                        timestep,
+                                        numberOfTimesteps,
+                                        numberOfParticles,
+                                        size_Mat,
+                                        isEvenTimestep);
       getLastCudaError("MoveParticles execution failed");
 }
 //////////////////////////////////////////////////////////////////////////
 void initRandomDevice(curandState* state,
-								 unsigned int size_Mat,
-								 unsigned int numberOfThreads)
+                                 unsigned int size_Mat,
+                                 unsigned int numberOfThreads)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
    initRandom<<< grid.grid, grid.threads >>> (state);
@@ -5603,9 +5603,9 @@ void initRandomDevice(curandState* state,
 }
 //////////////////////////////////////////////////////////////////////////
 void generateRandomValuesDevice( curandState* state,
-											unsigned int size_Mat,
-											real* randArray,
-											unsigned int numberOfThreads)
+                                            unsigned int size_Mat,
+                                            real* randArray,
+                                            unsigned int numberOfThreads)
 {
    vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(numberOfThreads, size_Mat);
    generateRandomValues<<< grid.grid, grid.threads >>> (state,randArray);
@@ -5636,7 +5636,7 @@ void CalcTurbulenceIntensityDevice(
      vxx,
      vyy,
      vzz,
-	 vxy,
+     vxy,
      vxz,
      vyz,
      vx_mean,
@@ -5652,16 +5652,3 @@ void CalcTurbulenceIntensityDevice(
 
    getLastCudaError("CalcTurbulenceIntensity execution failed");
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
index 78b190e37..b17ffefd1 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PrecursorBCs27.cu
@@ -1,4 +1,4 @@
-#include "LBM/LB.h" 
+#include "LBM/LB.h"
 #include <lbm/constants/NumericConstants.h>
 #include <lbm/constants/D3Q27.h>
 #include <lbm/MacroscopicQuantities.h>
@@ -16,18 +16,18 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
                                                 real omega,
                                                 real* distributions,
                                                 real* subgridDistances,
-                                                uint* neighborX, 
-                                                uint* neighborY, 
+                                                uint* neighborX,
+                                                uint* neighborY,
                                                 uint* neighborZ,
-                                                uint* neighbors0PP, 
+                                                uint* neighbors0PP,
                                                 uint* neighbors0PM,
                                                 uint* neighbors0MP,
                                                 uint* neighbors0MM,
-                                                real* weights0PP, 
+                                                real* weights0PP,
                                                 real* weights0PM,
                                                 real* weights0MP,
                                                 real* weights0MM,
-                                                real* vLast, 
+                                                real* vLast,
                                                 real* vCurrent,
                                                 real velocityX,
                                                 real velocityY,
@@ -43,8 +43,8 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
 
     ////////////////////////////////////////////////////////////////////////////////
     // interpolation of velocity
-    real vxLastInterpd, vyLastInterpd, vzLastInterpd; 
-    real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
+    real vxLastInterpd, vyLastInterpd, vzLastInterpd;
+    real vxNextInterpd, vyNextInterpd, vzNextInterpd;
 
     uint kNeighbor0PP = neighbors0PP[k];
     real d0PP = weights0PP[k];
@@ -90,7 +90,7 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
 
     // if(k==16300)s printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
     real VeloX = (velocityX + (1.f-timeRatio)*vxLastInterpd + timeRatio*vxNextInterpd)/velocityRatio;
-    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio; 
+    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio;
     real VeloZ = (velocityZ + (1.f-timeRatio)*vzLastInterpd + timeRatio*vzNextInterpd)/velocityRatio;
     // From here on just a copy of QVelDeviceCompZeroPress
     ////////////////////////////////////////////////////////////////////////////////
@@ -156,29 +156,29 @@ __global__ void QPrecursorDeviceCompZeroPress( 	int* subgridDistanceIndices,
     real f_PPP = (dist.f[DIR_MMM])[kMMM];
     real f_MPP = (dist.f[DIR_PMM])[kPMM];
     real f_PMP = (dist.f[DIR_MPM])[kMPM];
-    
+
     SubgridDistances27 subgridD;
     getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes);
-    
+
     ////////////////////////////////////////////////////////////////////////////////
       real drho   =  f_PMP + f_MPP + f_PPP + f_MMP + f_PMM + f_MPM + f_PPM + f_MMM +
-                     f_0PM + f_0PP + f_0MP + f_0MM + f_P0M + f_M0P + f_P0P + f_M0M + f_PM0 + f_MP0 + f_PP0 + f_MM0 + 
-                     f_00P + f_00M + f_0P0 + f_0M0 + f_P00 + f_M00 + ((dist.f[DIR_000])[k000]); 
+                     f_0PM + f_0PP + f_0MP + f_0MM + f_P0M + f_M0P + f_P0P + f_M0M + f_PM0 + f_MP0 + f_PP0 + f_MM0 +
+                     f_00P + f_00M + f_0P0 + f_0M0 + f_P00 + f_M00 + ((dist.f[DIR_000])[k000]);
 
       real vx1 =  (((f_PMP - f_MPM) - (f_MPP - f_PMM)) + ((f_PPP - f_MMM) - (f_MMP - f_PPM)) +
                       ((f_P0M - f_M0P)   + (f_P0P - f_M0M))   + ((f_PM0 - f_MP0)   + (f_PP0 - f_MM0)) +
-                      (f_P00 - f_M00)) / (c1o1 + drho); 
-         
+                      (f_P00 - f_M00)) / (c1o1 + drho);
+
 
       real vx2 =   ((-(f_PMP - f_MPM) + (f_MPP - f_PMM)) + ((f_PPP - f_MMM) - (f_MMP - f_PPM)) +
                        ((f_0PM - f_0MP)   + (f_0PP - f_0MM))    + (-(f_PM0 - f_MP0)  + (f_PP0 - f_MM0)) +
-                       (f_0P0 - f_0M0)) / (c1o1 + drho); 
+                       (f_0P0 - f_0M0)) / (c1o1 + drho);
 
       real vx3 =   (((f_PMP - f_MPM) + (f_MPP - f_PMM)) + ((f_PPP - f_MMM) + (f_MMP - f_PPM)) +
                        (-(f_0PM - f_0MP)  + (f_0PP - f_0MM))   + ((f_P0P - f_M0M)   - (f_P0M - f_M0P)) +
-                       (f_00P - f_00M)) / (c1o1 + drho); 
+                       (f_00P - f_00M)) / (c1o1 + drho);
+
 
-    
     // if(k==16383 || k==0) printf("k %d kQ %d drho = %f u %f v %f w %f\n",k, KQK, drho, vx1, vx2, vx3);
       real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho);
     //////////////////////////////////////////////////////////////////////////
@@ -429,18 +429,18 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
                                         int numberOfPrecursorNodes,
                                         real omega,
                                         real* distributions,
-                                        uint* neighborX, 
-                                        uint* neighborY, 
+                                        uint* neighborX,
+                                        uint* neighborY,
                                         uint* neighborZ,
-                                        uint* neighbors0PP, 
+                                        uint* neighbors0PP,
                                         uint* neighbors0PM,
                                         uint* neighbors0MP,
                                         uint* neighbors0MM,
-                                        real* weights0PP, 
+                                        real* weights0PP,
                                         real* weights0PM,
                                         real* weights0MP,
                                         real* weights0MM,
-                                        real* vLast, 
+                                        real* vLast,
                                         real* vCurrent,
                                         real velocityX,
                                         real velocityY,
@@ -456,8 +456,8 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
 
     ////////////////////////////////////////////////////////////////////////////////
     // interpolation of velocity
-    real vxLastInterpd, vyLastInterpd, vzLastInterpd; 
-    real vxNextInterpd, vyNextInterpd, vzNextInterpd; 
+    real vxLastInterpd, vyLastInterpd, vzLastInterpd;
+    real vxNextInterpd, vyNextInterpd, vzNextInterpd;
 
     uint kNeighbor0PP = neighbors0PP[k];
     real d0PP = weights0PP[k];
@@ -503,7 +503,7 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
 
     // if(k==16300) printf("%f %f %f\n", vxLastInterpd, vyLastInterpd, vzLastInterpd);
     real VeloX = (velocityX + (1.f-timeRatio)*vxLastInterpd + timeRatio*vxNextInterpd)/velocityRatio;
-    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio; 
+    real VeloY = (velocityY + (1.f-timeRatio)*vyLastInterpd + timeRatio*vyNextInterpd)/velocityRatio;
     real VeloZ = (velocityZ + (1.f-timeRatio)*vzLastInterpd + timeRatio*vzNextInterpd)/velocityRatio;
     // From here on just a copy of QVelDeviceCompZeroPress
     ////////////////////////////////////////////////////////////////////////////////
@@ -511,26 +511,26 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
     Distributions27 dist;
     getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep);
 
-    unsigned int KQK  = subgridDistanceIndices[k]; //QK 
+    unsigned int KQK  = subgridDistanceIndices[k]; //QK
     unsigned int k000 = KQK; //000
     unsigned int kP00 = KQK; //P00
     unsigned int kM00 = neighborX[KQK]; //M00
-    unsigned int k0P0   = KQK; //n  
-    unsigned int k0M0   = neighborY[KQK]; //s  
-    unsigned int k00P   = KQK; //t  
-    unsigned int k00M   = neighborZ[KQK]; //b  
-    unsigned int kMM0  = neighborY[kM00]; //sw 
-    unsigned int kPP0  = KQK; //ne 
-    unsigned int kPM0  = k0M0; //se 
-    unsigned int kMP0  = kM00; //nw 
-    unsigned int kM0M  = neighborZ[kM00]; //bw 
-    unsigned int kP0P  = KQK; //te 
-    unsigned int kP0M  = k00M; //be 
-    unsigned int k0PP  = KQK; //tn 
-    unsigned int k0MM  = neighborZ[k0M0]; //bs 
-    unsigned int kM0P  = kM00; //tw 
-    unsigned int k0PM  = k00M; //bn 
-    unsigned int k0MP  = k0M0; //ts 
+    unsigned int k0P0   = KQK; //n
+    unsigned int k0M0   = neighborY[KQK]; //s
+    unsigned int k00P   = KQK; //t
+    unsigned int k00M   = neighborZ[KQK]; //b
+    unsigned int kMM0  = neighborY[kM00]; //sw
+    unsigned int kPP0  = KQK; //ne
+    unsigned int kPM0  = k0M0; //se
+    unsigned int kMP0  = kM00; //nw
+    unsigned int kM0M  = neighborZ[kM00]; //bw
+    unsigned int kP0P  = KQK; //te
+    unsigned int kP0M  = k00M; //be
+    unsigned int k0PP  = KQK; //tn
+    unsigned int k0MM  = neighborZ[k0M0]; //bs
+    unsigned int kM0P  = kM00; //tw
+    unsigned int k0PM  = k00M; //bn
+    unsigned int k0MP  = k0M0; //ts
     unsigned int kPMP = k0M0; //tse
     unsigned int kMPM = kM0M; //bnw
     unsigned int kMPP = kM00; //tnw
@@ -576,11 +576,11 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
       //!
       real drho = c0o1;
 
-      real vx1  = VeloX;          
+      real vx1  = VeloX;
 
-      real vx2  = VeloY; 
+      real vx2  = VeloY;
 
-      real vx3  = VeloZ; 
+      real vx3  = VeloZ;
 
       real cusq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
@@ -625,7 +625,7 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
       (dist.f[DIR_PPM])[kPPM] = f_MMP;
       (dist.f[DIR_PPP])[kPPP] = f_MMM;
       (dist.f[DIR_PMM])[kPMM] = f_MPP;
-      
+
       (dist.f[DIR_M00])[kM00] = f_P00;
       (dist.f[DIR_MM0])[kMM0] = f_PP0;
       (dist.f[DIR_M0M])[kM0M] = f_P0P;
@@ -650,25 +650,25 @@ __global__ void PrecursorDeviceEQ27( 	int* subgridDistanceIndices,
 
 
 __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
-												int numberOfBCnodes,
+                                                int numberOfBCnodes,
                                                 int numberOfPrecursorNodes,
-												real* distributions,
-												uint* neighborX, 
-												uint* neighborY, 
-												uint* neighborZ,
-												uint* neighbors0PP, 
-												uint* neighbors0PM,
-												uint* neighbors0MP,
-												uint* neighbors0MM,
-												real* weights0PP, 
-												real* weights0PM,
-												real* weights0MP,
-												real* weights0MM,
-												real* fsLast, 
-												real* fsNext,
-												real timeRatio,
-												unsigned long long numberOfLBnodes,
-												bool isEvenTimestep)
+                                                real* distributions,
+                                                uint* neighborX,
+                                                uint* neighborY,
+                                                uint* neighborZ,
+                                                uint* neighbors0PP,
+                                                uint* neighbors0PM,
+                                                uint* neighbors0MP,
+                                                uint* neighbors0MM,
+                                                real* weights0PP,
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
+                                                real* fsLast,
+                                                real* fsNext,
+                                                real timeRatio,
+                                                unsigned long long numberOfLBnodes,
+                                                bool isEvenTimestep)
 {
     const unsigned k = vf::gpu::getNodeIndex();
 
@@ -715,31 +715,31 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 
         f0LastInterp = (f0Last[kNeighbor0PP]*d0PP + f0Last[kNeighbor0PM]*d0PM + f0Last[kNeighbor0MP]*d0MP + f0Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f0NextInterp = (f0Next[kNeighbor0PP]*d0PP + f0Next[kNeighbor0PM]*d0PM + f0Next[kNeighbor0MP]*d0MP + f0Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f1LastInterp = (f1Last[kNeighbor0PP]*d0PP + f1Last[kNeighbor0PM]*d0PM + f1Last[kNeighbor0MP]*d0MP + f1Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f1NextInterp = (f1Next[kNeighbor0PP]*d0PP + f1Next[kNeighbor0PM]*d0PM + f1Next[kNeighbor0MP]*d0MP + f1Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f2LastInterp = (f2Last[kNeighbor0PP]*d0PP + f2Last[kNeighbor0PM]*d0PM + f2Last[kNeighbor0MP]*d0MP + f2Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f2NextInterp = (f2Next[kNeighbor0PP]*d0PP + f2Next[kNeighbor0PM]*d0PM + f2Next[kNeighbor0MP]*d0MP + f2Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f3LastInterp = (f3Last[kNeighbor0PP]*d0PP + f3Last[kNeighbor0PM]*d0PM + f3Last[kNeighbor0MP]*d0MP + f3Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f3NextInterp = (f3Next[kNeighbor0PP]*d0PP + f3Next[kNeighbor0PM]*d0PM + f3Next[kNeighbor0MP]*d0MP + f3Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f4LastInterp = (f4Last[kNeighbor0PP]*d0PP + f4Last[kNeighbor0PM]*d0PM + f4Last[kNeighbor0MP]*d0MP + f4Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f4NextInterp = (f4Next[kNeighbor0PP]*d0PP + f4Next[kNeighbor0PM]*d0PM + f4Next[kNeighbor0MP]*d0MP + f4Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f5LastInterp = (f5Last[kNeighbor0PP]*d0PP + f5Last[kNeighbor0PM]*d0PM + f5Last[kNeighbor0MP]*d0MP + f5Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f5NextInterp = (f5Next[kNeighbor0PP]*d0PP + f5Next[kNeighbor0PM]*d0PM + f5Next[kNeighbor0MP]*d0MP + f5Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f6LastInterp = (f6Last[kNeighbor0PP]*d0PP + f6Last[kNeighbor0PM]*d0PM + f6Last[kNeighbor0MP]*d0MP + f6Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f6NextInterp = (f6Next[kNeighbor0PP]*d0PP + f6Next[kNeighbor0PM]*d0PM + f6Next[kNeighbor0MP]*d0MP + f6Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f7LastInterp = (f7Last[kNeighbor0PP]*d0PP + f7Last[kNeighbor0PM]*d0PM + f7Last[kNeighbor0MP]*d0MP + f7Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f7NextInterp = (f7Next[kNeighbor0PP]*d0PP + f7Next[kNeighbor0PM]*d0PM + f7Next[kNeighbor0MP]*d0MP + f7Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f8LastInterp = (f8Last[kNeighbor0PP]*d0PP + f8Last[kNeighbor0PM]*d0PM + f8Last[kNeighbor0MP]*d0MP + f8Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f8NextInterp = (f8Next[kNeighbor0PP]*d0PP + f8Next[kNeighbor0PM]*d0PM + f8Next[kNeighbor0MP]*d0MP + f8Next[kNeighbor0MM]*d0MM)*invWeightSum;
-    
+
     } else {
         f0LastInterp = f0Last[kNeighbor0PP];
         f1LastInterp = f1Last[kNeighbor0PP];
@@ -808,25 +808,25 @@ __global__ void PrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
                                                 real* subgridDistances,
                                                 int sizeQ,
-												int numberOfBCnodes,
+                                                int numberOfBCnodes,
                                                 int numberOfPrecursorNodes,
-												real* distributions,
-												uint* neighborX, 
-												uint* neighborY, 
-												uint* neighborZ,
-												uint* neighbors0PP, 
-												uint* neighbors0PM,
-												uint* neighbors0MP,
-												uint* neighbors0MM,
-												real* weights0PP, 
-												real* weights0PM,
-												real* weights0MP,
-												real* weights0MM,
-												real* fsLast, 
-												real* fsNext,
-												real timeRatio,
-												unsigned long long numberOfLBnodes,
-												bool isEvenTimestep)
+                                                real* distributions,
+                                                uint* neighborX,
+                                                uint* neighborY,
+                                                uint* neighborZ,
+                                                uint* neighbors0PP,
+                                                uint* neighbors0PM,
+                                                uint* neighbors0MP,
+                                                uint* neighbors0MM,
+                                                real* weights0PP,
+                                                real* weights0PM,
+                                                real* weights0MP,
+                                                real* weights0MM,
+                                                real* fsLast,
+                                                real* fsNext,
+                                                real timeRatio,
+                                                unsigned long long numberOfLBnodes,
+                                                bool isEvenTimestep)
 {
     const unsigned k = vf::gpu::getNodeIndex();
 
@@ -873,31 +873,31 @@ __global__ void QPrecursorDeviceDistributions( 	int* subgridDistanceIndices,
 
         f0LastInterp = (f0Last[kNeighbor0PP]*d0PP + f0Last[kNeighbor0PM]*d0PM + f0Last[kNeighbor0MP]*d0MP + f0Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f0NextInterp = (f0Next[kNeighbor0PP]*d0PP + f0Next[kNeighbor0PM]*d0PM + f0Next[kNeighbor0MP]*d0MP + f0Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f1LastInterp = (f1Last[kNeighbor0PP]*d0PP + f1Last[kNeighbor0PM]*d0PM + f1Last[kNeighbor0MP]*d0MP + f1Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f1NextInterp = (f1Next[kNeighbor0PP]*d0PP + f1Next[kNeighbor0PM]*d0PM + f1Next[kNeighbor0MP]*d0MP + f1Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f2LastInterp = (f2Last[kNeighbor0PP]*d0PP + f2Last[kNeighbor0PM]*d0PM + f2Last[kNeighbor0MP]*d0MP + f2Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f2NextInterp = (f2Next[kNeighbor0PP]*d0PP + f2Next[kNeighbor0PM]*d0PM + f2Next[kNeighbor0MP]*d0MP + f2Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f3LastInterp = (f3Last[kNeighbor0PP]*d0PP + f3Last[kNeighbor0PM]*d0PM + f3Last[kNeighbor0MP]*d0MP + f3Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f3NextInterp = (f3Next[kNeighbor0PP]*d0PP + f3Next[kNeighbor0PM]*d0PM + f3Next[kNeighbor0MP]*d0MP + f3Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f4LastInterp = (f4Last[kNeighbor0PP]*d0PP + f4Last[kNeighbor0PM]*d0PM + f4Last[kNeighbor0MP]*d0MP + f4Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f4NextInterp = (f4Next[kNeighbor0PP]*d0PP + f4Next[kNeighbor0PM]*d0PM + f4Next[kNeighbor0MP]*d0MP + f4Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f5LastInterp = (f5Last[kNeighbor0PP]*d0PP + f5Last[kNeighbor0PM]*d0PM + f5Last[kNeighbor0MP]*d0MP + f5Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f5NextInterp = (f5Next[kNeighbor0PP]*d0PP + f5Next[kNeighbor0PM]*d0PM + f5Next[kNeighbor0MP]*d0MP + f5Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f6LastInterp = (f6Last[kNeighbor0PP]*d0PP + f6Last[kNeighbor0PM]*d0PM + f6Last[kNeighbor0MP]*d0MP + f6Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f6NextInterp = (f6Next[kNeighbor0PP]*d0PP + f6Next[kNeighbor0PM]*d0PM + f6Next[kNeighbor0MP]*d0MP + f6Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f7LastInterp = (f7Last[kNeighbor0PP]*d0PP + f7Last[kNeighbor0PM]*d0PM + f7Last[kNeighbor0MP]*d0MP + f7Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f7NextInterp = (f7Next[kNeighbor0PP]*d0PP + f7Next[kNeighbor0PM]*d0PM + f7Next[kNeighbor0MP]*d0MP + f7Next[kNeighbor0MM]*d0MM)*invWeightSum;
-        
+
         f8LastInterp = (f8Last[kNeighbor0PP]*d0PP + f8Last[kNeighbor0PM]*d0PM + f8Last[kNeighbor0MP]*d0MP + f8Last[kNeighbor0MM]*d0MM)*invWeightSum;
         f8NextInterp = (f8Next[kNeighbor0PP]*d0PP + f8Next[kNeighbor0PM]*d0PM + f8Next[kNeighbor0MP]*d0MP + f8Next[kNeighbor0MM]*d0MM)*invWeightSum;
-    
+
     } else {
         f0LastInterp = f0Last[kNeighbor0PP];
         f1LastInterp = f1Last[kNeighbor0PP];
diff --git a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
index 6a14cebd4..a72ebb1a3 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
+++ b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu
@@ -1,5 +1,5 @@
 /* Device code */
-#include "LBM/LB.h" 
+#include "LBM/LB.h"
 #include "lbm/constants/D3Q27.h"
 #include "lbm/constants/NumericConstants.h"
 #include "lbm/MacroscopicQuantities.h"
@@ -12,21 +12,21 @@ using namespace vf::lbm::dir;
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
-														 real* DD, 
-														 int* k_Q, 
-														 int* k_N, 
-														 int numberOfBCnodes, 
-														 real om1, 
-														 unsigned int* neighborX,
-														 unsigned int* neighborY,
-														 unsigned int* neighborZ,
-														 unsigned int size_Mat, 
-														 bool isEvenTimestep)
+                                           real* DD,
+                                           int* k_Q,
+                                           int* k_N,
+                                           int numberOfBCnodes,
+                                           real om1,
+                                           unsigned int* neighborX,
+                                           unsigned int* neighborY,
+                                           unsigned int* neighborZ,
+                                           unsigned int size_Mat,
+                                           bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -127,7 +127,7 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -218,23 +218,23 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
       // real vx1, vx2, vx3;
       real drho, drho1;
       //////////////////////////////////////////////////////////////////////////
-	  //Dichte
+     //Dichte
       drho1  =  f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW +
-                f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + 
-                f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[DIR_000])[k1zero]); 
+                f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW +
+                f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[DIR_000])[k1zero]);
       drho   =  f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW +
-                f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + 
-                f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); 
+                f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW +
+                f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]);
       //////////////////////////////////////////////////////////////////////////
-	  //Schallgeschwindigkeit
-	  real cs = c1o1 / sqrtf(c3o1);
+     //Schallgeschwindigkeit
+     real cs = c1o1 / sqrtf(c3o1);
       //////////////////////////////////////////////////////////////////////////
-	  real rhoInterpol = drho1 * cs + (c1o1 - cs) * drho; 
-	  //real diffRho = (rhoBC[k] + one) / (rhoInterpol + one);
-	  real diffRhoToAdd = rhoBC[k] - rhoInterpol;
-	  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  //no velocity
-	  //////////////////////////////////////////
+     real rhoInterpol = drho1 * cs + (c1o1 - cs) * drho;
+     //real diffRho = (rhoBC[k] + one) / (rhoInterpol + one);
+     real diffRhoToAdd = rhoBC[k] - rhoInterpol;
+     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     //no velocity
+     //////////////////////////////////////////
       f_E    = f1_E   * cs + (c1o1 - cs) * f_E   ;
       f_W    = f1_W   * cs + (c1o1 - cs) * f_W   ;
       f_N    = f1_N   * cs + (c1o1 - cs) * f_N   ;
@@ -261,16 +261,16 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
       f_BSW  = f1_BSW * cs + (c1o1 - cs) * f_BSW ;
       f_BSE  = f1_BSE * cs + (c1o1 - cs) * f_BSE ;
       f_BNW  = f1_BNW * cs + (c1o1 - cs) * f_BNW ;
-	  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  //scale by press
-	  //////////////////////////////////////////
-	  //f_E    = (f_E   + c2over27 ) * diffRho - c2over27 ;
+     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     //scale by press
+     //////////////////////////////////////////
+     //f_E    = (f_E   + c2over27 ) * diffRho - c2over27 ;
    //   f_W    = (f_W   + c2over27 ) * diffRho - c2over27 ;
    //   f_N    = (f_N   + c2over27 ) * diffRho - c2over27 ;
    //   f_S    = (f_S   + c2over27 ) * diffRho - c2over27 ;
    //   f_T    = (f_T   + c2over27 ) * diffRho - c2over27 ;
    //   f_B    = (f_B   + c2over27 ) * diffRho - c2over27 ;
-	  //f_NE   = (f_NE  + c1over54 ) * diffRho - c1over54 ;
+     //f_NE   = (f_NE  + c1over54 ) * diffRho - c1over54 ;
    //   f_SW   = (f_SW  + c1over54 ) * diffRho - c1over54 ;
    //   f_SE   = (f_SE  + c1over54 ) * diffRho - c1over54 ;
    //   f_NW   = (f_NW  + c1over54 ) * diffRho - c1over54 ;
@@ -290,16 +290,16 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
    //   f_BSW  = (f_BSW + c1over216) * diffRho - c1over216;
    //   f_BSE  = (f_BSE + c1over216) * diffRho - c1over216;
    //   f_BNW  = (f_BNW + c1over216) * diffRho - c1over216;
-	  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  // add press
-	  //////////////////////////////////////////
-	  f_E    = (f_E   + c2o27  * diffRhoToAdd);
+     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     // add press
+     //////////////////////////////////////////
+     f_E    = (f_E   + c2o27  * diffRhoToAdd);
       f_W    = (f_W   + c2o27  * diffRhoToAdd);
       f_N    = (f_N   + c2o27  * diffRhoToAdd);
       f_S    = (f_S   + c2o27  * diffRhoToAdd);
       f_T    = (f_T   + c2o27  * diffRhoToAdd);
       f_B    = (f_B   + c2o27  * diffRhoToAdd);
-	  f_NE   = (f_NE  + c1o54  * diffRhoToAdd);
+     f_NE   = (f_NE  + c1o54  * diffRhoToAdd);
       f_SW   = (f_SW  + c1o54  * diffRhoToAdd);
       f_SE   = (f_SE  + c1o54  * diffRhoToAdd);
       f_NW   = (f_NW  + c1o54  * diffRhoToAdd);
@@ -319,9 +319,9 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
       f_BSW  = (f_BSW + c1o216 * diffRhoToAdd);
       f_BSE  = (f_BSE + c1o216 * diffRhoToAdd);
       f_BNW  = (f_BNW + c1o216 * diffRhoToAdd);
-	  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-	  //////////////////////////////////////////////////////////////////////////
+     //////////////////////////////////////////////////////////////////////////
       if (isEvenTimestep==false)
       {
          D.f[DIR_P00   ] = &DD[DIR_P00   *size_Mat];
@@ -351,7 +351,7 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -384,46 +384,46 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
       }
       //////////////////////////////////////////////////////////////////////////
       //__syncthreads();
-	  // -X
-	  //(D.f[DIR_P00   ])[ke   ] = f_E   ;
-	  //(D.f[DIR_PM0  ])[kse  ] = f_SE  ;
-	  //(D.f[DIR_PP0  ])[kne  ] = f_NE  ;
-	  //(D.f[DIR_P0M  ])[kbe  ] = f_BE  ;
-	  //(D.f[DIR_P0P  ])[kte  ] = f_TE  ;
-	  //(D.f[DIR_PMP ])[ktse ] = f_TSE ;
-	  //(D.f[DIR_PPP ])[ktne ] = f_TNE ;
-	  //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
-	  //(D.f[DIR_PPM ])[kbne ] = f_BNE ;     
-	  // X
-	  (D.f[DIR_M00   ])[kw   ] = f_W   ;
-	  (D.f[DIR_MM0  ])[ksw  ] = f_SW  ;
-	  (D.f[DIR_MP0  ])[knw  ] = f_NW  ;
-	  (D.f[DIR_M0M  ])[kbw  ] = f_BW  ;
-	  (D.f[DIR_M0P  ])[ktw  ] = f_TW  ;
-	  (D.f[DIR_MMP ])[ktsw ] = f_TSW ;
-	  (D.f[DIR_MPP ])[ktnw ] = f_TNW ;
-	  (D.f[DIR_MMM ])[kbsw ] = f_BSW ;
-	  (D.f[DIR_MPM ])[kbnw ] = f_BNW ;     
-	  // Y
-	  //(D.f[DIR_0M0   ])[ks   ] = f_S   ;
-	  //(D.f[DIR_PM0  ])[kse  ] = f_SE  ;
-	  //(D.f[DIR_MM0  ])[ksw  ] = f_SW  ;
-	  //(D.f[DIR_0MP  ])[kts  ] = f_TS  ;
-	  //(D.f[DIR_0MM  ])[kbs  ] = f_BS  ;
-	  //(D.f[DIR_PMP ])[ktse ] = f_TSE ;
-	  //(D.f[DIR_MMP ])[ktsw ] = f_TSW ;
-	  //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
-	  //(D.f[DIR_MMM ])[kbsw ] = f_BSW ;     
-	  // Z
-	  //(D.f[DIR_00M   ])[kb   ] = f_B   ;
-	  //(D.f[DIR_P0M  ])[kbe  ] = f_BE  ;
-	  //(D.f[DIR_M0M  ])[kbw  ] = f_BW  ;
-	  //(D.f[DIR_0PM  ])[kbn  ] = f_BN  ;
-	  //(D.f[DIR_0MM  ])[kbs  ] = f_BS  ;
-	  //(D.f[DIR_PPM ])[kbne ] = f_BNE ;
-	  //(D.f[DIR_MPM ])[kbnw ] = f_BNW ;
-	  //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
-	  //(D.f[DIR_MMM ])[kbsw ] = f_BSW ;     
+     // -X
+     //(D.f[DIR_P00   ])[ke   ] = f_E   ;
+     //(D.f[DIR_PM0  ])[kse  ] = f_SE  ;
+     //(D.f[DIR_PP0  ])[kne  ] = f_NE  ;
+     //(D.f[DIR_P0M  ])[kbe  ] = f_BE  ;
+     //(D.f[DIR_P0P  ])[kte  ] = f_TE  ;
+     //(D.f[DIR_PMP ])[ktse ] = f_TSE ;
+     //(D.f[DIR_PPP ])[ktne ] = f_TNE ;
+     //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
+     //(D.f[DIR_PPM ])[kbne ] = f_BNE ;
+     // X
+     (D.f[DIR_M00   ])[kw   ] = f_W   ;
+     (D.f[DIR_MM0  ])[ksw  ] = f_SW  ;
+     (D.f[DIR_MP0  ])[knw  ] = f_NW  ;
+     (D.f[DIR_M0M  ])[kbw  ] = f_BW  ;
+     (D.f[DIR_M0P  ])[ktw  ] = f_TW  ;
+     (D.f[DIR_MMP ])[ktsw ] = f_TSW ;
+     (D.f[DIR_MPP ])[ktnw ] = f_TNW ;
+     (D.f[DIR_MMM ])[kbsw ] = f_BSW ;
+     (D.f[DIR_MPM ])[kbnw ] = f_BNW ;
+     // Y
+     //(D.f[DIR_0M0   ])[ks   ] = f_S   ;
+     //(D.f[DIR_PM0  ])[kse  ] = f_SE  ;
+     //(D.f[DIR_MM0  ])[ksw  ] = f_SW  ;
+     //(D.f[DIR_0MP  ])[kts  ] = f_TS  ;
+     //(D.f[DIR_0MM  ])[kbs  ] = f_BS  ;
+     //(D.f[DIR_PMP ])[ktse ] = f_TSE ;
+     //(D.f[DIR_MMP ])[ktsw ] = f_TSW ;
+     //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
+     //(D.f[DIR_MMM ])[kbsw ] = f_BSW ;
+     // Z
+     //(D.f[DIR_00M   ])[kb   ] = f_B   ;
+     //(D.f[DIR_P0M  ])[kbe  ] = f_BE  ;
+     //(D.f[DIR_M0M  ])[kbw  ] = f_BW  ;
+     //(D.f[DIR_0PM  ])[kbn  ] = f_BN  ;
+     //(D.f[DIR_0MM  ])[kbs  ] = f_BS  ;
+     //(D.f[DIR_PPM ])[kbne ] = f_BNE ;
+     //(D.f[DIR_MPM ])[kbnw ] = f_BNW ;
+     //(D.f[DIR_PMM ])[kbse ] = f_BSE ;
+     //(D.f[DIR_MMM ])[kbsw ] = f_BSW ;
       //////////////////////////////////////////////////////////////////////////
    }
 }
@@ -469,21 +469,21 @@ __global__ void QInflowScaleByPressDevice27(  real* rhoBC,
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
-													real* DD, 
-													int* k_Q, 
-													int* k_N, 
-													int numberOfBCnodes, 
-													real om1, 
-													unsigned int* neighborX,
-													unsigned int* neighborY,
-													unsigned int* neighborZ,
-													unsigned int size_Mat, 
-													bool isEvenTimestep)
+                                       real* DD,
+                                       int* k_Q,
+                                       int* k_N,
+                                       int numberOfBCnodes,
+                                       real om1,
+                                       unsigned int* neighborX,
+                                       unsigned int* neighborY,
+                                       unsigned int* neighborZ,
+                                       unsigned int size_Mat,
+                                       bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -584,7 +584,7 @@ __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -652,17 +652,17 @@ __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
                           f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW;
 
       real vx1      =  ((f1_TSE - f1_BNW) - (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
-						  ((f1_BE - f1_TW)   + (f1_TE - f1_BW))   + ((f1_SE - f1_NW)   + (f1_NE - f1_SW)) +
-						  (f1_E - f1_W); 
+                    ((f1_BE - f1_TW)   + (f1_TE - f1_BW))   + ((f1_SE - f1_NW)   + (f1_NE - f1_SW)) +
+                    (f1_E - f1_W);
 
 
       real vx2    =   (-(f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
-						 ((f1_BN - f1_TS)   + (f1_TN - f1_BS))    + (-(f1_SE - f1_NW)  + (f1_NE - f1_SW)) +
-						 (f1_N - f1_S); 
+                   ((f1_BN - f1_TS)   + (f1_TN - f1_BS))    + (-(f1_SE - f1_NW)  + (f1_NE - f1_SW)) +
+                   (f1_N - f1_S);
 
       real vx3    =   ((f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) + (f1_TSW - f1_BNE)) +
-						 (-(f1_BN - f1_TS)  + (f1_TN - f1_BS))   + ((f1_TE - f1_BW)   - (f1_BE - f1_TW)) +
-						 (f1_T - f1_B); 
+                   (-(f1_BN - f1_TS)  + (f1_TN - f1_BS))   + ((f1_TE - f1_BW)   - (f1_BE - f1_TW)) +
+                   (f1_T - f1_B);
 
       real cusq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
 
@@ -693,15 +693,15 @@ __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
       f1_BNW   -=  c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq));
       f1_BSE   -=  c1o216*(drho1+(drho1+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
       f1_TNW   -=  c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
-	   
-	  drho1 = rhoBC[k];
 
-	  //if(vx1 < zero){
-		 // vx1 *= 0.9;
-	  //}
-	  //if(vx2 < zero){
-		 // vx2 *= c1o10;//0.9;
-	  //}
+     drho1 = rhoBC[k];
+
+     //if(vx1 < zero){
+       // vx1 *= 0.9;
+     //}
+     //if(vx2 < zero){
+       // vx2 *= c1o10;//0.9;
+     //}
 
       f1_ZERO  += c8o27*  (drho1-(drho1+c1o1)*cusq);
       f1_E     += c2o27*  (drho1+(drho1+c1o1)*(c3o1*( vx1        )+c9o2*( vx1        )*( vx1        )-cusq));
@@ -731,39 +731,39 @@ __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
       f1_BSE   +=  c1o216*(drho1+(drho1+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
       f1_TNW   +=  c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
 
-	  //drho1 = (drho1 + rhoBC[k])/2.f;
-	  //drho1 = drho1 - rhoBC[k];
+     //drho1 = (drho1 + rhoBC[k])/2.f;
+     //drho1 = drho1 - rhoBC[k];
       //////////////////////////////////////////////////////////////////////////
 
       __syncthreads();
 
-      (D.f[DIR_P00   ])[ke   ] = f1_W   ;  
-      (D.f[DIR_M00   ])[kw   ] = f1_E   ;	
-      (D.f[DIR_0P0   ])[kn   ] = f1_S   ;	
-      (D.f[DIR_0M0   ])[ks   ] = f1_N   ;	
-      (D.f[DIR_00P   ])[kt   ] = f1_B   ;	
-      (D.f[DIR_00M   ])[kb   ] = f1_T   ;	
-      (D.f[DIR_PP0  ])[kne  ] = f1_SW  ;	
-      (D.f[DIR_MM0  ])[ksw  ] = f1_NE  ;	
-      (D.f[DIR_PM0  ])[kse  ] = f1_NW  ;	
-      (D.f[DIR_MP0  ])[knw  ] = f1_SE  ;	
-      (D.f[DIR_P0P  ])[kte  ] = f1_BW  ;	
-      (D.f[DIR_M0M  ])[kbw  ] = f1_TE  ;	
-      (D.f[DIR_P0M  ])[kbe  ] = f1_TW  ;	
-      (D.f[DIR_M0P  ])[ktw  ] = f1_BE  ;	
-      (D.f[DIR_0PP  ])[ktn  ] = f1_BS  ;	
-      (D.f[DIR_0MM  ])[kbs  ] = f1_TN  ;	
-      (D.f[DIR_0PM  ])[kbn  ] = f1_TS  ;	
-      (D.f[DIR_0MP  ])[kts  ] = f1_BN  ;	
-      (D.f[DIR_000])[kzero] = f1_ZERO;	
-      (D.f[DIR_PPP ])[ktne ] = f1_BSW ;	
-      (D.f[DIR_MMP ])[ktsw ] = f1_BNE ;	
-      (D.f[DIR_PMP ])[ktse ] = f1_BNW ;	
-      (D.f[DIR_MPP ])[ktnw ] = f1_BSE ;	
-      (D.f[DIR_PPM ])[kbne ] = f1_TSW ;	
-      (D.f[DIR_MMM ])[kbsw ] = f1_TNE ;	
-      (D.f[DIR_PMM ])[kbse ] = f1_TNW ;	
-      (D.f[DIR_MPM ])[kbnw ] = f1_TSE ;       
+      (D.f[DIR_P00   ])[ke   ] = f1_W   ;
+      (D.f[DIR_M00   ])[kw   ] = f1_E   ;
+      (D.f[DIR_0P0   ])[kn   ] = f1_S   ;
+      (D.f[DIR_0M0   ])[ks   ] = f1_N   ;
+      (D.f[DIR_00P   ])[kt   ] = f1_B   ;
+      (D.f[DIR_00M   ])[kb   ] = f1_T   ;
+      (D.f[DIR_PP0  ])[kne  ] = f1_SW  ;
+      (D.f[DIR_MM0  ])[ksw  ] = f1_NE  ;
+      (D.f[DIR_PM0  ])[kse  ] = f1_NW  ;
+      (D.f[DIR_MP0  ])[knw  ] = f1_SE  ;
+      (D.f[DIR_P0P  ])[kte  ] = f1_BW  ;
+      (D.f[DIR_M0M  ])[kbw  ] = f1_TE  ;
+      (D.f[DIR_P0M  ])[kbe  ] = f1_TW  ;
+      (D.f[DIR_M0P  ])[ktw  ] = f1_BE  ;
+      (D.f[DIR_0PP  ])[ktn  ] = f1_BS  ;
+      (D.f[DIR_0MM  ])[kbs  ] = f1_TN  ;
+      (D.f[DIR_0PM  ])[kbn  ] = f1_TS  ;
+      (D.f[DIR_0MP  ])[kts  ] = f1_BN  ;
+      (D.f[DIR_000])[kzero] = f1_ZERO;
+      (D.f[DIR_PPP ])[ktne ] = f1_BSW ;
+      (D.f[DIR_MMP ])[ktsw ] = f1_BNE ;
+      (D.f[DIR_PMP ])[ktse ] = f1_BNW ;
+      (D.f[DIR_MPP ])[ktnw ] = f1_BSE ;
+      (D.f[DIR_PPM ])[kbne ] = f1_TSW ;
+      (D.f[DIR_MMM ])[kbsw ] = f1_TNE ;
+      (D.f[DIR_PMM ])[kbse ] = f1_TNW ;
+      (D.f[DIR_MPM ])[kbnw ] = f1_TSE ;
    }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -808,26 +808,26 @@ __global__ void QPressDeviceIncompNEQ27( real* rhoBC,
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceNEQ27(real* rhoBC,
-                                             real* distribution, 
+                                             real* distribution,
                                              int* bcNodeIndices,
                                              int* bcNeighborIndices,
                                              int numberOfBCnodes,
-                                             real omega1, 
+                                             real omega1,
                                              unsigned int* neighborX,
                                              unsigned int* neighborY,
                                              unsigned int* neighborZ,
-                                             unsigned int numberOfLBnodes, 
+                                             unsigned int numberOfLBnodes,
                                              bool isEvenTimestep)
 {
    //////////////////////////////////////////////////////////////////////////
-	//! The pressure boundary condition is executed in the following steps
-	//!
-	////////////////////////////////////////////////////////////////////////////////
-	//! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim.
-	//!
-   const unsigned x = threadIdx.x;    // global x-index 
-   const unsigned y = blockIdx.x;     // global y-index 
-   const unsigned z = blockIdx.y;     // global z-index 
+   //! The pressure boundary condition is executed in the following steps
+   //!
+   ////////////////////////////////////////////////////////////////////////////////
+   //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim.
+   //!
+   const unsigned x = threadIdx.x;    // global x-index
+   const unsigned y = blockIdx.x;     // global y-index
+   const unsigned z = blockIdx.y;     // global z-index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -949,20 +949,20 @@ __global__ void QPressDeviceNEQ27(real* rhoBC,
       //! - Calculate macroscopic quantities (for neighboring node)
       //!
       real drho1 = f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW +
-                   f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + 
-                   f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((dist.f[DIR_000])[kzero]); 
+                   f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW +
+                   f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((dist.f[DIR_000])[kzero]);
 
       real vx1  = (((f1_TSE - f1_BNW) - (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
                    ((f1_BE - f1_TW)   + (f1_TE - f1_BW))   + ((f1_SE - f1_NW)   + (f1_NE - f1_SW)) +
-                   (f1_E - f1_W)) / (c1o1 + drho1);          
+                   (f1_E - f1_W)) / (c1o1 + drho1);
 
       real vx2  = ((-(f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
                    ((f1_BN - f1_TS)   + (f1_TN - f1_BS))    + (-(f1_SE - f1_NW)  + (f1_NE - f1_SW)) +
-                   (f1_N - f1_S)) / (c1o1 + drho1); 
+                   (f1_N - f1_S)) / (c1o1 + drho1);
 
       real vx3  = (((f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) + (f1_TSW - f1_BNE)) +
                    (-(f1_BN - f1_TS)  + (f1_TN - f1_BS))   + ((f1_TE - f1_BW)   - (f1_BE - f1_TW)) +
-                   (f1_T - f1_B)) / (c1o1 + drho1); 
+                   (f1_T - f1_B)) / (c1o1 + drho1);
 
       real cusq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3);
 
@@ -1110,16 +1110,16 @@ __global__ void QPressDeviceNEQ27(real* rhoBC,
 
 
 ////////////////////////////////////////////////////////////////////////////////
-__global__ void LB_BC_Press_East27( int nx, 
-                                               int ny, 
-                                               int tz, 
-                                               unsigned int* bcMatD, 
+__global__ void LB_BC_Press_East27( int nx,
+                                               int ny,
+                                               int tz,
+                                               unsigned int* bcMatD,
                                                unsigned int* neighborX,
                                                unsigned int* neighborY,
                                                unsigned int* neighborZ,
-                                               real* DD, 
-                                               unsigned int size_Mat, 
-                                               bool isEvenTimestep) 
+                                               real* DD,
+                                               unsigned int size_Mat,
+                                               bool isEvenTimestep)
 {
    //thread-index
    int ty = blockIdx.x;
@@ -1127,9 +1127,9 @@ __global__ void LB_BC_Press_East27( int nx,
 
    int  k, k1, nxny;                   // Zugriff auf arrays im device
 
-   int  x = tx + STARTOFFX;  // Globaler x-Index 
-   int  y = ty + STARTOFFY;  // Globaler y-Index 
-   int  z = tz + STARTOFFZ;  // Globaler z-Index 
+   int  x = tx + STARTOFFX;  // Globaler x-Index
+   int  y = ty + STARTOFFY;  // Globaler y-Index
+   int  z = tz + STARTOFFZ;  // Globaler z-Index
 
    k = nx*(ny*z + y) + x;
    nxny = nx*ny;
@@ -1167,7 +1167,7 @@ __global__ void LB_BC_Press_East27( int nx,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -1374,10 +1374,10 @@ __global__ void LB_BC_Press_East27( int nx,
       (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1;
       (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1;
       (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1;
-      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;       
+      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;
    }
    __syncthreads();
-}          
+}
 //////////////////////////////////////////////////////////////////////////////
 
 
@@ -1420,15 +1420,15 @@ __global__ void LB_BC_Press_East27( int nx,
 
 //////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDevice27(real* rhoBC,
-                                           real* DD, 
-                                           int* k_Q, 
+                                           real* DD,
+                                           int* k_Q,
                                            real* QQ,
-                                           unsigned int numberOfBCnodes, 
-                                           real om1, 
+                                           unsigned int numberOfBCnodes,
+                                           real om1,
                                            unsigned int* neighborX,
                                            unsigned int* neighborY,
                                            unsigned int* neighborZ,
-                                           unsigned int size_Mat, 
+                                           unsigned int size_Mat,
                                            bool isEvenTimestep)
 {
    Distributions27 D;
@@ -1461,7 +1461,7 @@ __global__ void QPressDevice27(real* rhoBC,
       D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
       D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
       D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-   } 
+   }
    else
    {
       D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -1493,9 +1493,9 @@ __global__ void QPressDevice27(real* rhoBC,
       D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
    }
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -1505,11 +1505,11 @@ __global__ void QPressDevice27(real* rhoBC,
 
    if(k<numberOfBCnodes)
    {
-      real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB, 
+      real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB,
          *q_dirNE,  *q_dirSW,  *q_dirSE,  *q_dirNW,  *q_dirTE,  *q_dirBW,
          *q_dirBE,  *q_dirTW,  *q_dirTN,  *q_dirBS,  *q_dirBN,  *q_dirTS,
          *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW,
-         *q_dirBSE, *q_dirBNW; 
+         *q_dirBSE, *q_dirBNW;
       q_dirE   = &QQ[DIR_P00   * numberOfBCnodes];
       q_dirW   = &QQ[DIR_M00   * numberOfBCnodes];
       q_dirN   = &QQ[DIR_0P0   * numberOfBCnodes];
@@ -1600,16 +1600,16 @@ __global__ void QPressDevice27(real* rhoBC,
       real q, vx1, vx2, vx3, drho;
       vx1    =  ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
                   ((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
-                  (f_E - f_W); 
+                  (f_E - f_W);
 
 
       vx2    =   (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
                   ((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
-                  (f_N - f_S); 
+                  (f_N - f_S);
 
       vx3    =   ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
                   (-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
-                  (f_T - f_B); 
+                  (f_T - f_B);
 
       real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
       //////////////////////////////////////////////////////////////////////////
@@ -1646,7 +1646,7 @@ __global__ void QPressDevice27(real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -1681,183 +1681,183 @@ __global__ void QPressDevice27(real* rhoBC,
       q = q_dirE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_M00])[kw]=c2o27* (drho+c3o1*(-vx1        )+c9o2*(-vx1        )*(-vx1        )-cu_sq); 
-         //(D.f[DIR_P00])[ke]=c2over27* (drho+three*( vx1        )+c9over2*( vx1        )*( vx1        )-cu_sq); 
+         (D.f[DIR_M00])[kw]=c2o27* (drho+c3o1*(-vx1        )+c9o2*(-vx1        )*(-vx1        )-cu_sq);
+         //(D.f[DIR_P00])[ke]=c2over27* (drho+three*( vx1        )+c9over2*( vx1        )*( vx1        )-cu_sq);
       }
 
       q = q_dirW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_P00])[ke]=c2o27* (drho+c3o1*( vx1        )+c9o2*( vx1        )*( vx1        )-cu_sq); 
-         //(D.f[DIR_M00])[kw]=c2over27* (drho+three*(-vx1        )+c9over2*(-vx1        )*(-vx1        )-cu_sq); 
+         (D.f[DIR_P00])[ke]=c2o27* (drho+c3o1*( vx1        )+c9o2*( vx1        )*( vx1        )-cu_sq);
+         //(D.f[DIR_M00])[kw]=c2over27* (drho+three*(-vx1        )+c9over2*(-vx1        )*(-vx1        )-cu_sq);
       }
 
       q = q_dirN[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0M0])[ks]=c2o27* (drho+c3o1*(   -vx2     )+c9o2*(    -vx2    )*(    -vx2    )-cu_sq); 
-         //(D.f[DIR_0P0])[kn]=c2over27* (drho+three*(    vx2     )+c9over2*(     vx2    )*(     vx2    )-cu_sq); 
+         (D.f[DIR_0M0])[ks]=c2o27* (drho+c3o1*(   -vx2     )+c9o2*(    -vx2    )*(    -vx2    )-cu_sq);
+         //(D.f[DIR_0P0])[kn]=c2over27* (drho+three*(    vx2     )+c9over2*(     vx2    )*(     vx2    )-cu_sq);
       }
 
       q = q_dirS[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0P0])[kn]=c2o27* (drho+c3o1*(    vx2     )+c9o2*(     vx2    )*(     vx2    )-cu_sq); 
-         //(D.f[DIR_0M0])[ks]=c2over27* (drho+three*(   -vx2     )+c9over2*(    -vx2    )*(    -vx2    )-cu_sq); 
+         (D.f[DIR_0P0])[kn]=c2o27* (drho+c3o1*(    vx2     )+c9o2*(     vx2    )*(     vx2    )-cu_sq);
+         //(D.f[DIR_0M0])[ks]=c2over27* (drho+three*(   -vx2     )+c9over2*(    -vx2    )*(    -vx2    )-cu_sq);
       }
 
       q = q_dirT[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_00M])[kb]=c2o27* (drho+c3o1*(        -vx3)+c9o2*(        -vx3)*(        -vx3)-cu_sq); 
-         //(D.f[DIR_00P])[kt]=c2over27* (drho+three*(         vx3)+c9over2*(         vx3)*(         vx3)-cu_sq); 
+         (D.f[DIR_00M])[kb]=c2o27* (drho+c3o1*(        -vx3)+c9o2*(        -vx3)*(        -vx3)-cu_sq);
+         //(D.f[DIR_00P])[kt]=c2over27* (drho+three*(         vx3)+c9over2*(         vx3)*(         vx3)-cu_sq);
       }
 
       q = q_dirB[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_00P])[kt]=c2o27* (drho+c3o1*(         vx3)+c9o2*(         vx3)*(         vx3)-cu_sq); 
-         //(D.f[DIR_00M])[kb]=c2over27* (drho+three*(        -vx3)+c9over2*(        -vx3)*(        -vx3)-cu_sq); 
+         (D.f[DIR_00P])[kt]=c2o27* (drho+c3o1*(         vx3)+c9o2*(         vx3)*(         vx3)-cu_sq);
+         //(D.f[DIR_00M])[kb]=c2over27* (drho+three*(        -vx3)+c9over2*(        -vx3)*(        -vx3)-cu_sq);
       }
 
       q = q_dirNE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MM0])[ksw]=c1o54* (drho+c3o1*(-vx1-vx2    )+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq); 
-         //(D.f[DIR_PP0])[kne]=c1over54* (drho+three*( vx1+vx2    )+c9over2*( vx1+vx2    )*( vx1+vx2    )-cu_sq); 
+         (D.f[DIR_MM0])[ksw]=c1o54* (drho+c3o1*(-vx1-vx2    )+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq);
+         //(D.f[DIR_PP0])[kne]=c1over54* (drho+three*( vx1+vx2    )+c9over2*( vx1+vx2    )*( vx1+vx2    )-cu_sq);
       }
 
       q = q_dirSW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PP0])[kne]=c1o54* (drho+c3o1*( vx1+vx2    )+c9o2*( vx1+vx2    )*( vx1+vx2    )-cu_sq); 
-         //(D.f[DIR_MM0])[ksw]=c1over54* (drho+three*(-vx1-vx2    )+c9over2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq); 
+         (D.f[DIR_PP0])[kne]=c1o54* (drho+c3o1*( vx1+vx2    )+c9o2*( vx1+vx2    )*( vx1+vx2    )-cu_sq);
+         //(D.f[DIR_MM0])[ksw]=c1over54* (drho+three*(-vx1-vx2    )+c9over2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq);
       }
 
       q = q_dirSE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MP0])[knw]=c1o54* (drho+c3o1*(-vx1+vx2    )+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq); 
-         //(D.f[DIR_PM0])[kse]=c1over54* (drho+three*( vx1-vx2    )+c9over2*( vx1-vx2    )*( vx1-vx2    )-cu_sq); 
+         (D.f[DIR_MP0])[knw]=c1o54* (drho+c3o1*(-vx1+vx2    )+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq);
+         //(D.f[DIR_PM0])[kse]=c1over54* (drho+three*( vx1-vx2    )+c9over2*( vx1-vx2    )*( vx1-vx2    )-cu_sq);
       }
 
       q = q_dirNW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PM0])[kse]=c1o54* (drho+c3o1*( vx1-vx2    )+c9o2*( vx1-vx2    )*( vx1-vx2    )-cu_sq); 
-         //(D.f[DIR_MP0])[knw]=c1over54* (drho+three*(-vx1+vx2    )+c9over2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq); 
+         (D.f[DIR_PM0])[kse]=c1o54* (drho+c3o1*( vx1-vx2    )+c9o2*( vx1-vx2    )*( vx1-vx2    )-cu_sq);
+         //(D.f[DIR_MP0])[knw]=c1over54* (drho+three*(-vx1+vx2    )+c9over2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq);
       }
 
       q = q_dirTE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_M0M])[kbw]=c1o54* (drho+c3o1*(-vx1    -vx3)+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq); 
-         //(D.f[DIR_P0P])[kte]=c1over54* (drho+three*( vx1    +vx3)+c9over2*( vx1    +vx3)*( vx1    +vx3)-cu_sq); 
+         (D.f[DIR_M0M])[kbw]=c1o54* (drho+c3o1*(-vx1    -vx3)+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq);
+         //(D.f[DIR_P0P])[kte]=c1over54* (drho+three*( vx1    +vx3)+c9over2*( vx1    +vx3)*( vx1    +vx3)-cu_sq);
       }
 
       q = q_dirBW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_P0P])[kte]=c1o54* (drho+c3o1*( vx1    +vx3)+c9o2*( vx1    +vx3)*( vx1    +vx3)-cu_sq); 
-         //(D.f[DIR_M0M])[kbw]=c1over54* (drho+three*(-vx1    -vx3)+c9over2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq); 
+         (D.f[DIR_P0P])[kte]=c1o54* (drho+c3o1*( vx1    +vx3)+c9o2*( vx1    +vx3)*( vx1    +vx3)-cu_sq);
+         //(D.f[DIR_M0M])[kbw]=c1over54* (drho+three*(-vx1    -vx3)+c9over2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq);
       }
 
       q = q_dirBE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_M0P])[ktw]=c1o54* (drho+c3o1*(-vx1    +vx3)+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq); 
-         //(D.f[DIR_P0M])[kbe]=c1over54* (drho+three*( vx1    -vx3)+c9over2*( vx1    -vx3)*( vx1    -vx3)-cu_sq); 
+         (D.f[DIR_M0P])[ktw]=c1o54* (drho+c3o1*(-vx1    +vx3)+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq);
+         //(D.f[DIR_P0M])[kbe]=c1over54* (drho+three*( vx1    -vx3)+c9over2*( vx1    -vx3)*( vx1    -vx3)-cu_sq);
       }
 
       q = q_dirTW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_P0M])[kbe]=c1o54* (drho+c3o1*( vx1    -vx3)+c9o2*( vx1    -vx3)*( vx1    -vx3)-cu_sq); 
-         //(D.f[DIR_M0P])[ktw]=c1over54* (drho+three*(-vx1    +vx3)+c9over2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq); 
+         (D.f[DIR_P0M])[kbe]=c1o54* (drho+c3o1*( vx1    -vx3)+c9o2*( vx1    -vx3)*( vx1    -vx3)-cu_sq);
+         //(D.f[DIR_M0P])[ktw]=c1over54* (drho+three*(-vx1    +vx3)+c9over2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq);
       }
 
       q = q_dirTN[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0MM])[kbs]=c1o54* (drho+c3o1*(    -vx2-vx3)+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq); 
-         //(D.f[DIR_0PP])[ktn]=c1over54* (drho+three*(     vx2+vx3)+c9over2*(     vx2+vx3)*(     vx2+vx3)-cu_sq); 
+         (D.f[DIR_0MM])[kbs]=c1o54* (drho+c3o1*(    -vx2-vx3)+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq);
+         //(D.f[DIR_0PP])[ktn]=c1over54* (drho+three*(     vx2+vx3)+c9over2*(     vx2+vx3)*(     vx2+vx3)-cu_sq);
       }
 
       q = q_dirBS[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0PP])[ktn]=c1o54* (drho+c3o1*(     vx2+vx3)+c9o2*(     vx2+vx3)*(     vx2+vx3)-cu_sq); 
-         //(D.f[DIR_0MM])[kbs]=c1over54* (drho+three*(    -vx2-vx3)+c9over2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq); 
+         (D.f[DIR_0PP])[ktn]=c1o54* (drho+c3o1*(     vx2+vx3)+c9o2*(     vx2+vx3)*(     vx2+vx3)-cu_sq);
+         //(D.f[DIR_0MM])[kbs]=c1over54* (drho+three*(    -vx2-vx3)+c9over2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq);
       }
 
       q = q_dirBN[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0MP])[kts]=c1o54* (drho+c3o1*(    -vx2+vx3)+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq); 
-         //(D.f[DIR_0PM])[kbn]=c1over54* (drho+three*(     vx2-vx3)+c9over2*(     vx2-vx3)*(     vx2-vx3)-cu_sq); 
+         (D.f[DIR_0MP])[kts]=c1o54* (drho+c3o1*(    -vx2+vx3)+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq);
+         //(D.f[DIR_0PM])[kbn]=c1over54* (drho+three*(     vx2-vx3)+c9over2*(     vx2-vx3)*(     vx2-vx3)-cu_sq);
       }
 
       q = q_dirTS[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0PM])[kbn]=c1o54* (drho+c3o1*(     vx2-vx3)+c9o2*(     vx2-vx3)*(     vx2-vx3)-cu_sq); 
-         //(D.f[DIR_0MP])[kts]=c1over54* (drho+three*(    -vx2+vx3)+c9over2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq); 
+         (D.f[DIR_0PM])[kbn]=c1o54* (drho+c3o1*(     vx2-vx3)+c9o2*(     vx2-vx3)*(     vx2-vx3)-cu_sq);
+         //(D.f[DIR_0MP])[kts]=c1over54* (drho+three*(    -vx2+vx3)+c9over2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq);
       }
 
       q = q_dirTNE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MMM])[kbsw]=c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); 
-         //(D.f[DIR_PPP])[ktne]=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); 
+         (D.f[DIR_MMM])[kbsw]=c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
+         //(D.f[DIR_PPP])[ktne]=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
       }
 
       q = q_dirBSW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PPP])[ktne]=c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); 
-         //(D.f[DIR_MMM])[kbsw]=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); 
+         (D.f[DIR_PPP])[ktne]=c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
+         //(D.f[DIR_MMM])[kbsw]=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
       }
 
       q = q_dirBNE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MMP])[ktsw]=c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); 
-         //(D.f[DIR_PPM])[kbne]=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); 
+         (D.f[DIR_MMP])[ktsw]=c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
+         //(D.f[DIR_PPM])[kbne]=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
       }
 
       q = q_dirTSW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PPM])[kbne]=c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); 
-         //(D.f[DIR_MMP])[ktsw]=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); 
+         (D.f[DIR_PPM])[kbne]=c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
+         //(D.f[DIR_MMP])[ktsw]=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
       }
 
       q = q_dirTSE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MPM])[kbnw]=c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); 
-         //(D.f[DIR_PMP])[ktse]=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); 
+         (D.f[DIR_MPM])[kbnw]=c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
+         //(D.f[DIR_PMP])[ktse]=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
       }
 
       q = q_dirBNW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PMP])[ktse]=c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); 
-         //(D.f[DIR_MPM])[kbnw]=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); 
+         (D.f[DIR_PMP])[ktse]=c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
+         //(D.f[DIR_MPM])[kbnw]=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
       }
 
       q = q_dirBSE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_MPP])[ktnw]=c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); 
-         //(D.f[DIR_PMM])[kbse]=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); 
+         (D.f[DIR_MPP])[ktnw]=c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
+         //(D.f[DIR_PMM])[kbse]=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
       }
 
       q = q_dirTNW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_PMM])[kbse]=c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); 
-         //(D.f[DIR_MPP])[ktnw]=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); 
+         (D.f[DIR_PMM])[kbse]=c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
+         //(D.f[DIR_MPP])[ktnw]=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
       }
    }
 }
@@ -1903,19 +1903,19 @@ __global__ void QPressDevice27(real* rhoBC,
 
 //////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceAntiBB27(   real* rhoBC,
-												   real* vx,
-												   real* vy,
-												   real* vz,
-												   real* DD, 
-												   int* k_Q, 
-												   real* QQ,
-												   int numberOfBCnodes, 
-												   real om1, 
-												   unsigned int* neighborX,
-												   unsigned int* neighborY,
-												   unsigned int* neighborZ,
-												   unsigned int size_Mat, 
-												   bool isEvenTimestep)
+                                       real* vx,
+                                       real* vy,
+                                       real* vz,
+                                       real* DD,
+                                       int* k_Q,
+                                       real* QQ,
+                                       int numberOfBCnodes,
+                                       real om1,
+                                       unsigned int* neighborX,
+                                       unsigned int* neighborY,
+                                       unsigned int* neighborZ,
+                                       unsigned int size_Mat,
+                                       bool isEvenTimestep)
 {
    Distributions27 D;
    if (isEvenTimestep==true)
@@ -1947,7 +1947,7 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
       D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
       D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-   } 
+   }
    else
    {
       D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -1979,9 +1979,9 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
    }
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -1991,11 +1991,11 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
 
    if(k<numberOfBCnodes)
    {
-      real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB, 
+      real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB,
          *q_dirNE,  *q_dirSW,  *q_dirSE,  *q_dirNW,  *q_dirTE,  *q_dirBW,
          *q_dirBE,  *q_dirTW,  *q_dirTN,  *q_dirBS,  *q_dirBN,  *q_dirTS,
          *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW,
-         *q_dirBSE, *q_dirBNW; 
+         *q_dirBSE, *q_dirBNW;
       q_dirE   = &QQ[DIR_P00   *numberOfBCnodes];
       q_dirW   = &QQ[DIR_M00   *numberOfBCnodes];
       q_dirN   = &QQ[DIR_0P0   *numberOfBCnodes];
@@ -2087,25 +2087,25 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       //real vx1, vx2, vx3, drho;
       //vx1    =  ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
       //            ((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
-      //            (f_E - f_W); 
+      //            (f_E - f_W);
 
 
       //vx2    =   (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
       //            ((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
-      //            (f_N - f_S); 
+      //            (f_N - f_S);
 
       //vx3    =   ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
       //            (-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
-      //            (f_T - f_B); 
+      //            (f_T - f_B);
 
       //real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
       //////////////////////////////////////////////////////////////////////////
       real drho    = f_ZERO+f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+
-						f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW;
+                  f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW;
       drho = drho - rhoBC[k];
-	  drho *= 0.01f;
+     drho *= 0.01f;
       ////////////////////////////////////////////////////////////////////////////////
-	  real q;
+     real q;
       //deltaRho = (rhoBC[k] + one) / (deltaRho + one);
       ////////////////////////////////////////////////////////////////////////////////
       if (isEvenTimestep==false)
@@ -2137,7 +2137,7 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -2172,7 +2172,7 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       q = q_dirE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_M00])[kw]=f_W-c2o27*drho; 
+         (D.f[DIR_M00])[kw]=f_W-c2o27*drho;
       }
 
       q = q_dirW[k];
@@ -2184,19 +2184,19 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       q = q_dirN[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0M0])[ks]=f_S-c2o27*drho; 
+         (D.f[DIR_0M0])[ks]=f_S-c2o27*drho;
       }
 
       q = q_dirS[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_0P0])[kn]=f_N-c2o27*drho; 
+         (D.f[DIR_0P0])[kn]=f_N-c2o27*drho;
       }
 
       q = q_dirT[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_00M])[kb]=f_B-c2o27*drho; 
+         (D.f[DIR_00M])[kb]=f_B-c2o27*drho;
       }
 
       q = q_dirB[k];
@@ -2232,13 +2232,13 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
       q = q_dirTE[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_M0M])[kbw]=f_BW-c1o54*drho; 
+         (D.f[DIR_M0M])[kbw]=f_BW-c1o54*drho;
       }
 
       q = q_dirBW[k];
       if (q>=c0o1 && q<=c1o1)
       {
-         (D.f[DIR_P0P])[kte]=f_TE-c1o54*drho; 
+         (D.f[DIR_P0P])[kte]=f_TE-c1o54*drho;
       }
 
       q = q_dirBE[k];
@@ -2368,20 +2368,20 @@ __global__ void QPressDeviceAntiBB27(   real* rhoBC,
 
 //////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceFixBackflow27( real* rhoBC,
-                                                      real* DD, 
-                                                      int* k_Q, 
-                                                      int numberOfBCnodes, 
-                                                      real om1, 
+                                                      real* DD,
+                                                      int* k_Q,
+                                                      int numberOfBCnodes,
+                                                      real om1,
                                                       unsigned int* neighborX,
                                                       unsigned int* neighborY,
                                                       unsigned int* neighborZ,
-                                                      unsigned int size_Mat, 
+                                                      unsigned int size_Mat,
                                                       bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -2456,7 +2456,7 @@ __global__ void QPressDeviceFixBackflow27( real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -2559,20 +2559,20 @@ __global__ void QPressDeviceFixBackflow27( real* rhoBC,
 
 //////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceDirDepBot27(  real* rhoBC,
-                                                     real* DD, 
-                                                     int* k_Q, 
-                                                     int numberOfBCnodes, 
-                                                     real om1, 
+                                                     real* DD,
+                                                     int* k_Q,
+                                                     int numberOfBCnodes,
+                                                     real om1,
                                                      unsigned int* neighborX,
                                                      unsigned int* neighborY,
                                                      unsigned int* neighborZ,
-                                                     unsigned int size_Mat, 
+                                                     unsigned int size_Mat,
                                                      bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -2647,7 +2647,7 @@ __global__ void QPressDeviceDirDepBot27(  real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -2803,16 +2803,16 @@ __host__ __device__ real computeOutflowDistribution(const real* const &f, const
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressNoRhoDevice27( real* rhoBC,
-												 real* distributions, 
-												 int* k_Q, 
-												 int* k_N, 
-												 int numberOfBCnodes, 
-												 real om1, 
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int numberOfLBnodes, 
-												 bool isEvenTimestep,
+                                     real* distributions,
+                                     int* k_Q,
+                                     int* k_N,
+                                     int numberOfBCnodes,
+                                     real om1,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     unsigned int numberOfLBnodes,
+                                     bool isEvenTimestep,
                                      int direction)
 {
    ////////////////////////////////////////////////////////////////////////////////
@@ -2885,8 +2885,8 @@ __global__ void QPressNoRhoDevice27( real* rhoBC,
    unsigned int k1bsw = neighborZ[k1sw];
    ////////////////////////////////////////////////////////////////////////////////
    Distributions27 dist;
-   getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);      
-   real f[27], f1[27]; 
+   getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);
+   real f[27], f1[27];
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    f1[DIR_P00] = (dist.f[DIR_P00])[k1e   ];
    f1[DIR_M00] = (dist.f[DIR_M00])[k1w   ];
@@ -2986,9 +2986,9 @@ __global__ void QPressNoRhoDevice27( real* rhoBC,
          (dist.f[DIR_MPP])[ktnw ] = computeOutflowDistribution(f, f1, DIR_MPP, cs);
          (dist.f[DIR_PPM])[kbne ] = computeOutflowDistribution(f, f1, DIR_PPM, cs);
          (dist.f[DIR_MPM])[kbnw ] = computeOutflowDistribution(f, f1, DIR_MPM, cs);
-         break;  
+         break;
 
-      case ZPZ:   
+      case ZPZ:
          (dist.f[DIR_0M0])[ks   ] = computeOutflowDistribution(f, f1, DIR_0M0, cs);
          (dist.f[DIR_PM0])[kse  ] = computeOutflowDistribution(f, f1, DIR_PM0, cs);
          (dist.f[DIR_MM0])[ksw  ] = computeOutflowDistribution(f, f1, DIR_MM0, cs);
@@ -3009,7 +3009,7 @@ __global__ void QPressNoRhoDevice27( real* rhoBC,
          (dist.f[DIR_PPP])[ktne ] = computeOutflowDistribution(f, f1, DIR_PPP, cs);
          (dist.f[DIR_MPP])[ktnw ] = computeOutflowDistribution(f, f1, DIR_MPP, cs);
          (dist.f[DIR_PMP])[ktse ] = computeOutflowDistribution(f, f1, DIR_PMP, cs);
-         (dist.f[DIR_MMP])[ktsw ] = computeOutflowDistribution(f, f1, DIR_MMP, cs); 
+         (dist.f[DIR_MMP])[ktsw ] = computeOutflowDistribution(f, f1, DIR_MMP, cs);
          break;
 
       case ZZP:
@@ -3021,7 +3021,7 @@ __global__ void QPressNoRhoDevice27( real* rhoBC,
          (dist.f[DIR_PPM])[kbne ] = computeOutflowDistribution(f, f1, DIR_PPM, cs);
          (dist.f[DIR_MPM])[kbnw ] = computeOutflowDistribution(f, f1, DIR_MPM, cs);
          (dist.f[DIR_PMM])[kbse ] = computeOutflowDistribution(f, f1, DIR_PMM, cs);
-         (dist.f[DIR_MMM])[kbsw ] = computeOutflowDistribution(f, f1, DIR_MMM, cs);     
+         (dist.f[DIR_MMM])[kbsw ] = computeOutflowDistribution(f, f1, DIR_MMM, cs);
          break;
       default:
          break;
@@ -3036,22 +3036,22 @@ __host__ __device__ real computeOutflowDistribution(const real* const &f, const
 }
 
 __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
-												 real* distributions, 
-												 int* k_Q, 
-												 int* k_N, 
-												 int numberOfBCnodes, 
-												 real om1, 
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int numberOfLBnodes, 
-												 bool isEvenTimestep,
+                                     real* distributions,
+                                     int* k_Q,
+                                     int* k_N,
+                                     int numberOfBCnodes,
+                                     real om1,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     unsigned int numberOfLBnodes,
+                                     bool isEvenTimestep,
                                      int direction,
                                      real densityCorrectionFactor)
 {
    ////////////////////////////////////////////////////////////////////////////////
    const unsigned k = vf::gpu::getNodeIndex();
-   
+
    //////////////////////////////////////////////////////////////////////////
 
    if(k>=numberOfBCnodes) return;
@@ -3079,8 +3079,8 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
    uint kN_MMM = neighborZ[k_MM0];
    ////////////////////////////////////////////////////////////////////////////////
    Distributions27 dist;
-   getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);   
-   real f[27], fN[27];   
+   getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep);
+   real f[27], fN[27];
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    f[DIR_000] = (dist.f[DIR_000])[k_000];
    f[DIR_P00] = (dist.f[DIR_P00])[k_000];
@@ -3139,9 +3139,9 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
    fN[DIR_MMM] = (dist.f[DIR_MMM])[kN_MMM];
    //////////////////////////////////////////////////////////////////////////
    real drho = vf::lbm::getDensity(f);
-   
+
    real rhoCorrection = densityCorrectionFactor*drho;
-   
+
    real cs = c1o1 / sqrtf(c3o1);
 
    getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep);
@@ -3182,9 +3182,9 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
          (dist.f[DIR_MPP])[k_M00] = computeOutflowDistribution(f, fN, DIR_MPP, rhoCorrection, cs, c1o216);
          (dist.f[DIR_PPM])[k_00M] = computeOutflowDistribution(f, fN, DIR_PPM, rhoCorrection, cs, c1o216);
          (dist.f[DIR_MPM])[k_M0M] = computeOutflowDistribution(f, fN, DIR_MPM, rhoCorrection, cs, c1o216);
-         break;  
+         break;
 
-      case ZPZ:   
+      case ZPZ:
          (dist.f[DIR_0M0])[k_0M0] =computeOutflowDistribution(f, fN, DIR_0M0, rhoCorrection, cs, c2o27);
          (dist.f[DIR_PM0])[k_0M0] =computeOutflowDistribution(f, fN, DIR_PM0, rhoCorrection, cs, c1o54);
          (dist.f[DIR_MM0])[k_MM0] =computeOutflowDistribution(f, fN, DIR_MM0, rhoCorrection, cs, c1o54);
@@ -3205,7 +3205,7 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
          (dist.f[DIR_PPP])[k_000] = computeOutflowDistribution(f, fN, DIR_PPP, rhoCorrection, cs, c1o216);
          (dist.f[DIR_MPP])[k_M00] = computeOutflowDistribution(f, fN, DIR_MPP, rhoCorrection, cs, c1o216);
          (dist.f[DIR_PMP])[k_0M0] = computeOutflowDistribution(f, fN, DIR_PMP, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMP])[k_MM0] = computeOutflowDistribution(f, fN, DIR_MMP, rhoCorrection, cs, c1o216); 
+         (dist.f[DIR_MMP])[k_MM0] = computeOutflowDistribution(f, fN, DIR_MMP, rhoCorrection, cs, c1o216);
          break;
 
       case ZZP:
@@ -3217,7 +3217,7 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
          (dist.f[DIR_PPM])[k_00M] = computeOutflowDistribution(f, fN, DIR_PPM, rhoCorrection, cs, c1o216);
          (dist.f[DIR_MPM])[k_M0M] = computeOutflowDistribution(f, fN, DIR_MPM, rhoCorrection, cs, c1o216);
          (dist.f[DIR_PMM])[k_0MM] = computeOutflowDistribution(f, fN, DIR_PMM, rhoCorrection, cs, c1o216);
-         (dist.f[DIR_MMM])[k_MMM] = computeOutflowDistribution(f, fN, DIR_MMM, rhoCorrection, cs, c1o216);     
+         (dist.f[DIR_MMM])[k_MMM] = computeOutflowDistribution(f, fN, DIR_MMM, rhoCorrection, cs, c1o216);
          break;
       default:
          break;
@@ -3256,21 +3256,21 @@ __global__ void QPressZeroRhoOutflowDevice27(  real* rhoBC,
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceOld27(real* rhoBC,
-                                             real* DD, 
-                                             int* k_Q, 
-                                             int* k_N, 
-                                             int numberOfBCnodes, 
-                                             real om1, 
+                                             real* DD,
+                                             int* k_Q,
+                                             int* k_N,
+                                             int numberOfBCnodes,
+                                             real om1,
                                              unsigned int* neighborX,
                                              unsigned int* neighborY,
                                              unsigned int* neighborZ,
-                                             unsigned int size_Mat, 
+                                             unsigned int size_Mat,
                                              bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -3371,7 +3371,7 @@ __global__ void QPressDeviceOld27(real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -3438,8 +3438,8 @@ __global__ void QPressDeviceOld27(real* rhoBC,
       real drho1    =  f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+
                           f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW;
 
-	  //drho1 = (drho1 + rhoBC[k])/2.f;
-	  drho1 = drho1 - rhoBC[k];
+     //drho1 = (drho1 + rhoBC[k])/2.f;
+     drho1 = drho1 - rhoBC[k];
       //////////////////////////////////////////////////////////////////////////
 
       __syncthreads();
@@ -3470,7 +3470,7 @@ __global__ void QPressDeviceOld27(real* rhoBC,
       (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1;	//  c1o100;  // zero;  //
       (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1;	//  c1o100;  // zero;  //
       (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1;	//  c1o100;  // zero;  //
-      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;  //  c1o100;  // zero;  //      
+      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;  //  c1o100;  // zero;  //
    }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -3515,22 +3515,22 @@ __global__ void QPressDeviceOld27(real* rhoBC,
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceEQZ27(real* rhoBC,
-                                             real* DD, 
-                                             int* k_Q, 
+                                             real* DD,
+                                             int* k_Q,
                                              int* k_N,
-											 real* kTestRE,
-                                             int numberOfBCnodes, 
-                                             real om1, 
+                                  real* kTestRE,
+                                             int numberOfBCnodes,
+                                             real om1,
                                              unsigned int* neighborX,
                                              unsigned int* neighborY,
                                              unsigned int* neighborZ,
-                                             unsigned int size_Mat, 
+                                             unsigned int size_Mat,
                                              bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -3631,7 +3631,7 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -3755,17 +3755,17 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
 
    //   //////////////////////////////////////////////////////////////////////////
    //   real drho1    =  f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW;
-	  //real vx1      = (((f1_TNE-f1_BSW)+(f1_BSE-f1_TNW)+(f1_BNE-f1_TSW)+(f1_TSE-f1_BNW)) + (((f1_NE-f1_SW)+(f1_TE-f1_BW))+((f1_SE-f1_NW)+(f1_BE-f1_TW))) + (f1_E-f1_W)) / (one + drho1);
-	  //real vx2      = (((f1_TNE-f1_BSW)+(f1_TNW-f1_BSE)+(f1_BNE-f1_TSW)+(f1_BNW-f1_TSE)) + (((f1_NE-f1_SW)+(f1_TN-f1_BS))+((f1_BN-f1_TS)+(f1_NW-f1_SE))) + (f1_N-f1_S)) / (one + drho1);
-	  //real vx3      = (((f1_TNE-f1_BSW)+(f1_TNW-f1_BSE)+(f1_TSW-f1_BNE)+(f1_TSE-f1_BNW)) + (((f1_TE-f1_BW)+(f1_TN-f1_BS))+((f1_TW-f1_BE)+(f1_TS-f1_BN))) + (f1_T-f1_B)) / (one + drho1);
+     //real vx1      = (((f1_TNE-f1_BSW)+(f1_BSE-f1_TNW)+(f1_BNE-f1_TSW)+(f1_TSE-f1_BNW)) + (((f1_NE-f1_SW)+(f1_TE-f1_BW))+((f1_SE-f1_NW)+(f1_BE-f1_TW))) + (f1_E-f1_W)) / (one + drho1);
+     //real vx2      = (((f1_TNE-f1_BSW)+(f1_TNW-f1_BSE)+(f1_BNE-f1_TSW)+(f1_BNW-f1_TSE)) + (((f1_NE-f1_SW)+(f1_TN-f1_BS))+((f1_BN-f1_TS)+(f1_NW-f1_SE))) + (f1_N-f1_S)) / (one + drho1);
+     //real vx3      = (((f1_TNE-f1_BSW)+(f1_TNW-f1_BSE)+(f1_TSW-f1_BNE)+(f1_TSE-f1_BNW)) + (((f1_TE-f1_BW)+(f1_TN-f1_BS))+((f1_TW-f1_BE)+(f1_TS-f1_BN))) + (f1_T-f1_B)) / (one + drho1);
    //   //////////////////////////////////////////////////////////////////////////
-	  ////real omega = om1;
+     ////real omega = om1;
    //   real cusq  = c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
    //   //////////////////////////////////////////////////////////////////////////
-	  ////T�st MK
-	  ////if(vx1 < zero) vx1 = zero;
+     ////T�st MK
+     ////if(vx1 < zero) vx1 = zero;
    //   //////////////////////////////////////////////////////////////////////////
-	  ////becomes higher with neighbor source and lower with local source
+     ////becomes higher with neighbor source and lower with local source
    //   //real fZERO = c8over27*  (rhoBC[k]-(one + rhoBC[k])*(cusq))                                                           ;
    //   //real fE    = c2over27*  (rhoBC[k]+(one + rhoBC[k])*(three*( vx1        )+c9over2*( vx1        )*( vx1        )-cusq));
    //   //real fW    = c2over27*  (rhoBC[k]+(one + rhoBC[k])*(three*(-vx1        )+c9over2*(-vx1        )*(-vx1        )-cusq));
@@ -3794,7 +3794,7 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
    //   //real fBSE  = c1over216* (rhoBC[k]+(one + rhoBC[k])*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq));
    //   //real fTNW  = c1over216* (rhoBC[k]+(one + rhoBC[k])*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq));
    //   //////////////////////////////////////////////////////////////////////////
-	  //// based on VirtualFluids (kucher + fard)
+     //// based on VirtualFluids (kucher + fard)
    //   real fZERO = c8over27  * rhoBC[k] * (one                                                                      - cusq);
    //   real fE    = c2over27  * rhoBC[k] * (one + three * ( vx1        ) + c9over2 * ( vx1        ) * ( vx1        ) - cusq);
    //   real fW    = c2over27  * rhoBC[k] * (one + three * (-vx1        ) + c9over2 * (-vx1        ) * (-vx1        ) - cusq);
@@ -3823,7 +3823,7 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
    //   real fBSE  = c1over216 * rhoBC[k] * (one + three * ( vx1-vx2-vx3) + c9over2 * ( vx1-vx2-vx3) * ( vx1-vx2-vx3) - cusq);
    //   real fTNW  = c1over216 * rhoBC[k] * (one + three * (-vx1+vx2+vx3) + c9over2 * (-vx1+vx2+vx3) * (-vx1+vx2+vx3) - cusq);
    ////   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  //////test
+     //////test
    ////   real fZERO = c8over27  * ((drho1 + rhoBC[k]) / two) * (one                                                                      - cusq);
    ////   real fE    = c2over27  * ((drho1 + rhoBC[k]) / two) * (one + three * ( vx1        ) + c9over2 * ( vx1        ) * ( vx1        ) - cusq);
    ////   real fW    = c2over27  * ((drho1 + rhoBC[k]) / two) * (one + three * (-vx1        ) + c9over2 * (-vx1        ) * (-vx1        ) - cusq);
@@ -3852,190 +3852,190 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
    ////   real fBSE  = c1over216 * ((drho1 + rhoBC[k]) / two) * (one + three * ( vx1-vx2-vx3) + c9over2 * ( vx1-vx2-vx3) * ( vx1-vx2-vx3) - cusq);
    ////   real fTNW  = c1over216 * ((drho1 + rhoBC[k]) / two) * (one + three * (-vx1+vx2+vx3) + c9over2 * (-vx1+vx2+vx3) * (-vx1+vx2+vx3) - cusq);
 
-			//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             // based on BGK Plus Comp
-			//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-			//double mfabb = (D.f[DIR_P00   ])[k1e   ];
-			//double mfcbb = (D.f[DIR_M00   ])[k1w   ];
-			//double mfbab = (D.f[DIR_0P0   ])[k1n   ];
-			//double mfbcb = (D.f[DIR_0M0   ])[k1s   ];
-			//double mfbba = (D.f[DIR_00P   ])[k1t   ];
-			//double mfbbc = (D.f[DIR_00M   ])[k1b   ];
-			//double mfaab = (D.f[DIR_PP0  ])[k1ne  ];
-			//double mfccb = (D.f[DIR_MM0  ])[k1sw  ];
-			//double mfacb = (D.f[DIR_PM0  ])[k1se  ];
-			//double mfcab = (D.f[DIR_MP0  ])[k1nw  ];
-			//double mfaba = (D.f[DIR_P0P  ])[k1te  ];
-			//double mfcbc = (D.f[DIR_M0M  ])[k1bw  ];
-			//double mfabc = (D.f[DIR_P0M  ])[k1be  ];
-			//double mfcba = (D.f[DIR_M0P  ])[k1tw  ];
-			//double mfbaa = (D.f[DIR_0PP  ])[k1tn  ];
-			//double mfbcc = (D.f[DIR_0MM  ])[k1bs  ];
-			//double mfbac = (D.f[DIR_0PM  ])[k1bn  ];
-			//double mfbca = (D.f[DIR_0MP  ])[k1ts  ];
-			//double mfbbb = (D.f[DIR_000])[k1zero];
-			//double mfaaa = (D.f[DIR_PPP ])[k1tne ];
-			//double mfcca = (D.f[DIR_MMP ])[k1tsw ];
-			//double mfaca = (D.f[DIR_PMP ])[k1tse ];
-			//double mfcaa = (D.f[DIR_MPP ])[k1tnw ];
-			//double mfaac = (D.f[DIR_PPM ])[k1bne ];
-			//double mfccc = (D.f[DIR_MMM ])[k1bsw ];
-			//double mfacc = (D.f[DIR_PMM ])[k1bse ];
-			//double mfcac = (D.f[DIR_MPM ])[k1bnw ];
-			real mfabb = (D.f[DIR_P00   ])[k1e   ];
-			real mfcbb = (D.f[DIR_M00   ])[k1w   ];
-			real mfbab = (D.f[DIR_0P0   ])[k1n   ];
-			real mfbcb = (D.f[DIR_0M0   ])[k1s   ];
-			real mfbba = (D.f[DIR_00P   ])[k1t   ];
-			real mfbbc = (D.f[DIR_00M   ])[k1b   ];
-			real mfaab = (D.f[DIR_PP0  ])[k1ne  ];
-			real mfccb = (D.f[DIR_MM0  ])[k1sw  ];
-			real mfacb = (D.f[DIR_PM0  ])[k1se  ];
-			real mfcab = (D.f[DIR_MP0  ])[k1nw  ];
-			real mfaba = (D.f[DIR_P0P  ])[k1te  ];
-			real mfcbc = (D.f[DIR_M0M  ])[k1bw  ];
-			real mfabc = (D.f[DIR_P0M  ])[k1be  ];
-			real mfcba = (D.f[DIR_M0P  ])[k1tw  ];
-			real mfbaa = (D.f[DIR_0PP  ])[k1tn  ];
-			real mfbcc = (D.f[DIR_0MM  ])[k1bs  ];
-			real mfbac = (D.f[DIR_0PM  ])[k1bn  ];
-			real mfbca = (D.f[DIR_0MP  ])[k1ts  ];
-			real mfbbb = (D.f[DIR_000])[k1zero];
-			real mfaaa = (D.f[DIR_PPP ])[k1tne ];
-			real mfcca = (D.f[DIR_MMP ])[k1tsw ];
-			real mfaca = (D.f[DIR_PMP ])[k1tse ];
-			real mfcaa = (D.f[DIR_MPP ])[k1tnw ];
-			real mfaac = (D.f[DIR_PPM ])[k1bne ];
-			real mfccc = (D.f[DIR_MMM ])[k1bsw ];
-			real mfacc = (D.f[DIR_PMM ])[k1bse ];
-			real mfcac = (D.f[DIR_MPM ])[k1bnw ];
-
-			//real mfcbb = (D.f[DIR_P00   ])[ke   ];
-			//real mfabb = (D.f[DIR_M00   ])[kw   ];
-			//real mfbcb = (D.f[DIR_0P0   ])[kn   ];
-			//real mfbab = (D.f[DIR_0M0   ])[ks   ];
-			//real mfbbc = (D.f[DIR_00P   ])[kt   ];
-			//real mfbba = (D.f[DIR_00M   ])[kb   ];
-			//real mfccb = (D.f[DIR_PP0  ])[kne  ];
-			//real mfaab = (D.f[DIR_MM0  ])[ksw  ];
-			//real mfcab = (D.f[DIR_PM0  ])[kse  ];
-			//real mfacb = (D.f[DIR_MP0  ])[knw  ];
-			//real mfcbc = (D.f[DIR_P0P  ])[kte  ];
-			//real mfaba = (D.f[DIR_M0M  ])[kbw  ];
-			//real mfcba = (D.f[DIR_P0M  ])[kbe  ];
-			//real mfabc = (D.f[DIR_M0P  ])[ktw  ];
-			//real mfbcc = (D.f[DIR_0PP  ])[ktn  ];
-			//real mfbaa = (D.f[DIR_0MM  ])[kbs  ];
-			//real mfbca = (D.f[DIR_0PM  ])[kbn  ];
-			//real mfbac = (D.f[DIR_0MP  ])[kts  ];
-			//real mfbbb = (D.f[DIR_000])[kzero];
-			//real mfccc = (D.f[DIR_PPP ])[ktne ];
-			//real mfaac = (D.f[DIR_MMP ])[ktsw ];
-			//real mfcac = (D.f[DIR_PMP ])[ktse ];
-			//real mfacc = (D.f[DIR_MPP ])[ktnw ];
-			//real mfcca = (D.f[DIR_PPM ])[kbne ];
-			//real mfaaa = (D.f[DIR_MMM ])[kbsw ];
-			//real mfcaa = (D.f[DIR_PMM ])[kbse ];
-			//real mfaca = (D.f[DIR_MPM ])[kbnw ];
-			////////////////////////////////////////////////////////////////////////////////////
-			//real rho   = (((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + 
-			//				(((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) +
-			//				((mfabb+mfcbb) + (mfbab+mfbcb)) + (mfbba+mfbbc)) + mfbbb) + one;//!!!!Achtung + one
-			////////////////////////////////////////////////////////////////////////////////////
-			real rho = rhoBC[k];
-			////////////////////////////////////////////////////////////////////////////////////
-			real OoRho = c1o1 / (rho * 1.5f);
-			////////////////////////////////////////////////////////////////////////////////////
-			real vvx    = ((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) + 
-						     (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) +
-						       (mfcbb-mfabb)) * OoRho;
-			real vvy    =((((mfccc-mfaaa) + (mfaca-mfcac)) + ((mfacc-mfcaa) + (mfcca-mfaac))) + 
-				             (((mfbca-mfbac) + (mfbcc-mfbaa)) + ((mfacb-mfcab) + (mfccb-mfaab))) +
-				               (mfbcb-mfbab)) * OoRho;
-			real vvz    =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfacc-mfcaa) + (mfaac-mfcca))) + 
-				             (((mfbac-mfbca) + (mfbcc-mfbaa)) + ((mfabc-mfcba) + (mfcbc-mfaba))) +
-				               (mfbbc-mfbba)) * OoRho;
-			/////////////////////////
-			//Test Values
-			//double vvx    = 0.016;
-			//double vvy    = zero;
-			//double vvz    = zero;
-			////////////////////////////////////////////////////////////////////////////////////////
-			////round off error test
-			//if(vvx!=zero){
-			//	(kDistTest.f[DIR_P00   ])[k] = mfabb;
-			//	(kDistTest.f[DIR_M00   ])[k] = mfcbb;
-			//	(kDistTest.f[DIR_0P0   ])[k] = mfbab;
-			//	(kDistTest.f[DIR_0M0   ])[k] = mfbcb;
-			//	(kDistTest.f[DIR_00P   ])[k] = mfbba;
-			//	(kDistTest.f[DIR_00M   ])[k] = mfbbc;
-			//	(kDistTest.f[DIR_PP0  ])[k] = mfaab;
-			//	(kDistTest.f[DIR_MM0  ])[k] = mfccb;
-			//	(kDistTest.f[DIR_PM0  ])[k] = mfacb;
-			//	(kDistTest.f[DIR_MP0  ])[k] = mfcab;
-			//	(kDistTest.f[DIR_P0P  ])[k] = mfaba;
-			//	(kDistTest.f[DIR_M0M  ])[k] = mfcbc;
-			//	(kDistTest.f[DIR_P0M  ])[k] = mfabc;
-			//	(kDistTest.f[DIR_M0P  ])[k] = mfcba;
-			//	(kDistTest.f[DIR_0PP  ])[k] = mfbaa;
-			//	(kDistTest.f[DIR_0MM  ])[k] = mfbcc;
-			//	(kDistTest.f[DIR_0PM  ])[k] = mfbac;
-			//	(kDistTest.f[DIR_0MP  ])[k] = mfbca;
-			//	(kDistTest.f[DIR_000])[k] = KQK;
-			//	(kDistTest.f[DIR_PPP ])[k] = mfaaa;
-			//	(kDistTest.f[DIR_MMP ])[k] = mfcca;
-			//	(kDistTest.f[DIR_PMP ])[k] = mfaca;
-			//	(kDistTest.f[DIR_MPP ])[k] = mfcaa;
-			//	(kDistTest.f[DIR_PPM ])[k] = mfaac;
-			//	(kDistTest.f[DIR_MMM ])[k] = mfccc;
-			//	(kDistTest.f[DIR_PMM ])[k] = mfacc;
-			//	(kDistTest.f[DIR_MPM ])[k] = mfcac;
-			//}else{
-			//	(kDistTest.f[DIR_P00   ])[k] = zero;
-			//	(kDistTest.f[DIR_M00   ])[k] = zero;
-			//	(kDistTest.f[DIR_0P0   ])[k] = zero;
-			//	(kDistTest.f[DIR_0M0   ])[k] = zero;
-			//	(kDistTest.f[DIR_00P   ])[k] = zero;
-			//	(kDistTest.f[DIR_00M   ])[k] = zero;
-			//	(kDistTest.f[DIR_PP0  ])[k] = zero;
-			//	(kDistTest.f[DIR_MM0  ])[k] = zero;
-			//	(kDistTest.f[DIR_PM0  ])[k] = zero;
-			//	(kDistTest.f[DIR_MP0  ])[k] = zero;
-			//	(kDistTest.f[DIR_P0P  ])[k] = zero;
-			//	(kDistTest.f[DIR_M0M  ])[k] = zero;
-			//	(kDistTest.f[DIR_P0M  ])[k] = zero;
-			//	(kDistTest.f[DIR_M0P  ])[k] = zero;
-			//	(kDistTest.f[DIR_0PP  ])[k] = zero;
-			//	(kDistTest.f[DIR_0MM  ])[k] = zero;
-			//	(kDistTest.f[DIR_0PM  ])[k] = zero;
-			//	(kDistTest.f[DIR_0MP  ])[k] = zero;
-			//	(kDistTest.f[DIR_000])[k] = zero;
-			//	(kDistTest.f[DIR_PPP ])[k] = zero;
-			//	(kDistTest.f[DIR_MMP ])[k] = zero;
-			//	(kDistTest.f[DIR_PMP ])[k] = zero;
-			//	(kDistTest.f[DIR_MPP ])[k] = zero;
-			//	(kDistTest.f[DIR_PPM ])[k] = zero;
-			//	(kDistTest.f[DIR_MMM ])[k] = zero;
-			//	(kDistTest.f[DIR_PMM ])[k] = zero;
-			//	(kDistTest.f[DIR_MPM ])[k] = zero;
-			//}
-
-			//////////////////////////////////////////////////////////////////////////////////////
-			//// first bad fix for negative x velocity
-			////if(vvx > zero) vvx = zero;
-			//////////////////////////////////////////////////////////////////////////////////////
-			////// second bad fix for negative x velocity
-			////if(vvx > zero){
-			////	vvx = -vvx;
-			////	vvy = -vvy;
-			////	vvz = -vvz;
-			////}
-			////////////////////////////////////////////////////////////////////////////////////
-			double vx2    = vvx * vvx;
-			double vy2    = vvy * vvy;
-			double vz2    = vvz * vvz;
-			//////////////////////////////////////////////////////////////////////////////////
-			//original
+         //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+         //double mfabb = (D.f[DIR_P00   ])[k1e   ];
+         //double mfcbb = (D.f[DIR_M00   ])[k1w   ];
+         //double mfbab = (D.f[DIR_0P0   ])[k1n   ];
+         //double mfbcb = (D.f[DIR_0M0   ])[k1s   ];
+         //double mfbba = (D.f[DIR_00P   ])[k1t   ];
+         //double mfbbc = (D.f[DIR_00M   ])[k1b   ];
+         //double mfaab = (D.f[DIR_PP0  ])[k1ne  ];
+         //double mfccb = (D.f[DIR_MM0  ])[k1sw  ];
+         //double mfacb = (D.f[DIR_PM0  ])[k1se  ];
+         //double mfcab = (D.f[DIR_MP0  ])[k1nw  ];
+         //double mfaba = (D.f[DIR_P0P  ])[k1te  ];
+         //double mfcbc = (D.f[DIR_M0M  ])[k1bw  ];
+         //double mfabc = (D.f[DIR_P0M  ])[k1be  ];
+         //double mfcba = (D.f[DIR_M0P  ])[k1tw  ];
+         //double mfbaa = (D.f[DIR_0PP  ])[k1tn  ];
+         //double mfbcc = (D.f[DIR_0MM  ])[k1bs  ];
+         //double mfbac = (D.f[DIR_0PM  ])[k1bn  ];
+         //double mfbca = (D.f[DIR_0MP  ])[k1ts  ];
+         //double mfbbb = (D.f[DIR_000])[k1zero];
+         //double mfaaa = (D.f[DIR_PPP ])[k1tne ];
+         //double mfcca = (D.f[DIR_MMP ])[k1tsw ];
+         //double mfaca = (D.f[DIR_PMP ])[k1tse ];
+         //double mfcaa = (D.f[DIR_MPP ])[k1tnw ];
+         //double mfaac = (D.f[DIR_PPM ])[k1bne ];
+         //double mfccc = (D.f[DIR_MMM ])[k1bsw ];
+         //double mfacc = (D.f[DIR_PMM ])[k1bse ];
+         //double mfcac = (D.f[DIR_MPM ])[k1bnw ];
+         real mfabb = (D.f[DIR_P00   ])[k1e   ];
+         real mfcbb = (D.f[DIR_M00   ])[k1w   ];
+         real mfbab = (D.f[DIR_0P0   ])[k1n   ];
+         real mfbcb = (D.f[DIR_0M0   ])[k1s   ];
+         real mfbba = (D.f[DIR_00P   ])[k1t   ];
+         real mfbbc = (D.f[DIR_00M   ])[k1b   ];
+         real mfaab = (D.f[DIR_PP0  ])[k1ne  ];
+         real mfccb = (D.f[DIR_MM0  ])[k1sw  ];
+         real mfacb = (D.f[DIR_PM0  ])[k1se  ];
+         real mfcab = (D.f[DIR_MP0  ])[k1nw  ];
+         real mfaba = (D.f[DIR_P0P  ])[k1te  ];
+         real mfcbc = (D.f[DIR_M0M  ])[k1bw  ];
+         real mfabc = (D.f[DIR_P0M  ])[k1be  ];
+         real mfcba = (D.f[DIR_M0P  ])[k1tw  ];
+         real mfbaa = (D.f[DIR_0PP  ])[k1tn  ];
+         real mfbcc = (D.f[DIR_0MM  ])[k1bs  ];
+         real mfbac = (D.f[DIR_0PM  ])[k1bn  ];
+         real mfbca = (D.f[DIR_0MP  ])[k1ts  ];
+         real mfbbb = (D.f[DIR_000])[k1zero];
+         real mfaaa = (D.f[DIR_PPP ])[k1tne ];
+         real mfcca = (D.f[DIR_MMP ])[k1tsw ];
+         real mfaca = (D.f[DIR_PMP ])[k1tse ];
+         real mfcaa = (D.f[DIR_MPP ])[k1tnw ];
+         real mfaac = (D.f[DIR_PPM ])[k1bne ];
+         real mfccc = (D.f[DIR_MMM ])[k1bsw ];
+         real mfacc = (D.f[DIR_PMM ])[k1bse ];
+         real mfcac = (D.f[DIR_MPM ])[k1bnw ];
+
+         //real mfcbb = (D.f[DIR_P00   ])[ke   ];
+         //real mfabb = (D.f[DIR_M00   ])[kw   ];
+         //real mfbcb = (D.f[DIR_0P0   ])[kn   ];
+         //real mfbab = (D.f[DIR_0M0   ])[ks   ];
+         //real mfbbc = (D.f[DIR_00P   ])[kt   ];
+         //real mfbba = (D.f[DIR_00M   ])[kb   ];
+         //real mfccb = (D.f[DIR_PP0  ])[kne  ];
+         //real mfaab = (D.f[DIR_MM0  ])[ksw  ];
+         //real mfcab = (D.f[DIR_PM0  ])[kse  ];
+         //real mfacb = (D.f[DIR_MP0  ])[knw  ];
+         //real mfcbc = (D.f[DIR_P0P  ])[kte  ];
+         //real mfaba = (D.f[DIR_M0M  ])[kbw  ];
+         //real mfcba = (D.f[DIR_P0M  ])[kbe  ];
+         //real mfabc = (D.f[DIR_M0P  ])[ktw  ];
+         //real mfbcc = (D.f[DIR_0PP  ])[ktn  ];
+         //real mfbaa = (D.f[DIR_0MM  ])[kbs  ];
+         //real mfbca = (D.f[DIR_0PM  ])[kbn  ];
+         //real mfbac = (D.f[DIR_0MP  ])[kts  ];
+         //real mfbbb = (D.f[DIR_000])[kzero];
+         //real mfccc = (D.f[DIR_PPP ])[ktne ];
+         //real mfaac = (D.f[DIR_MMP ])[ktsw ];
+         //real mfcac = (D.f[DIR_PMP ])[ktse ];
+         //real mfacc = (D.f[DIR_MPP ])[ktnw ];
+         //real mfcca = (D.f[DIR_PPM ])[kbne ];
+         //real mfaaa = (D.f[DIR_MMM ])[kbsw ];
+         //real mfcaa = (D.f[DIR_PMM ])[kbse ];
+         //real mfaca = (D.f[DIR_MPM ])[kbnw ];
+         ////////////////////////////////////////////////////////////////////////////////////
+         //real rho   = (((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) +
+         //				(((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) +
+         //				((mfabb+mfcbb) + (mfbab+mfbcb)) + (mfbba+mfbbc)) + mfbbb) + one;//!!!!Achtung + one
+         ////////////////////////////////////////////////////////////////////////////////////
+         real rho = rhoBC[k];
+         ////////////////////////////////////////////////////////////////////////////////////
+         real OoRho = c1o1 / (rho * 1.5f);
+         ////////////////////////////////////////////////////////////////////////////////////
+         real vvx    = ((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) +
+                       (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) +
+                         (mfcbb-mfabb)) * OoRho;
+         real vvy    =((((mfccc-mfaaa) + (mfaca-mfcac)) + ((mfacc-mfcaa) + (mfcca-mfaac))) +
+                         (((mfbca-mfbac) + (mfbcc-mfbaa)) + ((mfacb-mfcab) + (mfccb-mfaab))) +
+                           (mfbcb-mfbab)) * OoRho;
+         real vvz    =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfacc-mfcaa) + (mfaac-mfcca))) +
+                         (((mfbac-mfbca) + (mfbcc-mfbaa)) + ((mfabc-mfcba) + (mfcbc-mfaba))) +
+                           (mfbbc-mfbba)) * OoRho;
+         /////////////////////////
+         //Test Values
+         //double vvx    = 0.016;
+         //double vvy    = zero;
+         //double vvz    = zero;
+         ////////////////////////////////////////////////////////////////////////////////////////
+         ////round off error test
+         //if(vvx!=zero){
+         //	(kDistTest.f[DIR_P00   ])[k] = mfabb;
+         //	(kDistTest.f[DIR_M00   ])[k] = mfcbb;
+         //	(kDistTest.f[DIR_0P0   ])[k] = mfbab;
+         //	(kDistTest.f[DIR_0M0   ])[k] = mfbcb;
+         //	(kDistTest.f[DIR_00P   ])[k] = mfbba;
+         //	(kDistTest.f[DIR_00M   ])[k] = mfbbc;
+         //	(kDistTest.f[DIR_PP0  ])[k] = mfaab;
+         //	(kDistTest.f[DIR_MM0  ])[k] = mfccb;
+         //	(kDistTest.f[DIR_PM0  ])[k] = mfacb;
+         //	(kDistTest.f[DIR_MP0  ])[k] = mfcab;
+         //	(kDistTest.f[DIR_P0P  ])[k] = mfaba;
+         //	(kDistTest.f[DIR_M0M  ])[k] = mfcbc;
+         //	(kDistTest.f[DIR_P0M  ])[k] = mfabc;
+         //	(kDistTest.f[DIR_M0P  ])[k] = mfcba;
+         //	(kDistTest.f[DIR_0PP  ])[k] = mfbaa;
+         //	(kDistTest.f[DIR_0MM  ])[k] = mfbcc;
+         //	(kDistTest.f[DIR_0PM  ])[k] = mfbac;
+         //	(kDistTest.f[DIR_0MP  ])[k] = mfbca;
+         //	(kDistTest.f[DIR_000])[k] = KQK;
+         //	(kDistTest.f[DIR_PPP ])[k] = mfaaa;
+         //	(kDistTest.f[DIR_MMP ])[k] = mfcca;
+         //	(kDistTest.f[DIR_PMP ])[k] = mfaca;
+         //	(kDistTest.f[DIR_MPP ])[k] = mfcaa;
+         //	(kDistTest.f[DIR_PPM ])[k] = mfaac;
+         //	(kDistTest.f[DIR_MMM ])[k] = mfccc;
+         //	(kDistTest.f[DIR_PMM ])[k] = mfacc;
+         //	(kDistTest.f[DIR_MPM ])[k] = mfcac;
+         //}else{
+         //	(kDistTest.f[DIR_P00   ])[k] = zero;
+         //	(kDistTest.f[DIR_M00   ])[k] = zero;
+         //	(kDistTest.f[DIR_0P0   ])[k] = zero;
+         //	(kDistTest.f[DIR_0M0   ])[k] = zero;
+         //	(kDistTest.f[DIR_00P   ])[k] = zero;
+         //	(kDistTest.f[DIR_00M   ])[k] = zero;
+         //	(kDistTest.f[DIR_PP0  ])[k] = zero;
+         //	(kDistTest.f[DIR_MM0  ])[k] = zero;
+         //	(kDistTest.f[DIR_PM0  ])[k] = zero;
+         //	(kDistTest.f[DIR_MP0  ])[k] = zero;
+         //	(kDistTest.f[DIR_P0P  ])[k] = zero;
+         //	(kDistTest.f[DIR_M0M  ])[k] = zero;
+         //	(kDistTest.f[DIR_P0M  ])[k] = zero;
+         //	(kDistTest.f[DIR_M0P  ])[k] = zero;
+         //	(kDistTest.f[DIR_0PP  ])[k] = zero;
+         //	(kDistTest.f[DIR_0MM  ])[k] = zero;
+         //	(kDistTest.f[DIR_0PM  ])[k] = zero;
+         //	(kDistTest.f[DIR_0MP  ])[k] = zero;
+         //	(kDistTest.f[DIR_000])[k] = zero;
+         //	(kDistTest.f[DIR_PPP ])[k] = zero;
+         //	(kDistTest.f[DIR_MMP ])[k] = zero;
+         //	(kDistTest.f[DIR_PMP ])[k] = zero;
+         //	(kDistTest.f[DIR_MPP ])[k] = zero;
+         //	(kDistTest.f[DIR_PPM ])[k] = zero;
+         //	(kDistTest.f[DIR_MMM ])[k] = zero;
+         //	(kDistTest.f[DIR_PMM ])[k] = zero;
+         //	(kDistTest.f[DIR_MPM ])[k] = zero;
+         //}
+
+         //////////////////////////////////////////////////////////////////////////////////////
+         //// first bad fix for negative x velocity
+         ////if(vvx > zero) vvx = zero;
+         //////////////////////////////////////////////////////////////////////////////////////
+         ////// second bad fix for negative x velocity
+         ////if(vvx > zero){
+         ////	vvx = -vvx;
+         ////	vvy = -vvy;
+         ////	vvz = -vvz;
+         ////}
+         ////////////////////////////////////////////////////////////////////////////////////
+         double vx2    = vvx * vvx;
+         double vy2    = vvy * vvy;
+         double vz2    = vvz * vvz;
+         //////////////////////////////////////////////////////////////////////////////////
+         //original
             real XXb    = -c2o3 + vx2;
             real XXc    = -c1o2 * (XXb + c1o1 + vvx);
             real XXa    = XXc + vvx;
@@ -4045,66 +4045,66 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
             real ZZb    = -c2o3 + vz2;
             real ZZc    = -c1o2 * (ZZb + c1o1 + vvz);
             real ZZa    = ZZc + vvz;
-			//////////////////////////////////////////////////////////////////////////////////
-			//unkonditioniert
-            mfcbb = -(rhoBC[k] + c1o1) * XXc * YYb * ZZb - c2o27; 
-			mfabb = -(rhoBC[k] + c1o1) * XXa * YYb * ZZb - c2o27;
-			mfbcb = -(rhoBC[k] + c1o1) * XXb * YYc * ZZb - c2o27;
-			mfbab = -(rhoBC[k] + c1o1) * XXb * YYa * ZZb - c2o27;
-			mfbbc = -(rhoBC[k] + c1o1) * XXb * YYb * ZZc - c2o27;
-			mfbba = -(rhoBC[k] + c1o1) * XXb * YYb * ZZa - c2o27;
-			mfccb = -(rhoBC[k] + c1o1) * XXc * YYc * ZZb - c1o54;
-			mfaab = -(rhoBC[k] + c1o1) * XXa * YYa * ZZb - c1o54;
-			mfcab = -(rhoBC[k] + c1o1) * XXc * YYa * ZZb - c1o54;
-			mfacb = -(rhoBC[k] + c1o1) * XXa * YYc * ZZb - c1o54;
-			mfcbc = -(rhoBC[k] + c1o1) * XXc * YYb * ZZc - c1o54;
-			mfaba = -(rhoBC[k] + c1o1) * XXa * YYb * ZZa - c1o54;
-			mfcba = -(rhoBC[k] + c1o1) * XXc * YYb * ZZa - c1o54;
-			mfabc = -(rhoBC[k] + c1o1) * XXa * YYb * ZZc - c1o54;
-			mfbcc = -(rhoBC[k] + c1o1) * XXb * YYc * ZZc - c1o54;
-			mfbaa = -(rhoBC[k] + c1o1) * XXb * YYa * ZZa - c1o54;
-			mfbca = -(rhoBC[k] + c1o1) * XXb * YYc * ZZa - c1o54;
-			mfbac = -(rhoBC[k] + c1o1) * XXb * YYa * ZZc - c1o54;
-			mfbbb = -(rhoBC[k] + c1o1) * XXb * YYb * ZZb - c8o27;
-			mfccc = -(rhoBC[k] + c1o1) * XXc * YYc * ZZc - c1o216;
-			mfaac = -(rhoBC[k] + c1o1) * XXa * YYa * ZZc - c1o216;
-			mfcac = -(rhoBC[k] + c1o1) * XXc * YYa * ZZc - c1o216;
-			mfacc = -(rhoBC[k] + c1o1) * XXa * YYc * ZZc - c1o216;
-			mfcca = -(rhoBC[k] + c1o1) * XXc * YYc * ZZa - c1o216;
-			mfaaa = -(rhoBC[k] + c1o1) * XXa * YYa * ZZa - c1o216;
-			mfcaa = -(rhoBC[k] + c1o1) * XXc * YYa * ZZa - c1o216;
-			mfaca = -(rhoBC[k] + c1o1) * XXa * YYc * ZZa - c1o216;
-			//////////////////////////////////////////////////////////
-			////konditioniert
-			//double OneOver216RhoPlusOne = c1over216*(rhoBC[k]+one);
-			//double OnoOver216Rho        = c1over216*rhoBC[k];
-			//mfcbb = OnoOver216Rho*sixteen + OneOver216RhoPlusOne*twelve*(-(two*vy2) - two*vz2 + three*vy2*vz2 + vvx*(-two + three*vy2)*(-two + three*vz2) + vx2*(-two + three*vy2)*(-two + three*vz2));
-			//mfabb = OnoOver216Rho*sixteen - OneOver216RhoPlusOne*twelve*(two*vy2 + two*vz2 - three*vy2*vz2 + vvx*(-two + three*vy2)*(-two + three*vz2) + vx2*(-four + six*vy2 + six*vz2 - nine*vy2*vz2));
-			//mfbcb = four*(-(four*OneOver216RhoPlusOne) + four*OnoOver216Rho + OneOver216RhoPlusOne*(-two + three*vx2)*(one + three*vvy + three*vy2)*(-two + three*vz2));
-			//mfbab = four*(four*OnoOver216Rho - OneOver216RhoPlusOne*three*(vvy*(-two + three*vx2)*(-two + three*vz2) - one*vx2*(one + three*vy2)*(-two + three*vz2) + two*(-(two*vy2) + vz2 + three*vy2*vz2)));
-			//mfbbc = four*(-(four*OneOver216RhoPlusOne) + four*OnoOver216Rho + OneOver216RhoPlusOne*(-two + three*vx2)*(-two + three*vy2)*(one + three*vvz + three*vz2));
-			//mfbba = four*(four*OnoOver216Rho - OneOver216RhoPlusOne*three*(vvz*(-two + three*vx2)*(-two + three*vy2) - one*vx2*(-two + three*vy2)*(one + three*vz2) + two*(vy2 - two*vz2 + three*vy2*vz2)));
-			//mfccb = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) - two*vy2 - six*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(one + three*vvy + three*vy2)*(-two + three*vz2))));
-			//mfaab = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) - two*vy2 - six*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-two + three*vz2))));
-			//mfcab = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 + two*vy2 + six*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-two + three*vz2)));
-			//mfacb = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 + two*vy2 + six*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(one + three*vvy + three*vy2)*(-two + three*vz2)));
-			//mfcbc = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) + vy2 + three*vx2*vy2 + vvz*(one + three*vx2)*(-two + three*vy2) - two*vz2 - six*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(one + three*vvz + three*vz2))));
-			//mfaba = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) + vy2 + three*vx2*vy2 - one*vvz*(one + three*vx2)*(-two + three*vy2) - two*vz2 - six*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(-one + three*vvz - three*vz2))));
-			//mfcba = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 - one*vy2 - three*vx2*vy2 + vvz*(one + three*vx2)*(-two + three*vy2) + two*vz2 + six*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(-one + three*vvz - three*vz2)));
-			//mfabc = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 - one*vy2 - three*vx2*vy2 - one*vvz*(one + three*vx2)*(-two + three*vy2) + two*vz2 + six*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(one + three*vvz + three*vz2)));
-			//mfbcc = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(vx2 - two*vy2 + three*vx2*vy2 + vvz*(-two + three*vx2)*(one + three*vy2) - two*vz2 + three*vx2*vz2 - six*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(one + three*vvz + three*vz2))));
-			//mfbaa = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(vx2 - two*vy2 + three*vx2*vy2 - one*vvz*(-two + three*vx2)*(one + three*vy2) - two*vz2 + three*vx2*vz2 - six*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(-one + three*vvz - three*vz2))));
-			//mfbca = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(-(one*vx2) + two*vy2 - three*vx2*vy2 + vvz*(-two + three*vx2)*(one + three*vy2) + two*vz2 - three*vx2*vz2 + six*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(-one + three*vvz - three*vz2)));
-			//mfbac = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(-(one*vx2) + two*vy2 - three*vx2*vy2 - one*vvz*(-two + three*vx2)*(one + three*vy2) + two*vz2 - three*vx2*vz2 + six*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(one + three*vvz + three*vz2)));
-			//mfbbb = eight*(eight*OnoOver216Rho + OneOver216RhoPlusOne*three*(four*vy2 + four*vz2 - six*vy2*vz2 + vx2*(-two + three*vy2)*(-two + three*vz2)));
-			//mfccc = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(one + three*vvz + three*vz2) + vvx*(one + three*vvy + three*vy2)*(one + three*vvz + three*vz2));
-			//mfaac = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(one + three*vvz + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(one + three*vvz + three*vz2));
-			//mfcac = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(one + three*vvz + three*vz2) - one*vvx*(-one + three*vvy - three*vy2)*(one + three*vvz + three*vz2));
-			//mfacc = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(one + three*vvz + three*vz2) - one*vvx*(one + three*vvy + three*vy2)*(one + three*vvz + three*vz2));
-			//mfcca = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) - one*vvx*(one + three*vvy + three*vy2)*(-one + three*vvz - three*vz2));
-			//mfaaa = OnoOver216Rho - OneOver216RhoPlusOne*three*(vvz - one*vx2 + three*vvz*vx2 - one*vy2 + three*vvz*vy2 - three*vx2*vy2 + nine*vvz*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-one + three*vvz - three*vz2));
-			//mfcaa = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-one + three*vvz - three*vz2));
-			//mfaca = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(one + three*vvy + three*vy2)*(-one + three*vvz - three*vz2));
+         //////////////////////////////////////////////////////////////////////////////////
+         //unkonditioniert
+            mfcbb = -(rhoBC[k] + c1o1) * XXc * YYb * ZZb - c2o27;
+         mfabb = -(rhoBC[k] + c1o1) * XXa * YYb * ZZb - c2o27;
+         mfbcb = -(rhoBC[k] + c1o1) * XXb * YYc * ZZb - c2o27;
+         mfbab = -(rhoBC[k] + c1o1) * XXb * YYa * ZZb - c2o27;
+         mfbbc = -(rhoBC[k] + c1o1) * XXb * YYb * ZZc - c2o27;
+         mfbba = -(rhoBC[k] + c1o1) * XXb * YYb * ZZa - c2o27;
+         mfccb = -(rhoBC[k] + c1o1) * XXc * YYc * ZZb - c1o54;
+         mfaab = -(rhoBC[k] + c1o1) * XXa * YYa * ZZb - c1o54;
+         mfcab = -(rhoBC[k] + c1o1) * XXc * YYa * ZZb - c1o54;
+         mfacb = -(rhoBC[k] + c1o1) * XXa * YYc * ZZb - c1o54;
+         mfcbc = -(rhoBC[k] + c1o1) * XXc * YYb * ZZc - c1o54;
+         mfaba = -(rhoBC[k] + c1o1) * XXa * YYb * ZZa - c1o54;
+         mfcba = -(rhoBC[k] + c1o1) * XXc * YYb * ZZa - c1o54;
+         mfabc = -(rhoBC[k] + c1o1) * XXa * YYb * ZZc - c1o54;
+         mfbcc = -(rhoBC[k] + c1o1) * XXb * YYc * ZZc - c1o54;
+         mfbaa = -(rhoBC[k] + c1o1) * XXb * YYa * ZZa - c1o54;
+         mfbca = -(rhoBC[k] + c1o1) * XXb * YYc * ZZa - c1o54;
+         mfbac = -(rhoBC[k] + c1o1) * XXb * YYa * ZZc - c1o54;
+         mfbbb = -(rhoBC[k] + c1o1) * XXb * YYb * ZZb - c8o27;
+         mfccc = -(rhoBC[k] + c1o1) * XXc * YYc * ZZc - c1o216;
+         mfaac = -(rhoBC[k] + c1o1) * XXa * YYa * ZZc - c1o216;
+         mfcac = -(rhoBC[k] + c1o1) * XXc * YYa * ZZc - c1o216;
+         mfacc = -(rhoBC[k] + c1o1) * XXa * YYc * ZZc - c1o216;
+         mfcca = -(rhoBC[k] + c1o1) * XXc * YYc * ZZa - c1o216;
+         mfaaa = -(rhoBC[k] + c1o1) * XXa * YYa * ZZa - c1o216;
+         mfcaa = -(rhoBC[k] + c1o1) * XXc * YYa * ZZa - c1o216;
+         mfaca = -(rhoBC[k] + c1o1) * XXa * YYc * ZZa - c1o216;
+         //////////////////////////////////////////////////////////
+         ////konditioniert
+         //double OneOver216RhoPlusOne = c1over216*(rhoBC[k]+one);
+         //double OnoOver216Rho        = c1over216*rhoBC[k];
+         //mfcbb = OnoOver216Rho*sixteen + OneOver216RhoPlusOne*twelve*(-(two*vy2) - two*vz2 + three*vy2*vz2 + vvx*(-two + three*vy2)*(-two + three*vz2) + vx2*(-two + three*vy2)*(-two + three*vz2));
+         //mfabb = OnoOver216Rho*sixteen - OneOver216RhoPlusOne*twelve*(two*vy2 + two*vz2 - three*vy2*vz2 + vvx*(-two + three*vy2)*(-two + three*vz2) + vx2*(-four + six*vy2 + six*vz2 - nine*vy2*vz2));
+         //mfbcb = four*(-(four*OneOver216RhoPlusOne) + four*OnoOver216Rho + OneOver216RhoPlusOne*(-two + three*vx2)*(one + three*vvy + three*vy2)*(-two + three*vz2));
+         //mfbab = four*(four*OnoOver216Rho - OneOver216RhoPlusOne*three*(vvy*(-two + three*vx2)*(-two + three*vz2) - one*vx2*(one + three*vy2)*(-two + three*vz2) + two*(-(two*vy2) + vz2 + three*vy2*vz2)));
+         //mfbbc = four*(-(four*OneOver216RhoPlusOne) + four*OnoOver216Rho + OneOver216RhoPlusOne*(-two + three*vx2)*(-two + three*vy2)*(one + three*vvz + three*vz2));
+         //mfbba = four*(four*OnoOver216Rho - OneOver216RhoPlusOne*three*(vvz*(-two + three*vx2)*(-two + three*vy2) - one*vx2*(-two + three*vy2)*(one + three*vz2) + two*(vy2 - two*vz2 + three*vy2*vz2)));
+         //mfccb = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) - two*vy2 - six*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(one + three*vvy + three*vy2)*(-two + three*vz2))));
+         //mfaab = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) - two*vy2 - six*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-two + three*vz2))));
+         //mfcab = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 + two*vy2 + six*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-two + three*vz2)));
+         //mfacb = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 + two*vy2 + six*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-two + three*vz2) + vvx*(one + three*vvy + three*vy2)*(-two + three*vz2)));
+         //mfcbc = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) + vy2 + three*vx2*vy2 + vvz*(one + three*vx2)*(-two + three*vy2) - two*vz2 - six*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(one + three*vvz + three*vz2))));
+         //mfaba = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(-(two*vx2) + vy2 + three*vx2*vy2 - one*vvz*(one + three*vx2)*(-two + three*vy2) - two*vz2 - six*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(-one + three*vvz - three*vz2))));
+         //mfcba = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 - one*vy2 - three*vx2*vy2 + vvz*(one + three*vx2)*(-two + three*vy2) + two*vz2 + six*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(-one + three*vvz - three*vz2)));
+         //mfabc = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(two*vx2 - one*vy2 - three*vx2*vy2 - one*vvz*(one + three*vx2)*(-two + three*vy2) + two*vz2 + six*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 + vvx*(-two + three*vy2)*(one + three*vvz + three*vz2)));
+         //mfbcc = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(vx2 - two*vy2 + three*vx2*vy2 + vvz*(-two + three*vx2)*(one + three*vy2) - two*vz2 + three*vx2*vz2 - six*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(one + three*vvz + three*vz2))));
+         //mfbaa = -(two*(-(OnoOver216Rho*two) + OneOver216RhoPlusOne*three*(vx2 - two*vy2 + three*vx2*vy2 - one*vvz*(-two + three*vx2)*(one + three*vy2) - two*vz2 + three*vx2*vz2 - six*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(-one + three*vvz - three*vz2))));
+         //mfbca = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(-(one*vx2) + two*vy2 - three*vx2*vy2 + vvz*(-two + three*vx2)*(one + three*vy2) + two*vz2 - three*vx2*vz2 + six*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(-one + three*vvz - three*vz2)));
+         //mfbac = two*(OnoOver216Rho*two + OneOver216RhoPlusOne*three*(-(one*vx2) + two*vy2 - three*vx2*vy2 - one*vvz*(-two + three*vx2)*(one + three*vy2) + two*vz2 - three*vx2*vz2 + six*vy2*vz2 - nine*vx2*vy2*vz2 + vvy*(-two + three*vx2)*(one + three*vvz + three*vz2)));
+         //mfbbb = eight*(eight*OnoOver216Rho + OneOver216RhoPlusOne*three*(four*vy2 + four*vz2 - six*vy2*vz2 + vx2*(-two + three*vy2)*(-two + three*vz2)));
+         //mfccc = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(one + three*vvz + three*vz2) + vvx*(one + three*vvy + three*vy2)*(one + three*vvz + three*vz2));
+         //mfaac = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(one + three*vvz + three*vz2) + vvx*(-one + three*vvy - three*vy2)*(one + three*vvz + three*vz2));
+         //mfcac = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(one + three*vvz + three*vz2) - one*vvx*(-one + three*vvy - three*vy2)*(one + three*vvz + three*vz2));
+         //mfacc = OnoOver216Rho + OneOver216RhoPlusOne*three*(vvz + vx2 + three*vvz*vx2 + vy2 + three*vvz*vy2 + three*vx2*vy2 + nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(one + three*vvz + three*vz2) - one*vvx*(one + three*vvy + three*vy2)*(one + three*vvz + three*vz2));
+         //mfcca = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) - one*vvx*(one + three*vvy + three*vy2)*(-one + three*vvz - three*vz2));
+         //mfaaa = OnoOver216Rho - OneOver216RhoPlusOne*three*(vvz - one*vx2 + three*vvz*vx2 - one*vy2 + three*vvz*vy2 - three*vx2*vy2 + nine*vvz*vx2*vy2 - one*vz2 - three*vx2*vz2 - three*vy2*vz2 - nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-one + three*vvz - three*vz2));
+         //mfcaa = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 + vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(-one + three*vvy - three*vy2)*(-one + three*vvz - three*vz2));
+         //mfaca = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(one + three*vvy + three*vy2)*(-one + three*vvz - three*vz2));
 
       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       //if (isEvenTimestep==true)
@@ -4136,7 +4136,7 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
       //   D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
       //   D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
       //   D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      //} 
+      //}
       //else
       //{
       //   D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -4170,88 +4170,88 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       //__syncthreads();
 
-			(D.f[DIR_P00   ])[ke   ] = mfabb;//mfcbb;
-			(D.f[DIR_M00   ])[kw   ] = mfcbb;//mfabb;
-			(D.f[DIR_0P0   ])[kn   ] = mfbab;//mfbcb;
-			(D.f[DIR_0M0   ])[ks   ] = mfbcb;//mfbab;
-			(D.f[DIR_00P   ])[kt   ] = mfbba;//mfbbc;
-			(D.f[DIR_00M   ])[kb   ] = mfbbc;//mfbba;
-			(D.f[DIR_PP0  ])[kne  ] = mfaab;//mfccb;
-			(D.f[DIR_MM0  ])[ksw  ] = mfccb;//mfaab;
-			(D.f[DIR_PM0  ])[kse  ] = mfacb;//mfcab;
-			(D.f[DIR_MP0  ])[knw  ] = mfcab;//mfacb;
-			(D.f[DIR_P0P  ])[kte  ] = mfaba;//mfcbc;
-			(D.f[DIR_M0M  ])[kbw  ] = mfcbc;//mfaba;
-			(D.f[DIR_P0M  ])[kbe  ] = mfabc;//mfcba;
-			(D.f[DIR_M0P  ])[ktw  ] = mfcba;//mfabc;
-			(D.f[DIR_0PP  ])[ktn  ] = mfbaa;//mfbcc;
-			(D.f[DIR_0MM  ])[kbs  ] = mfbcc;//mfbaa;
-			(D.f[DIR_0PM  ])[kbn  ] = mfbac;//mfbca;
-			(D.f[DIR_0MP  ])[kts  ] = mfbca;//mfbac;
-			(D.f[DIR_000])[kzero] = mfbbb;//mfbbb;
-			(D.f[DIR_PPP ])[ktne ] = mfaaa;//mfccc;
-			(D.f[DIR_MMP ])[ktsw ] = mfcca;//mfaac;
-			(D.f[DIR_PMP ])[ktse ] = mfaca;//mfcac;
-			(D.f[DIR_MPP ])[ktnw ] = mfcaa;//mfacc;
-			(D.f[DIR_PPM ])[kbne ] = mfaac;//mfcca;
-			(D.f[DIR_MMM ])[kbsw ] = mfccc;//mfaaa;
-			(D.f[DIR_PMM ])[kbse ] = mfacc;//mfcaa;
-			(D.f[DIR_MPM ])[kbnw ] = mfcac;//mfaca;
-			//(D.f[DIR_P00   ])[ke   ] = mfcbb;
-			//(D.f[DIR_M00   ])[kw   ] = mfabb;
-			//(D.f[DIR_0P0   ])[kn   ] = mfbcb;
-			//(D.f[DIR_0M0   ])[ks   ] = mfbab;
-			//(D.f[DIR_00P   ])[kt   ] = mfbbc;
-			//(D.f[DIR_00M   ])[kb   ] = mfbba;
-			//(D.f[DIR_PP0  ])[kne  ] = mfccb;
-			//(D.f[DIR_MM0  ])[ksw  ] = mfaab;
-			//(D.f[DIR_PM0  ])[kse  ] = mfcab;
-			//(D.f[DIR_MP0  ])[knw  ] = mfacb;
-			//(D.f[DIR_P0P  ])[kte  ] = mfcbc;
-			//(D.f[DIR_M0M  ])[kbw  ] = mfaba;
-			//(D.f[DIR_P0M  ])[kbe  ] = mfcba;
-			//(D.f[DIR_M0P  ])[ktw  ] = mfabc;
-			//(D.f[DIR_0PP  ])[ktn  ] = mfbcc;
-			//(D.f[DIR_0MM  ])[kbs  ] = mfbaa;
-			//(D.f[DIR_0PM  ])[kbn  ] = mfbca;
-			//(D.f[DIR_0MP  ])[kts  ] = mfbac;
-			//(D.f[DIR_000])[kzero] = mfbbb;
-			//(D.f[DIR_PPP ])[ktne ] = mfccc;
-			//(D.f[DIR_MMP ])[ktsw ] = mfaac;
-			//(D.f[DIR_PMP ])[ktse ] = mfcac;
-			//(D.f[DIR_MPP ])[ktnw ] = mfacc;
-			//(D.f[DIR_PPM ])[kbne ] = mfcca;
-			//(D.f[DIR_MMM ])[kbsw ] = mfaaa;
-			//(D.f[DIR_PMM ])[kbse ] = mfcaa;
-			//(D.f[DIR_MPM ])[kbnw ] = mfaca;
-
-      //(D.f[DIR_P00   ])[ke   ] = fE ;  //f1_E ;   //fW;    //fE ;  
-      //(D.f[DIR_M00   ])[kw   ] = fW ;  //f1_W ;   //fE;    //fW ;  
-      //(D.f[DIR_0P0   ])[kn   ] = fN ;  //f1_N ;   //fS;    //fN ;  
-      //(D.f[DIR_0M0   ])[ks   ] = fS ;  //f1_S ;   //fN;    //fS ;  
-      //(D.f[DIR_00P   ])[kt   ] = fT ;  //f1_T ;   //fB;    //fT ;  
-      //(D.f[DIR_00M   ])[kb   ] = fB ;  //f1_B ;   //fT;    //fB ;  
-      //(D.f[DIR_PP0  ])[kne  ] = fNE;  //f1_NE;   //fSW;   //fNE;  
-      //(D.f[DIR_MM0  ])[ksw  ] = fSW;  //f1_SW;   //fNE;   //fSW;  
-      //(D.f[DIR_PM0  ])[kse  ] = fSE;  //f1_SE;   //fNW;   //fSE;  
-      //(D.f[DIR_MP0  ])[knw  ] = fNW;  //f1_NW;   //fSE;   //fNW;  
-      //(D.f[DIR_P0P  ])[kte  ] = fTE;  //f1_TE;   //fBW;   //fTE;  
-      //(D.f[DIR_M0M  ])[kbw  ] = fBW;  //f1_BW;   //fTE;   //fBW;  
-      //(D.f[DIR_P0M  ])[kbe  ] = fBE;  //f1_BE;   //fTW;   //fBE;  
-      //(D.f[DIR_M0P  ])[ktw  ] = fTW;  //f1_TW;   //fBE;   //fTW;  
-      //(D.f[DIR_0PP  ])[ktn  ] = fTN;  //f1_TN;   //fBS;   //fTN;  
-      //(D.f[DIR_0MM  ])[kbs  ] = fBS;  //f1_BS;   //fTN;   //fBS;  
-      //(D.f[DIR_0PM  ])[kbn  ] = fBN;  //f1_BN;   //fTS;   //fBN;  
-      //(D.f[DIR_0MP  ])[kts  ] = fTS;  //f1_TS;   //fBN;   //fTS;  
+         (D.f[DIR_P00   ])[ke   ] = mfabb;//mfcbb;
+         (D.f[DIR_M00   ])[kw   ] = mfcbb;//mfabb;
+         (D.f[DIR_0P0   ])[kn   ] = mfbab;//mfbcb;
+         (D.f[DIR_0M0   ])[ks   ] = mfbcb;//mfbab;
+         (D.f[DIR_00P   ])[kt   ] = mfbba;//mfbbc;
+         (D.f[DIR_00M   ])[kb   ] = mfbbc;//mfbba;
+         (D.f[DIR_PP0  ])[kne  ] = mfaab;//mfccb;
+         (D.f[DIR_MM0  ])[ksw  ] = mfccb;//mfaab;
+         (D.f[DIR_PM0  ])[kse  ] = mfacb;//mfcab;
+         (D.f[DIR_MP0  ])[knw  ] = mfcab;//mfacb;
+         (D.f[DIR_P0P  ])[kte  ] = mfaba;//mfcbc;
+         (D.f[DIR_M0M  ])[kbw  ] = mfcbc;//mfaba;
+         (D.f[DIR_P0M  ])[kbe  ] = mfabc;//mfcba;
+         (D.f[DIR_M0P  ])[ktw  ] = mfcba;//mfabc;
+         (D.f[DIR_0PP  ])[ktn  ] = mfbaa;//mfbcc;
+         (D.f[DIR_0MM  ])[kbs  ] = mfbcc;//mfbaa;
+         (D.f[DIR_0PM  ])[kbn  ] = mfbac;//mfbca;
+         (D.f[DIR_0MP  ])[kts  ] = mfbca;//mfbac;
+         (D.f[DIR_000])[kzero] = mfbbb;//mfbbb;
+         (D.f[DIR_PPP ])[ktne ] = mfaaa;//mfccc;
+         (D.f[DIR_MMP ])[ktsw ] = mfcca;//mfaac;
+         (D.f[DIR_PMP ])[ktse ] = mfaca;//mfcac;
+         (D.f[DIR_MPP ])[ktnw ] = mfcaa;//mfacc;
+         (D.f[DIR_PPM ])[kbne ] = mfaac;//mfcca;
+         (D.f[DIR_MMM ])[kbsw ] = mfccc;//mfaaa;
+         (D.f[DIR_PMM ])[kbse ] = mfacc;//mfcaa;
+         (D.f[DIR_MPM ])[kbnw ] = mfcac;//mfaca;
+         //(D.f[DIR_P00   ])[ke   ] = mfcbb;
+         //(D.f[DIR_M00   ])[kw   ] = mfabb;
+         //(D.f[DIR_0P0   ])[kn   ] = mfbcb;
+         //(D.f[DIR_0M0   ])[ks   ] = mfbab;
+         //(D.f[DIR_00P   ])[kt   ] = mfbbc;
+         //(D.f[DIR_00M   ])[kb   ] = mfbba;
+         //(D.f[DIR_PP0  ])[kne  ] = mfccb;
+         //(D.f[DIR_MM0  ])[ksw  ] = mfaab;
+         //(D.f[DIR_PM0  ])[kse  ] = mfcab;
+         //(D.f[DIR_MP0  ])[knw  ] = mfacb;
+         //(D.f[DIR_P0P  ])[kte  ] = mfcbc;
+         //(D.f[DIR_M0M  ])[kbw  ] = mfaba;
+         //(D.f[DIR_P0M  ])[kbe  ] = mfcba;
+         //(D.f[DIR_M0P  ])[ktw  ] = mfabc;
+         //(D.f[DIR_0PP  ])[ktn  ] = mfbcc;
+         //(D.f[DIR_0MM  ])[kbs  ] = mfbaa;
+         //(D.f[DIR_0PM  ])[kbn  ] = mfbca;
+         //(D.f[DIR_0MP  ])[kts  ] = mfbac;
+         //(D.f[DIR_000])[kzero] = mfbbb;
+         //(D.f[DIR_PPP ])[ktne ] = mfccc;
+         //(D.f[DIR_MMP ])[ktsw ] = mfaac;
+         //(D.f[DIR_PMP ])[ktse ] = mfcac;
+         //(D.f[DIR_MPP ])[ktnw ] = mfacc;
+         //(D.f[DIR_PPM ])[kbne ] = mfcca;
+         //(D.f[DIR_MMM ])[kbsw ] = mfaaa;
+         //(D.f[DIR_PMM ])[kbse ] = mfcaa;
+         //(D.f[DIR_MPM ])[kbnw ] = mfaca;
+
+      //(D.f[DIR_P00   ])[ke   ] = fE ;  //f1_E ;   //fW;    //fE ;
+      //(D.f[DIR_M00   ])[kw   ] = fW ;  //f1_W ;   //fE;    //fW ;
+      //(D.f[DIR_0P0   ])[kn   ] = fN ;  //f1_N ;   //fS;    //fN ;
+      //(D.f[DIR_0M0   ])[ks   ] = fS ;  //f1_S ;   //fN;    //fS ;
+      //(D.f[DIR_00P   ])[kt   ] = fT ;  //f1_T ;   //fB;    //fT ;
+      //(D.f[DIR_00M   ])[kb   ] = fB ;  //f1_B ;   //fT;    //fB ;
+      //(D.f[DIR_PP0  ])[kne  ] = fNE;  //f1_NE;   //fSW;   //fNE;
+      //(D.f[DIR_MM0  ])[ksw  ] = fSW;  //f1_SW;   //fNE;   //fSW;
+      //(D.f[DIR_PM0  ])[kse  ] = fSE;  //f1_SE;   //fNW;   //fSE;
+      //(D.f[DIR_MP0  ])[knw  ] = fNW;  //f1_NW;   //fSE;   //fNW;
+      //(D.f[DIR_P0P  ])[kte  ] = fTE;  //f1_TE;   //fBW;   //fTE;
+      //(D.f[DIR_M0M  ])[kbw  ] = fBW;  //f1_BW;   //fTE;   //fBW;
+      //(D.f[DIR_P0M  ])[kbe  ] = fBE;  //f1_BE;   //fTW;   //fBE;
+      //(D.f[DIR_M0P  ])[ktw  ] = fTW;  //f1_TW;   //fBE;   //fTW;
+      //(D.f[DIR_0PP  ])[ktn  ] = fTN;  //f1_TN;   //fBS;   //fTN;
+      //(D.f[DIR_0MM  ])[kbs  ] = fBS;  //f1_BS;   //fTN;   //fBS;
+      //(D.f[DIR_0PM  ])[kbn  ] = fBN;  //f1_BN;   //fTS;   //fBN;
+      //(D.f[DIR_0MP  ])[kts  ] = fTS;  //f1_TS;   //fBN;   //fTS;
       //(D.f[DIR_000])[kzero] = fZERO;//f1_ZERO; //fZERO; //fZERO;
-      //(D.f[DIR_PPP ])[ktne ] = fTNE; //f1_TNE;  //fBSW;  //fTNE; 
-      //(D.f[DIR_MMM ])[kbsw ] = fBSW; //f1_BSW;  //fTNE;  //fBSW; 
-      //(D.f[DIR_PPM ])[kbne ] = fBNE; //f1_BNE;  //fTSW;  //fBNE; 
-      //(D.f[DIR_MMP ])[ktsw ] = fTSW; //f1_TSW;  //fBNE;  //fTSW; 
-      //(D.f[DIR_PMP ])[ktse ] = fTSE; //f1_TSE;  //fBNW;  //fTSE; 
-      //(D.f[DIR_MPM ])[kbnw ] = fBNW; //f1_BNW;  //fTSE;  //fBNW; 
-      //(D.f[DIR_PMM ])[kbse ] = fBSE; //f1_BSE;  //fTNW;  //fBSE; 
-      //(D.f[DIR_MPP ])[ktnw ] = fTNW; //f1_TNW;  //fBSE;  //fTNW; 
+      //(D.f[DIR_PPP ])[ktne ] = fTNE; //f1_TNE;  //fBSW;  //fTNE;
+      //(D.f[DIR_MMM ])[kbsw ] = fBSW; //f1_BSW;  //fTNE;  //fBSW;
+      //(D.f[DIR_PPM ])[kbne ] = fBNE; //f1_BNE;  //fTSW;  //fBNE;
+      //(D.f[DIR_MMP ])[ktsw ] = fTSW; //f1_TSW;  //fBNE;  //fTSW;
+      //(D.f[DIR_PMP ])[ktse ] = fTSE; //f1_TSE;  //fBNW;  //fTSE;
+      //(D.f[DIR_MPM ])[kbnw ] = fBNW; //f1_BNW;  //fTSE;  //fBNW;
+      //(D.f[DIR_PMM ])[kbse ] = fBSE; //f1_BSE;  //fTNW;  //fBSE;
+      //(D.f[DIR_MPP ])[ktnw ] = fTNW; //f1_TNW;  //fBSE;  //fTNW;
    }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4295,19 +4295,19 @@ __global__ void QPressDeviceEQZ27(real* rhoBC,
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-__global__ void QPressDeviceZero27(	 real* DD, 
-												 int* k_Q, 
-												 unsigned int numberOfBCnodes, 
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat, 
-												 bool isEvenTimestep)
+__global__ void QPressDeviceZero27(	 real* DD,
+                                     int* k_Q,
+                                     unsigned int numberOfBCnodes,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     unsigned int size_Mat,
+                                     bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -4378,7 +4378,7 @@ __global__ void QPressDeviceZero27(	 real* DD,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -4411,7 +4411,7 @@ __global__ void QPressDeviceZero27(	 real* DD,
       }
       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       //__syncthreads();
-	  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       (D.f[DIR_P00   ])[ke   ] =c0o1;
       (D.f[DIR_M00   ])[kw   ] =c0o1;
       (D.f[DIR_0P0   ])[kn   ] =c0o1;
@@ -4483,21 +4483,21 @@ __global__ void QPressDeviceZero27(	 real* DD,
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 __global__ void QPressDeviceFake27(	 real* rhoBC,
-												 real* DD, 
-												 int* k_Q, 
-												 int* k_N, 
-												 int numberOfBCnodes, 
-												 real om1, 
-												 unsigned int* neighborX,
-												 unsigned int* neighborY,
-												 unsigned int* neighborZ,
-												 unsigned int size_Mat, 
-												 bool isEvenTimestep)
+                                     real* DD,
+                                     int* k_Q,
+                                     int* k_N,
+                                     int numberOfBCnodes,
+                                     real om1,
+                                     unsigned int* neighborX,
+                                     unsigned int* neighborY,
+                                     unsigned int* neighborZ,
+                                     unsigned int size_Mat,
+                                     bool isEvenTimestep)
 {
    ////////////////////////////////////////////////////////////////////////////////
-   const unsigned  x = threadIdx.x;  // Globaler x-Index 
-   const unsigned  y = blockIdx.x;   // Globaler y-Index 
-   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
 
    const unsigned nx = blockDim.x;
    const unsigned ny = gridDim.x;
@@ -4598,7 +4598,7 @@ __global__ void QPressDeviceFake27(	 real* rhoBC,
          D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
          D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
          D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-      } 
+      }
       else
       {
          D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
@@ -4665,24 +4665,24 @@ __global__ void QPressDeviceFake27(	 real* rhoBC,
       real vx1, vx2, vx3;
       vx1    =  ((f1_TSE - f1_BNW) - (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
                   ((f1_BE - f1_TW)   + (f1_TE - f1_BW))   + ((f1_SE - f1_NW)   + (f1_NE - f1_SW)) +
-                  (f1_E - f1_W); 
+                  (f1_E - f1_W);
 
 
       vx2    =   (-(f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) +
                   ((f1_BN - f1_TS)   + (f1_TN - f1_BS))    + (-(f1_SE - f1_NW)  + (f1_NE - f1_SW)) +
-                  (f1_N - f1_S); 
+                  (f1_N - f1_S);
 
       vx3    =   ((f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) + (f1_TSW - f1_BNE)) +
                   (-(f1_BN - f1_TS)  + (f1_TN - f1_BS))   + ((f1_TE - f1_BW)   - (f1_BE - f1_TW)) +
-                  (f1_T - f1_B); 
+                  (f1_T - f1_B);
 
       real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
       //////////////////////////////////////////////////////////////////////////
       real drho1    =  f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+
          f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW;
 
-	  //drho1 = (drho1 + rhoBC[k])/2.f;
-	  drho1 = drho1 - rhoBC[k];
+     //drho1 = (drho1 + rhoBC[k])/2.f;
+     drho1 = drho1 - rhoBC[k];
 
       __syncthreads();
 
@@ -4712,7 +4712,7 @@ __global__ void QPressDeviceFake27(	 real* rhoBC,
       (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1;	//  c1o100;  // zero;  //
       (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1;	//  c1o100;  // zero;  //
       (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1;	//  c1o100;  // zero;  //
-      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;  //  c1o100;  // zero;  //      
+      (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1;  //  c1o100;  // zero;  //
    }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4757,460 +4757,460 @@ __global__ void QPressDeviceFake27(	 real* rhoBC,
 
 //////////////////////////////////////////////////////////////////////////
 __global__ void QPressDevice27_IntBB(real* rho,
-												real* DD, 
-												int* k_Q, 
-												real* QQ,
-												unsigned int numberOfBCnodes, 
-												real om1, 
-												unsigned int* neighborX,
-												unsigned int* neighborY,
-												unsigned int* neighborZ,
-												unsigned int size_Mat, 
-												bool isEvenTimestep)
+                                    real* DD,
+                                    int* k_Q,
+                                    real* QQ,
+                                    unsigned int numberOfBCnodes,
+                                    real om1,
+                                    unsigned int* neighborX,
+                                    unsigned int* neighborY,
+                                    unsigned int* neighborZ,
+                                    unsigned int size_Mat,
+                                    bool isEvenTimestep)
 {
-	Distributions27 D;
-	if (isEvenTimestep==true)
-	{
-		D.f[DIR_P00   ] = &DD[DIR_P00   *size_Mat];
-		D.f[DIR_M00   ] = &DD[DIR_M00   *size_Mat];
-		D.f[DIR_0P0   ] = &DD[DIR_0P0   *size_Mat];
-		D.f[DIR_0M0   ] = &DD[DIR_0M0   *size_Mat];
-		D.f[DIR_00P   ] = &DD[DIR_00P   *size_Mat];
-		D.f[DIR_00M   ] = &DD[DIR_00M   *size_Mat];
-		D.f[DIR_PP0  ] = &DD[DIR_PP0  *size_Mat];
-		D.f[DIR_MM0  ] = &DD[DIR_MM0  *size_Mat];
-		D.f[DIR_PM0  ] = &DD[DIR_PM0  *size_Mat];
-		D.f[DIR_MP0  ] = &DD[DIR_MP0  *size_Mat];
-		D.f[DIR_P0P  ] = &DD[DIR_P0P  *size_Mat];
-		D.f[DIR_M0M  ] = &DD[DIR_M0M  *size_Mat];
-		D.f[DIR_P0M  ] = &DD[DIR_P0M  *size_Mat];
-		D.f[DIR_M0P  ] = &DD[DIR_M0P  *size_Mat];
-		D.f[DIR_0PP  ] = &DD[DIR_0PP  *size_Mat];
-		D.f[DIR_0MM  ] = &DD[DIR_0MM  *size_Mat];
-		D.f[DIR_0PM  ] = &DD[DIR_0PM  *size_Mat];
-		D.f[DIR_0MP  ] = &DD[DIR_0MP  *size_Mat];
-		D.f[DIR_000] = &DD[DIR_000*size_Mat];
-		D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat];
-		D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat];
-		D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat];
-		D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat];
-		D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat];
-		D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
-		D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
-		D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-	} 
-	else
-	{
-		D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
-		D.f[DIR_P00   ] = &DD[DIR_M00   *size_Mat];
-		D.f[DIR_0M0   ] = &DD[DIR_0P0   *size_Mat];
-		D.f[DIR_0P0   ] = &DD[DIR_0M0   *size_Mat];
-		D.f[DIR_00M   ] = &DD[DIR_00P   *size_Mat];
-		D.f[DIR_00P   ] = &DD[DIR_00M   *size_Mat];
-		D.f[DIR_MM0  ] = &DD[DIR_PP0  *size_Mat];
-		D.f[DIR_PP0  ] = &DD[DIR_MM0  *size_Mat];
-		D.f[DIR_MP0  ] = &DD[DIR_PM0  *size_Mat];
-		D.f[DIR_PM0  ] = &DD[DIR_MP0  *size_Mat];
-		D.f[DIR_M0M  ] = &DD[DIR_P0P  *size_Mat];
-		D.f[DIR_P0P  ] = &DD[DIR_M0M  *size_Mat];
-		D.f[DIR_M0P  ] = &DD[DIR_P0M  *size_Mat];
-		D.f[DIR_P0M  ] = &DD[DIR_M0P  *size_Mat];
-		D.f[DIR_0MM  ] = &DD[DIR_0PP  *size_Mat];
-		D.f[DIR_0PP  ] = &DD[DIR_0MM  *size_Mat];
-		D.f[DIR_0MP  ] = &DD[DIR_0PM  *size_Mat];
-		D.f[DIR_0PM  ] = &DD[DIR_0MP  *size_Mat];
-		D.f[DIR_000] = &DD[DIR_000*size_Mat];
-		D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat];
-		D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat];
-		D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat];
-		D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat];
-		D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat];
-		D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat];
-		D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat];
-		D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
-	}
-	////////////////////////////////////////////////////////////////////////////////
-	const unsigned  x = threadIdx.x;  // Globaler x-Index 
-	const unsigned  y = blockIdx.x;   // Globaler y-Index 
-	const unsigned  z = blockIdx.y;   // Globaler z-Index 
-
-	const unsigned nx = blockDim.x;
-	const unsigned ny = gridDim.x;
-
-	const unsigned k = nx*(ny*z + y) + x;
-	//////////////////////////////////////////////////////////////////////////
-
-	if(k < numberOfBCnodes)
-	{
-		////////////////////////////////////////////////////////////////////////////////
-		//real VeloX = vx[k];
-		//real VeloY = vy[k];
-		//real VeloZ = vz[k]; //(16.0*(u0*2.0)*bbx*bby*(grid_nx-bbx)*(grid_ny-bby))/(grid_nx*grid_nx*grid_ny*grid_ny)
-		////////////////////////////////////////////////////////////////////////////////
-		real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB, 
-			*q_dirNE,  *q_dirSW,  *q_dirSE,  *q_dirNW,  *q_dirTE,  *q_dirBW,
-			*q_dirBE,  *q_dirTW,  *q_dirTN,  *q_dirBS,  *q_dirBN,  *q_dirTS,
-			*q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW,
-			*q_dirBSE, *q_dirBNW; 
-		q_dirE   = &QQ[DIR_P00   * numberOfBCnodes];
-		q_dirW   = &QQ[DIR_M00   * numberOfBCnodes];
-		q_dirN   = &QQ[DIR_0P0   * numberOfBCnodes];
-		q_dirS   = &QQ[DIR_0M0   * numberOfBCnodes];
-		q_dirT   = &QQ[DIR_00P   * numberOfBCnodes];
-		q_dirB   = &QQ[DIR_00M   * numberOfBCnodes];
-		q_dirNE  = &QQ[DIR_PP0  * numberOfBCnodes];
-		q_dirSW  = &QQ[DIR_MM0  * numberOfBCnodes];
-		q_dirSE  = &QQ[DIR_PM0  * numberOfBCnodes];
-		q_dirNW  = &QQ[DIR_MP0  * numberOfBCnodes];
-		q_dirTE  = &QQ[DIR_P0P  * numberOfBCnodes];
-		q_dirBW  = &QQ[DIR_M0M  * numberOfBCnodes];
-		q_dirBE  = &QQ[DIR_P0M  * numberOfBCnodes];
-		q_dirTW  = &QQ[DIR_M0P  * numberOfBCnodes];
-		q_dirTN  = &QQ[DIR_0PP  * numberOfBCnodes];
-		q_dirBS  = &QQ[DIR_0MM  * numberOfBCnodes];
-		q_dirBN  = &QQ[DIR_0PM  * numberOfBCnodes];
-		q_dirTS  = &QQ[DIR_0MP  * numberOfBCnodes];
-		q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes];
-		q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes];
-		q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes];
-		q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes];
-		q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes];
-		q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes];
-		q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes];
-		q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes];
-		////////////////////////////////////////////////////////////////////////////////
-		//index
-		unsigned int KQK  = k_Q[k];
-		unsigned int kzero= KQK;
-		unsigned int ke   = KQK;
-		unsigned int kw   = neighborX[KQK];
-		unsigned int kn   = KQK;
-		unsigned int ks   = neighborY[KQK];
-		unsigned int kt   = KQK;
-		unsigned int kb   = neighborZ[KQK];
-		unsigned int ksw  = neighborY[kw];
-		unsigned int kne  = KQK;
-		unsigned int kse  = ks;
-		unsigned int knw  = kw;
-		unsigned int kbw  = neighborZ[kw];
-		unsigned int kte  = KQK;
-		unsigned int kbe  = kb;
-		unsigned int ktw  = kw;
-		unsigned int kbs  = neighborZ[ks];
-		unsigned int ktn  = KQK;
-		unsigned int kbn  = kb;
-		unsigned int kts  = ks;
-		unsigned int ktse = ks;
-		unsigned int kbnw = kbw;
-		unsigned int ktnw = kw;
-		unsigned int kbse = kbs;
-		unsigned int ktsw = ksw;
-		unsigned int kbne = kb;
-		unsigned int ktne = KQK;
-		unsigned int kbsw = neighborZ[ksw];
-		////////////////////////////////////////////////////////////////////////////////
-		real f_E,  f_W,  f_N,  f_S,  f_T,  f_B,   f_NE,  f_SW,  f_SE,  f_NW,  f_TE,  f_BW,  f_BE,
-			f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW;
-
-		f_W    = (D.f[DIR_P00   ])[ke   ];
-		f_E    = (D.f[DIR_M00   ])[kw   ];
-		f_S    = (D.f[DIR_0P0   ])[kn   ];
-		f_N    = (D.f[DIR_0M0   ])[ks   ];
-		f_B    = (D.f[DIR_00P   ])[kt   ];
-		f_T    = (D.f[DIR_00M   ])[kb   ];
-		f_SW   = (D.f[DIR_PP0  ])[kne  ];
-		f_NE   = (D.f[DIR_MM0  ])[ksw  ];
-		f_NW   = (D.f[DIR_PM0  ])[kse  ];
-		f_SE   = (D.f[DIR_MP0  ])[knw  ];
-		f_BW   = (D.f[DIR_P0P  ])[kte  ];
-		f_TE   = (D.f[DIR_M0M  ])[kbw  ];
-		f_TW   = (D.f[DIR_P0M  ])[kbe  ];
-		f_BE   = (D.f[DIR_M0P  ])[ktw  ];
-		f_BS   = (D.f[DIR_0PP  ])[ktn  ];
-		f_TN   = (D.f[DIR_0MM  ])[kbs  ];
-		f_TS   = (D.f[DIR_0PM  ])[kbn  ];
-		f_BN   = (D.f[DIR_0MP  ])[kts  ];
-		f_BSW  = (D.f[DIR_PPP ])[ktne ];
-		f_BNE  = (D.f[DIR_MMP ])[ktsw ];
-		f_BNW  = (D.f[DIR_PMP ])[ktse ];
-		f_BSE  = (D.f[DIR_MPP ])[ktnw ];
-		f_TSW  = (D.f[DIR_PPM ])[kbne ];
-		f_TNE  = (D.f[DIR_MMM ])[kbsw ];
-		f_TNW  = (D.f[DIR_PMM ])[kbse ];
-		f_TSE  = (D.f[DIR_MPM ])[kbnw ];
-		////////////////////////////////////////////////////////////////////////////////
-		real vx1, vx2, vx3, drho, feq, q;
-		drho   =  f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW +
-			f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + 
-			f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); 
-
-		vx1    = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-			((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
-			(f_E - f_W))/(c1o1+drho); 
-
-
-		vx2    =  ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
-			((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
-			(f_N - f_S))/(c1o1+drho); 
-
-		vx3    =  (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
-			(-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
-			(f_T - f_B))/(c1o1+drho); 
-
-		real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
-
-		//////////////////////////////////////////////////////////////////////////
-		if (isEvenTimestep==false)
-		{
-			D.f[DIR_P00   ] = &DD[DIR_P00   *size_Mat];
-			D.f[DIR_M00   ] = &DD[DIR_M00   *size_Mat];
-			D.f[DIR_0P0   ] = &DD[DIR_0P0   *size_Mat];
-			D.f[DIR_0M0   ] = &DD[DIR_0M0   *size_Mat];
-			D.f[DIR_00P   ] = &DD[DIR_00P   *size_Mat];
-			D.f[DIR_00M   ] = &DD[DIR_00M   *size_Mat];
-			D.f[DIR_PP0  ] = &DD[DIR_PP0  *size_Mat];
-			D.f[DIR_MM0  ] = &DD[DIR_MM0  *size_Mat];
-			D.f[DIR_PM0  ] = &DD[DIR_PM0  *size_Mat];
-			D.f[DIR_MP0  ] = &DD[DIR_MP0  *size_Mat];
-			D.f[DIR_P0P  ] = &DD[DIR_P0P  *size_Mat];
-			D.f[DIR_M0M  ] = &DD[DIR_M0M  *size_Mat];
-			D.f[DIR_P0M  ] = &DD[DIR_P0M  *size_Mat];
-			D.f[DIR_M0P  ] = &DD[DIR_M0P  *size_Mat];
-			D.f[DIR_0PP  ] = &DD[DIR_0PP  *size_Mat];
-			D.f[DIR_0MM  ] = &DD[DIR_0MM  *size_Mat];
-			D.f[DIR_0PM  ] = &DD[DIR_0PM  *size_Mat];
-			D.f[DIR_0MP  ] = &DD[DIR_0MP  *size_Mat];
-			D.f[DIR_000] = &DD[DIR_000*size_Mat];
-			D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat];
-			D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat];
-			D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat];
-			D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat];
-			D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat];
-			D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
-			D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
-			D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
-		} 
-		else
-		{
-			D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
-			D.f[DIR_P00   ] = &DD[DIR_M00   *size_Mat];
-			D.f[DIR_0M0   ] = &DD[DIR_0P0   *size_Mat];
-			D.f[DIR_0P0   ] = &DD[DIR_0M0   *size_Mat];
-			D.f[DIR_00M   ] = &DD[DIR_00P   *size_Mat];
-			D.f[DIR_00P   ] = &DD[DIR_00M   *size_Mat];
-			D.f[DIR_MM0  ] = &DD[DIR_PP0  *size_Mat];
-			D.f[DIR_PP0  ] = &DD[DIR_MM0  *size_Mat];
-			D.f[DIR_MP0  ] = &DD[DIR_PM0  *size_Mat];
-			D.f[DIR_PM0  ] = &DD[DIR_MP0  *size_Mat];
-			D.f[DIR_M0M  ] = &DD[DIR_P0P  *size_Mat];
-			D.f[DIR_P0P  ] = &DD[DIR_M0M  *size_Mat];
-			D.f[DIR_M0P  ] = &DD[DIR_P0M  *size_Mat];
-			D.f[DIR_P0M  ] = &DD[DIR_M0P  *size_Mat];
-			D.f[DIR_0MM  ] = &DD[DIR_0PP  *size_Mat];
-			D.f[DIR_0PP  ] = &DD[DIR_0MM  *size_Mat];
-			D.f[DIR_0MP  ] = &DD[DIR_0PM  *size_Mat];
-			D.f[DIR_0PM  ] = &DD[DIR_0MP  *size_Mat];
-			D.f[DIR_000] = &DD[DIR_000*size_Mat];
-			D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat];
-			D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat];
-			D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat];
-			D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat];
-			D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat];
-			D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat];
-			D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat];
-			D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
-		}
-		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-		//Test
-		//(D.f[DIR_000])[k]=c1o10;
-		real rhoDiff = drho - rho[k];
-		real VeloX = vx1;
-		real VeloY = vx2;
-		real VeloZ = vx3;
-		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-		q = q_dirE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*( vx1        )*( vx1        )-cu_sq); 
-			(D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c2o27*(rhoDiff + c6o1*( VeloX     )))/(c1o1+q);
-		}
-
-		q = q_dirW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*(-vx1        )*(-vx1        )-cu_sq); 
-			(D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c2o27*(rhoDiff + c6o1*(-VeloX     )))/(c1o1+q);
-		}
-
-		q = q_dirN[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*(     vx2    )*(     vx2    )-cu_sq); 
-			(D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c2o27*(rhoDiff + c6o1*( VeloY     )))/(c1o1+q);
-		}
-
-		q = q_dirS[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*(    -vx2    )*(    -vx2    )-cu_sq); 
-			(D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c2o27*(rhoDiff + c6o1*(-VeloY     )))/(c1o1+q);
-		}
-
-		q = q_dirT[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*(         vx3)*(         vx3)-cu_sq); 
-			(D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c2o27*(rhoDiff + c6o1*( VeloZ     )))/(c1o1+q);
-		}
-
-		q = q_dirB[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c2o27* (drho+c9o2*(        -vx3)*(        -vx3)-cu_sq); 
-			(D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c2o27*(rhoDiff + c6o1*(-VeloZ     )))/(c1o1+q);
-		}
-
-		q = q_dirNE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*( vx1+vx2    )*( vx1+vx2    )-cu_sq); 
-			(D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c1o54*(rhoDiff + c6o1*(VeloX+VeloY)))/(c1o1+q);
-		}
-
-		q = q_dirSW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq); 
-			(D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloY)))/(c1o1+q);
-		}
-
-		q = q_dirSE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*( vx1-vx2    )*( vx1-vx2    )-cu_sq); 
-			(D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloY)))/(c1o1+q);
-		}
-
-		q = q_dirNW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq); 
-			(D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloY)))/(c1o1+q);
-		}
-
-		q = q_dirTE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*( vx1    +vx3)*( vx1    +vx3)-cu_sq); 
-			(D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c1o54*(rhoDiff + c6o1*( VeloX+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq); 
-			(D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*( vx1    -vx3)*( vx1    -vx3)-cu_sq); 
-			(D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq); 
-			(D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTN[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(     vx2+vx3)*(     vx2+vx3)-cu_sq); 
-			(D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c1o54*(rhoDiff + c6o1*( VeloY+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBS[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq); 
-			(D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c1o54*(rhoDiff + c6o1*( -VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBN[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(     vx2-vx3)*(     vx2-vx3)-cu_sq); 
-			(D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c1o54*(rhoDiff + c6o1*( VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTS[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o54* (drho+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq); 
-			(D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c1o54*(rhoDiff + c6o1*( -VeloY+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTNE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); 
-			(D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBSW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); 
-			(D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBNE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); 
-			(D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTSW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); 
-			(D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTSE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); 
-			(D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY+VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBNW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); 
-			(D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirBSE[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); 
-			(D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY-VeloZ)))/(c1o1+q);
-		}
-
-		q = q_dirTNW[k];
-		if (q>=c0o1 && q<=c1o1)
-		{
-			feq=c1o216*(drho+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); 
-			(D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY+VeloZ)))/(c1o1+q);
-		}
-	}
+   Distributions27 D;
+   if (isEvenTimestep==true)
+   {
+      D.f[DIR_P00   ] = &DD[DIR_P00   *size_Mat];
+      D.f[DIR_M00   ] = &DD[DIR_M00   *size_Mat];
+      D.f[DIR_0P0   ] = &DD[DIR_0P0   *size_Mat];
+      D.f[DIR_0M0   ] = &DD[DIR_0M0   *size_Mat];
+      D.f[DIR_00P   ] = &DD[DIR_00P   *size_Mat];
+      D.f[DIR_00M   ] = &DD[DIR_00M   *size_Mat];
+      D.f[DIR_PP0  ] = &DD[DIR_PP0  *size_Mat];
+      D.f[DIR_MM0  ] = &DD[DIR_MM0  *size_Mat];
+      D.f[DIR_PM0  ] = &DD[DIR_PM0  *size_Mat];
+      D.f[DIR_MP0  ] = &DD[DIR_MP0  *size_Mat];
+      D.f[DIR_P0P  ] = &DD[DIR_P0P  *size_Mat];
+      D.f[DIR_M0M  ] = &DD[DIR_M0M  *size_Mat];
+      D.f[DIR_P0M  ] = &DD[DIR_P0M  *size_Mat];
+      D.f[DIR_M0P  ] = &DD[DIR_M0P  *size_Mat];
+      D.f[DIR_0PP  ] = &DD[DIR_0PP  *size_Mat];
+      D.f[DIR_0MM  ] = &DD[DIR_0MM  *size_Mat];
+      D.f[DIR_0PM  ] = &DD[DIR_0PM  *size_Mat];
+      D.f[DIR_0MP  ] = &DD[DIR_0MP  *size_Mat];
+      D.f[DIR_000] = &DD[DIR_000*size_Mat];
+      D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat];
+      D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat];
+      D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat];
+      D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat];
+      D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat];
+      D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
+      D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
+      D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
+   }
+   else
+   {
+      D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
+      D.f[DIR_P00   ] = &DD[DIR_M00   *size_Mat];
+      D.f[DIR_0M0   ] = &DD[DIR_0P0   *size_Mat];
+      D.f[DIR_0P0   ] = &DD[DIR_0M0   *size_Mat];
+      D.f[DIR_00M   ] = &DD[DIR_00P   *size_Mat];
+      D.f[DIR_00P   ] = &DD[DIR_00M   *size_Mat];
+      D.f[DIR_MM0  ] = &DD[DIR_PP0  *size_Mat];
+      D.f[DIR_PP0  ] = &DD[DIR_MM0  *size_Mat];
+      D.f[DIR_MP0  ] = &DD[DIR_PM0  *size_Mat];
+      D.f[DIR_PM0  ] = &DD[DIR_MP0  *size_Mat];
+      D.f[DIR_M0M  ] = &DD[DIR_P0P  *size_Mat];
+      D.f[DIR_P0P  ] = &DD[DIR_M0M  *size_Mat];
+      D.f[DIR_M0P  ] = &DD[DIR_P0M  *size_Mat];
+      D.f[DIR_P0M  ] = &DD[DIR_M0P  *size_Mat];
+      D.f[DIR_0MM  ] = &DD[DIR_0PP  *size_Mat];
+      D.f[DIR_0PP  ] = &DD[DIR_0MM  *size_Mat];
+      D.f[DIR_0MP  ] = &DD[DIR_0PM  *size_Mat];
+      D.f[DIR_0PM  ] = &DD[DIR_0MP  *size_Mat];
+      D.f[DIR_000] = &DD[DIR_000*size_Mat];
+      D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat];
+      D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat];
+      D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat];
+      D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat];
+      D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat];
+      D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat];
+      D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat];
+      D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
+   }
+   ////////////////////////////////////////////////////////////////////////////////
+   const unsigned  x = threadIdx.x;  // Globaler x-Index
+   const unsigned  y = blockIdx.x;   // Globaler y-Index
+   const unsigned  z = blockIdx.y;   // Globaler z-Index
+
+   const unsigned nx = blockDim.x;
+   const unsigned ny = gridDim.x;
+
+   const unsigned k = nx*(ny*z + y) + x;
+   //////////////////////////////////////////////////////////////////////////
+
+   if(k < numberOfBCnodes)
+   {
+      ////////////////////////////////////////////////////////////////////////////////
+      //real VeloX = vx[k];
+      //real VeloY = vy[k];
+      //real VeloZ = vz[k]; //(16.0*(u0*2.0)*bbx*bby*(grid_nx-bbx)*(grid_ny-bby))/(grid_nx*grid_nx*grid_ny*grid_ny)
+      ////////////////////////////////////////////////////////////////////////////////
+      real *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB,
+         *q_dirNE,  *q_dirSW,  *q_dirSE,  *q_dirNW,  *q_dirTE,  *q_dirBW,
+         *q_dirBE,  *q_dirTW,  *q_dirTN,  *q_dirBS,  *q_dirBN,  *q_dirTS,
+         *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW,
+         *q_dirBSE, *q_dirBNW;
+      q_dirE   = &QQ[DIR_P00   * numberOfBCnodes];
+      q_dirW   = &QQ[DIR_M00   * numberOfBCnodes];
+      q_dirN   = &QQ[DIR_0P0   * numberOfBCnodes];
+      q_dirS   = &QQ[DIR_0M0   * numberOfBCnodes];
+      q_dirT   = &QQ[DIR_00P   * numberOfBCnodes];
+      q_dirB   = &QQ[DIR_00M   * numberOfBCnodes];
+      q_dirNE  = &QQ[DIR_PP0  * numberOfBCnodes];
+      q_dirSW  = &QQ[DIR_MM0  * numberOfBCnodes];
+      q_dirSE  = &QQ[DIR_PM0  * numberOfBCnodes];
+      q_dirNW  = &QQ[DIR_MP0  * numberOfBCnodes];
+      q_dirTE  = &QQ[DIR_P0P  * numberOfBCnodes];
+      q_dirBW  = &QQ[DIR_M0M  * numberOfBCnodes];
+      q_dirBE  = &QQ[DIR_P0M  * numberOfBCnodes];
+      q_dirTW  = &QQ[DIR_M0P  * numberOfBCnodes];
+      q_dirTN  = &QQ[DIR_0PP  * numberOfBCnodes];
+      q_dirBS  = &QQ[DIR_0MM  * numberOfBCnodes];
+      q_dirBN  = &QQ[DIR_0PM  * numberOfBCnodes];
+      q_dirTS  = &QQ[DIR_0MP  * numberOfBCnodes];
+      q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes];
+      q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes];
+      q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes];
+      q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes];
+      q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes];
+      q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes];
+      q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes];
+      q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes];
+      ////////////////////////////////////////////////////////////////////////////////
+      //index
+      unsigned int KQK  = k_Q[k];
+      unsigned int kzero= KQK;
+      unsigned int ke   = KQK;
+      unsigned int kw   = neighborX[KQK];
+      unsigned int kn   = KQK;
+      unsigned int ks   = neighborY[KQK];
+      unsigned int kt   = KQK;
+      unsigned int kb   = neighborZ[KQK];
+      unsigned int ksw  = neighborY[kw];
+      unsigned int kne  = KQK;
+      unsigned int kse  = ks;
+      unsigned int knw  = kw;
+      unsigned int kbw  = neighborZ[kw];
+      unsigned int kte  = KQK;
+      unsigned int kbe  = kb;
+      unsigned int ktw  = kw;
+      unsigned int kbs  = neighborZ[ks];
+      unsigned int ktn  = KQK;
+      unsigned int kbn  = kb;
+      unsigned int kts  = ks;
+      unsigned int ktse = ks;
+      unsigned int kbnw = kbw;
+      unsigned int ktnw = kw;
+      unsigned int kbse = kbs;
+      unsigned int ktsw = ksw;
+      unsigned int kbne = kb;
+      unsigned int ktne = KQK;
+      unsigned int kbsw = neighborZ[ksw];
+      ////////////////////////////////////////////////////////////////////////////////
+      real f_E,  f_W,  f_N,  f_S,  f_T,  f_B,   f_NE,  f_SW,  f_SE,  f_NW,  f_TE,  f_BW,  f_BE,
+         f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW;
+
+      f_W    = (D.f[DIR_P00   ])[ke   ];
+      f_E    = (D.f[DIR_M00   ])[kw   ];
+      f_S    = (D.f[DIR_0P0   ])[kn   ];
+      f_N    = (D.f[DIR_0M0   ])[ks   ];
+      f_B    = (D.f[DIR_00P   ])[kt   ];
+      f_T    = (D.f[DIR_00M   ])[kb   ];
+      f_SW   = (D.f[DIR_PP0  ])[kne  ];
+      f_NE   = (D.f[DIR_MM0  ])[ksw  ];
+      f_NW   = (D.f[DIR_PM0  ])[kse  ];
+      f_SE   = (D.f[DIR_MP0  ])[knw  ];
+      f_BW   = (D.f[DIR_P0P  ])[kte  ];
+      f_TE   = (D.f[DIR_M0M  ])[kbw  ];
+      f_TW   = (D.f[DIR_P0M  ])[kbe  ];
+      f_BE   = (D.f[DIR_M0P  ])[ktw  ];
+      f_BS   = (D.f[DIR_0PP  ])[ktn  ];
+      f_TN   = (D.f[DIR_0MM  ])[kbs  ];
+      f_TS   = (D.f[DIR_0PM  ])[kbn  ];
+      f_BN   = (D.f[DIR_0MP  ])[kts  ];
+      f_BSW  = (D.f[DIR_PPP ])[ktne ];
+      f_BNE  = (D.f[DIR_MMP ])[ktsw ];
+      f_BNW  = (D.f[DIR_PMP ])[ktse ];
+      f_BSE  = (D.f[DIR_MPP ])[ktnw ];
+      f_TSW  = (D.f[DIR_PPM ])[kbne ];
+      f_TNE  = (D.f[DIR_MMM ])[kbsw ];
+      f_TNW  = (D.f[DIR_PMM ])[kbse ];
+      f_TSE  = (D.f[DIR_MPM ])[kbnw ];
+      ////////////////////////////////////////////////////////////////////////////////
+      real vx1, vx2, vx3, drho, feq, q;
+      drho   =  f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW +
+         f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW +
+         f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]);
+
+      vx1    = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
+         ((f_BE - f_TW)   + (f_TE - f_BW))   + ((f_SE - f_NW)   + (f_NE - f_SW)) +
+         (f_E - f_W))/(c1o1+drho);
+
+
+      vx2    =  ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) +
+         ((f_BN - f_TS)   + (f_TN - f_BS))    + (-(f_SE - f_NW)  + (f_NE - f_SW)) +
+         (f_N - f_S))/(c1o1+drho);
+
+      vx3    =  (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) +
+         (-(f_BN - f_TS)  + (f_TN - f_BS))   + ((f_TE - f_BW)   - (f_BE - f_TW)) +
+         (f_T - f_B))/(c1o1+drho);
+
+      real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);
+
+      //////////////////////////////////////////////////////////////////////////
+      if (isEvenTimestep==false)
+      {
+         D.f[DIR_P00   ] = &DD[DIR_P00   *size_Mat];
+         D.f[DIR_M00   ] = &DD[DIR_M00   *size_Mat];
+         D.f[DIR_0P0   ] = &DD[DIR_0P0   *size_Mat];
+         D.f[DIR_0M0   ] = &DD[DIR_0M0   *size_Mat];
+         D.f[DIR_00P   ] = &DD[DIR_00P   *size_Mat];
+         D.f[DIR_00M   ] = &DD[DIR_00M   *size_Mat];
+         D.f[DIR_PP0  ] = &DD[DIR_PP0  *size_Mat];
+         D.f[DIR_MM0  ] = &DD[DIR_MM0  *size_Mat];
+         D.f[DIR_PM0  ] = &DD[DIR_PM0  *size_Mat];
+         D.f[DIR_MP0  ] = &DD[DIR_MP0  *size_Mat];
+         D.f[DIR_P0P  ] = &DD[DIR_P0P  *size_Mat];
+         D.f[DIR_M0M  ] = &DD[DIR_M0M  *size_Mat];
+         D.f[DIR_P0M  ] = &DD[DIR_P0M  *size_Mat];
+         D.f[DIR_M0P  ] = &DD[DIR_M0P  *size_Mat];
+         D.f[DIR_0PP  ] = &DD[DIR_0PP  *size_Mat];
+         D.f[DIR_0MM  ] = &DD[DIR_0MM  *size_Mat];
+         D.f[DIR_0PM  ] = &DD[DIR_0PM  *size_Mat];
+         D.f[DIR_0MP  ] = &DD[DIR_0MP  *size_Mat];
+         D.f[DIR_000] = &DD[DIR_000*size_Mat];
+         D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat];
+         D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat];
+         D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat];
+         D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat];
+         D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat];
+         D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat];
+         D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat];
+         D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat];
+      }
+      else
+      {
+         D.f[DIR_M00   ] = &DD[DIR_P00   *size_Mat];
+         D.f[DIR_P00   ] = &DD[DIR_M00   *size_Mat];
+         D.f[DIR_0M0   ] = &DD[DIR_0P0   *size_Mat];
+         D.f[DIR_0P0   ] = &DD[DIR_0M0   *size_Mat];
+         D.f[DIR_00M   ] = &DD[DIR_00P   *size_Mat];
+         D.f[DIR_00P   ] = &DD[DIR_00M   *size_Mat];
+         D.f[DIR_MM0  ] = &DD[DIR_PP0  *size_Mat];
+         D.f[DIR_PP0  ] = &DD[DIR_MM0  *size_Mat];
+         D.f[DIR_MP0  ] = &DD[DIR_PM0  *size_Mat];
+         D.f[DIR_PM0  ] = &DD[DIR_MP0  *size_Mat];
+         D.f[DIR_M0M  ] = &DD[DIR_P0P  *size_Mat];
+         D.f[DIR_P0P  ] = &DD[DIR_M0M  *size_Mat];
+         D.f[DIR_M0P  ] = &DD[DIR_P0M  *size_Mat];
+         D.f[DIR_P0M  ] = &DD[DIR_M0P  *size_Mat];
+         D.f[DIR_0MM  ] = &DD[DIR_0PP  *size_Mat];
+         D.f[DIR_0PP  ] = &DD[DIR_0MM  *size_Mat];
+         D.f[DIR_0MP  ] = &DD[DIR_0PM  *size_Mat];
+         D.f[DIR_0PM  ] = &DD[DIR_0MP  *size_Mat];
+         D.f[DIR_000] = &DD[DIR_000*size_Mat];
+         D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat];
+         D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat];
+         D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat];
+         D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat];
+         D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat];
+         D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat];
+         D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat];
+         D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat];
+      }
+      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+      //Test
+      //(D.f[DIR_000])[k]=c1o10;
+      real rhoDiff = drho - rho[k];
+      real VeloX = vx1;
+      real VeloY = vx2;
+      real VeloZ = vx3;
+      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+      q = q_dirE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*( vx1        )*( vx1        )-cu_sq);
+         (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c2o27*(rhoDiff + c6o1*( VeloX     )))/(c1o1+q);
+      }
+
+      q = q_dirW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*(-vx1        )*(-vx1        )-cu_sq);
+         (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c2o27*(rhoDiff + c6o1*(-VeloX     )))/(c1o1+q);
+      }
+
+      q = q_dirN[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*(     vx2    )*(     vx2    )-cu_sq);
+         (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c2o27*(rhoDiff + c6o1*( VeloY     )))/(c1o1+q);
+      }
+
+      q = q_dirS[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*(    -vx2    )*(    -vx2    )-cu_sq);
+         (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c2o27*(rhoDiff + c6o1*(-VeloY     )))/(c1o1+q);
+      }
+
+      q = q_dirT[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*(         vx3)*(         vx3)-cu_sq);
+         (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c2o27*(rhoDiff + c6o1*( VeloZ     )))/(c1o1+q);
+      }
+
+      q = q_dirB[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c2o27* (drho+c9o2*(        -vx3)*(        -vx3)-cu_sq);
+         (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c2o27*(rhoDiff + c6o1*(-VeloZ     )))/(c1o1+q);
+      }
+
+      q = q_dirNE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*( vx1+vx2    )*( vx1+vx2    )-cu_sq);
+         (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c1o54*(rhoDiff + c6o1*(VeloX+VeloY)))/(c1o1+q);
+      }
+
+      q = q_dirSW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(-vx1-vx2    )*(-vx1-vx2    )-cu_sq);
+         (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloY)))/(c1o1+q);
+      }
+
+      q = q_dirSE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*( vx1-vx2    )*( vx1-vx2    )-cu_sq);
+         (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloY)))/(c1o1+q);
+      }
+
+      q = q_dirNW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(-vx1+vx2    )*(-vx1+vx2    )-cu_sq);
+         (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloY)))/(c1o1+q);
+      }
+
+      q = q_dirTE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*( vx1    +vx3)*( vx1    +vx3)-cu_sq);
+         (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c1o54*(rhoDiff + c6o1*( VeloX+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(-vx1    -vx3)*(-vx1    -vx3)-cu_sq);
+         (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*( vx1    -vx3)*( vx1    -vx3)-cu_sq);
+         (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(-vx1    +vx3)*(-vx1    +vx3)-cu_sq);
+         (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTN[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(     vx2+vx3)*(     vx2+vx3)-cu_sq);
+         (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c1o54*(rhoDiff + c6o1*( VeloY+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBS[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(    -vx2-vx3)*(    -vx2-vx3)-cu_sq);
+         (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c1o54*(rhoDiff + c6o1*( -VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBN[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(     vx2-vx3)*(     vx2-vx3)-cu_sq);
+         (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c1o54*(rhoDiff + c6o1*( VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTS[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o54* (drho+c9o2*(    -vx2+vx3)*(    -vx2+vx3)-cu_sq);
+         (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c1o54*(rhoDiff + c6o1*( -VeloY+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTNE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
+         (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBSW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
+         (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBNE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
+         (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTSW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
+         (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTSE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
+         (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY+VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBNW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
+         (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirBSE[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
+         (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY-VeloZ)))/(c1o1+q);
+      }
+
+      q = q_dirTNW[k];
+      if (q>=c0o1 && q<=c1o1)
+      {
+         feq=c1o216*(drho+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);
+         (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY+VeloZ)))/(c1o1+q);
+      }
+   }
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
index 70b0c4352..477539348 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu
@@ -6,132 +6,132 @@
 
 #include <cuda.h>
 
-template<TurbulenceModel turbulenceModel> 
+template<TurbulenceModel turbulenceModel>
 std::shared_ptr< CumulantK17<turbulenceModel> > CumulantK17<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level)
 {
-	return std::shared_ptr<CumulantK17<turbulenceModel> >(new CumulantK17<turbulenceModel>(para,level));
+    return std::shared_ptr<CumulantK17<turbulenceModel> >(new CumulantK17<turbulenceModel>(para,level));
 }
 
 template<TurbulenceModel turbulenceModel>
 void CumulantK17<turbulenceModel>::run()
 {
-	LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega,										
-																										para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																										para->getParD(level)->distributions.f[0],	
-																										para->getParD(level)->rho,		
-																										para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																										para->getParD(level)->turbViscosity,
-																										para->getSGSConstant(),
-																										(unsigned long)para->getParD(level)->numberOfNodes,	
-																										level,			
-																										para->getForcesDev(),				
-																										para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																										para->getQuadricLimitersDev(),			
-																										para->getParD(level)->isEvenTimestep,
-																										para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
-																										para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
+    LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega,
+                                                                                                        para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+                                                                                                        para->getParD(level)->distributions.f[0],
+                                                                                                        para->getParD(level)->rho,
+                                                                                                        para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+                                                                                                        para->getParD(level)->turbViscosity,
+                                                                                                        para->getSGSConstant(),
+                                                                                                        (unsigned long)para->getParD(level)->numberOfNodes,
+                                                                                                        level,
+                                                                                                        para->getForcesDev(),
+                                                                                                        para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+                                                                                                        para->getQuadricLimitersDev(),
+                                                                                                        para->getParD(level)->isEvenTimestep,
+                                                                                                        para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
+                                                                                                        para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
 
-	getLastCudaError("LB_Kernel_CumulantK17 execution failed");
+    getLastCudaError("LB_Kernel_CumulantK17 execution failed");
 }
 
 template<TurbulenceModel turbulenceModel>
 void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex )
 {
-	cudaStream_t stream = para->getStreamManager()->getStream(streamIndex);
-	
-	switch (collisionTemplate)
-	{
-		case CollisionTemplate::Default:
-			LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(para->getParD(level)->omega,								
-																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																														para->getParD(level)->distributions.f[0],	
-																														para->getParD(level)->rho,		
-																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																														para->getParD(level)->turbViscosity,
-																														para->getSGSConstant(),
-																														(unsigned long)para->getParD(level)->numberOfNodes,	
-																														level,			
-																														para->getForcesDev(),				
-																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																														para->getQuadricLimitersDev(),			
-																														para->getParD(level)->isEvenTimestep,
-																														indices,
-																														size_indices);
-			break;
-		
-		case CollisionTemplate::WriteMacroVars:
-			LB_Kernel_CumulantK17 < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,										
-																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																														para->getParD(level)->distributions.f[0],	
-																														para->getParD(level)->rho,		
-																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																														para->getParD(level)->turbViscosity,
-																														para->getSGSConstant(),
-																														(unsigned long)para->getParD(level)->numberOfNodes,	
-																														level,			
-																														para->getForcesDev(),				
-																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																														para->getQuadricLimitersDev(),			
-																														para->getParD(level)->isEvenTimestep,
-																														indices,
-																														size_indices);
-			break;
-		
-		case CollisionTemplate::SubDomainBorder:
-		case CollisionTemplate::AllFeatures:
-			LB_Kernel_CumulantK17 < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  para->getParD(level)->omega,
-																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																														para->getParD(level)->distributions.f[0],	
-																														para->getParD(level)->rho,		
-																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																														para->getParD(level)->turbViscosity,
-																														para->getSGSConstant(),
-																														(unsigned long)para->getParD(level)->numberOfNodes,	
-																														level,			
-																														para->getForcesDev(),				
-																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																														para->getQuadricLimitersDev(),			
-																														para->getParD(level)->isEvenTimestep,
-																														indices,
-																														size_indices);
-			break;	case CollisionTemplate::ApplyBodyForce:
-			LB_Kernel_CumulantK17 < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,									
-																														para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																														para->getParD(level)->distributions.f[0],	
-																														para->getParD(level)->rho,		
-																														para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																														para->getParD(level)->turbViscosity,
-																														para->getSGSConstant(),
-																														(unsigned long)para->getParD(level)->numberOfNodes,	
-																														level,			
-																														para->getForcesDev(),				
-																														para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																														para->getQuadricLimitersDev(),			
-																														para->getParD(level)->isEvenTimestep,
-																														indices,
-																														size_indices);
-			break;	default:
-			throw std::runtime_error("Invalid CollisionTemplate in CumulantK17::runOnIndices()");
-			break;
-	}
+    cudaStream_t stream = para->getStreamManager()->getStream(streamIndex);
+
+    switch (collisionTemplate)
+    {
+        case CollisionTemplate::Default:
+            LB_Kernel_CumulantK17 < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(para->getParD(level)->omega,
+                                                                                                                        para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+                                                                                                                        para->getParD(level)->distributions.f[0],
+                                                                                                                        para->getParD(level)->rho,
+                                                                                                                        para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+                                                                                                                        para->getParD(level)->turbViscosity,
+                                                                                                                        para->getSGSConstant(),
+                                                                                                                        (unsigned long)para->getParD(level)->numberOfNodes,
+                                                                                                                        level,
+                                                                                                                        para->getForcesDev(),
+                                                                                                                        para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+                                                                                                                        para->getQuadricLimitersDev(),
+                                                                                                                        para->getParD(level)->isEvenTimestep,
+                                                                                                                        indices,
+                                                                                                                        size_indices);
+            break;
+
+        case CollisionTemplate::WriteMacroVars:
+            LB_Kernel_CumulantK17 < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,
+                                                                                                                        para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+                                                                                                                        para->getParD(level)->distributions.f[0],
+                                                                                                                        para->getParD(level)->rho,
+                                                                                                                        para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+                                                                                                                        para->getParD(level)->turbViscosity,
+                                                                                                                        para->getSGSConstant(),
+                                                                                                                        (unsigned long)para->getParD(level)->numberOfNodes,
+                                                                                                                        level,
+                                                                                                                        para->getForcesDev(),
+                                                                                                                        para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+                                                                                                                        para->getQuadricLimitersDev(),
+                                                                                                                        para->getParD(level)->isEvenTimestep,
+                                                                                                                        indices,
+                                                                                                                        size_indices);
+            break;
 
-	getLastCudaError("LB_Kernel_CumulantK17 execution failed");
+        case CollisionTemplate::SubDomainBorder:
+        case CollisionTemplate::AllFeatures:
+            LB_Kernel_CumulantK17 < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  para->getParD(level)->omega,
+                                                                                                                        para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+                                                                                                                        para->getParD(level)->distributions.f[0],
+                                                                                                                        para->getParD(level)->rho,
+                                                                                                                        para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+                                                                                                                        para->getParD(level)->turbViscosity,
+                                                                                                                        para->getSGSConstant(),
+                                                                                                                        (unsigned long)para->getParD(level)->numberOfNodes,
+                                                                                                                        level,
+                                                                                                                        para->getForcesDev(),
+                                                                                                                        para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+                                                                                                                        para->getQuadricLimitersDev(),
+                                                                                                                        para->getParD(level)->isEvenTimestep,
+                                                                                                                        indices,
+                                                                                                                        size_indices);
+            break;	case CollisionTemplate::ApplyBodyForce:
+            LB_Kernel_CumulantK17 < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega,
+                                                                                                                        para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+                                                                                                                        para->getParD(level)->distributions.f[0],
+                                                                                                                        para->getParD(level)->rho,
+                                                                                                                        para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+                                                                                                                        para->getParD(level)->turbViscosity,
+                                                                                                                        para->getSGSConstant(),
+                                                                                                                        (unsigned long)para->getParD(level)->numberOfNodes,
+                                                                                                                        level,
+                                                                                                                        para->getForcesDev(),
+                                                                                                                        para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+                                                                                                                        para->getQuadricLimitersDev(),
+                                                                                                                        para->getParD(level)->isEvenTimestep,
+                                                                                                                        indices,
+                                                                                                                        size_indices);
+            break;	default:
+            throw std::runtime_error("Invalid CollisionTemplate in CumulantK17::runOnIndices()");
+            break;
+    }
+
+    getLastCudaError("LB_Kernel_CumulantK17 execution failed");
 }
 
 template<TurbulenceModel turbulenceModel>
 CumulantK17<turbulenceModel>::CumulantK17(std::shared_ptr<Parameter> para, int level)
 {
-	this->para = para;
-	this->level = level;
+    this->para = para;
+    this->level = level;
+
+    myPreProcessorTypes.push_back(InitCompSP27);
 
-	myPreProcessorTypes.push_back(InitCompSP27);
+    myKernelGroup = BasicKernel;
 
-	myKernelGroup = BasicKernel;
+    this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes);
+    this->kernelUsesFluidNodeIndices = true;
 
-	this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes);
-	this->kernelUsesFluidNodeIndices = true;
-	
-	VF_LOG_INFO("Using turbulence model: {}", turbulenceModel);
+    VF_LOG_INFO("Using turbulence model: {}", turbulenceModel);
 }
 
 template class CumulantK17<TurbulenceModel::AMD>;
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
index 34a444230..77e5172da 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu
@@ -1,28 +1,28 @@
 
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -32,17 +32,17 @@
 //! \brief Kernel for CumulantK17 including different turbulence models and options for local body forces and writing macroscopic variables
 //!
 //! CumulantK17 kernel using chimera transformations and quartic limiters as present in Geier et al. (2017). Additional options are three different
-//! eddy-viscosity turbulence models (Smagorinsky, AMD, QR) that can be set via the template parameter turbulenceModel (with default 
-//! TurbulenceModel::None). 
+//! eddy-viscosity turbulence models (Smagorinsky, AMD, QR) that can be set via the template parameter turbulenceModel (with default
+//! TurbulenceModel::None).
 //! The kernel is executed separately for each subset of fluid node indices with a different tag CollisionTemplate. For each subset, only the locally
-//! required options are switched on ( \param writeMacroscopicVariables and/or \param applyBodyForce) in order to minimize memory accesses. The default 
-//! refers to the plain cumlant kernel (CollisionTemplate::Default). 
-//! Nodes are added to subsets (taggedFluidNodes) in Simulation::init using a corresponding tag with different values of CollisionTemplate. These subsets 
+//! required options are switched on ( \param writeMacroscopicVariables and/or \param applyBodyForce) in order to minimize memory accesses. The default
+//! refers to the plain cumlant kernel (CollisionTemplate::Default).
+//! Nodes are added to subsets (taggedFluidNodes) in Simulation::init using a corresponding tag with different values of CollisionTemplate. These subsets
 //! are provided by the utilized PostCollisionInteractiors depending on they specifc requirements (e.g. writeMacroscopicVariables for probes).
 
 //=======================================================================================
 /* Device code */
-#include "LBM/LB.h" 
+#include "LBM/LB.h"
 #include "lbm/constants/D3Q27.h"
 #include <lbm/constants/NumericConstants.h>
 #include "Kernel/Utilities/DistributionHelper.cuh"
@@ -57,25 +57,25 @@ using namespace vf::lbm::dir;
 ////////////////////////////////////////////////////////////////////////////////
 template<TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce>
 __global__ void LB_Kernel_CumulantK17(
-	real omega_in,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	real* distributions,
+    real omega_in,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    real* distributions,
     real* rho,
     real* vx,
     real* vy,
     real* vz,
     real* turbulentViscosity,
     real SGSconstant,
-	unsigned long numberOfLBnodes,
-	int level,
-	real* forces,
+    unsigned long numberOfLBnodes,
+    int level,
+    real* forces,
     real* bodyForceX,
     real* bodyForceY,
     real* bodyForceZ,
-	real* quadricLimiters,
-	bool isEvenTimestep,
+    real* quadricLimiters,
+    bool isEvenTimestep,
     const uint *fluidNodeIndices,
     uint numberOfFluidNodes)
 {
@@ -91,10 +91,10 @@ __global__ void LB_Kernel_CumulantK17(
     //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim.
     //!
     const unsigned kThread = vf::gpu::getNodeIndex();
-    
+
     //////////////////////////////////////////////////////////////////////////
     // run for all indices in size_Mat and fluid nodes
-    if (kThread >= numberOfFluidNodes) 
+    if (kThread >= numberOfFluidNodes)
         return;
     ////////////////////////////////////////////////////////////////////////////////
     //! - Get the node index from the array containing all indices of fluid nodes
@@ -202,7 +202,7 @@ __global__ void LB_Kernel_CumulantK17(
     real vvz = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) +
                 (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) *
             oneOverRho;
-    
+
     ////////////////////////////////////////////////////////////////////////////////////
     //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
     //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
@@ -212,13 +212,13 @@ __global__ void LB_Kernel_CumulantK17(
     for (size_t i = 1; i <= level; i++) {
         factor *= c2o1;
     }
-    
+
     real fx = forces[0];
     real fy = forces[1];
     real fz = forces[2];
 
     if( applyBodyForce ){
-        fx += bodyForceX[k_000]; 
+        fx += bodyForceX[k_000];
         fy += bodyForceY[k_000];
         fz += bodyForceZ[k_000];
 
@@ -232,7 +232,7 @@ __global__ void LB_Kernel_CumulantK17(
         vvx += acc_x;
         vvy += acc_y;
         vvz += acc_z;
-        
+
         // Reset body force. To be used when not using round-off correction.
         bodyForceX[k_000] = 0.0f;
         bodyForceY[k_000] = 0.0f;
@@ -243,9 +243,9 @@ __global__ void LB_Kernel_CumulantK17(
         //!
         //!> Similar to Kahan summation algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm)
         //!> Essentially computes the round-off error of the applied force and adds it in the next time step as a compensation.
-        //!> Seems to be necesseary at very high Re boundary layers, where the forcing and velocity can  
+        //!> Seems to be necesseary at very high Re boundary layers, where the forcing and velocity can
         //!> differ by several orders of magnitude.
-        //!> \note 16/05/2022: Testing, still ongoing! 
+        //!> \note 16/05/2022: Testing, still ongoing!
         //!
         // bodyForceX[k_000] = (acc_x-(vvx-vx))*factor*c2o1;
         // bodyForceY[k_000] = (acc_y-(vvy-vy))*factor*c2o1;
@@ -256,7 +256,7 @@ __global__ void LB_Kernel_CumulantK17(
         vvy += fy * c1o2 / factor;
         vvz += fz * c1o2 / factor;
     }
-    
+
 
     ////////////////////////////////////////////////////////////////////////////////////
     // calculate the square of velocities for this lattice node
@@ -723,4 +723,4 @@ template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, f
 
 template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
+template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
index b8cc9543e..55c22def9 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh
@@ -5,25 +5,25 @@
 #include <curand.h>
 
 template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void LB_Kernel_CumulantK17(
-	real omega_in,
-	uint* neighborX,
-	uint* neighborY,
-	uint* neighborZ,
-	real* distributions,
-	real* rho,
-	real* vx,
+    real omega_in,
+    uint* neighborX,
+    uint* neighborY,
+    uint* neighborZ,
+    real* distributions,
+    real* rho,
+    real* vx,
     real* vy,
     real* vz,
-	real* turbulentViscosity,
-	real SGSconstant,
-	unsigned long numberOfLBnodes,
-	int level,
-	real* forces,
-	real* bodyForceX,
-	real* bodyForceY,
-	real* bodyForceZ,
-	real* quadricLimiters,
-	bool isEvenTimestep,
-	const uint *fluidNodeIndices,
+    real* turbulentViscosity,
+    real SGSconstant,
+    unsigned long numberOfLBnodes,
+    int level,
+    real* forces,
+    real* bodyForceX,
+    real* bodyForceY,
+    real* bodyForceZ,
+    real* quadricLimiters,
+    bool isEvenTimestep,
+    const uint *fluidNodeIndices,
     uint numberOfFluidNodes);
 #endif
diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
index 1310cf09e..e8fc3f318 100644
--- a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp
@@ -428,4 +428,4 @@ void BCKernelManager::runPrecursorBCKernelPost(int level, uint t, CudaMemoryMana
     
     real tRatio = real(t_level-lastTime)/para->getParD(level)->precursorBC.timeStepsBetweenReads;
     precursorBoundaryConditionPost(para->getParD(level).get(), &para->getParD(level)->precursorBC, tRatio, para->getVelocityRatio());
-}
\ No newline at end of file
+}
diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h
index a7517ca0f..cfdbbbae0 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/LB.h
+++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h
@@ -15,9 +15,9 @@
 
 //////////////////////////
 //porous media
-#define GEO_PM_0		 5
-#define GEO_PM_1		 6
-#define GEO_PM_2		 7
+#define GEO_PM_0         5
+#define GEO_PM_1         6
+#define GEO_PM_2         7
 //////////////////////////
 
 #define GEO_SOLID       15
@@ -191,7 +191,7 @@ typedef struct OffFC{
 
 // Distribution functions g 6
 typedef struct  Distri6 {
-	real* g[6];
+   real* g[6];
 } Distributions6;
 
 // Distribution functions f 7
@@ -284,55 +284,53 @@ typedef struct WMparas{
 
 //measurePoints
 typedef struct MeasP{
-	std::string name;
-	uint k;
-	std::vector<real> Vx;
-	std::vector<real> Vy;
-	std::vector<real> Vz;
-	std::vector<real> Rho;
-	//real* Vx;
-	//real* Vy;
-	//real* Vz;
-	//real* Rho;
+   std::string name;
+   uint k;
+   std::vector<real> Vx;
+   std::vector<real> Vy;
+   std::vector<real> Vz;
+   std::vector<real> Rho;
+   //real* Vx;
+   //real* Vy;
+   //real* Vz;
+   //real* Rho;
 }MeasurePoints;
 
 //Process Neighbors
 typedef struct PN27{
-	real* f[27];
-	uint memsizeFs;
-	int* index;
-	uint memsizeIndex;
-	uint rankNeighbor;
-	int numberOfNodes;
-	int numberOfFs;
+   real* f[27];
+   uint memsizeFs;
+   int* index;
+   uint memsizeIndex;
+   uint rankNeighbor;
+   int numberOfNodes;
+   int numberOfFs;
 }ProcessNeighbor27;
 
 typedef struct PN_F3 {
-	real* g[6];
-	uint memsizeGs;
-	int* index;
-	uint memsizeIndex;
-	uint rankNeighbor;
-	int numberOfNodes;
-	int numberOfGs;
+   real* g[6];
+   uint memsizeGs;
+   int* index;
+   uint memsizeIndex;
+   uint rankNeighbor;
+   int numberOfNodes;
+   int numberOfGs;
 }ProcessNeighborF3;
 
 //path line particles
 typedef struct PLP{
-	bool *stuck, *hot;
-	real *coordXabsolut, *coordYabsolut, *coordZabsolut;
-	real *coordXlocal,   *coordYlocal,   *coordZlocal;
-	real *veloX,         *veloY,         *veloZ;
-	real *randomLocationInit;
-	uint *timestep;
-	uint *ID;
-	uint *cellBaseID;
-	uint numberOfParticles, numberOfTimestepsParticles;
-	uint memSizeID, memSizeTimestep, memSizerealAll, memSizereal, memSizeBool, memSizeBoolBC;
+   bool *stuck, *hot;
+   real *coordXabsolut, *coordYabsolut, *coordZabsolut;
+   real *coordXlocal,   *coordYlocal,   *coordZlocal;
+   real *veloX,         *veloY,         *veloZ;
+   real *randomLocationInit;
+   uint *timestep;
+   uint *ID;
+   uint *cellBaseID;
+   uint numberOfParticles, numberOfTimestepsParticles;
+   uint memSizeID, memSizeTimestep, memSizerealAll, memSizereal, memSizeBool, memSizeBoolBC;
 }PathLineParticles;
 
-
-
 //////////////////////////////////////////////////////////////////////////
 inline int vectorPosition(int i, int j, int k, int Lx, int Ly )
 {
@@ -341,7 +339,4 @@ inline int vectorPosition(int i, int j, int k, int Lx, int Ly )
 }
 //////////////////////////////////////////////////////////////////////////
 
-
 #endif
-
-
diff --git a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
index 53e030c0d..95fea46d4 100644
--- a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
+++ b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.h
@@ -1,28 +1,28 @@
 //=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+// ____          ____    __    ______     __________   __      __       __        __
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|
+//      \    \  |    |   ________________________________________________________________
+//       \    \ |    |  |  ______________________________________________________________|
+//        \    \|    |  |  |         __          __     __     __     ______      _______
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______
 //           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/
 //
-//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can
 //  redistribute it and/or modify it under the terms of the GNU General Public
-//  License as published by the Free Software Foundation, either version 3 of 
+//  License as published by the Free Software Foundation, either version 3 of
 //  the License, or (at your option) any later version.
-//  
-//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
-//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 //  for more details.
-//  
+//
 //  You should have received a copy of the GNU General Public License along
 //  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
 //
@@ -45,7 +45,7 @@
 class DistributionDebugInspector
 {
 public:
-	DistributionDebugInspector(uint _inspectionLevel, real _minX, real _maxX, real _minY, real _maxY, real _minZ, real _maxZ, std::string _tag):
+    DistributionDebugInspector(uint _inspectionLevel, real _minX, real _maxX, real _minY, real _maxY, real _minZ, real _maxZ, std::string _tag):
     inspectionLevel(_inspectionLevel),
     minX(_minX),
     maxX(_maxX),
@@ -55,8 +55,8 @@ public:
     maxZ(_maxZ),
     tag(_tag)
     {};
-	
-    ~DistributionDebugInspector(){}
+
+    ~DistributionDebugInspector() = default;
 
     void inspect(std::shared_ptr<Parameter> para, uint level, uint t);
 
@@ -73,4 +73,4 @@ std::string tag;
 
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
index f771ce10c..8e21cdb6b 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
@@ -44,10 +44,7 @@ public:
             throw std::runtime_error("ActuatorFarm::ActuatorFarm: epsilon needs to be larger than dx!");
     }
 
-    virtual  ~ActuatorFarm()
-    {
-        
-    }
+    ~ActuatorFarm() override = default;
     void addTurbine(real turbinePosX, real turbinePosY, real turbinePosZ, real diameter, real omega, real azimuth, real yaw, std::vector<real> bladeRadii);
     void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager) override;
     void interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t) override;
@@ -197,4 +194,4 @@ private:
     int streamIndex;
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
index 3959fb2d8..3bae63a33 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.h
@@ -158,4 +158,4 @@ private:
     uint writePrecision = 8;
 };
 
-#endif //PRECURSORPROBE_H_
\ No newline at end of file
+#endif //PRECURSORPROBE_H_
-- 
GitLab


From aec9f88ad2f5269b3d2dafd4b62e2a1c4d366f66 Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Tue, 13 Sep 2022 16:01:13 +0200
Subject: [PATCH 146/179] Use hpc-rocket in pipeline

---
 .gitlab-ci.yml                         | 22 +++++++++++++++++++---
 Python/SlurmTests/poiseuille/slurm.job |  1 +
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 081faa4b2..f209d7843 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -139,6 +139,7 @@ gcc_9_python:
 ##                            Container Upload                               ##
 ###############################################################################
 build_singularity_image:
+  image: quay.io/singularity/singularity
   stage: container_upload
 
   needs:
@@ -148,12 +149,13 @@ build_singularity_image:
     - linux
     - privileged
 
-  rules:
-    - if: $CI_COMMIT_TAG
+  artifacts:
+    expire_in: 1 hrs
+    paths:
+      - Containers/VirtualFluidsPython.sif
 
   script:
     - singularity build Containers/VirtualFluidsPython.sif Containers/VirtualFluidsPython.def
-    - singularity push --docker-username "${CI_REGISTRY_USER}" --docker-password "${CI_REGISTRY_PASSWORD}" Containers/VirtualFluidsPython.sif oras://"$CI_REGISTRY_IMAGE"/"$CI_PROJECT_NAME":"$CI_COMMIT_TAG"
 
 ###############################################################################
 ##                                Tests                                      ##
@@ -203,6 +205,20 @@ gcc_9_python_bindings_test:
     - python3 -m unittest discover -s Python -v
 
 
+###############################################################################
+gcc_9_python_hpc_test:
+  image: python:latest
+  stage: test
+
+  needs: ["build_singularity_image"]
+
+  before_script:
+    - pip install hpc-rocket
+
+  script:
+    - hpc-rocket launch --watch rocket.yml
+
+
 ###############################################################################
 ##                            Benchmark                                      ##
 ###############################################################################
diff --git a/Python/SlurmTests/poiseuille/slurm.job b/Python/SlurmTests/poiseuille/slurm.job
index 488fc9a42..8115b13e1 100644
--- a/Python/SlurmTests/poiseuille/slurm.job
+++ b/Python/SlurmTests/poiseuille/slurm.job
@@ -1,5 +1,6 @@
 #!/bin/bash
 #SBATCH -J PyFluidsTest
+#SBATCH -o POISEUILLE_TEST.out
 #SBATCH --nodes=1
 #SBATCH --ntasks-per-node=1
 #SBATCH --cpus-per-task=20
-- 
GitLab


From 91500699aebde354c31dd7d0f7178b6ea538d8aa Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Tue, 13 Sep 2022 16:15:04 +0200
Subject: [PATCH 147/179] Build poiseuille container

---
 .gitlab-ci.yml | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f209d7843..1e1671536 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -138,13 +138,10 @@ gcc_9_python:
 ###############################################################################
 ##                            Container Upload                               ##
 ###############################################################################
-build_singularity_image:
+build_poiseuille_test_container:
   image: quay.io/singularity/singularity
   stage: container_upload
 
-  needs:
-    - gcc_9_python
-
   tags:
     - linux
     - privileged
@@ -152,10 +149,10 @@ build_singularity_image:
   artifacts:
     expire_in: 1 hrs
     paths:
-      - Containers/VirtualFluidsPython.sif
+      - Containers/PoiseuilleTestContainer.sif
 
   script:
-    - singularity build Containers/VirtualFluidsPython.sif Containers/VirtualFluidsPython.def
+    - singularity build Containers/PoiseuilleTestContainer.sif Containers/PoiseuilleTestContainer.def
 
 ###############################################################################
 ##                                Tests                                      ##
@@ -210,7 +207,7 @@ gcc_9_python_hpc_test:
   image: python:latest
   stage: test
 
-  needs: ["build_singularity_image"]
+  needs: ["build_poiseuille_test_container"]
 
   before_script:
     - pip install hpc-rocket
-- 
GitLab


From cf1250e4aa05ea4498921e4180c60fdce3ada0f1 Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Tue, 13 Sep 2022 16:16:37 +0200
Subject: [PATCH 148/179] Remove deprecated release job

---
 .gitlab-ci.yml | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1e1671536..ccaad7f09 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -617,26 +617,3 @@ sonar-scanner:
   script:
     - cd $CI_PROJECT_DIR
     - sonar-scanner -X -Dsonar.verbose=true -Dsonar.login=$SONAR_SECURITY_TOKEN
-
-###############################################################################
-##                              Release                                      ##
-###############################################################################
-create_release:
-  stage: release
-
-  image: registry.gitlab.com/gitlab-org/release-cli:latest
-
-  needs: ["build_singularity_image"]
-
-  rules:
-    - if: $CI_COMMIT_TAG
-
-  script:
-    - echo "Creating release with tag $CI_COMMIT_TAG"
-    - release-cli create --name "VirtualFluids $CI_COMMIT_TAG" \
-      --description "VirtualFluids CFD Simulator" \
-      --tag-name "$CI_COMMIT_TAG" \
-      --ref "$CI_COMMIT_SHA" \
-      --job-token "$CI_JOB_TOKEN" \
-      --assets-link="{'name':'VirtualFluidsSingularityImage_OpenMPI','url':'','type':'other','filepath':'Containers/VirtualFluidsOpenMPI.sif'}"
-    - build/bin/basicsTests
-- 
GitLab


From d274fe62043d49c7d880c6ce18927d6457b2d1ea Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Tue, 13 Sep 2022 16:19:25 +0200
Subject: [PATCH 149/179] Fix path of Poiseuille container build file

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ccaad7f09..cf3487687 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -152,7 +152,7 @@ build_poiseuille_test_container:
       - Containers/PoiseuilleTestContainer.sif
 
   script:
-    - singularity build Containers/PoiseuilleTestContainer.sif Containers/PoiseuilleTestContainer.def
+    - singularity build Containers/PoiseuilleTestContainer.sif Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def
 
 ###############################################################################
 ##                                Tests                                      ##
-- 
GitLab


From 7ce30ffe5fae7c467979691439d025b480d206eb Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Tue, 13 Sep 2022 16:32:09 +0200
Subject: [PATCH 150/179] Specify singularity image tag

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf3487687..12eba18d9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -139,7 +139,7 @@ gcc_9_python:
 ##                            Container Upload                               ##
 ###############################################################################
 build_poiseuille_test_container:
-  image: quay.io/singularity/singularity
+  image: quay.io/singularity/singularity:v3.10.2-slim
   stage: container_upload
 
   tags:
-- 
GitLab


From 4df32c9e7be9219df06f25eda6defbc8736ff08e Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 15 Sep 2022 14:12:23 +0200
Subject: [PATCH 151/179] Adds hpc-rocket config. Python bindings don't need
 CUDA if only CPU. Multistage PoiseuilleTestContainer

---
 .../poiseuille/PoiseuilleTestContainer.def    | 30 +++++++++++++++++--
 .../poiseuille/simulation_runner.py           |  2 +-
 Python/SlurmTests/poiseuille/slurm.job        |  5 +++-
 pythonbindings/CMakeLists.txt                 |  9 +++++-
 rocket.yml                                    | 23 ++++++++++++++
 5 files changed, 63 insertions(+), 6 deletions(-)
 create mode 100644 rocket.yml

diff --git a/Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def b/Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def
index a3836e790..a275c88a6 100644
--- a/Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def
+++ b/Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def
@@ -1,11 +1,13 @@
 BootStrap: docker
 From: ubuntu:20.04
+Stage: build
 
 %files
     3rdParty 3rdParty
     apps apps
     CMake CMake
     Python Python
+    pythonbindings pythonbindings
     src src
     CMakeLists.txt CMakeLists.txt
     cpu.cmake cpu.cmake
@@ -19,7 +21,8 @@ From: ubuntu:20.04
     apt-get update &&          \
     apt-get install -y         \
     build-essential            \
-    cmake=3.16.3-1ubuntu1      \
+    ccache                     \
+    git                        \
     python3                    \
     python3-dev                \
     python3-pip                \
@@ -27,10 +30,31 @@ From: ubuntu:20.04
     libomp-dev                 \
     libgl1
 
-    pip3 install setuptools wheel numpy scipy pyvista
+    pip3 install setuptools wheel cmake numpy scipy pyvista
 
     export PYTHONPATH=Python
-    python3 /setup.py install
+    python3 /setup.py bdist_wheel build_ext --build-temp=build
+    pip3 install $(find dist/*.whl)
+
+
+BootStrap: docker
+From: ubuntu:20.04
+Stage: runtime
+
+%files from build
+    Python Python
+    dist dist
+
+%post
+    export DEBIAN_FRONTEND=noninteractive
+    apt-get update &&          \
+    apt-get install -y         \
+    python3                    \
+    python3-pip                \
+    mpich                      \
+    libgl1
+
+    pip3 install $(find dist/*.whl)
 
 %environment
     export PYTHONPATH=/Python
diff --git a/Python/SlurmTests/poiseuille/simulation_runner.py b/Python/SlurmTests/poiseuille/simulation_runner.py
index 03fb24be7..d54a35e72 100644
--- a/Python/SlurmTests/poiseuille/simulation_runner.py
+++ b/Python/SlurmTests/poiseuille/simulation_runner.py
@@ -5,7 +5,7 @@ from poiseuille.simulation import run_simulation
 from pyfluids.cpu.writer import Writer, OutputFormat
 
 
-scale_level = int(os.environ["PYFLUIDS_SCALE_LEVEL"])
+scale_level = int(os.environ.get("PYFLUIDS_SCALE_LEVEL", 1))
 grid_params, physical_params, runtime_params, kernel = Scaling.configuration_for_scale_level(scale_level)
 
 writer = Writer()
diff --git a/Python/SlurmTests/poiseuille/slurm.job b/Python/SlurmTests/poiseuille/slurm.job
index 8115b13e1..b4e4da271 100644
--- a/Python/SlurmTests/poiseuille/slurm.job
+++ b/Python/SlurmTests/poiseuille/slurm.job
@@ -1,6 +1,6 @@
 #!/bin/bash
 #SBATCH -J PyFluidsTest
-#SBATCH -o POISEUILLE_TEST.out
+#SBATCH -o poiseuille_test/POISEUILLE_TEST.out
 #SBATCH --nodes=1
 #SBATCH --ntasks-per-node=1
 #SBATCH --cpus-per-task=20
@@ -10,6 +10,9 @@
 #SBATCH --partition=standard
 
 source $HOME/.bashrc
+module load singularity/3.9.9
+
+cd poiseuille_test
 
 echo "PyFluids Poiseuille Test Case"
 echo "Number of tasks: ${SLURM_NTASKS}"
diff --git a/pythonbindings/CMakeLists.txt b/pythonbindings/CMakeLists.txt
index 644b308c9..ea6ff833a 100644
--- a/pythonbindings/CMakeLists.txt
+++ b/pythonbindings/CMakeLists.txt
@@ -1,4 +1,11 @@
-project(VirtualFluidsPython LANGUAGES CUDA CXX)
+set(PYFLUIDS_LANGUAGES CXX)
+
+if(BUILD_VF_GPU)
+    set(PYFLUIDS_LANGUAGES CUDA CXX)
+endif()
+
+project(VirtualFluidsPython LANGUAGES ${PYFLUIDS_LANGUAGES})
+
 pybind11_add_module(python_bindings MODULE src/VirtualFluids.cpp)
 
 set_target_properties(  python_bindings PROPERTIES
diff --git a/rocket.yml b/rocket.yml
new file mode 100644
index 000000000..da64a48cd
--- /dev/null
+++ b/rocket.yml
@@ -0,0 +1,23 @@
+host: $REMOTE_HOST
+user: $REMOTE_USER
+private_keyfile: $PRIVATE_KEY
+
+copy:
+  - from: Python/SlurmTests/poiseuille/slurm.job
+    to: poiseuille_test/slurm.job
+    overwrite: true
+
+  - from: Containers/PoiseuilleTestContainer.sif
+    to: poiseuille_test/PoiseuilleTestContainer.sif
+    overwrite: true
+
+collect:
+  - from: poiseuille_test/POISEUILLE_TEST.out
+    to: POISEUILLE_TEST.out
+    overwrite: true
+
+clean:
+  - poiseuille_test/*
+
+sbatch: poiseuille_test/slurm.job
+continue_if_job_fails: true
-- 
GitLab


From 6bf5019ce547f5e7188e0a2e5dd3844e76bd85db Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 15 Sep 2022 14:26:28 +0200
Subject: [PATCH 152/179] Use full singularity image for container build

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 12eba18d9..cf3159107 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -139,7 +139,7 @@ gcc_9_python:
 ##                            Container Upload                               ##
 ###############################################################################
 build_poiseuille_test_container:
-  image: quay.io/singularity/singularity:v3.10.2-slim
+  image: quay.io/singularity/singularity:v3.10.2
   stage: container_upload
 
   tags:
-- 
GitLab


From 8860020779b8bb0a46db8662a8671b78ed7f3c5f Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 15 Sep 2022 15:03:33 +0200
Subject: [PATCH 153/179] Attempt container build with quotes

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf3159107..7dd6c5ba1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -152,7 +152,7 @@ build_poiseuille_test_container:
       - Containers/PoiseuilleTestContainer.sif
 
   script:
-    - singularity build Containers/PoiseuilleTestContainer.sif Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def
+    - singularity build "Containers/PoiseuilleTestContainer.sif" "Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def"
 
 ###############################################################################
 ##                                Tests                                      ##
-- 
GitLab


From 18b555874ddc2ef1afb212fade9d560e84d4bf09 Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 15 Sep 2022 15:20:19 +0200
Subject: [PATCH 154/179] Override entrypoint of singularity CI image

---
 .gitlab-ci.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7dd6c5ba1..bd4dfbf4c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -139,7 +139,10 @@ gcc_9_python:
 ##                            Container Upload                               ##
 ###############################################################################
 build_poiseuille_test_container:
-  image: quay.io/singularity/singularity:v3.10.2
+  image: 
+    name: quay.io/singularity/singularity:v3.10.2
+    entrypoint: [""]
+
   stage: container_upload
 
   tags:
-- 
GitLab


From f81f50b68363bc4bb177f2fc484625bb68c6bb71 Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 15 Sep 2022 16:49:28 +0200
Subject: [PATCH 155/179] Use env variables as rules

---
 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bd4dfbf4c..a6a6e0eb2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -145,6 +145,9 @@ build_poiseuille_test_container:
 
   stage: container_upload
 
+  rules:
+    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY
+
   tags:
     - linux
     - privileged
@@ -212,6 +215,9 @@ gcc_9_python_hpc_test:
 
   needs: ["build_poiseuille_test_container"]
 
+  rules:
+    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY
+
   before_script:
     - pip install hpc-rocket
 
-- 
GitLab


From 51ce6cfc7ac57e0a480865e2c032b50f06fea8c8 Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 6 Oct 2022 13:49:59 +0200
Subject: [PATCH 156/179] Move rocket.yml to poiseuille dir. Run HPC test only
 on schedule and manually

---
 .gitlab-ci.yml                                        | 5 +++--
 rocket.yml => Python/SlurmTests/poiseuille/rocket.yml | 0
 2 files changed, 3 insertions(+), 2 deletions(-)
 rename rocket.yml => Python/SlurmTests/poiseuille/rocket.yml (100%)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a6a6e0eb2..ebd7e51ae 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -216,13 +216,14 @@ gcc_9_python_hpc_test:
   needs: ["build_poiseuille_test_container"]
 
   rules:
-    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY
+    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
+    - when: manual
 
   before_script:
     - pip install hpc-rocket
 
   script:
-    - hpc-rocket launch --watch rocket.yml
+    - hpc-rocket launch --watch Python/SlurmTests/poiseuille/rocket.yml
 
 
 ###############################################################################
diff --git a/rocket.yml b/Python/SlurmTests/poiseuille/rocket.yml
similarity index 100%
rename from rocket.yml
rename to Python/SlurmTests/poiseuille/rocket.yml
-- 
GitLab


From 42ad0698989d341b26f1c95d542316b0e8b2287f Mon Sep 17 00:00:00 2001
From: Sven Marcus <sven.marcus@tu-braunschweig.de>
Date: Thu, 6 Oct 2022 13:52:03 +0200
Subject: [PATCH 157/179] Add missing settings to singularity build job

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ebd7e51ae..542ef02cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -146,7 +146,8 @@ build_poiseuille_test_container:
   stage: container_upload
 
   rules:
-    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY
+    - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
+    - when: manual
 
   tags:
     - linux
-- 
GitLab


From 0d75a4c4d5391548f0caa7e8965d021170f8be84 Mon Sep 17 00:00:00 2001
From: Sven Marcus <s.marcus@outlook.de>
Date: Tue, 20 Dec 2022 13:45:29 +0100
Subject: [PATCH 158/179] Adds always as condition for hpc jobs

---
 .gitlab-ci.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 542ef02cb..31bf267fa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -147,7 +147,9 @@ build_poiseuille_test_container:
 
   rules:
     - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
+      when: always
     - when: manual
+      allow_failure: true
 
   tags:
     - linux
@@ -218,7 +220,9 @@ gcc_9_python_hpc_test:
 
   rules:
     - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
+      when: always
     - when: manual
+      allow_failure: true
 
   before_script:
     - pip install hpc-rocket
-- 
GitLab


From d258102eff94eb5126fafc0662e26d18af2b1db1 Mon Sep 17 00:00:00 2001
From: Sven Marcus <s.marcus@outlook.de>
Date: Tue, 20 Dec 2022 13:48:38 +0100
Subject: [PATCH 159/179] Don't run hpc tests in MRs

---
 .gitlab-ci.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 31bf267fa..4294ee792 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -148,6 +148,8 @@ build_poiseuille_test_container:
   rules:
     - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
       when: always
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
     - when: manual
       allow_failure: true
 
@@ -221,6 +223,8 @@ gcc_9_python_hpc_test:
   rules:
     - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule"
       when: always
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: never
     - when: manual
       allow_failure: true
 
-- 
GitLab


From 1e3dd6f0f891a7a0730714c6260da929d9e925b2 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 160/179] TestSetup1

---
 .../ARAGORNUBUNTU.config.cmake                |  1 +
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 42 ++++++++++++-------
 .../LBM/ActuatorLine/configActuatorLine.txt   | 18 ++++----
 src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp  |  4 ++
 4 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake
index 90debb1a4..cd50d08b1 100644
--- a/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake
+++ b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake
@@ -13,5 +13,6 @@ set(GPU_APP "apps/gpu/LBM/")
 list(APPEND USER_APPS 
     "${GPU_APP}DrivenCavityMultiGPU"
     "${GPU_APP}SphereScaling"
+    "${GPU_APP}ActuatorLine"
     # "${GPU_APP}MusselOyster"
     )
\ No newline at end of file
diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 9d982ebac..1caf83dc5 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -39,6 +39,7 @@
 #include <fstream>
 #include <exception>
 #include <memory>
+#include <filesystem>
 
 //////////////////////////////////////////////////////////////////////////
 
@@ -114,6 +115,8 @@ void multipleLevel(const std::string& configPath)
     logging::Logger::timeStamp(logging::Logger::ENABLE);
     logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE);
 
+    VF_LOG_INFO("Start Preprocessing");
+
     vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance();
 
     auto gridFactory = GridFactory::make();
@@ -127,7 +130,7 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 24*reference_diameter;
+    const real L_x = 20*reference_diameter;
     const real L_y = 6*reference_diameter;
     const real L_z = 6*reference_diameter;
 
@@ -140,11 +143,11 @@ void multipleLevel(const std::string& configPath)
     const float tOut        = config.getValue<real>("tOut");
     const float tEnd        = config.getValue<real>("tEnd"); // total time of simulation
 
-    const float tStartAveraging     =  config.getValue<real>("tStartAveraging");
-    const float tStartTmpAveraging  =  config.getValue<real>("tStartTmpAveraging");
-    const float tAveraging          =  config.getValue<real>("tAveraging");
-    const float tStartOutProbe      =  config.getValue<real>("tStartOutProbe");
-    const float tOutProbe           =  config.getValue<real>("tOutProbe");
+    // const float tStartAveraging     =  config.getValue<real>("tStartAveraging");
+    // const float tStartTmpAveraging  =  config.getValue<real>("tStartTmpAveraging");
+    // const float tAveraging          =  config.getValue<real>("tAveraging");
+    // const float tStartOutProbe      =  config.getValue<real>("tStartOutProbe");
+    // const float tOutProbe           =  config.getValue<real>("tOutProbe");
         
     SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config);
     BoundaryConditionFactory bcFactory = BoundaryConditionFactory();
@@ -152,12 +155,12 @@ void multipleLevel(const std::string& configPath)
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-	const real dx = reference_diameter/real(nodes_per_diameter);
+    const real dx = reference_diameter/real(nodes_per_diameter);
 
     real turbPos[3] = {3*reference_diameter, 3*reference_diameter, 3*reference_diameter};
 
-	gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
-							   L_x,  L_y,  L_z, dx);
+    gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
+                               L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
     gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.5*reference_diameter,  turbPos[1]-1.5*reference_diameter,  turbPos[2]-1.5*reference_diameter, 
@@ -165,11 +168,11 @@ void multipleLevel(const std::string& configPath)
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
-	gridBuilder->setPeriodicBoundaryCondition(false, false, false);
+    gridBuilder->setPeriodicBoundaryCondition(false, false, false);
 
-	gridBuilder->buildGrids(lbmOrGks, false); // buildGrids() has to be called before setting the BCs!!!!
+    gridBuilder->buildGrids(lbmOrGks, false); // buildGrids() has to be called before setting the BCs!!!!
 
-	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     const real dt = dx * mach / (sqrt(3) * velocity);
 
@@ -274,11 +277,20 @@ int main( int argc, char* argv[])
     {
         try
         {
-            vf::logging::Logger::initalizeLogger();
+            //////////////////////////////////////////////////////////////////////////
+            // assuming that a config files is stored parallel to this file.
+            std::filesystem::path configPath = __FILE__;
+
+            // the config file's default name can be replaced by passing a command line argument
+            std::string configName("configActuatorLine.txt");
+            if (argc == 2) {
+                configName = argv[1];
+                std::cout << "Using configFile command line argument: " << configName << std::endl;
+            }
 
-            if( argc > 1){ path = argv[1]; }
+            configPath.replace_filename(configName);
 
-            multipleLevel(path + "/configActuatorLine.txt");
+            multipleLevel(configPath);
         }
         catch (const spdlog::spdlog_ex &ex) {
             std::cout << "Log initialization failed: " << ex.what() << std::endl;
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 5799f2471..311121235 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -1,14 +1,14 @@
 ##################################################
 #informations for Writing
 ##################################################
-Path = .
+# Path = ./output
 ##################################################
 #informations for reading
 ##################################################
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=32
+NodesPerDiameter=16
 Velocity=9
 ##################################################
 tStartOut=100
@@ -16,15 +16,15 @@ tOut=100
 tEnd=1000
 ##################################################
 
-tStartTmpAveraging=100
-tStartAveraging=100
-tAveraging=100
-tTmpAveraging=100
-tStartOutProbe=100
-tOutProbe=100
+# tStartTmpAveraging=100
+# tStartAveraging=100
+# tAveraging=100
+# tTmpAveraging=100
+# tStartOutProbe=100
+# tOutProbe=100
 
 ##################################################
-#TurbulenceModel = QR
+TurbulenceModel = None
 #SGSconstant = 0.3333333
 #
 #QuadricLimiterP = 100000.0
diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
index 84ab84ff9..74e37b4cb 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
+++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -461,6 +461,10 @@ void Simulation::run()
     ////////////////////////////////////////////////////////////////////////////////
     // Time loop
     ////////////////////////////////////////////////////////////////////////////////
+
+    puts("\n\n\n\n\n\n");
+    VF_LOG_INFO("Start Simulation \n");
+
     for(timestep=para->getTimestepStart();timestep<=para->getTimestepEnd();timestep++)
     {
         this->updateGrid27->updateGrid(0, timestep);
-- 
GitLab


From b5776b6b52b4ecedc92d2b7b8760ee31c6dce742 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 161/179] smaller

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 21 +++++++++----------
 .../LBM/ActuatorLine/configActuatorLine.txt   |  6 +++---
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 1caf83dc5..bcf23ee40 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -130,8 +130,8 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 20*reference_diameter;
-    const real L_y = 6*reference_diameter;
+    const real L_x = 12*reference_diameter;
+    const real L_y = 5*reference_diameter;
     const real L_z = 6*reference_diameter;
 
     const real viscosity = 1.56e-5;
@@ -157,14 +157,14 @@ void multipleLevel(const std::string& configPath)
 
     const real dx = reference_diameter/real(nodes_per_diameter);
 
-    real turbPos[3] = {3*reference_diameter, 3*reference_diameter, 3*reference_diameter};
+    real turbPos[3] = {2*reference_diameter, 2*reference_diameter, 3*reference_diameter};
 
     gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
                                L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
-    gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.5*reference_diameter,  turbPos[1]-1.5*reference_diameter,  turbPos[2]-1.5*reference_diameter, 
-                                        turbPos[0]+10.0*reference_diameter, turbPos[1]+1.5*reference_diameter,  turbPos[2]+1.5*reference_diameter) , 1 );
+    gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.0*reference_diameter,  turbPos[1]-1.5*reference_diameter,  turbPos[2]-1.5*reference_diameter, 
+                                        turbPos[0]+6.0*reference_diameter,  turbPos[1]+1.5*reference_diameter,  turbPos[2]+1.5*reference_diameter) , 1 );
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
@@ -213,12 +213,11 @@ void multipleLevel(const std::string& configPath)
 
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-    gridBuilder->setVelocityBoundaryCondition(SideType::MX,  velocityLB,  0.0, 0.0);
-
-    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  velocityLB,  0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::PY,  velocityLB,  0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::MZ,  velocityLB,  0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB,  0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::MX,  velocityLB, 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  0.0       , 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::PY,  velocityLB, 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::MZ,  velocityLB, 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
 
     bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible);
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 311121235..3f94f328a 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,12 +8,12 @@
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=16
+NodesPerDiameter=20
 Velocity=9
 ##################################################
 tStartOut=100
-tOut=100
-tEnd=1000
+tOut=50
+tEnd=500
 ##################################################
 
 # tStartTmpAveraging=100
-- 
GitLab


From 1b9981073527fbec4a74a3f924318bf8f19907a1 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 162/179] Make Grid::findFluidNodeIndicesBorder() private

---
 src/gpu/GridGenerator/grid/Grid.h    | 1 -
 src/gpu/GridGenerator/grid/GridImp.h | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gpu/GridGenerator/grid/Grid.h b/src/gpu/GridGenerator/grid/Grid.h
index 85b19bedd..bc46e6b23 100644
--- a/src/gpu/GridGenerator/grid/Grid.h
+++ b/src/gpu/GridGenerator/grid/Grid.h
@@ -175,7 +175,6 @@ public:
     virtual uint getNumberOfFluidNodes() const = 0;
     virtual void getFluidNodeIndices(uint *fluidNodeIndices) const = 0;
 
-    virtual void findFluidNodeIndicesBorder() = 0;
     virtual uint getNumberOfFluidNodesBorder() const = 0;
     virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const = 0;
 
diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h
index 8283bf569..d518868b6 100644
--- a/src/gpu/GridGenerator/grid/GridImp.h
+++ b/src/gpu/GridGenerator/grid/GridImp.h
@@ -343,6 +343,8 @@ private:
 
     void allocateQs();
 
+    void findFluidNodeIndicesBorder();
+
 public:
     void findCommunicationIndices(int direction, SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) override;
     void findCommunicationIndex(uint index, real coordinate, real limit, int direction);
@@ -359,7 +361,6 @@ public:
     void repairCommunicationIndices(int direction) override;
 
     void findFluidNodeIndices(bool splitDomain) override;
-    void findFluidNodeIndicesBorder() override;
 
     uint getNumberOfFluidNodes() const override;
     void getFluidNodeIndices(uint *fluidNodeIndices) const override;
-- 
GitLab


From d1bd595c157b7e93b22968ece28f672cc627ccf7 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 163/179] Add spongeKernel

---
 .../CumulantK17Sponge/CumulantK17Sponge.cu    | 156 ++++
 .../CumulantK17Sponge/CumulantK17Sponge.h     |  20 +
 .../CumulantK17Sponge_Device.cu               | 728 ++++++++++++++++++
 .../CumulantK17Sponge_Device.cuh              |  31 +
 4 files changed, 935 insertions(+)
 create mode 100644 src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
 create mode 100644 src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.h
 create mode 100644 src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
 create mode 100644 src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
new file mode 100644
index 000000000..7a313e783
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
@@ -0,0 +1,156 @@
+#include "CumulantK17Sponge.h"
+#include <logger/Logger.h>
+#include "Parameter/Parameter.h"
+#include "Parameter/CudaStreamManager.h"
+#include "CumulantK17Sponge_Device.cuh"
+
+#include <cuda.h>
+
+template<TurbulenceModel turbulenceModel> 
+std::shared_ptr< CumulantK17Sponge<turbulenceModel> > CumulantK17Sponge<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level)
+{
+	return std::shared_ptr<CumulantK17Sponge<turbulenceModel> >(new CumulantK17Sponge<turbulenceModel>(para,level));
+}
+
+template<TurbulenceModel turbulenceModel>
+void CumulantK17Sponge<turbulenceModel>::run()
+{
+	LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega, 	
+																												para->getParD(level)->typeOfGridNode, 										
+																												para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																												para->getParD(level)->distributions.f[0],	
+																												para->getParD(level)->rho,		
+																												para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																												para->getParD(level)->turbViscosity,
+																												para->getSGSConstant(),
+																												(unsigned long)para->getParD(level)->numberOfNodes,	
+																												level,				
+																												para->getIsBodyForce(),				
+																												para->getForcesDev(),				
+																												para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																												para->getQuadricLimitersDev(),			
+																												para->getParD(level)->isEvenTimestep,
+																												para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
+        																										para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
+
+	getLastCudaError("LB_Kernel_CumulantK17Sponge execution failed");
+}
+
+template<TurbulenceModel turbulenceModel>
+void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex )
+{
+	cudaStream_t stream = para->getStreamManager()->getStream(streamIndex);
+	
+	switch (collisionTemplate)
+	{
+		case CollisionTemplate::Default:
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(   
+																																	para->getParD(level)->omega, 	
+																																	para->getParD(level)->typeOfGridNode, 										
+																																	para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																																	para->getParD(level)->distributions.f[0],	
+																																	para->getParD(level)->rho,		
+																																	para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																																	para->getParD(level)->turbViscosity,
+																																	para->getSGSConstant(),
+																																	(unsigned long)para->getParD(level)->numberOfNodes,	
+																																	level,				
+																																	para->getIsBodyForce(),				
+																																	para->getForcesDev(),				
+																																	para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																																	para->getQuadricLimitersDev(),			
+																																	para->getParD(level)->isEvenTimestep,
+																																	indices,
+																																	size_indices);
+			break;
+		
+		case CollisionTemplate::WriteMacroVars:
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
+																																para->getParD(level)->omega, 	
+																																para->getParD(level)->typeOfGridNode, 										
+																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																																para->getParD(level)->distributions.f[0],	
+																																para->getParD(level)->rho,		
+																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																																para->getParD(level)->turbViscosity,
+																																para->getSGSConstant(),
+																																(unsigned long)para->getParD(level)->numberOfNodes,	
+																																level,				
+																																para->getIsBodyForce(),				
+																																para->getForcesDev(),				
+																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																																para->getQuadricLimitersDev(),			
+																																para->getParD(level)->isEvenTimestep,
+																																indices,
+																																size_indices);
+			break;
+		
+		case CollisionTemplate::Border:
+		case CollisionTemplate::AllFeatures:
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  
+																																para->getParD(level)->omega, 	
+																																para->getParD(level)->typeOfGridNode, 										
+																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																																para->getParD(level)->distributions.f[0],	
+																																para->getParD(level)->rho,		
+																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																																para->getParD(level)->turbViscosity,
+																																para->getSGSConstant(),
+																																(unsigned long)para->getParD(level)->numberOfNodes,	
+																																level,				
+																																para->getIsBodyForce(),				
+																																para->getForcesDev(),				
+																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																																para->getQuadricLimitersDev(),			
+																																para->getParD(level)->isEvenTimestep,
+																																indices,
+																																size_indices);
+			break;
+		case CollisionTemplate::ApplyBodyForce:
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
+																																para->getParD(level)->omega, 	
+																																para->getParD(level)->typeOfGridNode, 										
+																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
+																																para->getParD(level)->distributions.f[0],	
+																																para->getParD(level)->rho,		
+																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
+																																para->getParD(level)->turbViscosity,
+																																para->getSGSConstant(),
+																																(unsigned long)para->getParD(level)->numberOfNodes,	
+																																level,				
+																																para->getIsBodyForce(),				
+																																para->getForcesDev(),				
+																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+																																para->getQuadricLimitersDev(),			
+																																para->getParD(level)->isEvenTimestep,
+																																indices,
+																																size_indices);
+			break;
+		default:
+			throw std::runtime_error("Invalid CollisionTemplate in CumulantK17Sponge::runOnIndices()");
+			break;
+	}
+
+	getLastCudaError("LB_Kernel_CumulantK17Sponge execution failed");
+}
+
+template<TurbulenceModel turbulenceModel>
+CumulantK17Sponge<turbulenceModel>::CumulantK17Sponge(std::shared_ptr<Parameter> para, int level)
+{
+	this->para = para;
+	this->level = level;
+
+	myPreProcessorTypes.push_back(InitCompSP27);
+
+	myKernelGroup = BasicKernel;
+
+	this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes);
+	this->kernelUsesFluidNodeIndices = true;
+	
+	VF_LOG_INFO("Using turbulence model: {}", turbulenceModel);
+}
+
+template class CumulantK17Sponge<TurbulenceModel::AMD>;
+template class CumulantK17Sponge<TurbulenceModel::Smagorinsky>;
+template class CumulantK17Sponge<TurbulenceModel::QR>;
+template class CumulantK17Sponge<TurbulenceModel::None>;
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.h
new file mode 100644
index 000000000..60c4a70dc
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.h
@@ -0,0 +1,20 @@
+#ifndef CUMULANT_K17_S_H
+#define CUMULANT_K17_S_H
+
+#include "Kernel/KernelImp.h"
+#include "Parameter/Parameter.h"
+
+template<TurbulenceModel turbulenceModel> 
+class CumulantK17Sponge : public KernelImp
+{
+public:
+	static std::shared_ptr< CumulantK17Sponge<turbulenceModel> > getNewInstance(std::shared_ptr< Parameter> para, int level);
+	void run() override;
+    void runOnIndices(const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex) override;
+
+private:
+    CumulantK17Sponge();
+    CumulantK17Sponge(std::shared_ptr<Parameter> para, int level);
+};
+
+#endif 
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
new file mode 100644
index 000000000..df5495432
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -0,0 +1,728 @@
+
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file CumlantK17_Device.cu
+//! \author Anna Wellmann, Martin Schönherr, Henry Korb, Henrik Asmuth
+//! \date 05/12/2022
+//! \brief Kernel for CumulantK17Sponge including different turbulence models and options for local body forces and writing macroscopic variables
+//!
+//! CumulantK17Sponge kernel using chimera transformations and quartic limiters as present in Geier et al. (2017). Additional options are three different
+//! eddy-viscosity turbulence models (Smagorinsky, AMD, QR) that can be set via the template parameter turbulenceModel (with default 
+//! TurbulenceModel::None). 
+//! The kernel is executed separately for each subset of fluid node indices with a different tag CollisionTemplate. For each subset, only the locally
+//! required options are switched on ( \param writeMacroscopicVariables and/or \param applyBodyForce) in order to minimize memory accesses. The default 
+//! refers to the plain cumlant kernel (CollisionTemplate::Default). 
+//! Nodes are added to subsets (taggedFluidNodes) in Simulation::init using a corresponding tag with different values of CollisionTemplate. These subsets 
+//! are provided by the utilized PostCollisionInteractiors depending on they specifc requirements (e.g. writeMacroscopicVariables for probes).
+
+//=======================================================================================
+/* Device code */
+#include "LBM/LB.h" 
+#include "lbm/constants/D3Q27.h"
+#include <lbm/constants/NumericConstants.h>
+#include "Kernel/Utilities/DistributionHelper.cuh"
+
+#include "GPU/TurbulentViscosityInlines.cuh"
+
+using namespace vf::lbm::constant;
+using namespace vf::lbm::dir;
+#include "Kernel/Utilities/ChimeraTransformation.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+template<TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce>
+__global__ void LB_Kernel_CumulantK17Sponge(
+	real omega_in,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+    real* rho,
+    real* vx,
+    real* vy,
+    real* vz,
+    real* turbulentViscosity,
+    real SGSconstant,
+	unsigned long numberOfLBnodes,
+	int level,
+    bool bodyForce,
+	real* forces,
+    real* bodyForceX,
+    real* bodyForceY,
+    real* bodyForceZ,
+	real* quadricLimiters,
+	bool isEvenTimestep,
+    const uint *fluidNodeIndices,
+    uint numberOfFluidNodes)
+{
+    //////////////////////////////////////////////////////////////////////////
+    //! Cumulant K17 Kernel is based on \ref
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040
+    //! ]</b></a> and \ref <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.07.004 ]</b></a>
+    //!
+    //! The cumulant kernel is executed in the following steps
+    //!
+    ////////////////////////////////////////////////////////////////////////////////
+    //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim.
+    //!
+    const unsigned kThread = vf::gpu::getNodeIndex();
+    
+    //////////////////////////////////////////////////////////////////////////
+    // run for all indices in size_Mat and fluid nodes
+    if (kThread >= numberOfFluidNodes) 
+        return;
+    ////////////////////////////////////////////////////////////////////////////////
+    //! - Get the node index from the array containing all indices of fluid nodes
+    //!
+    const unsigned k_000 = fluidNodeIndices[kThread];
+
+    //////////////////////////////////////////////////////////////////////////
+    //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on
+    //! timestep is based on the esoteric twist algorithm \ref <a
+    //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017),
+    //! DOI:10.3390/computation5020019 ]</b></a>
+    //!
+    Distributions27 dist = vf::gpu::getDistributionReferences27(distributions, numberOfLBnodes, isEvenTimestep);
+
+    ////////////////////////////////////////////////////////////////////////////////
+    //! - Set neighbor indices (necessary for indirect addressing)
+    uint k_M00 = neighborX[k_000];
+    uint k_0M0 = neighborY[k_000];
+    uint k_00M = neighborZ[k_000];
+    uint k_MM0 = neighborY[k_M00];
+    uint k_M0M = neighborZ[k_M00];
+    uint k_0MM = neighborZ[k_0M0];
+    uint k_MMM = neighborZ[k_MM0];
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Set local distributions
+    //!
+    real f_000 = (dist.f[DIR_000])[k_000];
+    real f_P00 = (dist.f[DIR_P00])[k_000];
+    real f_M00 = (dist.f[DIR_M00])[k_M00];
+    real f_0P0 = (dist.f[DIR_0P0])[k_000];
+    real f_0M0 = (dist.f[DIR_0M0])[k_0M0];
+    real f_00P = (dist.f[DIR_00P])[k_000];
+    real f_00M = (dist.f[DIR_00M])[k_00M];
+    real f_PP0 = (dist.f[DIR_PP0])[k_000];
+    real f_MM0 = (dist.f[DIR_MM0])[k_MM0];
+    real f_PM0 = (dist.f[DIR_PM0])[k_0M0];
+    real f_MP0 = (dist.f[DIR_MP0])[k_M00];
+    real f_P0P = (dist.f[DIR_P0P])[k_000];
+    real f_M0M = (dist.f[DIR_M0M])[k_M0M];
+    real f_P0M = (dist.f[DIR_P0M])[k_00M];
+    real f_M0P = (dist.f[DIR_M0P])[k_M00];
+    real f_0PP = (dist.f[DIR_0PP])[k_000];
+    real f_0MM = (dist.f[DIR_0MM])[k_0MM];
+    real f_0PM = (dist.f[DIR_0PM])[k_00M];
+    real f_0MP = (dist.f[DIR_0MP])[k_0M0];
+    real f_PPP = (dist.f[DIR_PPP])[k_000];
+    real f_MPP = (dist.f[DIR_MPP])[k_M00];
+    real f_PMP = (dist.f[DIR_PMP])[k_0M0];
+    real f_MMP = (dist.f[DIR_MMP])[k_MM0];
+    real f_PPM = (dist.f[DIR_PPM])[k_00M];
+    real f_MPM = (dist.f[DIR_MPM])[k_M0M];
+    real f_PMM = (dist.f[DIR_PMM])[k_0MM];
+    real f_MMM = (dist.f[DIR_MMM])[k_MMM];
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Define aliases to use the same variable for the moments (m's):
+    //!
+    real& m_111 = f_000;
+    real& m_211 = f_P00;
+    real& m_011 = f_M00;
+    real& m_121 = f_0P0;
+    real& m_101 = f_0M0;
+    real& m_112 = f_00P;
+    real& m_110 = f_00M;
+    real& m_221 = f_PP0;
+    real& m_001 = f_MM0;
+    real& m_201 = f_PM0;
+    real& m_021 = f_MP0;
+    real& m_212 = f_P0P;
+    real& m_010 = f_M0M;
+    real& m_210 = f_P0M;
+    real& m_012 = f_M0P;
+    real& m_122 = f_0PP;
+    real& m_100 = f_0MM;
+    real& m_120 = f_0PM;
+    real& m_102 = f_0MP;
+    real& m_222 = f_PPP;
+    real& m_022 = f_MPP;
+    real& m_202 = f_PMP;
+    real& m_002 = f_MMP;
+    real& m_220 = f_PPM;
+    real& m_020 = f_MPM;
+    real& m_200 = f_PMM;
+    real& m_000 = f_MMM;
+
+    //////////////////////////////////////////////////////(unsigned long)//////////////////////////////
+    //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+    //!
+    real drho = ((((f_PPP + f_MMM) + (f_MPM + f_PMP)) + ((f_MPP + f_PMM) + (f_MMP + f_PPM))) +
+                (((f_0MP + f_0PM) + (f_0MM + f_0PP)) + ((f_M0P + f_P0M) + (f_M0M + f_P0P)) +
+                ((f_MP0 + f_PM0) + (f_MM0 + f_PP0))) +
+                ((f_M00 + f_P00) + (f_0M0 + f_0P0) + (f_00M + f_00P))) +
+                    f_000;
+
+    real oneOverRho = c1o1 / (c1o1 + drho);
+
+    real vvx = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_PMM - f_MPP) + (f_PPM - f_MMP))) +
+                (((f_P0M - f_M0P) + (f_P0P - f_M0M)) + ((f_PM0 - f_MP0) + (f_PP0 - f_MM0))) + (f_P00 - f_M00)) *
+            oneOverRho;
+    real vvy = ((((f_PPP - f_MMM) + (f_MPM - f_PMP)) + ((f_MPP - f_PMM) + (f_PPM - f_MMP))) +
+                (((f_0PM - f_0MP) + (f_0PP - f_0MM)) + ((f_MP0 - f_PM0) + (f_PP0 - f_MM0))) + (f_0P0 - f_0M0)) *
+            oneOverRho;
+    real vvz = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) +
+                (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) *
+            oneOverRho;
+    
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+    //!
+    real factor = c1o1;
+    for (size_t i = 1; i <= level; i++) {
+        factor *= c2o1;
+    }
+    
+    real fx = forces[0];
+    real fy = forces[1];
+    real fz = forces[2];
+
+    if( applyBodyForce ){
+        fx += bodyForceX[k_000]; 
+        fy += bodyForceY[k_000];
+        fz += bodyForceZ[k_000];
+
+        // real vx = vvx;
+        // real vy = vvy;
+        // real vz = vvz;
+        real acc_x = fx * c1o2 / factor;
+        real acc_y = fy * c1o2 / factor;
+        real acc_z = fz * c1o2 / factor;
+
+        vvx += acc_x;
+        vvy += acc_y;
+        vvz += acc_z;
+        
+        // Reset body force. To be used when not using round-off correction.
+        bodyForceX[k_000] = 0.0f;
+        bodyForceY[k_000] = 0.0f;
+        bodyForceZ[k_000] = 0.0f;
+
+        ////////////////////////////////////////////////////////////////////////////////////
+        //!> Round-off correction
+        //!
+        //!> Similar to Kahan summation algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm)
+        //!> Essentially computes the round-off error of the applied force and adds it in the next time step as a compensation.
+        //!> Seems to be necesseary at very high Re boundary layers, where the forcing and velocity can  
+        //!> differ by several orders of magnitude.
+        //!> \note 16/05/2022: Testing, still ongoing! 
+        //!
+        // bodyForceX[k_000] = (acc_x-(vvx-vx))*factor*c2o1;
+        // bodyForceY[k_000] = (acc_y-(vvy-vy))*factor*c2o1;
+        // bodyForceZ[k_000] = (acc_z-(vvz-vz))*factor*c2o1;
+    }
+    else{
+        vvx += fx * c1o2 / factor;
+        vvy += fy * c1o2 / factor;
+        vvz += fz * c1o2 / factor;
+    }
+    
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // calculate the square of velocities for this lattice node
+    real vx2 = vvx * vvx;
+    real vy2 = vvy * vvy;
+    real vz2 = vvz * vvz;
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to
+    //! section 6 in \ref <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+    real quadricLimitP = quadricLimiters[0];
+    real quadricLimitM = quadricLimiters[1];
+    real quadricLimitD = quadricLimiters[2];
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (6)-(14) in \ref <a
+    //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040
+    //! ]</b></a>
+    //!
+    ////////////////////////////////////////////////////////////////////////////////////
+    // Z - Dir
+    forwardInverseChimeraWithK(f_MMM, f_MM0, f_MMP, vvz, vz2, c36o1, c1o36);
+    forwardInverseChimeraWithK(f_M0M, f_M00, f_M0P, vvz, vz2, c9o1,  c1o9);
+    forwardInverseChimeraWithK(f_MPM, f_MP0, f_MPP, vvz, vz2, c36o1, c1o36);
+    forwardInverseChimeraWithK(f_0MM, f_0M0, f_0MP, vvz, vz2, c9o1,  c1o9);
+    forwardInverseChimeraWithK(f_00M, f_000, f_00P, vvz, vz2, c9o4,  c4o9);
+    forwardInverseChimeraWithK(f_0PM, f_0P0, f_0PP, vvz, vz2, c9o1,  c1o9);
+    forwardInverseChimeraWithK(f_PMM, f_PM0, f_PMP, vvz, vz2, c36o1, c1o36);
+    forwardInverseChimeraWithK(f_P0M, f_P00, f_P0P, vvz, vz2, c9o1,  c1o9);
+    forwardInverseChimeraWithK(f_PPM, f_PP0, f_PPP, vvz, vz2, c36o1, c1o36);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // Y - Dir
+    forwardInverseChimeraWithK(f_MMM, f_M0M, f_MPM, vvy, vy2, c6o1,  c1o6);
+    forwardChimera(            f_MM0, f_M00, f_MP0, vvy, vy2);
+    forwardInverseChimeraWithK(f_MMP, f_M0P, f_MPP, vvy, vy2, c18o1, c1o18);
+    forwardInverseChimeraWithK(f_0MM, f_00M, f_0PM, vvy, vy2, c3o2,  c2o3);
+    forwardChimera(            f_0M0, f_000, f_0P0, vvy, vy2);
+    forwardInverseChimeraWithK(f_0MP, f_00P, f_0PP, vvy, vy2, c9o2,  c2o9);
+    forwardInverseChimeraWithK(f_PMM, f_P0M, f_PPM, vvy, vy2, c6o1,  c1o6);
+    forwardChimera(            f_PM0, f_P00, f_PP0, vvy, vy2);
+    forwardInverseChimeraWithK(f_PMP, f_P0P, f_PPP, vvy, vy2, c18o1, c1o18);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // X - Dir
+    forwardInverseChimeraWithK(f_MMM, f_0MM, f_PMM, vvx, vx2, c1o1, c1o1);
+    forwardChimera(            f_M0M, f_00M, f_P0M, vvx, vx2);
+    forwardInverseChimeraWithK(f_MPM, f_0PM, f_PPM, vvx, vx2, c3o1, c1o3);
+    forwardChimera(            f_MM0, f_0M0, f_PM0, vvx, vx2);
+    forwardChimera(            f_M00, f_000, f_P00, vvx, vx2);
+    forwardChimera(            f_MP0, f_0P0, f_PP0, vvx, vx2);
+    forwardInverseChimeraWithK(f_MMP, f_0MP, f_PMP, vvx, vx2, c3o1, c1o3);
+    forwardChimera(            f_M0P, f_00P, f_P0P, vvx, vx2);
+    forwardInverseChimeraWithK(f_MPP, f_0PP, f_PPP, vvx, vx2, c3o1, c1o9);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations
+    //! according to <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!  => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE].
+    //!  - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk
+    //!  viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$.
+    //!  - Third order cumulants \f$ C_{120}+C_{102}, C_{210}+C_{012}, C_{201}+C_{021} \f$: \f$ \omega_3=OxyyPxzz
+    //!  \f$ set according to Eq. (111) with simplifications assuming \f$ \omega_2=1.0\f$.
+    //!  - Third order cumulants \f$ C_{120}-C_{102}, C_{210}-C_{012}, C_{201}-C_{021} \f$: \f$ \omega_4 = OxyyMxzz
+    //!  \f$ set according to Eq. (112) with simplifications assuming \f$ \omega_2 = 1.0\f$.
+    //!  - Third order cumulants \f$ C_{111} \f$: \f$ \omega_5 = Oxyz \f$ set according to Eq. (113) with
+    //!  simplifications assuming \f$ \omega_2 = 1.0\f$  (modify for different bulk viscosity).
+    //!  - Fourth order cumulants \f$ C_{220}, C_{202}, C_{022}, C_{211}, C_{121}, C_{112} \f$: for simplification
+    //!  all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$.
+    //!  - Fifth order cumulants \f$ C_{221}, C_{212}, C_{122}\f$: \f$\omega_9=O5=1.0\f$.
+    //!  - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$.
+    //!
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Calculate modified omega with turbulent viscosity
+    //!
+    real omega = omega_in;
+    if(turbulenceModel != TurbulenceModel::None){ omega /= (c1o1 + c3o1*omega_in*turbulentViscosity[k_000]); }
+    ////////////////////////////////////////////////////////////
+    // 2.
+    real OxxPyyPzz = c1o1;
+    ////////////////////////////////////////////////////////////
+    // 3.
+    real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
+    real OxyyMxzz =
+        c8o1 * (-c2o1 + omega) * (-c7o1 + c4o1 * omega) / (c56o1 - c50o1 * omega + c9o1 * omega * omega);
+    real Oxyz = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1 * omega + c3o1 * omega * omega) /
+                (c48o1 + c152o1 * omega - c130o1 * omega * omega + c29o1 * omega * omega * omega);
+    ////////////////////////////////////////////////////////////
+    // 4.
+    real O4 = c1o1;
+    ////////////////////////////////////////////////////////////
+    // 5.
+    real O5 = c1o1;
+    ////////////////////////////////////////////////////////////
+    // 6.
+    real O6 = c1o1;
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116)
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for
+    //! different bulk viscosity).
+    //!
+    real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega);
+    real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Compute cumulants from central moments according to Eq. (20)-(23) in
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+    ////////////////////////////////////////////////////////////
+    // 4.
+    real c_211 = m_211 - ((m_200 + c1o3) * m_011 + c2o1 * m_110 * m_101) * oneOverRho;
+    real c_121 = m_121 - ((m_020 + c1o3) * m_101 + c2o1 * m_110 * m_011) * oneOverRho;
+    real c_112 = m_112 - ((m_002 + c1o3) * m_110 + c2o1 * m_101 * m_011) * oneOverRho;
+
+    real c_220 = m_220 - (((m_200 * m_020 + c2o1 * m_110 * m_110) + c1o3 * (m_200 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho));
+    real c_202 = m_202 - (((m_200 * m_002 + c2o1 * m_101 * m_101) + c1o3 * (m_200 + m_002)) * oneOverRho - c1o9 * (drho * oneOverRho));
+    real c_022 = m_022 - (((m_002 * m_020 + c2o1 * m_011 * m_011) + c1o3 * (m_002 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho));
+    ////////////////////////////////////////////////////////////
+    // 5.
+    real c_122 =
+        m_122 - ((m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) +
+                c1o3 * (m_120 + m_102)) *
+                oneOverRho;
+    real c_212 =
+        m_212 - ((m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) +
+                c1o3 * (m_210 + m_012)) *
+                oneOverRho;
+    real c_221 =
+        m_221 - ((m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) +
+                c1o3 * (m_021 + m_201)) *
+                oneOverRho;
+    ////////////////////////////////////////////////////////////
+    // 6.
+    real c_222 = m_222 + ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) -
+                            c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) -
+                            c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) *
+                            oneOverRho +
+                        (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) +
+                            c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) *
+                            oneOverRho * oneOverRho -
+                            c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho +
+                        (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) +
+                            (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) *
+                            oneOverRho * oneOverRho * c2o3 +
+                            c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho));
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Compute linear combinations of second and third order cumulants
+    //!
+    ////////////////////////////////////////////////////////////
+    // 2.
+    real mxxPyyPzz = m_200 + m_020 + m_002;
+    real mxxMyy    = m_200 - m_020;
+    real mxxMzz    = m_200 - m_002;
+    ////////////////////////////////////////////////////////////
+    // 3.
+    real mxxyPyzz = m_210 + m_012;
+    real mxxyMyzz = m_210 - m_012;
+
+    real mxxzPyyz = m_201 + m_021;
+    real mxxzMyyz = m_201 - m_021;
+
+    real mxyyPxzz = m_120 + m_102;
+    real mxyyMxzz = m_120 - m_102;
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // incl. correction
+    ////////////////////////////////////////////////////////////
+    //! - Compute velocity  gradients from second order cumulants according to Eq. (27)-(32)
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> Further explanations of the correction in viscosity in Appendix H of
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> Note that the division by rho is omitted here as we need rho times
+    //! the gradients later.
+    //!
+    real Dxy  = -c3o1 * omega * m_110;
+    real Dxz  = -c3o1 * omega * m_101;
+    real Dyz  = -c3o1 * omega * m_011;
+    real dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (m_000 - mxxPyyPzz);
+    real dyuy = dxux + omega * c3o2 * mxxMyy;
+    real dzuz = dxux + omega * c3o2 * mxxMzz;
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    switch (turbulenceModel)
+    {
+    case TurbulenceModel::None:
+    case TurbulenceModel::AMD:  //AMD is computed in separate kernel
+        break;
+    case TurbulenceModel::Smagorinsky:
+        turbulentViscosity[k_000] = calcTurbulentViscositySmagorinsky(SGSconstant, dxux, dyuy, dzuz, Dxy, Dxz , Dyz);
+        break;
+    case TurbulenceModel::QR:
+        turbulentViscosity[k_000] = calcTurbulentViscosityQR(SGSconstant, dxux, dyuy, dzuz, Dxy, Dxz , Dyz);
+        break;
+    default:
+        break;
+    }
+    ////////////////////////////////////////////////////////////
+    //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+    mxxPyyPzz += OxxPyyPzz * (m_000 - mxxPyyPzz) - c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+    mxxMyy += omega * (-mxxMyy) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy);
+    mxxMzz += omega * (-mxxMzz) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    ////no correction
+    // mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz);
+    // mxxMyy += -(-omega) * (-mxxMyy);
+    // mxxMzz += -(-omega) * (-mxxMzz);
+    //////////////////////////////////////////////////////////////////////////
+    m_011 += omega * (-m_011);
+    m_101 += omega * (-m_101);
+    m_110 += omega * (-m_110);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // relax
+    //////////////////////////////////////////////////////////////////////////
+    // incl. limiter
+    //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123)
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+    real wadjust = Oxyz + (c1o1 - Oxyz) * abs(m_111) / (abs(m_111) + quadricLimitD);
+    m_111 += wadjust * (-m_111);
+    wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxyPyzz) / (abs(mxxyPyzz) + quadricLimitP);
+    mxxyPyzz += wadjust * (-mxxyPyzz);
+    wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxyMyzz) / (abs(mxxyMyzz) + quadricLimitM);
+    mxxyMyzz += wadjust * (-mxxyMyzz);
+    wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxzPyyz) / (abs(mxxzPyyz) + quadricLimitP);
+    mxxzPyyz += wadjust * (-mxxzPyyz);
+    wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxzMyyz) / (abs(mxxzMyyz) + quadricLimitM);
+    mxxzMyyz += wadjust * (-mxxzMyyz);
+    wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxyyPxzz) / (abs(mxyyPxzz) + quadricLimitP);
+    mxyyPxzz += wadjust * (-mxyyPxzz);
+    wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxyyMxzz) / (abs(mxyyMxzz) + quadricLimitM);
+    mxyyMxzz += wadjust * (-mxyyMxzz);
+    //////////////////////////////////////////////////////////////////////////
+    // no limiter
+    // mfbbb += OxyyMxzz * (-mfbbb);
+    // mxxyPyzz += OxyyPxzz * (-mxxyPyzz);
+    // mxxyMyzz += OxyyMxzz * (-mxxyMyzz);
+    // mxxzPyyz += OxyyPxzz * (-mxxzPyyz);
+    // mxxzMyyz += OxyyMxzz * (-mxxzMyyz);
+    // mxyyPxzz += OxyyPxzz * (-mxyyPxzz);
+    // mxyyMxzz += OxyyMxzz * (-mxyyMxzz);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Compute inverse linear combinations of second and third order cumulants
+    //!
+    m_200 = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+    m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz);
+    m_002 = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz);
+
+    m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2;
+    m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2;
+    m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2;
+    m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2;
+    m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2;
+    m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2;
+    //////////////////////////////////////////////////////////////////////////
+
+    //////////////////////////////////////////////////////////////////////////
+    // 4.
+    // no limiter
+    //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according
+    //! to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+    c_022 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_022);
+    c_202 = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_202);
+    c_220 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (c_220);
+    c_112 = -O4 * (c1o1 / omega - c1o2) * Dxy           * c1o3 * factorB + (c1o1 - O4) * (c_112);
+    c_121 = -O4 * (c1o1 / omega - c1o2) * Dxz           * c1o3 * factorB + (c1o1 - O4) * (c_121);
+    c_211 = -O4 * (c1o1 / omega - c1o2) * Dyz           * c1o3 * factorB + (c1o1 - O4) * (c_211);
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // 5.
+    c_122 += O5 * (-c_122);
+    c_212 += O5 * (-c_212);
+    c_221 += O5 * (-c_221);
+
+    //////////////////////////////////////////////////////////////////////////
+    // 6.
+    c_222 += O6 * (-c_222);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+    //!
+
+    //////////////////////////////////////////////////////////////////////////
+    // 4.
+    m_211 = c_211 + c1o3 * ((c3o1 * m_200 + c1o1) * m_011 + c6o1 * m_110 * m_101) * oneOverRho;
+    m_121 = c_121 + c1o3 * ((c3o1 * m_020 + c1o1) * m_101 + c6o1 * m_110 * m_011) * oneOverRho;
+    m_112 = c_112 + c1o3 * ((c3o1 * m_002 + c1o1) * m_110 + c6o1 * m_101 * m_011) * oneOverRho;
+
+    m_220 =
+        c_220 + (((m_200 * m_020 + c2o1 * m_110 * m_110) * c9o1 + c3o1 * (m_200 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9;
+    m_202 =
+        c_202 + (((m_200 * m_002 + c2o1 * m_101 * m_101) * c9o1 + c3o1 * (m_200 + m_002)) * oneOverRho - (drho * oneOverRho)) * c1o9;
+    m_022 =
+        c_022 + (((m_002 * m_020 + c2o1 * m_011 * m_011) * c9o1 + c3o1 * (m_002 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9;
+
+    //////////////////////////////////////////////////////////////////////////
+    // 5.
+    m_122 = c_122 + c1o3 *
+            (c3o1 * (m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) +
+            (m_120 + m_102)) * oneOverRho;
+    m_212 = c_212 + c1o3 *
+            (c3o1 * (m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) +
+            (m_210 + m_012)) * oneOverRho;
+    m_221 = c_221 + c1o3 *
+            (c3o1 * (m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) +
+            (m_021 + m_201)) * oneOverRho;
+
+    //////////////////////////////////////////////////////////////////////////
+    // 6.
+    m_222 = c_222 - ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) -
+                    c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) -
+                    c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) *
+                    oneOverRho +
+                    (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) +
+                    c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) *
+                    oneOverRho * oneOverRho -
+                    c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho +
+                    (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) +
+                    (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) *
+                    oneOverRho * oneOverRho * c2o3 +
+                    c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho));
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! -  Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+    //!
+    m_100 = -m_100;
+    m_010 = -m_010;
+    m_001 = -m_001;
+
+    //Write to array here to distribute read/write
+    if(writeMacroscopicVariables)
+    {
+        rho[k_000] = drho;
+        vx[k_000] = vvx;
+        vy[k_000] = vvy;
+        vz[k_000] = vvz;
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+    //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015),
+    //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a
+    //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040
+    //! ]</b></a>
+    //!
+    ////////////////////////////////////////////////////////////////////////////////////
+    // X - Dir
+    backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx2, c1o1, c1o1);
+    backwardChimera(            m_010, m_110, m_210, vvx, vx2);
+    backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx2, c3o1, c1o3);
+    backwardChimera(            m_001, m_101, m_201, vvx, vx2);
+    backwardChimera(            m_011, m_111, m_211, vvx, vx2);
+    backwardChimera(            m_021, m_121, m_221, vvx, vx2);
+    backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx2, c3o1, c1o3);
+    backwardChimera(            m_012, m_112, m_212, vvx, vx2);
+    backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx2, c9o1, c1o9);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // Y - Dir
+    backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy2, c6o1, c1o6);
+    backwardChimera(            m_001, m_011, m_021, vvy, vy2);
+    backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy2, c18o1, c1o18);
+    backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy2, c3o2, c2o3);
+    backwardChimera(            m_101, m_111, m_121, vvy, vy2);
+    backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy2, c9o2, c2o9);
+    backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy2, c6o1, c1o6);
+    backwardChimera(            m_201, m_211, m_221, vvy, vy2);
+    backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy2, c18o1, c1o18);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    // Z - Dir
+    backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz2, c36o1, c1o36);
+    backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz2, c9o1, c1o9);
+    backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz2, c36o1, c1o36);
+    backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz2, c9o1, c1o9);
+    backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz2, c9o4, c4o9);
+    backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz2, c9o1, c1o9);
+    backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz2, c36o1, c1o36);
+    backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz2, c9o1, c1o9);
+    backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz2, c36o1, c1o36);
+
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - Write distributions: style of reading and writing the distributions from/to
+    //! stored arrays dependent on timestep is based on the esoteric twist algorithm
+    //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017),
+    //! DOI:10.3390/computation5020019 ]</b></a>
+    //!
+    (dist.f[DIR_P00])[k_000]    = f_M00;
+    (dist.f[DIR_M00])[k_M00]    = f_P00;
+    (dist.f[DIR_0P0])[k_000]    = f_0M0;
+    (dist.f[DIR_0M0])[k_0M0]    = f_0P0;
+    (dist.f[DIR_00P])[k_000]    = f_00M;
+    (dist.f[DIR_00M])[k_00M]    = f_00P;
+    (dist.f[DIR_PP0])[k_000]   = f_MM0;
+    (dist.f[DIR_MM0])[k_MM0]   = f_PP0;
+    (dist.f[DIR_PM0])[k_0M0]   = f_MP0;
+    (dist.f[DIR_MP0])[k_M00]   = f_PM0;
+    (dist.f[DIR_P0P])[k_000]   = f_M0M;
+    (dist.f[DIR_M0M])[k_M0M]   = f_P0P;
+    (dist.f[DIR_P0M])[k_00M]   = f_M0P;
+    (dist.f[DIR_M0P])[k_M00]   = f_P0M;
+    (dist.f[DIR_0PP])[k_000]   = f_0MM;
+    (dist.f[DIR_0MM])[k_0MM]   = f_0PP;
+    (dist.f[DIR_0PM])[k_00M]   = f_0MP;
+    (dist.f[DIR_0MP])[k_0M0]   = f_0PM;
+    (dist.f[DIR_000])[k_000] = f_000;
+    (dist.f[DIR_PPP])[k_000]  = f_MMM;
+    (dist.f[DIR_PMP])[k_0M0]  = f_MPM;
+    (dist.f[DIR_PPM])[k_00M]  = f_MMP;
+    (dist.f[DIR_PMM])[k_0MM]  = f_MPP;
+    (dist.f[DIR_MPP])[k_M00]  = f_PMM;
+    (dist.f[DIR_MMP])[k_MM0]  = f_PPM;
+    (dist.f[DIR_MPM])[k_M0M]  = f_PMP;
+    (dist.f[DIR_MMM])[k_MMM]  = f_PPP;
+}
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
new file mode 100644
index 000000000..28da79958
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
@@ -0,0 +1,31 @@
+#ifndef LB_Kernel_CUMULANT_K17_S_H
+#define LB_Kernel_CUMULANT_K17_S_H
+
+#include <DataTypes.h>
+#include <curand.h>
+
+template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void LB_Kernel_CumulantK17Sponge(
+	real omega_in,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+	real* rho,
+	real* vx,
+    real* vy,
+    real* vz,
+	real* turbulentViscosity,
+	real SGSconstant,
+	unsigned long numberOfLBnodes,
+	int level,
+	bool bodyForce,
+	real* forces,
+	real* bodyForceX,
+	real* bodyForceY,
+	real* bodyForceZ,
+	real* quadricLimiters,
+	bool isEvenTimestep,
+	const uint *fluidNodeIndices,
+    uint numberOfFluidNodes);
+#endif
-- 
GitLab


From c0c3cd42e320f4b98d0c5a6a68a62ba0e57b1e9b Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 164/179] Add coordinate as parameter to sponge kernel

---
 .../CumulantK17Sponge/CumulantK17Sponge.cu    | 194 +++++++++---------
 .../CumulantK17Sponge_Device.cu               |  35 ++--
 .../CumulantK17Sponge_Device.cuh              |   3 +
 3 files changed, 122 insertions(+), 110 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
index 7a313e783..28c7cafd4 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
@@ -6,7 +6,7 @@
 
 #include <cuda.h>
 
-template<TurbulenceModel turbulenceModel> 
+template<TurbulenceModel turbulenceModel>
 std::shared_ptr< CumulantK17Sponge<turbulenceModel> > CumulantK17Sponge<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level)
 {
 	return std::shared_ptr<CumulantK17Sponge<turbulenceModel> >(new CumulantK17Sponge<turbulenceModel>(para,level));
@@ -15,23 +15,25 @@ std::shared_ptr< CumulantK17Sponge<turbulenceModel> > CumulantK17Sponge<turbulen
 template<TurbulenceModel turbulenceModel>
 void CumulantK17Sponge<turbulenceModel>::run()
 {
-	LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(   para->getParD(level)->omega, 	
-																												para->getParD(level)->typeOfGridNode, 										
-																												para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																												para->getParD(level)->distributions.f[0],	
-																												para->getParD(level)->rho,		
-																												para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																												para->getParD(level)->turbViscosity,
-																												para->getSGSConstant(),
-																												(unsigned long)para->getParD(level)->numberOfNodes,	
-																												level,				
-																												para->getIsBodyForce(),				
-																												para->getForcesDev(),				
-																												para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																												para->getQuadricLimitersDev(),			
-																												para->getParD(level)->isEvenTimestep,
-																												para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
-        																										para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
+	LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(
+		para->getParD(level)->omega,
+		para->getParD(level)->typeOfGridNode,
+		para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+		para->getParD(level)->distributions.f[0],
+		para->getParD(level)->rho,
+		para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+		para->getParD(level)->turbViscosity,
+		para->getSGSConstant(),
+		(unsigned long)para->getParD(level)->numberOfNodes,
+		level,
+		para->getIsBodyForce(),
+		para->getForcesDev(),
+		para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+		para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
+		para->getQuadricLimitersDev(),
+		para->getParD(level)->isEvenTimestep,
+		para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default],
+        para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]);
 
 	getLastCudaError("LB_Kernel_CumulantK17Sponge execution failed");
 }
@@ -40,91 +42,95 @@ template<TurbulenceModel turbulenceModel>
 void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex )
 {
 	cudaStream_t stream = para->getStreamManager()->getStream(streamIndex);
-	
+
 	switch (collisionTemplate)
 	{
 		case CollisionTemplate::Default:
-			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(   
-																																	para->getParD(level)->omega, 	
-																																	para->getParD(level)->typeOfGridNode, 										
-																																	para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																	para->getParD(level)->distributions.f[0],	
-																																	para->getParD(level)->rho,		
-																																	para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																	para->getParD(level)->turbViscosity,
-																																	para->getSGSConstant(),
-																																	(unsigned long)para->getParD(level)->numberOfNodes,	
-																																	level,				
-																																	para->getIsBodyForce(),				
-																																	para->getForcesDev(),				
-																																	para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																	para->getQuadricLimitersDev(),			
-																																	para->getParD(level)->isEvenTimestep,
-																																	indices,
-																																	size_indices);
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
+				para->getParD(level)->omega,
+				para->getParD(level)->typeOfGridNode,
+				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+				para->getParD(level)->distributions.f[0],
+				para->getParD(level)->rho,
+				para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+				para->getParD(level)->turbViscosity,
+				para->getSGSConstant(),
+				(unsigned long)para->getParD(level)->numberOfNodes,
+				level,
+				para->getIsBodyForce(),
+				para->getForcesDev(),
+				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
+				para->getQuadricLimitersDev(),
+				para->getParD(level)->isEvenTimestep,
+				indices,
+				size_indices);
 			break;
-		
+
 		case CollisionTemplate::WriteMacroVars:
-			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
+				para->getParD(level)->omega,
+				para->getParD(level)->typeOfGridNode,
+				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+				para->getParD(level)->distributions.f[0],
+				para->getParD(level)->rho,
+				para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+				para->getParD(level)->turbViscosity,
+				para->getSGSConstant(),
+				(unsigned long)para->getParD(level)->numberOfNodes,
+				level,
+				para->getIsBodyForce(),
+				para->getForcesDev(),
+				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
+				para->getQuadricLimitersDev(),
+				para->getParD(level)->isEvenTimestep,
+				indices,
+				size_indices);
 			break;
-		
+
 		case CollisionTemplate::Border:
 		case CollisionTemplate::AllFeatures:
-			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(  
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
+				para->getParD(level)->omega,
+				para->getParD(level)->typeOfGridNode,
+				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+				para->getParD(level)->distributions.f[0],
+				para->getParD(level)->rho,
+				para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+				para->getParD(level)->turbViscosity,
+				para->getSGSConstant(),
+				(unsigned long)para->getParD(level)->numberOfNodes,
+				level,
+				para->getIsBodyForce(),
+				para->getForcesDev(),
+				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
+				para->getQuadricLimitersDev(),
+				para->getParD(level)->isEvenTimestep,
+				indices,
+				size_indices);
 			break;
 		case CollisionTemplate::ApplyBodyForce:
-			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( 
-																																para->getParD(level)->omega, 	
-																																para->getParD(level)->typeOfGridNode, 										
-																																para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,	
-																																para->getParD(level)->distributions.f[0],	
-																																para->getParD(level)->rho,		
-																																para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,	
-																																para->getParD(level)->turbViscosity,
-																																para->getSGSConstant(),
-																																(unsigned long)para->getParD(level)->numberOfNodes,	
-																																level,				
-																																para->getIsBodyForce(),				
-																																para->getForcesDev(),				
-																																para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
-																																para->getQuadricLimitersDev(),			
-																																para->getParD(level)->isEvenTimestep,
-																																indices,
-																																size_indices);
+			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
+				para->getParD(level)->omega,
+				para->getParD(level)->typeOfGridNode,
+				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
+				para->getParD(level)->distributions.f[0],
+				para->getParD(level)->rho,
+				para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ,
+				para->getParD(level)->turbViscosity,
+				para->getSGSConstant(),
+				(unsigned long)para->getParD(level)->numberOfNodes,
+				level,
+				para->getIsBodyForce(),
+				para->getForcesDev(),
+				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
+				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
+				para->getQuadricLimitersDev(),
+				para->getParD(level)->isEvenTimestep,
+				indices,
+				size_indices);
 			break;
 		default:
 			throw std::runtime_error("Invalid CollisionTemplate in CumulantK17Sponge::runOnIndices()");
@@ -146,7 +152,7 @@ CumulantK17Sponge<turbulenceModel>::CumulantK17Sponge(std::shared_ptr<Parameter>
 
 	this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes);
 	this->kernelUsesFluidNodeIndices = true;
-	
+
 	VF_LOG_INFO("Using turbulence model: {}", turbulenceModel);
 }
 
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index df5495432..83c31acdb 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -76,6 +76,9 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     real* bodyForceX,
     real* bodyForceY,
     real* bodyForceZ,
+    real* coordX,
+    real* coordY,
+    real* coordZ,
 	real* quadricLimiters,
 	bool isEvenTimestep,
     const uint *fluidNodeIndices,
@@ -695,34 +698,34 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     (dist.f[DIR_MMM])[k_MMM]  = f_PPP;
 }
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
index 28da79958..d119fa439 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
@@ -24,6 +24,9 @@ template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool
 	real* bodyForceX,
 	real* bodyForceY,
 	real* bodyForceZ,
+	real* coordX,
+    real* coordY,
+    real* coordZ,
 	real* quadricLimiters,
 	bool isEvenTimestep,
 	const uint *fluidNodeIndices,
-- 
GitLab


From 756b184392718efd40f95931b738e235eeb8779c Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:29 +0000
Subject: [PATCH 165/179] Add sponge kernel to factory

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  3 +-
 .../KernelFactory/KernelFactoryImp.cpp        | 42 ++++++++++++++-----
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index bcf23ee40..482fac34f 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -195,7 +195,8 @@ void multipleLevel(const std::string& configPath)
     para->setViscosityLB(viscosityLB);
     para->setVelocityRatio( dx / dt );
     para->setViscosityRatio( dx*dx/dt );
-    para->setMainKernel("CumulantK17");
+    para->setDensityRatio( 1.0 );
+    para->setMainKernel("CumulantK17Sponge");
 
     para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) {
         rho = (real)0.0;
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp
index 5a2d8c9a4..81e5ac06c 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp
@@ -11,6 +11,7 @@
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h"
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h"
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.h"
+#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.h"
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h"
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h"
 #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h"
@@ -141,11 +142,30 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter>
                 break;
             default:
                 throw std::runtime_error("Unknown turbulence model!");
-            break;                                                              
-        }                                                                       
-        checkStrategy = FluidFlowCompStrategy::getInstance();       
+            break;
+        }
+        checkStrategy = FluidFlowCompStrategy::getInstance();
+    } else if (kernel == "CumulantK17Sponge") {
+        switch (para->getTurbulenceModel()) {
+            case TurbulenceModel::AMD:
+                newKernel = CumulantK17Sponge<TurbulenceModel::AMD>::getNewInstance(para, level);
+                break;
+            case TurbulenceModel::Smagorinsky:
+                newKernel = CumulantK17Sponge<TurbulenceModel::Smagorinsky>::getNewInstance(para, level);
+                break;
+            case TurbulenceModel::QR:
+                newKernel = CumulantK17Sponge<TurbulenceModel::QR>::getNewInstance(para, level);
+                break;
+            case TurbulenceModel::None:
+                newKernel = CumulantK17Sponge<TurbulenceModel::None>::getNewInstance(para, level);
+                break;
+            default:
+                throw std::runtime_error("Unknown turbulence model!");
+                break;
+        }
+        checkStrategy = FluidFlowCompStrategy::getInstance();
     } else if (kernel == "CumulantAll4CompSP27") {
-        newKernel     = CumulantAll4CompSP27::getNewInstance(para, level);
+        newKernel = CumulantAll4CompSP27::getNewInstance(para, level);
         checkStrategy = FluidFlowCompStrategy::getInstance();
     } else if (kernel == "CumulantK18Comp") {
         newKernel     = CumulantK18Comp::getNewInstance(para, level);
@@ -162,8 +182,8 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter>
     } else if (kernel == "CumulantK15SpongeComp") {                             //     /\      //
         newKernel     = CumulantK15SpongeComp::getNewInstance(para, level);     //	   ||
         checkStrategy = FluidFlowCompStrategy::getInstance();                   // compressible
-    }																			//===============
-	else if (  kernel == "BGKIncompSP27") {										// incompressible
+    }                                                                           //===============
+    else if (kernel == "BGKIncompSP27") {                                       // incompressible
         newKernel     = BGKIncompSP27::getNewInstance(para, level);				//	   ||
         checkStrategy = FluidFlowIncompStrategy::getInstance();                 //     \/
     } else if (kernel == "BGKPlusIncompSP27") {
@@ -181,11 +201,11 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter>
     } else if (kernel == "CumulantIsoIncompSP27") {
         newKernel     = CumulantIsoIncompSP27::getNewInstance(para, level);
         checkStrategy = FluidFlowIncompStrategy::getInstance();
-    } else if (kernel == "CumulantK15Incomp") {									//     /\      //
+    } else if (kernel == "CumulantK15Incomp") {                                 //     /\      //
         newKernel     = CumulantK15Incomp::getNewInstance(para, level);			//	   ||
         checkStrategy = FluidFlowIncompStrategy::getInstance();                 // incompressible
-    }																			//===============
-	else if (kernel == "PMCumulantOneCompSP27") {								// porous media
+    }                                                                           //===============
+    else if (kernel == "PMCumulantOneCompSP27") {                               // porous media
         newKernel     = PMCumulantOneCompSP27::getNewInstance(para, pm, level);	//	   ||
         checkStrategy = PMFluidFlowCompStrategy::getInstance();                 // porous media
     }                                                                           //===============
@@ -198,10 +218,10 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter>
     } else if (kernel == "WaleCumulantK15Comp") {
         newKernel     = WaleCumulantK15Comp::getNewInstance(para, level);
         checkStrategy = WaleFluidFlowCompStrategy::getInstance();
-    } else if (kernel == "WaleBySoniMalavCumulantK15Comp") {                    //     /\      //
+    } else if (kernel == "WaleBySoniMalavCumulantK15Comp") {                        //     /\      //
         newKernel     = WaleBySoniMalavCumulantK15Comp::getNewInstance(para, level);// ||
         checkStrategy = WaleFluidFlowCompStrategy::getInstance();               // wale model
-    }                                                                          //===============
+    }                                                                           //===============
     else {
         throw std::runtime_error("KernelFactory does not know the KernelType.");
     }
-- 
GitLab


From b04b0efb6f241369fcfbd637219383a87878101b Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 166/179] Add omega modification to sponge layer kernel

---
 .../CumulantK17Sponge_Device.cu                | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index 83c31acdb..f81c96430 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -342,6 +342,24 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     //!
     real omega = omega_in;
     if(turbulenceModel != TurbulenceModel::None){ omega /= (c1o1 + c3o1*omega_in*turbulentViscosity[k_000]); }
+    ////////////////////////////////////////////////////////////////////////////////////
+    // Calculate modified omega for sponge layer
+    // sponge layer inflow
+    real startXsponge = 1507.0f;
+    real endXsponge = 1537.0f;
+    real sizeSponge = endXsponge - startXsponge;
+
+    if (coordX[k_000] > startXsponge) {
+        real spongeFactor = (((endXsponge - coordX[k_000]) / sizeSponge) * c1o2) + c1o2;
+        omega = spongeFactor * omega;
+    }
+    //sponge layer outflow
+    endXsponge = 30.0f;
+    if (coordX[k_000] < endXsponge) {
+        real spongeFactor = (((coordX[k_000]) / endXsponge) * c1o2) + c1o2;
+        omega = spongeFactor * omega;
+    }
+
     ////////////////////////////////////////////////////////////
     // 2.
     real OxxPyyPzz = c1o1;
-- 
GitLab


From ba855e03350919ede2005f94bee7c88fbc7b79b6 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 167/179] correct factors in sponge kernel

---
 .../CumulantK17Sponge_Device.cu               | 56 ++++++++++---------
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index f81c96430..87e42b90d 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -342,34 +342,49 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     //!
     real omega = omega_in;
     if(turbulenceModel != TurbulenceModel::None){ omega /= (c1o1 + c3o1*omega_in*turbulentViscosity[k_000]); }
-    ////////////////////////////////////////////////////////////////////////////////////
-    // Calculate modified omega for sponge layer
-    // sponge layer inflow
-    real startXsponge = 1507.0f;
-    real endXsponge = 1537.0f;
-    real sizeSponge = endXsponge - startXsponge;
 
-    if (coordX[k_000] > startXsponge) {
-        real spongeFactor = (((endXsponge - coordX[k_000]) / sizeSponge) * c1o2) + c1o2;
-        omega = spongeFactor * omega;
-    }
-    //sponge layer outflow
-    endXsponge = 30.0f;
-    if (coordX[k_000] < endXsponge) {
-        real spongeFactor = (((coordX[k_000]) / endXsponge) * c1o2) + c1o2;
-        omega = spongeFactor * omega;
-    }
+    ////////////////////////////////////////////////////////////////////////////////////
+    //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116)
+    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
+    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for
+    //! different bulk viscosity).
+    //!
+    real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega);
+    real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega);
 
     ////////////////////////////////////////////////////////////
     // 2.
     real OxxPyyPzz = c1o1;
+    
     ////////////////////////////////////////////////////////////
     // 3.
+    
+    // Calculate modified omega for sponge bob layer
+    real startXsponge = 1300.0f;
+    real endXsponge = 1500.0f;
+    real sizeSponge = endXsponge - startXsponge;
+
     real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
     real OxyyMxzz =
         c8o1 * (-c2o1 + omega) * (-c7o1 + c4o1 * omega) / (c56o1 - c50o1 * omega + c9o1 * omega * omega);
     real Oxyz = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1 * omega + c3o1 * omega * omega) /
                 (c48o1 + c152o1 * omega - c130o1 * omega * omega + c29o1 * omega * omega * omega);
+
+    if (coordX[k_000] > startXsponge) {
+        real spongeFactor = (((endXsponge - coordX[k_000]) / sizeSponge) * c1o2) + c1o2;
+        omega = spongeFactor * omega;
+
+        OxyyPxzz = c1o1;
+        OxyyMxzz = c1o1;
+        Oxyz = c1o1;
+
+        quadricLimitM = c1o100;
+        quadricLimitP = c1o100;
+        quadricLimitD = c1o100;
+
+        factorA = c0o1;
+        factorB = c0o1;
+    }
     ////////////////////////////////////////////////////////////
     // 4.
     real O4 = c1o1;
@@ -380,15 +395,6 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     // 6.
     real O6 = c1o1;
 
-    ////////////////////////////////////////////////////////////////////////////////////
-    //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116)
-    //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
-    //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for
-    //! different bulk viscosity).
-    //!
-    real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega);
-    real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega);
-
     ////////////////////////////////////////////////////////////////////////////////////
     //! - Compute cumulants from central moments according to Eq. (20)-(23) in
     //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017),
-- 
GitLab


From 6a300ec5071a0116be8491577e189ac6e5535e01 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 168/179] setup livedemo

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp       | 15 ++++++++++-----
 apps/gpu/LBM/ActuatorLine/configActuatorLine.txt |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 482fac34f..69fcacbb3 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -180,6 +180,8 @@ void multipleLevel(const std::string& configPath)
 
     const real viscosityLB = viscosity * dt / (dx * dx); // LB units
 
+    VF_LOG_INFO("Knoten pro Turbinendurchmesser     = {}", reference_diameter/dx);
+    VF_LOG_INFO("velocity  [m/s] = {}", velocity);
     VF_LOG_INFO("velocity  [dx/dt] = {}", velocityLB);
     VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8);
 
@@ -205,9 +207,13 @@ void multipleLevel(const std::string& configPath)
         vz  = (real)0.0;
     });
 
-    para->setTimestepStartOut( uint(tStartOut/dt) );
-    para->setTimestepOut( uint(tOut/dt) );
-    para->setTimestepEnd( uint(tEnd/dt) );
+    para->setTimestepStartOut( uint(tStartOut) );
+    para->setTimestepOut( uint(tOut) );
+    para->setTimestepEnd( uint(tEnd) );
+
+    // para->setTimestepStartOut( uint(tStartOut/dt) );
+    // para->setTimestepOut( uint(tOut/dt) );
+    // para->setTimestepEnd( uint(tEnd/dt) );
 
     para->setIsBodyForce( true );
     para->setUseStreams( true );
@@ -215,7 +221,7 @@ void multipleLevel(const std::string& configPath)
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     gridBuilder->setVelocityBoundaryCondition(SideType::MX,  velocityLB, 0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  0.0       , 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::PY,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::MZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
@@ -245,7 +251,6 @@ void multipleLevel(const std::string& configPath)
     actuator_farm->addTurbine(turbPos[0], turbPos[1], turbPos[2], reference_diameter, omega, 0, 0, bladeRadii);
     para->addActuator( actuator_farm );
 
-
     // SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>("pointProbe", para->getOutputPath(), 100, 1, 500, 100);
     // std::vector<real> probeCoordsX = {reference_diameter,2*reference_diameter,5*reference_diameter};
     // std::vector<real> probeCoordsY = {3*reference_diameter,3*reference_diameter,3*reference_diameter};
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 3f94f328a..e6475bbae 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -11,7 +11,7 @@ ReferenceDiameter=126
 NodesPerDiameter=20
 Velocity=9
 ##################################################
-tStartOut=100
+tStartOut=0
 tOut=50
 tEnd=500
 ##################################################
-- 
GitLab


From 0a4faeb52cd617befbce12b3a09abc053089e6bd Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 169/179] Remove unused parameters in K17 sponge kernels

---
 .../CumulantK17Sponge/CumulantK17Sponge.cu    | 10 ------
 .../CumulantK17Sponge_Device.cu               | 34 +++++++++----------
 .../CumulantK17Sponge_Device.cuh              |  2 --
 3 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
index 28c7cafd4..2788cda23 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
@@ -17,7 +17,6 @@ void CumulantK17Sponge<turbulenceModel>::run()
 {
 	LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads >>>(
 		para->getParD(level)->omega,
-		para->getParD(level)->typeOfGridNode,
 		para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
 		para->getParD(level)->distributions.f[0],
 		para->getParD(level)->rho,
@@ -26,7 +25,6 @@ void CumulantK17Sponge<turbulenceModel>::run()
 		para->getSGSConstant(),
 		(unsigned long)para->getParD(level)->numberOfNodes,
 		level,
-		para->getIsBodyForce(),
 		para->getForcesDev(),
 		para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
 		para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
@@ -48,7 +46,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 		case CollisionTemplate::Default:
 			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
 				para->getParD(level)->omega,
-				para->getParD(level)->typeOfGridNode,
 				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
 				para->getParD(level)->distributions.f[0],
 				para->getParD(level)->rho,
@@ -57,7 +54,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 				para->getSGSConstant(),
 				(unsigned long)para->getParD(level)->numberOfNodes,
 				level,
-				para->getIsBodyForce(),
 				para->getForcesDev(),
 				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
 				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
@@ -70,7 +66,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 		case CollisionTemplate::WriteMacroVars:
 			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, false  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
 				para->getParD(level)->omega,
-				para->getParD(level)->typeOfGridNode,
 				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
 				para->getParD(level)->distributions.f[0],
 				para->getParD(level)->rho,
@@ -79,7 +74,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 				para->getSGSConstant(),
 				(unsigned long)para->getParD(level)->numberOfNodes,
 				level,
-				para->getIsBodyForce(),
 				para->getForcesDev(),
 				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
 				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
@@ -93,7 +87,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 		case CollisionTemplate::AllFeatures:
 			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
 				para->getParD(level)->omega,
-				para->getParD(level)->typeOfGridNode,
 				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
 				para->getParD(level)->distributions.f[0],
 				para->getParD(level)->rho,
@@ -102,7 +95,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 				para->getSGSConstant(),
 				(unsigned long)para->getParD(level)->numberOfNodes,
 				level,
-				para->getIsBodyForce(),
 				para->getForcesDev(),
 				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
 				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
@@ -114,7 +106,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 		case CollisionTemplate::ApplyBodyForce:
 			LB_Kernel_CumulantK17Sponge < turbulenceModel, false, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
 				para->getParD(level)->omega,
-				para->getParD(level)->typeOfGridNode,
 				para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ,
 				para->getParD(level)->distributions.f[0],
 				para->getParD(level)->rho,
@@ -123,7 +114,6 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 				para->getSGSConstant(),
 				(unsigned long)para->getParD(level)->numberOfNodes,
 				level,
-				para->getIsBodyForce(),
 				para->getForcesDev(),
 				para->getParD(level)->forceX_SP, para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP,
 				para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ,
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index 87e42b90d..84ad84ac2 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -58,7 +58,6 @@ using namespace vf::lbm::dir;
 template<TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce>
 __global__ void LB_Kernel_CumulantK17Sponge(
 	real omega_in,
-	uint* typeOfGridNode,
 	uint* neighborX,
 	uint* neighborY,
 	uint* neighborZ,
@@ -71,7 +70,6 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     real SGSconstant,
 	unsigned long numberOfLBnodes,
 	int level,
-    bool bodyForce,
 	real* forces,
     real* bodyForceX,
     real* bodyForceY,
@@ -722,34 +720,34 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     (dist.f[DIR_MMM])[k_MMM]  = f_PPP;
 }
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, true > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::AMD, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::QR, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
 
-template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, false > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
+template __global__ void LB_Kernel_CumulantK17Sponge < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, real* forces, real* bodyForceX, real* bodyForceY, real* , real* coordX, real* coordY, real* coordZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes);
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
index d119fa439..236ea4b8d 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cuh
@@ -6,7 +6,6 @@
 
 template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void LB_Kernel_CumulantK17Sponge(
 	real omega_in,
-	uint* typeOfGridNode,
 	uint* neighborX,
 	uint* neighborY,
 	uint* neighborZ,
@@ -19,7 +18,6 @@ template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool
 	real SGSconstant,
 	unsigned long numberOfLBnodes,
 	int level,
-	bool bodyForce,
 	real* forces,
 	real* bodyForceX,
 	real* bodyForceY,
-- 
GitLab


From a12a5ce40acc878344cdcddf696e38857b9b2436 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 170/179] Change ALM size

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 22 +++++++++----------
 .../LBM/ActuatorLine/configActuatorLine.txt   |  4 ++--
 .../CumulantK17Sponge_Device.cu               |  4 ++--
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 69fcacbb3..8e3302db8 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -97,12 +97,6 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-LbmOrGks lbmOrGks = LBM;
-
-std::string path(".");
-
-std::string simulationName("ActuatorLine");
-
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -110,6 +104,10 @@ std::string simulationName("ActuatorLine");
 void multipleLevel(const std::string& configPath)
 {
 
+    const LbmOrGks lbmOrGks = LBM;
+    const std::string path(".");
+    const std::string simulationName("ActuatorLine");
+
     logging::Logger::addStream(&std::cout);
     logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW);
     logging::Logger::timeStamp(logging::Logger::ENABLE);
@@ -130,7 +128,7 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 12*reference_diameter;
+    const real L_x = 10*reference_diameter;
     const real L_y = 5*reference_diameter;
     const real L_z = 6*reference_diameter;
 
@@ -148,7 +146,7 @@ void multipleLevel(const std::string& configPath)
     // const float tAveraging          =  config.getValue<real>("tAveraging");
     // const float tStartOutProbe      =  config.getValue<real>("tStartOutProbe");
     // const float tOutProbe           =  config.getValue<real>("tOutProbe");
-        
+
     SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config);
     BoundaryConditionFactory bcFactory = BoundaryConditionFactory();
     GridScalingFactory scalingFactory  = GridScalingFactory();
@@ -157,14 +155,14 @@ void multipleLevel(const std::string& configPath)
 
     const real dx = reference_diameter/real(nodes_per_diameter);
 
-    real turbPos[3] = {2*reference_diameter, 2*reference_diameter, 3*reference_diameter};
+    real turbPos[3] = {static_cast<real>(1.5*reference_diameter), 2*reference_diameter, 3*reference_diameter};
 
     gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
                                L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
-    gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.0*reference_diameter,  turbPos[1]-1.5*reference_diameter,  turbPos[2]-1.5*reference_diameter, 
-                                        turbPos[0]+6.0*reference_diameter,  turbPos[1]+1.5*reference_diameter,  turbPos[2]+1.5*reference_diameter) , 1 );
+    gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.0*reference_diameter,  turbPos[1]-1.1*reference_diameter,  turbPos[2]-1.1*reference_diameter,
+                                        turbPos[0]+5.0*reference_diameter,  turbPos[1]+1.1*reference_diameter,  turbPos[2]+1.1*reference_diameter) , 1 );
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
@@ -181,6 +179,7 @@ void multipleLevel(const std::string& configPath)
     const real viscosityLB = viscosity * dt / (dx * dx); // LB units
 
     VF_LOG_INFO("Knoten pro Turbinendurchmesser     = {}", reference_diameter/dx);
+    VF_LOG_INFO("dx = {}", dx);
     VF_LOG_INFO("velocity  [m/s] = {}", velocity);
     VF_LOG_INFO("velocity  [dx/dt] = {}", velocityLB);
     VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8);
@@ -242,7 +241,6 @@ void multipleLevel(const std::string& configPath)
     const uint nBladeNodes = 32;
     const real tipspeed_ratio = 7.5f; // tipspeed ratio = angular vel * radius / inflow vel
     const real omega = 2*tipspeed_ratio*velocity/reference_diameter;
-    
 
     SPtr<ActuatorFarm> actuator_farm = std::make_shared<ActuatorFarm>(nBlades, density, nBladeNodes, epsilon, level, dt, dx, true);
     std::vector<real> bladeRadii;
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index e6475bbae..668ee1c6e 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -12,8 +12,8 @@ NodesPerDiameter=20
 Velocity=9
 ##################################################
 tStartOut=0
-tOut=50
-tEnd=500
+tOut=10000
+tEnd=100000
 ##################################################
 
 # tStartTmpAveraging=100
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index 84ad84ac2..a6bf00fb0 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -358,8 +358,8 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     // 3.
     
     // Calculate modified omega for sponge bob layer
-    real startXsponge = 1300.0f;
-    real endXsponge = 1500.0f;
+    real startXsponge = 1060.0f;
+    real endXsponge = 1260.0f;
     real sizeSponge = endXsponge - startXsponge;
 
     real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
-- 
GitLab


From 646236dad6fcdedeac7fa5d6774aba877bcfb90a Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 171/179] Add pole

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  22 ++-
 apps/gpu/LBM/ActuatorLine/Pole.stl            | 142 ++++++++++++++++++
 .../LBM/ActuatorLine/configActuatorLine.txt   |   4 +-
 3 files changed, 163 insertions(+), 5 deletions(-)
 create mode 100644 apps/gpu/LBM/ActuatorLine/Pole.stl

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 8e3302db8..a36ac4aca 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -61,6 +61,8 @@
 #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h"
 #include "GridGenerator/grid/BoundaryConditions/Side.h"
 #include "GridGenerator/grid/BoundaryConditions/BoundaryCondition.h"
+#include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h"
+
 
 #include "GridGenerator/grid/GridFactory.h"
 
@@ -134,7 +136,7 @@ void multipleLevel(const std::string& configPath)
 
     const real viscosity = 1.56e-5;
 
-    const real mach = 0.1;
+    const real mach = 0.2;
 
 
     const float tStartOut   = config.getValue<real>("tStartOut");
@@ -166,6 +168,12 @@ void multipleLevel(const std::string& configPath)
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
+    std::string stlPath = "./apps/gpu/LBM/ActuatorLine/Pole.stl";
+
+    Object *sphere = TriangularMesh::make(stlPath);
+
+    gridBuilder->addGeometry(sphere);
+
     gridBuilder->setPeriodicBoundaryCondition(false, false, false);
 
     gridBuilder->buildGrids(lbmOrGks, false); // buildGrids() has to be called before setting the BCs!!!!
@@ -178,11 +186,16 @@ void multipleLevel(const std::string& configPath)
 
     const real viscosityLB = viscosity * dt / (dx * dx); // LB units
 
-    VF_LOG_INFO("Knoten pro Turbinendurchmesser     = {}", reference_diameter/dx);
-    VF_LOG_INFO("dx = {}", dx);
+    VF_LOG_INFO("dx (coarse grid) [m] = {}", dx);
+    VF_LOG_INFO("dt [s] = {}", dt);
+    VF_LOG_INFO("Lx [m] = {}", L_x);
+    VF_LOG_INFO("Ly [m] = {}", L_y);
+    VF_LOG_INFO("Lz [m] = {}", L_z);
     VF_LOG_INFO("velocity  [m/s] = {}", velocity);
     VF_LOG_INFO("velocity  [dx/dt] = {}", velocityLB);
     VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8);
+    VF_LOG_INFO("nodes/turbine diameter = {}", reference_diameter/dx);
+    VF_LOG_INFO("1000 timesteps are {} s", 1000 * dt);
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -226,6 +239,9 @@ void multipleLevel(const std::string& configPath)
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
 
+    gridBuilder->setNoSlipBoundaryCondition(SideType::GEOMETRY);
+    bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
+
     bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible);
     bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective);
 
diff --git a/apps/gpu/LBM/ActuatorLine/Pole.stl b/apps/gpu/LBM/ActuatorLine/Pole.stl
new file mode 100644
index 000000000..5b6453f68
--- /dev/null
+++ b/apps/gpu/LBM/ActuatorLine/Pole.stl
@@ -0,0 +1,142 @@
+solid Visualization Toolkit generated SLA File
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 214 256 378
+   vertex 214 -4 378
+   vertex 209 256 369.34
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 209 -4 369.34
+   vertex 209 256 369.34
+   vertex 214 -4 378
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 209 256 369.34
+   vertex 209 -4 369.34
+   vertex 199 256 369.34
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 199 -4 369.34
+   vertex 199 256 369.34
+   vertex 209 -4 369.34
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 199 256 369.34
+   vertex 199 -4 369.34
+   vertex 194 256 378
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 194 -4 378
+   vertex 194 256 378
+   vertex 199 -4 369.34
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 194 256 378
+   vertex 194 -4 378
+   vertex 199 256 386.66
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 199 -4 386.66
+   vertex 199 256 386.66
+   vertex 194 -4 378
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 199 256 386.66
+   vertex 199 -4 386.66
+   vertex 209 256 386.66
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 209 -4 386.66
+   vertex 209 256 386.66
+   vertex 199 -4 386.66
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 209 256 386.66
+   vertex 209 -4 386.66
+   vertex 214 256 378
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 214 -4 378
+   vertex 214 256 378
+   vertex 209 -4 386.66
+  endloop
+ endfacet
+ facet normal 0.5 0 -0.866026
+  outer loop
+   vertex 214 256 378
+   vertex 209 256 369.34
+   vertex 209 256 386.66
+  endloop
+ endfacet
+ facet normal -0.5 0 0.866026
+  outer loop
+   vertex 209 256 386.66
+   vertex 209 256 369.34
+   vertex 199 256 386.66
+  endloop
+ endfacet
+ facet normal 0 0.0332902 0.999446
+  outer loop
+   vertex 209 256 369.34
+   vertex 199 256 369.34
+   vertex 199 256 386.66
+  endloop
+ endfacet
+ facet normal 0 0 -1
+  outer loop
+   vertex 194 256 378
+   vertex 199 256 386.66
+   vertex 199 256 369.34
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 194 -4 378
+   vertex 199 -4 369.34
+   vertex 199 -4 386.66
+  endloop
+ endfacet
+ facet normal 0.866025 0 -0.5
+  outer loop
+   vertex 199 -4 386.66
+   vertex 199 -4 369.34
+   vertex 209 -4 386.66
+  endloop
+ endfacet
+ facet normal 0.499907 0.0192272 -0.865865
+  outer loop
+   vertex 199 -4 369.34
+   vertex 209 -4 369.34
+   vertex 209 -4 386.66
+  endloop
+ endfacet
+ facet normal -0.5 0 0.866026
+  outer loop
+   vertex 214 -4 378
+   vertex 209 -4 386.66
+   vertex 209 -4 369.34
+  endloop
+ endfacet
+endsolid
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 668ee1c6e..11f0d471d 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,7 +8,7 @@
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=20
+NodesPerDiameter=32 #20=800mb # 32=3200mb
 Velocity=9
 ##################################################
 tStartOut=0
@@ -25,7 +25,7 @@ tEnd=100000
 
 ##################################################
 TurbulenceModel = None
-#SGSconstant = 0.3333333
+# SGSconstant = 0.3333333
 #
 #QuadricLimiterP = 100000.0
 #QuadricLimiterM = 100000.0
-- 
GitLab


From a79fa95d5c11d90ac30e3d769e3c4f8cf77b88ec Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 172/179] Finer grid, but slower

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  21 +-
 apps/gpu/LBM/ActuatorLine/Pole.stl            | 550 +++++++++++++++---
 .../LBM/ActuatorLine/configActuatorLine.txt   |   2 +-
 .../CumulantK17Sponge_Device.cu               |   4 +-
 4 files changed, 484 insertions(+), 93 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index a36ac4aca..aab2ddb8a 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -130,9 +130,9 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 10*reference_diameter;
-    const real L_y = 5*reference_diameter;
-    const real L_z = 6*reference_diameter;
+    const real L_x = 6*reference_diameter;
+    const real L_y = 4*reference_diameter;
+    const real L_z = 4*reference_diameter;
 
     const real viscosity = 1.56e-5;
 
@@ -157,22 +157,21 @@ void multipleLevel(const std::string& configPath)
 
     const real dx = reference_diameter/real(nodes_per_diameter);
 
-    real turbPos[3] = {static_cast<real>(1.5*reference_diameter), 2*reference_diameter, 3*reference_diameter};
+    real turbPos[3] = {1*reference_diameter, 2*reference_diameter, 2*reference_diameter};
 
     gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
                                L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
-    gridBuilder->addGrid( new Cuboid(   turbPos[0]-1.0*reference_diameter,  turbPos[1]-1.1*reference_diameter,  turbPos[2]-1.1*reference_diameter,
-                                        turbPos[0]+5.0*reference_diameter,  turbPos[1]+1.1*reference_diameter,  turbPos[2]+1.1*reference_diameter) , 1 );
+    gridBuilder->addGrid( new Cuboid(   turbPos[0]-0.4*reference_diameter,  turbPos[1]-0.8*reference_diameter,  turbPos[2]-0.8*reference_diameter,
+                                        turbPos[0]+3.0*reference_diameter,  turbPos[1]+0.8*reference_diameter,  turbPos[2]+0.8*reference_diameter) , 1 );
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
     std::string stlPath = "./apps/gpu/LBM/ActuatorLine/Pole.stl";
 
-    Object *sphere = TriangularMesh::make(stlPath);
-
-    gridBuilder->addGeometry(sphere);
+    // Object *sphere = TriangularMesh::make(stlPath);
+    // gridBuilder->addGeometry(sphere);
 
     gridBuilder->setPeriodicBoundaryCondition(false, false, false);
 
@@ -239,8 +238,8 @@ void multipleLevel(const std::string& configPath)
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
 
-    gridBuilder->setNoSlipBoundaryCondition(SideType::GEOMETRY);
-    bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
+    // gridBuilder->setNoSlipBoundaryCondition(SideType::GEOMETRY);
+    // bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
 
     bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible);
     bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective);
diff --git a/apps/gpu/LBM/ActuatorLine/Pole.stl b/apps/gpu/LBM/ActuatorLine/Pole.stl
index 5b6453f68..9373b1f54 100644
--- a/apps/gpu/LBM/ActuatorLine/Pole.stl
+++ b/apps/gpu/LBM/ActuatorLine/Pole.stl
@@ -1,142 +1,534 @@
 solid Visualization Toolkit generated SLA File
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 214 256 378
-   vertex 214 -4 378
-   vertex 209 256 369.34
+   vertex 148 252 252
+   vertex 148 0 252
+   vertex 147.608 252 249.528
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 209 -4 369.34
-   vertex 209 256 369.34
-   vertex 214 -4 378
+   vertex 147.608 0 249.528
+   vertex 147.608 252 249.528
+   vertex 148 0 252
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 209 256 369.34
-   vertex 209 -4 369.34
-   vertex 199 256 369.34
+   vertex 147.608 252 249.528
+   vertex 147.608 0 249.528
+   vertex 146.472 252 247.298
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 199 -4 369.34
-   vertex 199 256 369.34
-   vertex 209 -4 369.34
+   vertex 146.472 0 247.298
+   vertex 146.472 252 247.298
+   vertex 147.608 0 249.528
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 199 256 369.34
-   vertex 199 -4 369.34
-   vertex 194 256 378
+   vertex 146.472 252 247.298
+   vertex 146.472 0 247.298
+   vertex 144.702 252 245.528
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 194 -4 378
-   vertex 194 256 378
-   vertex 199 -4 369.34
+   vertex 144.702 0 245.528
+   vertex 144.702 252 245.528
+   vertex 146.472 0 247.298
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 194 256 378
-   vertex 194 -4 378
-   vertex 199 256 386.66
+   vertex 144.702 252 245.528
+   vertex 144.702 0 245.528
+   vertex 142.472 252 244.392
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 199 -4 386.66
-   vertex 199 256 386.66
-   vertex 194 -4 378
+   vertex 142.472 0 244.392
+   vertex 142.472 252 244.392
+   vertex 144.702 0 245.528
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 199 256 386.66
-   vertex 199 -4 386.66
-   vertex 209 256 386.66
+   vertex 142.472 252 244.392
+   vertex 142.472 0 244.392
+   vertex 140 252 244
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 209 -4 386.66
-   vertex 209 256 386.66
-   vertex 199 -4 386.66
+   vertex 140 0 244
+   vertex 140 252 244
+   vertex 142.472 0 244.392
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 209 256 386.66
-   vertex 209 -4 386.66
-   vertex 214 256 378
+   vertex 140 252 244
+   vertex 140 0 244
+   vertex 137.528 252 244.392
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 214 -4 378
-   vertex 214 256 378
-   vertex 209 -4 386.66
+   vertex 137.528 0 244.392
+   vertex 137.528 252 244.392
+   vertex 140 0 244
   endloop
  endfacet
- facet normal 0.5 0 -0.866026
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 214 256 378
-   vertex 209 256 369.34
-   vertex 209 256 386.66
+   vertex 137.528 252 244.392
+   vertex 137.528 0 244.392
+   vertex 135.298 252 245.528
   endloop
  endfacet
- facet normal -0.5 0 0.866026
+ facet normal -0.987689 0 0.156432
   outer loop
-   vertex 209 256 386.66
-   vertex 209 256 369.34
-   vertex 199 256 386.66
+   vertex 135.298 0 245.528
+   vertex 135.298 252 245.528
+   vertex 137.528 0 244.392
   endloop
  endfacet
- facet normal 0 0.0332902 0.999446
+ facet normal 0.987689 0 -0.156432
   outer loop
-   vertex 209 256 369.34
-   vertex 199 256 369.34
-   vertex 199 256 386.66
+   vertex 135.298 252 245.528
+   vertex 135.298 0 245.528
+   vertex 133.528 252 247.298
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 133.528 0 247.298
+   vertex 133.528 252 247.298
+   vertex 135.298 0 245.528
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 133.528 252 247.298
+   vertex 133.528 0 247.298
+   vertex 132.392 252 249.528
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 132.392 0 249.528
+   vertex 132.392 252 249.528
+   vertex 133.528 0 247.298
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 132.392 252 249.528
+   vertex 132.392 0 249.528
+   vertex 132 252 252
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 132 0 252
+   vertex 132 252 252
+   vertex 132.392 0 249.528
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 132 252 252
+   vertex 132 0 252
+   vertex 132.392 252 254.472
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 132.392 0 254.472
+   vertex 132.392 252 254.472
+   vertex 132 0 252
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 132.392 252 254.472
+   vertex 132.392 0 254.472
+   vertex 133.528 252 256.702
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 133.528 252 256.702
+   vertex 132.392 0 254.472
+   vertex 133.528 0 256.702
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 133.528 252 256.702
+   vertex 133.528 0 256.702
+   vertex 135.298 252 258.472
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 135.298 0 258.472
+   vertex 135.298 252 258.472
+   vertex 133.528 0 256.702
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 135.298 252 258.472
+   vertex 135.298 0 258.472
+   vertex 137.528 252 259.608
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 137.528 0 259.608
+   vertex 137.528 252 259.608
+   vertex 135.298 0 258.472
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 137.528 252 259.608
+   vertex 137.528 0 259.608
+   vertex 140 252 260
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 140 0 260
+   vertex 140 252 260
+   vertex 137.528 0 259.608
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 140 252 260
+   vertex 140 0 260
+   vertex 142.472 252 259.608
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 142.472 0 259.608
+   vertex 142.472 252 259.608
+   vertex 140 0 260
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 142.472 252 259.608
+   vertex 142.472 0 259.608
+   vertex 144.702 252 258.472
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 144.702 0 258.472
+   vertex 144.702 252 258.472
+   vertex 142.472 0 259.608
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 144.702 252 258.472
+   vertex 144.702 0 258.472
+   vertex 146.472 252 256.702
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 146.472 0 256.702
+   vertex 146.472 252 256.702
+   vertex 144.702 0 258.472
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 146.472 252 256.702
+   vertex 146.472 0 256.702
+   vertex 147.608 252 254.472
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 147.608 252 254.472
+   vertex 146.472 0 256.702
+   vertex 147.608 0 254.472
+  endloop
+ endfacet
+ facet normal 0.987689 0 -0.156432
+  outer loop
+   vertex 147.608 252 254.472
+   vertex 147.608 0 254.472
+   vertex 148 252 252
+  endloop
+ endfacet
+ facet normal -0.987689 0 0.156432
+  outer loop
+   vertex 148 0 252
+   vertex 148 252 252
+   vertex 147.608 0 254.472
+  endloop
+ endfacet
+ facet normal -0.156432 0 -0.987689
+  outer loop
+   vertex 132.392 252 254.472
+   vertex 133.528 252 256.702
+   vertex 132 252 252
+  endloop
+ endfacet
+ facet normal 0.156431 0.00306919 0.987684
+  outer loop
+   vertex 132 252 252
+   vertex 133.528 252 256.702
+   vertex 132.392 252 249.528
   endloop
  endfacet
  facet normal 0 0 -1
   outer loop
-   vertex 194 256 378
-   vertex 199 256 386.66
-   vertex 199 256 369.34
+   vertex 132.392 252 249.528
+   vertex 133.528 252 256.702
+   vertex 133.528 252 247.298
+  endloop
+ endfacet
+ facet normal -0 0.00450917 0.99999
+  outer loop
+   vertex 133.528 252 247.298
+   vertex 133.528 252 256.702
+   vertex 135.298 252 245.528
+  endloop
+ endfacet
+ facet normal 0.156435 0 -0.987688
+  outer loop
+   vertex 135.298 252 245.528
+   vertex 133.528 252 256.702
+   vertex 137.528 252 244.392
+  endloop
+ endfacet
+ facet normal -0.156432 0.00583797 0.987671
+  outer loop
+   vertex 137.528 252 244.392
+   vertex 133.528 252 256.702
+   vertex 140 252 244
+  endloop
+ endfacet
+ facet normal -0.309017 0 0.951056
+  outer loop
+   vertex 133.528 252 256.702
+   vertex 135.298 252 258.472
+   vertex 140 252 244
+  endloop
+ endfacet
+ facet normal 0.30901 0.00702308 -0.951033
+  outer loop
+   vertex 135.298 252 258.472
+   vertex 137.528 252 259.608
+   vertex 140 252 244
+  endloop
+ endfacet
+ facet normal -0.156434 0 0.987688
+  outer loop
+   vertex 137.528 252 259.608
+   vertex 140 252 260
+   vertex 140 252 244
+  endloop
+ endfacet
+ facet normal 0.156434 0 -0.987688
+  outer loop
+   vertex 140 252 244
+   vertex 140 252 260
+   vertex 142.472 252 244.392
+  endloop
+ endfacet
+ facet normal -0.309009 0.00702306 0.951033
+  outer loop
+   vertex 142.472 252 244.392
+   vertex 140 252 260
+   vertex 144.702 252 245.528
+  endloop
+ endfacet
+ facet normal 0.309005 0.00884943 -0.951019
+  outer loop
+   vertex 140 252 260
+   vertex 142.472 252 259.608
+   vertex 144.702 252 245.528
+  endloop
+ endfacet
+ facet normal -0.156435 0 0.987688
+  outer loop
+   vertex 142.472 252 259.608
+   vertex 144.702 252 258.472
+   vertex 144.702 252 245.528
+  endloop
+ endfacet
+ facet normal 0.156428 0.00944581 -0.987644
+  outer loop
+   vertex 144.702 252 258.472
+   vertex 146.472 252 256.702
+   vertex 144.702 252 245.528
+  endloop
+ endfacet
+ facet normal 0 0 1
+  outer loop
+   vertex 146.472 252 256.702
+   vertex 147.608 252 254.472
+   vertex 144.702 252 245.528
+  endloop
+ endfacet
+ facet normal 0 0 -1
+  outer loop
+   vertex 144.702 252 245.528
+   vertex 147.608 252 254.472
+   vertex 146.472 252 247.298
+  endloop
+ endfacet
+ facet normal -0.156428 0.00944581 0.987644
+  outer loop
+   vertex 146.472 252 247.298
+   vertex 147.608 252 254.472
+   vertex 147.608 252 249.528
+  endloop
+ endfacet
+ facet normal 0.156434 0 -0.987688
+  outer loop
+   vertex 148 252 252
+   vertex 147.608 252 249.528
+   vertex 147.608 252 254.472
+  endloop
+ endfacet
+ facet normal 0.156434 0 -0.987688
+  outer loop
+   vertex 147.608 0 254.472
+   vertex 146.472 0 256.702
+   vertex 148 0 252
+  endloop
+ endfacet
+ facet normal -0.156434 0 0.987688
+  outer loop
+   vertex 148 0 252
+   vertex 146.472 0 256.702
+   vertex 147.608 0 249.528
+  endloop
+ endfacet
+ facet normal 0.309002 0.00980961 -0.951011
+  outer loop
+   vertex 147.608 0 249.528
+   vertex 146.472 0 256.702
+   vertex 146.472 0 247.298
+  endloop
+ endfacet
+ facet normal -0.309017 0 0.951056
+  outer loop
+   vertex 146.472 0 247.298
+   vertex 146.472 0 256.702
+   vertex 144.702 0 245.528
+  endloop
+ endfacet
+ facet normal 0.45397 0.00944579 -0.890967
+  outer loop
+   vertex 144.702 0 245.528
+   vertex 146.472 0 256.702
+   vertex 142.472 0 244.392
+  endloop
+ endfacet
+ facet normal -0.45399 0 0.891007
+  outer loop
+   vertex 142.472 0 244.392
+   vertex 146.472 0 256.702
+   vertex 140 0 244
+  endloop
+ endfacet
+ facet normal -0.309005 0.00884946 0.951019
+  outer loop
+   vertex 146.472 0 256.702
+   vertex 144.702 0 258.472
+   vertex 140 0 244
+  endloop
+ endfacet
+ facet normal 0.309017 0 -0.951057
+  outer loop
+   vertex 144.702 0 258.472
+   vertex 142.472 0 259.608
+   vertex 140 0 244
+  endloop
+ endfacet
+ facet normal -0.156429 0.00803518 0.987656
+  outer loop
+   vertex 142.472 0 259.608
+   vertex 140 0 260
+   vertex 140 0 244
+  endloop
+ endfacet
+ facet normal 0.156432 0.00583801 -0.987672
+  outer loop
+   vertex 140 0 244
+   vertex 140 0 260
+   vertex 137.528 0 244.392
+  endloop
+ endfacet
+ facet normal -0.309017 0 0.951056
+  outer loop
+   vertex 137.528 0 244.392
+   vertex 140 0 260
+   vertex 135.298 0 245.528
+  endloop
+ endfacet
+ facet normal 0.309017 0 -0.951056
+  outer loop
+   vertex 140 0 260
+   vertex 137.528 0 259.608
+   vertex 135.298 0 245.528
+  endloop
+ endfacet
+ facet normal -0.156432 0.00583797 0.987671
+  outer loop
+   vertex 137.528 0 259.608
+   vertex 135.298 0 258.472
+   vertex 135.298 0 245.528
+  endloop
+ endfacet
+ facet normal 0.156435 0 -0.987688
+  outer loop
+   vertex 135.298 0 258.472
+   vertex 133.528 0 256.702
+   vertex 135.298 0 245.528
   endloop
  endfacet
- facet normal -0.866025 0 0.5
+ facet normal 0 0.00450917 0.99999
   outer loop
-   vertex 194 -4 378
-   vertex 199 -4 369.34
-   vertex 199 -4 386.66
+   vertex 133.528 0 256.702
+   vertex 132.392 0 254.472
+   vertex 135.298 0 245.528
   endloop
  endfacet
- facet normal 0.866025 0 -0.5
+ facet normal 0 0.00155373 -0.999999
   outer loop
-   vertex 199 -4 386.66
-   vertex 199 -4 369.34
-   vertex 209 -4 386.66
+   vertex 135.298 0 245.528
+   vertex 132.392 0 254.472
+   vertex 133.528 0 247.298
   endloop
  endfacet
- facet normal 0.499907 0.0192272 -0.865865
+ facet normal -0.156432 0 0.987689
   outer loop
-   vertex 199 -4 369.34
-   vertex 209 -4 369.34
-   vertex 209 -4 386.66
+   vertex 133.528 0 247.298
+   vertex 132.392 0 254.472
+   vertex 132.392 0 249.528
   endloop
  endfacet
- facet normal -0.5 0 0.866026
+ facet normal 0.156432 0 -0.987689
   outer loop
-   vertex 214 -4 378
-   vertex 209 -4 386.66
-   vertex 209 -4 369.34
+   vertex 132 0 252
+   vertex 132.392 0 249.528
+   vertex 132.392 0 254.472
   endloop
  endfacet
 endsolid
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 11f0d471d..f28c2ff3c 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,7 +8,7 @@
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=32 #20=800mb # 32=3200mb
+NodesPerDiameter=40 #20=800mb # 32=3200mb
 Velocity=9
 ##################################################
 tStartOut=0
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index a6bf00fb0..ce6bbce68 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -358,8 +358,8 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     // 3.
     
     // Calculate modified omega for sponge bob layer
-    real startXsponge = 1060.0f;
-    real endXsponge = 1260.0f;
+    real startXsponge = 656.0f;
+    real endXsponge = 756.0f;
     real sizeSponge = endXsponge - startXsponge;
 
     real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
-- 
GitLab


From b2b29c94c74f1dc8fda0adcd3e04f99a82b78a2e Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 173/179] Move turbine down

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  20 +-
 apps/gpu/LBM/ActuatorLine/Pole.stl            | 564 +++++-------------
 .../LBM/ActuatorLine/configActuatorLine.txt   |   2 +-
 3 files changed, 152 insertions(+), 434 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index aab2ddb8a..77afe599b 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -99,10 +99,6 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 void multipleLevel(const std::string& configPath)
 {
 
@@ -131,7 +127,7 @@ void multipleLevel(const std::string& configPath)
 
 
     const real L_x = 6*reference_diameter;
-    const real L_y = 4*reference_diameter;
+    const real L_y = 3*reference_diameter;
     const real L_z = 4*reference_diameter;
 
     const real viscosity = 1.56e-5;
@@ -157,21 +153,21 @@ void multipleLevel(const std::string& configPath)
 
     const real dx = reference_diameter/real(nodes_per_diameter);
 
-    real turbPos[3] = {1*reference_diameter, 2*reference_diameter, 2*reference_diameter};
+    real turbPos[3] = {1*reference_diameter, reference_diameter, 2*reference_diameter};
 
     gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
                                L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
-    gridBuilder->addGrid( new Cuboid(   turbPos[0]-0.4*reference_diameter,  turbPos[1]-0.8*reference_diameter,  turbPos[2]-0.8*reference_diameter,
+    gridBuilder->addGrid( new Cuboid(   turbPos[0]-0.4*reference_diameter,  turbPos[1]-1*reference_diameter,  turbPos[2]-0.8*reference_diameter,
                                         turbPos[0]+3.0*reference_diameter,  turbPos[1]+0.8*reference_diameter,  turbPos[2]+0.8*reference_diameter) , 1 );
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
     std::string stlPath = "./apps/gpu/LBM/ActuatorLine/Pole.stl";
 
-    // Object *sphere = TriangularMesh::make(stlPath);
-    // gridBuilder->addGeometry(sphere);
+    Object *sphere = TriangularMesh::make(stlPath);
+    gridBuilder->addGeometry(sphere);
 
     gridBuilder->setPeriodicBoundaryCondition(false, false, false);
 
@@ -238,8 +234,8 @@ void multipleLevel(const std::string& configPath)
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
 
-    // gridBuilder->setNoSlipBoundaryCondition(SideType::GEOMETRY);
-    // bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
+    gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0);
+    bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
 
     bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible);
     bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective);
@@ -247,6 +243,8 @@ void multipleLevel(const std::string& configPath)
     SPtr<TurbulenceModelFactory> tmFactory = std::make_shared<TurbulenceModelFactory>(para);
     tmFactory->readConfigFile(config);
 
+    // gridBuilder->writeGridsToVtk(para->getOutputPath() + "Grid" + "_");
+
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     int level = 1; // grid level at which the turbine samples velocities and distributes forces
diff --git a/apps/gpu/LBM/ActuatorLine/Pole.stl b/apps/gpu/LBM/ActuatorLine/Pole.stl
index 9373b1f54..dae651651 100644
--- a/apps/gpu/LBM/ActuatorLine/Pole.stl
+++ b/apps/gpu/LBM/ActuatorLine/Pole.stl
@@ -1,534 +1,254 @@
 solid Visualization Toolkit generated SLA File
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 148 252 252
-   vertex 148 0 252
-   vertex 147.608 252 249.528
+   vertex 150 126 252
+   vertex 150 0 252
+   vertex 148.09 126 246.122
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 147.608 0 249.528
-   vertex 147.608 252 249.528
-   vertex 148 0 252
+   vertex 148.09 0 246.122
+   vertex 148.09 126 246.122
+   vertex 150 0 252
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 147.608 252 249.528
-   vertex 147.608 0 249.528
-   vertex 146.472 252 247.298
+   vertex 148.09 126 246.122
+   vertex 148.09 0 246.122
+   vertex 143.09 126 242.489
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 146.472 0 247.298
-   vertex 146.472 252 247.298
-   vertex 147.608 0 249.528
+   vertex 143.09 0 242.489
+   vertex 143.09 126 242.489
+   vertex 148.09 0 246.122
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 146.472 252 247.298
-   vertex 146.472 0 247.298
-   vertex 144.702 252 245.528
+   vertex 143.09 126 242.489
+   vertex 143.09 0 242.489
+   vertex 136.91 126 242.489
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 144.702 0 245.528
-   vertex 144.702 252 245.528
-   vertex 146.472 0 247.298
+   vertex 136.91 0 242.489
+   vertex 136.91 126 242.489
+   vertex 143.09 0 242.489
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 144.702 252 245.528
-   vertex 144.702 0 245.528
-   vertex 142.472 252 244.392
+   vertex 136.91 126 242.489
+   vertex 136.91 0 242.489
+   vertex 131.91 126 246.122
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 142.472 0 244.392
-   vertex 142.472 252 244.392
-   vertex 144.702 0 245.528
+   vertex 131.91 0 246.122
+   vertex 131.91 126 246.122
+   vertex 136.91 0 242.489
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 142.472 252 244.392
-   vertex 142.472 0 244.392
-   vertex 140 252 244
+   vertex 131.91 126 246.122
+   vertex 131.91 0 246.122
+   vertex 130 126 252
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 140 0 244
-   vertex 140 252 244
-   vertex 142.472 0 244.392
+   vertex 130 0 252
+   vertex 130 126 252
+   vertex 131.91 0 246.122
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 140 252 244
-   vertex 140 0 244
-   vertex 137.528 252 244.392
+   vertex 130 126 252
+   vertex 130 0 252
+   vertex 131.91 126 257.878
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 137.528 0 244.392
-   vertex 137.528 252 244.392
-   vertex 140 0 244
+   vertex 131.91 0 257.878
+   vertex 131.91 126 257.878
+   vertex 130 0 252
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 137.528 252 244.392
-   vertex 137.528 0 244.392
-   vertex 135.298 252 245.528
+   vertex 131.91 126 257.878
+   vertex 131.91 0 257.878
+   vertex 136.91 126 261.511
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 135.298 0 245.528
-   vertex 135.298 252 245.528
-   vertex 137.528 0 244.392
+   vertex 136.91 0 261.511
+   vertex 136.91 126 261.511
+   vertex 131.91 0 257.878
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 135.298 252 245.528
-   vertex 135.298 0 245.528
-   vertex 133.528 252 247.298
+   vertex 136.91 126 261.511
+   vertex 136.91 0 261.511
+   vertex 143.09 126 261.511
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 133.528 0 247.298
-   vertex 133.528 252 247.298
-   vertex 135.298 0 245.528
+   vertex 143.09 0 261.511
+   vertex 143.09 126 261.511
+   vertex 136.91 0 261.511
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 133.528 252 247.298
-   vertex 133.528 0 247.298
-   vertex 132.392 252 249.528
+   vertex 143.09 126 261.511
+   vertex 143.09 0 261.511
+   vertex 148.09 126 257.878
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 132.392 0 249.528
-   vertex 132.392 252 249.528
-   vertex 133.528 0 247.298
+   vertex 148.09 0 257.878
+   vertex 148.09 126 257.878
+   vertex 143.09 0 261.511
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
+ facet normal 0.951056 0 -0.309018
   outer loop
-   vertex 132.392 252 249.528
-   vertex 132.392 0 249.528
-   vertex 132 252 252
+   vertex 148.09 126 257.878
+   vertex 148.09 0 257.878
+   vertex 150 126 252
   endloop
  endfacet
- facet normal -0.987689 0 0.156432
+ facet normal -0.951056 0 0.309018
   outer loop
-   vertex 132 0 252
-   vertex 132 252 252
-   vertex 132.392 0 249.528
+   vertex 150 0 252
+   vertex 150 126 252
+   vertex 148.09 0 257.878
   endloop
  endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 132 252 252
-   vertex 132 0 252
-   vertex 132.392 252 254.472
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 132.392 0 254.472
-   vertex 132.392 252 254.472
-   vertex 132 0 252
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 132.392 252 254.472
-   vertex 132.392 0 254.472
-   vertex 133.528 252 256.702
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 133.528 252 256.702
-   vertex 132.392 0 254.472
-   vertex 133.528 0 256.702
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 133.528 252 256.702
-   vertex 133.528 0 256.702
-   vertex 135.298 252 258.472
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 135.298 0 258.472
-   vertex 135.298 252 258.472
-   vertex 133.528 0 256.702
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 135.298 252 258.472
-   vertex 135.298 0 258.472
-   vertex 137.528 252 259.608
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 137.528 0 259.608
-   vertex 137.528 252 259.608
-   vertex 135.298 0 258.472
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 137.528 252 259.608
-   vertex 137.528 0 259.608
-   vertex 140 252 260
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 140 0 260
-   vertex 140 252 260
-   vertex 137.528 0 259.608
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 140 252 260
-   vertex 140 0 260
-   vertex 142.472 252 259.608
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 142.472 0 259.608
-   vertex 142.472 252 259.608
-   vertex 140 0 260
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 142.472 252 259.608
-   vertex 142.472 0 259.608
-   vertex 144.702 252 258.472
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 144.702 0 258.472
-   vertex 144.702 252 258.472
-   vertex 142.472 0 259.608
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 144.702 252 258.472
-   vertex 144.702 0 258.472
-   vertex 146.472 252 256.702
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 146.472 0 256.702
-   vertex 146.472 252 256.702
-   vertex 144.702 0 258.472
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 146.472 252 256.702
-   vertex 146.472 0 256.702
-   vertex 147.608 252 254.472
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 147.608 252 254.472
-   vertex 146.472 0 256.702
-   vertex 147.608 0 254.472
-  endloop
- endfacet
- facet normal 0.987689 0 -0.156432
-  outer loop
-   vertex 147.608 252 254.472
-   vertex 147.608 0 254.472
-   vertex 148 252 252
-  endloop
- endfacet
- facet normal -0.987689 0 0.156432
-  outer loop
-   vertex 148 0 252
-   vertex 148 252 252
-   vertex 147.608 0 254.472
-  endloop
- endfacet
- facet normal -0.156432 0 -0.987689
-  outer loop
-   vertex 132.392 252 254.472
-   vertex 133.528 252 256.702
-   vertex 132 252 252
-  endloop
- endfacet
- facet normal 0.156431 0.00306919 0.987684
-  outer loop
-   vertex 132 252 252
-   vertex 133.528 252 256.702
-   vertex 132.392 252 249.528
-  endloop
- endfacet
- facet normal 0 0 -1
-  outer loop
-   vertex 132.392 252 249.528
-   vertex 133.528 252 256.702
-   vertex 133.528 252 247.298
-  endloop
- endfacet
- facet normal -0 0.00450917 0.99999
-  outer loop
-   vertex 133.528 252 247.298
-   vertex 133.528 252 256.702
-   vertex 135.298 252 245.528
-  endloop
- endfacet
- facet normal 0.156435 0 -0.987688
-  outer loop
-   vertex 135.298 252 245.528
-   vertex 133.528 252 256.702
-   vertex 137.528 252 244.392
-  endloop
- endfacet
- facet normal -0.156432 0.00583797 0.987671
-  outer loop
-   vertex 137.528 252 244.392
-   vertex 133.528 252 256.702
-   vertex 140 252 244
-  endloop
- endfacet
- facet normal -0.309017 0 0.951056
-  outer loop
-   vertex 133.528 252 256.702
-   vertex 135.298 252 258.472
-   vertex 140 252 244
-  endloop
- endfacet
- facet normal 0.30901 0.00702308 -0.951033
-  outer loop
-   vertex 135.298 252 258.472
-   vertex 137.528 252 259.608
-   vertex 140 252 244
-  endloop
- endfacet
- facet normal -0.156434 0 0.987688
-  outer loop
-   vertex 137.528 252 259.608
-   vertex 140 252 260
-   vertex 140 252 244
-  endloop
- endfacet
- facet normal 0.156434 0 -0.987688
-  outer loop
-   vertex 140 252 244
-   vertex 140 252 260
-   vertex 142.472 252 244.392
-  endloop
- endfacet
- facet normal -0.309009 0.00702306 0.951033
-  outer loop
-   vertex 142.472 252 244.392
-   vertex 140 252 260
-   vertex 144.702 252 245.528
-  endloop
- endfacet
- facet normal 0.309005 0.00884943 -0.951019
-  outer loop
-   vertex 140 252 260
-   vertex 142.472 252 259.608
-   vertex 144.702 252 245.528
-  endloop
- endfacet
- facet normal -0.156435 0 0.987688
+ facet normal 0.309017 0 -0.951056
   outer loop
-   vertex 142.472 252 259.608
-   vertex 144.702 252 258.472
-   vertex 144.702 252 245.528
+   vertex 150 126 252
+   vertex 148.09 126 246.122
+   vertex 148.09 126 257.878
   endloop
  endfacet
- facet normal 0.156428 0.00944581 -0.987644
+ facet normal -0.308774 0.0396513 0.950309
   outer loop
-   vertex 144.702 252 258.472
-   vertex 146.472 252 256.702
-   vertex 144.702 252 245.528
+   vertex 148.09 126 246.122
+   vertex 143.09 126 242.489
+   vertex 148.09 126 257.878
   endloop
  endfacet
  facet normal 0 0 1
   outer loop
-   vertex 146.472 252 256.702
-   vertex 147.608 252 254.472
-   vertex 144.702 252 245.528
-  endloop
- endfacet
- facet normal 0 0 -1
-  outer loop
-   vertex 144.702 252 245.528
-   vertex 147.608 252 254.472
-   vertex 146.472 252 247.298
+   vertex 148.09 126 257.878
+   vertex 143.09 126 242.489
+   vertex 143.09 126 261.511
   endloop
  endfacet
- facet normal -0.156428 0.00944581 0.987644
+ facet normal 0 0.028819 -0.999585
   outer loop
-   vertex 146.472 252 247.298
-   vertex 147.608 252 254.472
-   vertex 147.608 252 249.528
+   vertex 143.09 126 261.511
+   vertex 143.09 126 242.489
+   vertex 136.91 126 261.511
   endloop
  endfacet
- facet normal 0.156434 0 -0.987688
+ facet normal -0.309017 0 0.951057
   outer loop
-   vertex 148 252 252
-   vertex 147.608 252 249.528
-   vertex 147.608 252 254.472
+   vertex 136.91 126 261.511
+   vertex 143.09 126 242.489
+   vertex 131.91 126 257.878
   endloop
  endfacet
- facet normal 0.156434 0 -0.987688
+ facet normal 0.308981 0.0151556 -0.950947
   outer loop
-   vertex 147.608 0 254.472
-   vertex 146.472 0 256.702
-   vertex 148 0 252
+   vertex 131.91 126 257.878
+   vertex 143.09 126 242.489
+   vertex 130 126 252
   endloop
  endfacet
- facet normal -0.156434 0 0.987688
+ facet normal -0.587785 0 0.809018
   outer loop
-   vertex 148 0 252
-   vertex 146.472 0 256.702
-   vertex 147.608 0 249.528
+   vertex 130 126 252
+   vertex 143.09 126 242.489
+   vertex 131.91 126 246.122
   endloop
  endfacet
- facet normal 0.309002 0.00980961 -0.951011
+ facet normal 0.587785 0 -0.809018
   outer loop
-   vertex 147.608 0 249.528
-   vertex 146.472 0 256.702
-   vertex 146.472 0 247.298
+   vertex 136.91 126 242.489
+   vertex 131.91 126 246.122
+   vertex 143.09 126 242.489
   endloop
  endfacet
- facet normal -0.309017 0 0.951056
+ facet normal -0.587785 0 0.809018
   outer loop
-   vertex 146.472 0 247.298
-   vertex 146.472 0 256.702
-   vertex 144.702 0 245.528
+   vertex 130 0 252
+   vertex 131.91 0 246.122
+   vertex 131.91 0 257.878
   endloop
  endfacet
- facet normal 0.45397 0.00944579 -0.890967
+ facet normal 0.58754 0.028819 -0.808682
   outer loop
-   vertex 144.702 0 245.528
-   vertex 146.472 0 256.702
-   vertex 142.472 0 244.392
-  endloop
- endfacet
- facet normal -0.45399 0 0.891007
-  outer loop
-   vertex 142.472 0 244.392
-   vertex 146.472 0 256.702
-   vertex 140 0 244
-  endloop
- endfacet
- facet normal -0.309005 0.00884946 0.951019
-  outer loop
-   vertex 146.472 0 256.702
-   vertex 144.702 0 258.472
-   vertex 140 0 244
+   vertex 131.91 0 246.122
+   vertex 136.91 0 242.489
+   vertex 131.91 0 257.878
   endloop
  endfacet
  facet normal 0.309017 0 -0.951057
   outer loop
-   vertex 144.702 0 258.472
-   vertex 142.472 0 259.608
-   vertex 140 0 244
-  endloop
- endfacet
- facet normal -0.156429 0.00803518 0.987656
-  outer loop
-   vertex 142.472 0 259.608
-   vertex 140 0 260
-   vertex 140 0 244
-  endloop
- endfacet
- facet normal 0.156432 0.00583801 -0.987672
-  outer loop
-   vertex 140 0 244
-   vertex 140 0 260
-   vertex 137.528 0 244.392
-  endloop
- endfacet
- facet normal -0.309017 0 0.951056
-  outer loop
-   vertex 137.528 0 244.392
-   vertex 140 0 260
-   vertex 135.298 0 245.528
-  endloop
- endfacet
- facet normal 0.309017 0 -0.951056
-  outer loop
-   vertex 140 0 260
-   vertex 137.528 0 259.608
-   vertex 135.298 0 245.528
-  endloop
- endfacet
- facet normal -0.156432 0.00583797 0.987671
-  outer loop
-   vertex 137.528 0 259.608
-   vertex 135.298 0 258.472
-   vertex 135.298 0 245.528
+   vertex 131.91 0 257.878
+   vertex 136.91 0 242.489
+   vertex 136.91 0 261.511
   endloop
  endfacet
- facet normal 0.156435 0 -0.987688
+ facet normal -0.308774 0.0396513 0.950309
   outer loop
-   vertex 135.298 0 258.472
-   vertex 133.528 0 256.702
-   vertex 135.298 0 245.528
+   vertex 136.91 0 261.511
+   vertex 136.91 0 242.489
+   vertex 143.09 0 261.511
   endloop
  endfacet
- facet normal 0 0.00450917 0.99999
+ facet normal 0.587785 0 -0.809017
   outer loop
-   vertex 133.528 0 256.702
-   vertex 132.392 0 254.472
-   vertex 135.298 0 245.528
+   vertex 143.09 0 261.511
+   vertex 136.91 0 242.489
+   vertex 148.09 0 257.878
   endloop
  endfacet
- facet normal 0 0.00155373 -0.999999
+ facet normal -0.587147 0.0465989 0.808138
   outer loop
-   vertex 135.298 0 245.528
-   vertex 132.392 0 254.472
-   vertex 133.528 0 247.298
+   vertex 148.09 0 257.878
+   vertex 136.91 0 242.489
+   vertex 150 0 252
   endloop
  endfacet
- facet normal -0.156432 0 0.987689
+ facet normal 0.587785 0 0.809018
   outer loop
-   vertex 133.528 0 247.298
-   vertex 132.392 0 254.472
-   vertex 132.392 0 249.528
+   vertex 150 0 252
+   vertex 136.91 0 242.489
+   vertex 148.09 0 246.122
   endloop
  endfacet
- facet normal 0.156432 0 -0.987689
+ facet normal -0.587785 0 -0.809018
   outer loop
-   vertex 132 0 252
-   vertex 132.392 0 249.528
-   vertex 132.392 0 254.472
+   vertex 143.09 0 242.489
+   vertex 148.09 0 246.122
+   vertex 136.91 0 242.489
   endloop
  endfacet
 endsolid
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index f28c2ff3c..ae4ea633a 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,7 +8,7 @@
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=40 #20=800mb # 32=3200mb
+NodesPerDiameter=40
 Velocity=9
 ##################################################
 tStartOut=0
-- 
GitLab


From df681e3ea00181b7b203bfbbde658a462e2ef575 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 174/179] Phoenix setup

---
 CMake/cmake_config_files/PHOENIX.config.cmake    | 1 +
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp       | 2 +-
 apps/gpu/LBM/ActuatorLine/configActuatorLine.txt | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CMake/cmake_config_files/PHOENIX.config.cmake b/CMake/cmake_config_files/PHOENIX.config.cmake
index d31d8684a..43f29d9d0 100644
--- a/CMake/cmake_config_files/PHOENIX.config.cmake
+++ b/CMake/cmake_config_files/PHOENIX.config.cmake
@@ -31,4 +31,5 @@ list(APPEND USER_APPS
     # "${GPU_APP}DrivenCavityMultiGPU"
     # "${GPU_APP}SphereScaling"
     # "${GPU_APP}MusselOyster"
+    "${GPU_APP}ActuatorLine"
     )
diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 77afe599b..61140eacd 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -164,7 +164,7 @@ void multipleLevel(const std::string& configPath)
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
-    std::string stlPath = "./apps/gpu/LBM/ActuatorLine/Pole.stl";
+    std::string stlPath = "./VirtualFluids_dev/apps/gpu/LBM/ActuatorLine/Pole.stl";
 
     Object *sphere = TriangularMesh::make(stlPath);
     gridBuilder->addGeometry(sphere);
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index ae4ea633a..ca7f0aefb 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -1,14 +1,14 @@
 ##################################################
 #informations for Writing
 ##################################################
-# Path = ./output
+Path = /work/y0078217/Results/ActuatorLine
 ##################################################
 #informations for reading
 ##################################################
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=40
+NodesPerDiameter=60
 Velocity=9
 ##################################################
 tStartOut=0
-- 
GitLab


From e553f5833ddceee13e818f2b27c46d70078b95c0 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 175/179] Smaller domain

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  15 +-
 apps/gpu/LBM/ActuatorLine/Pole.stl            | 288 +++++++++---------
 .../LBM/ActuatorLine/configActuatorLine.txt   |   4 +-
 .../CumulantK17Sponge_Device.cu               |   4 +-
 .../PreCollisionInteractor/ActuatorFarm.cu    |  10 +-
 5 files changed, 160 insertions(+), 161 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 61140eacd..50cfff1be 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -126,9 +126,9 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 6*reference_diameter;
-    const real L_y = 3*reference_diameter;
-    const real L_z = 4*reference_diameter;
+    const real L_x = 4*reference_diameter;
+    const real L_y = 2.5*reference_diameter;
+    const real L_z = 3*reference_diameter;
 
     const real viscosity = 1.56e-5;
 
@@ -153,14 +153,14 @@ void multipleLevel(const std::string& configPath)
 
     const real dx = reference_diameter/real(nodes_per_diameter);
 
-    real turbPos[3] = {1*reference_diameter, reference_diameter, 2*reference_diameter};
+    real turbPos[3] = {0.7f*reference_diameter, reference_diameter, 1.5f*reference_diameter};
 
     gridBuilder->addCoarseGrid(0.0, 0.0, 0.0,
                                L_x,  L_y,  L_z, dx);
 
     gridBuilder->setNumberOfLayers(4,0);
-    gridBuilder->addGrid( new Cuboid(   turbPos[0]-0.4*reference_diameter,  turbPos[1]-1*reference_diameter,  turbPos[2]-0.8*reference_diameter,
-                                        turbPos[0]+3.0*reference_diameter,  turbPos[1]+0.8*reference_diameter,  turbPos[2]+0.8*reference_diameter) , 1 );
+    gridBuilder->addGrid( new Cuboid(   turbPos[0]-0.3*reference_diameter,  turbPos[1]-1*reference_diameter,  turbPos[2]-0.7*reference_diameter,
+                                        turbPos[0]+2.0*reference_diameter,  turbPos[1]+0.7*reference_diameter,  turbPos[2]+0.7*reference_diameter) , 1 );
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
@@ -190,7 +190,6 @@ void multipleLevel(const std::string& configPath)
     VF_LOG_INFO("velocity  [dx/dt] = {}", velocityLB);
     VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8);
     VF_LOG_INFO("nodes/turbine diameter = {}", reference_diameter/dx);
-    VF_LOG_INFO("1000 timesteps are {} s", 1000 * dt);
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -228,7 +227,7 @@ void multipleLevel(const std::string& configPath)
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     gridBuilder->setVelocityBoundaryCondition(SideType::MX,  velocityLB, 0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  velocityLB, 0.0, 0.0);
+    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  0.0, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::PY,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::MZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
diff --git a/apps/gpu/LBM/ActuatorLine/Pole.stl b/apps/gpu/LBM/ActuatorLine/Pole.stl
index dae651651..4ece0f0d1 100644
--- a/apps/gpu/LBM/ActuatorLine/Pole.stl
+++ b/apps/gpu/LBM/ActuatorLine/Pole.stl
@@ -1,254 +1,254 @@
 solid Visualization Toolkit generated SLA File
- facet normal 0.951056 0 -0.309018
+ facet normal 0.95105063192813954 0 -0.30903510400775902
   outer loop
-   vertex 150 126 252
-   vertex 150 0 252
-   vertex 148.09 126 246.122
+   vertex 112 126 189
+   vertex 112 0 189
+   vertex 110.08999633789062 126 183.12199401855469
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0.95105063192813954 0 -0.30903510400775902
   outer loop
-   vertex 148.09 0 246.122
-   vertex 148.09 126 246.122
-   vertex 150 0 252
+   vertex 110.08999633789062 0 183.12199401855469
+   vertex 110.08999633789062 126 183.12199401855469
+   vertex 112 0 189
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal 0.58781521760400901 0 -0.80899522245384836
   outer loop
-   vertex 148.09 126 246.122
-   vertex 148.09 0 246.122
-   vertex 143.09 126 242.489
+   vertex 110.08999633789062 126 183.12199401855469
+   vertex 110.08999633789062 0 183.12199401855469
+   vertex 105.08999633789062 126 179.48899841308594
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0.58781521760400901 0 -0.80899522245384836
   outer loop
-   vertex 143.09 0 242.489
-   vertex 143.09 126 242.489
-   vertex 148.09 0 246.122
+   vertex 105.08999633789062 0 179.48899841308594
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 110.08999633789062 0 183.12199401855469
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal 0 0 -1
   outer loop
-   vertex 143.09 126 242.489
-   vertex 143.09 0 242.489
-   vertex 136.91 126 242.489
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 105.08999633789062 0 179.48899841308594
+   vertex 98.910003662109375 126 179.48899841308594
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0 0 -1
   outer loop
-   vertex 136.91 0 242.489
-   vertex 136.91 126 242.489
-   vertex 143.09 0 242.489
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 98.910003662109375 126 179.48899841308594
+   vertex 105.08999633789062 0 179.48899841308594
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal -0.58781521760400901 0 -0.80899522245384836
   outer loop
-   vertex 136.91 126 242.489
-   vertex 136.91 0 242.489
-   vertex 131.91 126 246.122
+   vertex 98.910003662109375 126 179.48899841308594
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 93.910003662109375 126 183.12199401855469
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal -0.58781521760400901 -0 -0.80899522245384836
   outer loop
-   vertex 131.91 0 246.122
-   vertex 131.91 126 246.122
-   vertex 136.91 0 242.489
+   vertex 93.910003662109375 0 183.12199401855469
+   vertex 93.910003662109375 126 183.12199401855469
+   vertex 98.910003662109375 0 179.48899841308594
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal -0.95105063192813954 0 -0.30903510400775902
   outer loop
-   vertex 131.91 126 246.122
-   vertex 131.91 0 246.122
-   vertex 130 126 252
+   vertex 93.910003662109375 126 183.12199401855469
+   vertex 93.910003662109375 0 183.12199401855469
+   vertex 92 126 189
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal -0.95105063192813954 -0 -0.30903510400775902
   outer loop
-   vertex 130 0 252
-   vertex 130 126 252
-   vertex 131.91 0 246.122
+   vertex 92 0 189
+   vertex 92 126 189
+   vertex 93.910003662109375 0 183.12199401855469
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal -0.95105039614603315 0 0.30903582962251064
   outer loop
-   vertex 130 126 252
-   vertex 130 0 252
-   vertex 131.91 126 257.878
+   vertex 92 126 189
+   vertex 92 0 189
+   vertex 93.910003662109375 126 194.87799072265625
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal -0.95105039614603315 0 0.30903582962251064
   outer loop
-   vertex 131.91 0 257.878
-   vertex 131.91 126 257.878
-   vertex 130 0 252
+   vertex 93.910003662109375 0 194.87799072265625
+   vertex 93.910003662109375 126 194.87799072265625
+   vertex 92 0 189
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal -0.58781521760400901 0 0.80899522245384836
   outer loop
-   vertex 131.91 126 257.878
-   vertex 131.91 0 257.878
-   vertex 136.91 126 261.511
+   vertex 93.910003662109375 126 194.87799072265625
+   vertex 93.910003662109375 0 194.87799072265625
+   vertex 98.910003662109375 126 198.510986328125
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal -0.58781521760400901 0 0.80899522245384836
   outer loop
-   vertex 136.91 0 261.511
-   vertex 136.91 126 261.511
-   vertex 131.91 0 257.878
+   vertex 98.910003662109375 0 198.510986328125
+   vertex 98.910003662109375 126 198.510986328125
+   vertex 93.910003662109375 0 194.87799072265625
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal 0 0 1
   outer loop
-   vertex 136.91 126 261.511
-   vertex 136.91 0 261.511
-   vertex 143.09 126 261.511
+   vertex 98.910003662109375 126 198.510986328125
+   vertex 98.910003662109375 0 198.510986328125
+   vertex 105.08999633789062 126 198.510986328125
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0 0 1
   outer loop
-   vertex 143.09 0 261.511
-   vertex 143.09 126 261.511
-   vertex 136.91 0 261.511
+   vertex 105.08999633789062 0 198.510986328125
+   vertex 105.08999633789062 126 198.510986328125
+   vertex 98.910003662109375 0 198.510986328125
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal 0.58781521760400901 -0 0.80899522245384836
   outer loop
-   vertex 143.09 126 261.511
-   vertex 143.09 0 261.511
-   vertex 148.09 126 257.878
+   vertex 105.08999633789062 126 198.510986328125
+   vertex 105.08999633789062 0 198.510986328125
+   vertex 110.08999633789062 126 194.87799072265625
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0.58781521760400901 0 0.80899522245384836
   outer loop
-   vertex 148.09 0 257.878
-   vertex 148.09 126 257.878
-   vertex 143.09 0 261.511
+   vertex 110.08999633789062 0 194.87799072265625
+   vertex 110.08999633789062 126 194.87799072265625
+   vertex 105.08999633789062 0 198.510986328125
   endloop
  endfacet
- facet normal 0.951056 0 -0.309018
+ facet normal 0.95105039614603315 -0 0.30903582962251064
   outer loop
-   vertex 148.09 126 257.878
-   vertex 148.09 0 257.878
-   vertex 150 126 252
+   vertex 110.08999633789062 126 194.87799072265625
+   vertex 110.08999633789062 0 194.87799072265625
+   vertex 112 126 189
   endloop
  endfacet
- facet normal -0.951056 0 0.309018
+ facet normal 0.95105039614603315 0 0.30903582962251064
   outer loop
-   vertex 150 0 252
-   vertex 150 126 252
-   vertex 148.09 0 257.878
+   vertex 112 0 189
+   vertex 112 126 189
+   vertex 110.08999633789062 0 194.87799072265625
   endloop
  endfacet
- facet normal 0.309017 0 -0.951056
+ facet normal 0 1 0
   outer loop
-   vertex 150 126 252
-   vertex 148.09 126 246.122
-   vertex 148.09 126 257.878
+   vertex 112 126 189
+   vertex 110.08999633789062 126 183.12199401855469
+   vertex 110.08999633789062 126 194.87799072265625
   endloop
  endfacet
- facet normal -0.308774 0.0396513 0.950309
+ facet normal 0 1 0
   outer loop
-   vertex 148.09 126 246.122
-   vertex 143.09 126 242.489
-   vertex 148.09 126 257.878
+   vertex 110.08999633789062 126 183.12199401855469
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 110.08999633789062 126 194.87799072265625
   endloop
  endfacet
- facet normal 0 0 1
+ facet normal 0 1 0
   outer loop
-   vertex 148.09 126 257.878
-   vertex 143.09 126 242.489
-   vertex 143.09 126 261.511
+   vertex 110.08999633789062 126 194.87799072265625
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 105.08999633789062 126 198.510986328125
   endloop
  endfacet
- facet normal 0 0.028819 -0.999585
+ facet normal 0 1 -0
   outer loop
-   vertex 143.09 126 261.511
-   vertex 143.09 126 242.489
-   vertex 136.91 126 261.511
+   vertex 105.08999633789062 126 198.510986328125
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 98.910003662109375 126 198.510986328125
   endloop
  endfacet
- facet normal -0.309017 0 0.951057
+ facet normal 0 1 0
   outer loop
-   vertex 136.91 126 261.511
-   vertex 143.09 126 242.489
-   vertex 131.91 126 257.878
+   vertex 98.910003662109375 126 198.510986328125
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 93.910003662109375 126 194.87799072265625
   endloop
  endfacet
- facet normal 0.308981 0.0151556 -0.950947
+ facet normal 0 1 0
   outer loop
-   vertex 131.91 126 257.878
-   vertex 143.09 126 242.489
-   vertex 130 126 252
+   vertex 93.910003662109375 126 194.87799072265625
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 92 126 189
   endloop
  endfacet
- facet normal -0.587785 0 0.809018
+ facet normal 0 1 0
   outer loop
-   vertex 130 126 252
-   vertex 143.09 126 242.489
-   vertex 131.91 126 246.122
+   vertex 92 126 189
+   vertex 105.08999633789062 126 179.48899841308594
+   vertex 93.910003662109375 126 183.12199401855469
   endloop
  endfacet
- facet normal 0.587785 0 -0.809018
+ facet normal 0 1 0
   outer loop
-   vertex 136.91 126 242.489
-   vertex 131.91 126 246.122
-   vertex 143.09 126 242.489
+   vertex 98.910003662109375 126 179.48899841308594
+   vertex 93.910003662109375 126 183.12199401855469
+   vertex 105.08999633789062 126 179.48899841308594
   endloop
  endfacet
- facet normal -0.587785 0 0.809018
+ facet normal 0 -1 0
   outer loop
-   vertex 130 0 252
-   vertex 131.91 0 246.122
-   vertex 131.91 0 257.878
+   vertex 92 0 189
+   vertex 93.910003662109375 0 183.12199401855469
+   vertex 93.910003662109375 0 194.87799072265625
   endloop
  endfacet
- facet normal 0.58754 0.028819 -0.808682
+ facet normal 0 -1 0
   outer loop
-   vertex 131.91 0 246.122
-   vertex 136.91 0 242.489
-   vertex 131.91 0 257.878
+   vertex 93.910003662109375 0 183.12199401855469
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 93.910003662109375 0 194.87799072265625
   endloop
  endfacet
- facet normal 0.309017 0 -0.951057
+ facet normal 0 -1 0
   outer loop
-   vertex 131.91 0 257.878
-   vertex 136.91 0 242.489
-   vertex 136.91 0 261.511
+   vertex 93.910003662109375 0 194.87799072265625
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 98.910003662109375 0 198.510986328125
   endloop
  endfacet
- facet normal -0.308774 0.0396513 0.950309
+ facet normal 0 -1 0
   outer loop
-   vertex 136.91 0 261.511
-   vertex 136.91 0 242.489
-   vertex 143.09 0 261.511
+   vertex 98.910003662109375 0 198.510986328125
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 105.08999633789062 0 198.510986328125
   endloop
  endfacet
- facet normal 0.587785 0 -0.809017
+ facet normal 0 -1 0
   outer loop
-   vertex 143.09 0 261.511
-   vertex 136.91 0 242.489
-   vertex 148.09 0 257.878
+   vertex 105.08999633789062 0 198.510986328125
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 110.08999633789062 0 194.87799072265625
   endloop
  endfacet
- facet normal -0.587147 0.0465989 0.808138
+ facet normal 0 -1 0
   outer loop
-   vertex 148.09 0 257.878
-   vertex 136.91 0 242.489
-   vertex 150 0 252
+   vertex 110.08999633789062 0 194.87799072265625
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 112 0 189
   endloop
  endfacet
- facet normal 0.587785 0 0.809018
+ facet normal 0 -1 0
   outer loop
-   vertex 150 0 252
-   vertex 136.91 0 242.489
-   vertex 148.09 0 246.122
+   vertex 112 0 189
+   vertex 98.910003662109375 0 179.48899841308594
+   vertex 110.08999633789062 0 183.12199401855469
   endloop
  endfacet
- facet normal -0.587785 0 -0.809018
+ facet normal 0 -1 0
   outer loop
-   vertex 143.09 0 242.489
-   vertex 148.09 0 246.122
-   vertex 136.91 0 242.489
+   vertex 105.08999633789062 0 179.48899841308594
+   vertex 110.08999633789062 0 183.12199401855469
+   vertex 98.910003662109375 0 179.48899841308594
   endloop
  endfacet
 endsolid
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index ca7f0aefb..64ddb3961 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,12 +8,12 @@ Path = /work/y0078217/Results/ActuatorLine
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=60
+NodesPerDiameter=100
 Velocity=9
 ##################################################
 tStartOut=0
 tOut=10000
-tEnd=100000
+tEnd=10000
 ##################################################
 
 # tStartTmpAveraging=100
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index ce6bbce68..1bad79fa5 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -358,8 +358,8 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     // 3.
     
     // Calculate modified omega for sponge bob layer
-    real startXsponge = 656.0f;
-    real endXsponge = 756.0f;
+    real startXsponge = 504.0f;
+    real endXsponge = 454.0f;
     real sizeSponge = endXsponge - startXsponge;
 
     real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
index 626e3bc0b..0e70df88e 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
@@ -508,11 +508,11 @@ void ActuatorFarm::initBoundingSpheres(Parameter* para, CudaMemoryManager* cudaM
             }
         }
 
-        if(nodesInThisSphere<minimumNumberOfNodesPerSphere)
-        {
-            VF_LOG_CRITICAL("Found only {} nodes in bounding sphere of turbine no. {}, expected at least {}!", nodesInThisSphere, turbine, minimumNumberOfNodesPerSphere);
-            throw std::runtime_error("ActuatorFarm::initBoundingSpheres: Turbine bounding sphere partially out of domain.");
-        }
+        // if(nodesInThisSphere<minimumNumberOfNodesPerSphere)
+        // {
+        //     VF_LOG_CRITICAL("Found only {} nodes in bounding sphere of turbine no. {}, expected at least {}!", nodesInThisSphere, turbine, minimumNumberOfNodesPerSphere);
+        //     throw std::runtime_error("ActuatorFarm::initBoundingSpheres: Turbine bounding sphere partially out of domain.");
+        // }
     }
 
     this->numberOfIndices = uint(nodesInSpheres.size());
-- 
GitLab


From 958d120cd60270c0b146f5585856bc68e301cb74 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 176/179] Poster20221219

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |    4 +-
 apps/gpu/LBM/ActuatorLine/Pole.stl            | 3200 ++++++++++++++++-
 .../LBM/ActuatorLine/configActuatorLine.txt   |    4 +-
 .../CumulantK17Sponge_Device.cu               |    4 +-
 4 files changed, 3062 insertions(+), 150 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 50cfff1be..820b6d8d4 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -126,7 +126,7 @@ void multipleLevel(const std::string& configPath)
     const real velocity = config.getValue<real>("Velocity");
 
 
-    const real L_x = 4*reference_diameter;
+    const real L_x = 3.5*reference_diameter;
     const real L_y = 2.5*reference_diameter;
     const real L_z = 3*reference_diameter;
 
@@ -250,7 +250,7 @@ void multipleLevel(const std::string& configPath)
     const real epsilon = dx*exp2(-level)*1.5; // width of gaussian smearing
     const real density = 1.225f;
     const uint nBlades = 3;
-    const uint nBladeNodes = 32;
+    const uint nBladeNodes = 401; // passt zu auflösung von 105 Knoten
     const real tipspeed_ratio = 7.5f; // tipspeed ratio = angular vel * radius / inflow vel
     const real omega = 2*tipspeed_ratio*velocity/reference_diameter;
 
diff --git a/apps/gpu/LBM/ActuatorLine/Pole.stl b/apps/gpu/LBM/ActuatorLine/Pole.stl
index 4ece0f0d1..f8e00efce 100644
--- a/apps/gpu/LBM/ActuatorLine/Pole.stl
+++ b/apps/gpu/LBM/ActuatorLine/Pole.stl
@@ -1,254 +1,3166 @@
 solid Visualization Toolkit generated SLA File
- facet normal 0.95105063192813954 0 -0.30903510400775902
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 112 126 189
-   vertex 112 0 189
-   vertex 110.08999633789062 126 183.12199401855469
+   vertex 105 126 189
+   vertex 105 0 189
+   vertex 104.989 126 188.614
   endloop
  endfacet
- facet normal 0.95105063192813954 0 -0.30903510400775902
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 110.08999633789062 0 183.12199401855469
-   vertex 110.08999633789062 126 183.12199401855469
-   vertex 112 0 189
+   vertex 104.989 0 188.614
+   vertex 104.989 126 188.614
+   vertex 105 0 189
   endloop
  endfacet
- facet normal 0.58781521760400901 0 -0.80899522245384836
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 110.08999633789062 126 183.12199401855469
-   vertex 110.08999633789062 0 183.12199401855469
-   vertex 105.08999633789062 126 179.48899841308594
+   vertex 104.989 126 188.614
+   vertex 104.989 0 188.614
+   vertex 104.958 126 188.23
   endloop
  endfacet
- facet normal 0.58781521760400901 0 -0.80899522245384836
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 105.08999633789062 0 179.48899841308594
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 110.08999633789062 0 183.12199401855469
+   vertex 104.958 126 188.23
+   vertex 104.989 0 188.614
+   vertex 104.958 0 188.23
   endloop
  endfacet
- facet normal 0 0 -1
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 105.08999633789062 0 179.48899841308594
-   vertex 98.910003662109375 126 179.48899841308594
+   vertex 104.958 126 188.23
+   vertex 104.958 0 188.23
+   vertex 104.905 126 187.848
   endloop
  endfacet
- facet normal 0 0 -1
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 98.910003662109375 126 179.48899841308594
-   vertex 105.08999633789062 0 179.48899841308594
+   vertex 104.905 0 187.848
+   vertex 104.905 126 187.848
+   vertex 104.958 0 188.23
   endloop
  endfacet
- facet normal -0.58781521760400901 0 -0.80899522245384836
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 98.910003662109375 126 179.48899841308594
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 93.910003662109375 126 183.12199401855469
+   vertex 104.905 126 187.848
+   vertex 104.905 0 187.848
+   vertex 104.831 126 187.469
   endloop
  endfacet
- facet normal -0.58781521760400901 -0 -0.80899522245384836
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 93.910003662109375 0 183.12199401855469
-   vertex 93.910003662109375 126 183.12199401855469
-   vertex 98.910003662109375 0 179.48899841308594
+   vertex 104.831 0 187.469
+   vertex 104.831 126 187.469
+   vertex 104.905 0 187.848
   endloop
  endfacet
- facet normal -0.95105063192813954 0 -0.30903510400775902
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 93.910003662109375 126 183.12199401855469
-   vertex 93.910003662109375 0 183.12199401855469
-   vertex 92 126 189
+   vertex 104.831 126 187.469
+   vertex 104.831 0 187.469
+   vertex 104.736 126 187.095
   endloop
  endfacet
- facet normal -0.95105063192813954 -0 -0.30903510400775902
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 92 0 189
-   vertex 92 126 189
-   vertex 93.910003662109375 0 183.12199401855469
+   vertex 104.736 126 187.095
+   vertex 104.831 0 187.469
+   vertex 104.736 0 187.095
   endloop
  endfacet
- facet normal -0.95105039614603315 0 0.30903582962251064
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 92 126 189
-   vertex 92 0 189
-   vertex 93.910003662109375 126 194.87799072265625
+   vertex 104.736 126 187.095
+   vertex 104.736 0 187.095
+   vertex 104.621 126 186.727
   endloop
  endfacet
- facet normal -0.95105039614603315 0 0.30903582962251064
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 93.910003662109375 0 194.87799072265625
-   vertex 93.910003662109375 126 194.87799072265625
-   vertex 92 0 189
+   vertex 104.621 0 186.727
+   vertex 104.621 126 186.727
+   vertex 104.736 0 187.095
   endloop
  endfacet
- facet normal -0.58781521760400901 0 0.80899522245384836
+ facet normal 0.99962 0 -0.0275497
   outer loop
-   vertex 93.910003662109375 126 194.87799072265625
-   vertex 93.910003662109375 0 194.87799072265625
-   vertex 98.910003662109375 126 198.510986328125
+   vertex 104.621 126 186.727
+   vertex 104.621 0 186.727
+   vertex 104.485 126 186.366
   endloop
  endfacet
- facet normal -0.58781521760400901 0 0.80899522245384836
+ facet normal -0.99962 0 0.0275497
   outer loop
-   vertex 98.910003662109375 0 198.510986328125
-   vertex 98.910003662109375 126 198.510986328125
-   vertex 93.910003662109375 0 194.87799072265625
+   vertex 104.485 126 186.366
+   vertex 104.621 0 186.727
+   vertex 104.485 0 186.366
   endloop
  endfacet
- facet normal 0 0 1
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.485 126 186.366
+   vertex 104.485 0 186.366
+   vertex 104.33 126 186.013
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.33 126 186.013
+   vertex 104.485 0 186.366
+   vertex 104.33 0 186.013
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.33 126 186.013
+   vertex 104.33 0 186.013
+   vertex 104.156 126 185.668
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.156 0 185.668
+   vertex 104.156 126 185.668
+   vertex 104.33 0 186.013
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.156 126 185.668
+   vertex 104.156 0 185.668
+   vertex 103.963 126 185.334
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.963 0 185.334
+   vertex 103.963 126 185.334
+   vertex 104.156 0 185.668
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.963 126 185.334
+   vertex 103.963 0 185.334
+   vertex 103.752 126 185.011
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.752 126 185.011
+   vertex 103.963 0 185.334
+   vertex 103.752 0 185.011
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.752 126 185.011
+   vertex 103.752 0 185.011
+   vertex 103.524 126 184.701
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.524 126 184.701
+   vertex 103.752 0 185.011
+   vertex 103.524 0 184.701
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.524 126 184.701
+   vertex 103.524 0 184.701
+   vertex 103.279 126 184.403
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.279 0 184.403
+   vertex 103.279 126 184.403
+   vertex 103.524 0 184.701
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.279 126 184.403
+   vertex 103.279 0 184.403
+   vertex 103.017 126 184.119
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.017 0 184.119
+   vertex 103.017 126 184.119
+   vertex 103.279 0 184.403
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.017 126 184.119
+   vertex 103.017 0 184.119
+   vertex 102.741 126 183.85
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.741 0 183.85
+   vertex 102.741 126 183.85
+   vertex 103.017 0 184.119
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.741 126 183.85
+   vertex 102.741 0 183.85
+   vertex 102.45 126 183.597
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.45 0 183.597
+   vertex 102.45 126 183.597
+   vertex 102.741 0 183.85
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.45 126 183.597
+   vertex 102.45 0 183.597
+   vertex 102.146 126 183.36
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.146 0 183.36
+   vertex 102.146 126 183.36
+   vertex 102.45 0 183.597
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.146 126 183.36
+   vertex 102.146 0 183.36
+   vertex 101.829 126 183.14
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.829 0 183.14
+   vertex 101.829 126 183.14
+   vertex 102.146 0 183.36
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.829 126 183.14
+   vertex 101.829 0 183.14
+   vertex 101.5 126 182.938
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.5 0 182.938
+   vertex 101.5 126 182.938
+   vertex 101.829 0 183.14
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.5 126 182.938
+   vertex 101.5 0 182.938
+   vertex 101.161 126 182.754
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.161 126 182.754
+   vertex 101.5 0 182.938
+   vertex 101.161 0 182.754
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.161 126 182.754
+   vertex 101.161 0 182.754
+   vertex 100.812 126 182.59
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.812 0 182.59
+   vertex 100.812 126 182.59
+   vertex 101.161 0 182.754
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.812 126 182.59
+   vertex 100.812 0 182.59
+   vertex 100.454 126 182.444
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.454 0 182.444
+   vertex 100.454 126 182.444
+   vertex 100.812 0 182.59
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.454 126 182.444
+   vertex 100.454 0 182.444
+   vertex 100.09 126 182.319
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.09 0 182.319
+   vertex 100.09 126 182.319
+   vertex 100.454 0 182.444
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.09 126 182.319
+   vertex 100.09 0 182.319
+   vertex 99.7184 126 182.214
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 99.7184 0 182.214
+   vertex 99.7184 126 182.214
+   vertex 100.09 0 182.319
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 99.7184 126 182.214
+   vertex 99.7184 0 182.214
+   vertex 99.342 126 182.13
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 99.342 0 182.13
+   vertex 99.342 126 182.13
+   vertex 99.7184 0 182.214
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 99.342 126 182.13
+   vertex 99.342 0 182.13
+   vertex 98.9615 126 182.066
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.9615 0 182.066
+   vertex 98.9615 126 182.066
+   vertex 99.342 0 182.13
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.9615 126 182.066
+   vertex 98.9615 0 182.066
+   vertex 98.5781 126 182.024
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.5781 0 182.024
+   vertex 98.5781 126 182.024
+   vertex 98.9615 0 182.066
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.5781 126 182.024
+   vertex 98.5781 0 182.024
+   vertex 98.1929 126 182.003
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.1929 0 182.003
+   vertex 98.1929 126 182.003
+   vertex 98.5781 0 182.024
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.1929 126 182.003
+   vertex 98.1929 0 182.003
+   vertex 97.8071 126 182.003
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.8071 0 182.003
+   vertex 97.8071 126 182.003
+   vertex 98.1929 0 182.003
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.8071 126 182.003
+   vertex 97.8071 0 182.003
+   vertex 97.4219 126 182.024
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.4219 0 182.024
+   vertex 97.4219 126 182.024
+   vertex 97.8071 0 182.003
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.4219 126 182.024
+   vertex 97.4219 0 182.024
+   vertex 97.0385 126 182.066
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.0385 0 182.066
+   vertex 97.0385 126 182.066
+   vertex 97.4219 0 182.024
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.0385 126 182.066
+   vertex 97.0385 0 182.066
+   vertex 96.658 126 182.13
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 96.658 0 182.13
+   vertex 96.658 126 182.13
+   vertex 97.0385 0 182.066
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 96.658 126 182.13
+   vertex 96.658 0 182.13
+   vertex 96.2816 126 182.214
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 96.2816 0 182.214
+   vertex 96.2816 126 182.214
+   vertex 96.658 0 182.13
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 96.2816 126 182.214
+   vertex 96.2816 0 182.214
+   vertex 95.9104 126 182.319
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.9104 0 182.319
+   vertex 95.9104 126 182.319
+   vertex 96.2816 0 182.214
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.9104 126 182.319
+   vertex 95.9104 0 182.319
+   vertex 95.5455 126 182.444
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.5455 0 182.444
+   vertex 95.5455 126 182.444
+   vertex 95.9104 0 182.319
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.5455 126 182.444
+   vertex 95.5455 0 182.444
+   vertex 95.1881 126 182.59
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.1881 0 182.59
+   vertex 95.1881 126 182.59
+   vertex 95.5455 0 182.444
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.1881 126 182.59
+   vertex 95.1881 0 182.59
+   vertex 94.8393 126 182.754
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.8393 0 182.754
+   vertex 94.8393 126 182.754
+   vertex 95.1881 0 182.59
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.8393 126 182.754
+   vertex 94.8393 0 182.754
+   vertex 94.5 126 182.938
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.5 126 182.938
+   vertex 94.8393 0 182.754
+   vertex 94.5 0 182.938
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.5 126 182.938
+   vertex 94.5 0 182.938
+   vertex 94.1714 126 183.14
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.1714 0 183.14
+   vertex 94.1714 126 183.14
+   vertex 94.5 0 182.938
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.1714 126 183.14
+   vertex 94.1714 0 183.14
+   vertex 93.8544 126 183.36
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.8544 0 183.36
+   vertex 93.8544 126 183.36
+   vertex 94.1714 0 183.14
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.8544 126 183.36
+   vertex 93.8544 0 183.36
+   vertex 93.5499 126 183.597
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.5499 0 183.597
+   vertex 93.5499 126 183.597
+   vertex 93.8544 0 183.36
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.5499 126 183.597
+   vertex 93.5499 0 183.597
+   vertex 93.259 126 183.85
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.259 0 183.85
+   vertex 93.259 126 183.85
+   vertex 93.5499 0 183.597
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.259 126 183.85
+   vertex 93.259 0 183.85
+   vertex 92.9825 126 184.119
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.9825 0 184.119
+   vertex 92.9825 126 184.119
+   vertex 93.259 0 183.85
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.9825 126 184.119
+   vertex 92.9825 0 184.119
+   vertex 92.7213 126 184.403
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.7213 0 184.403
+   vertex 92.7213 126 184.403
+   vertex 92.9825 0 184.119
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.7213 126 184.403
+   vertex 92.7213 0 184.403
+   vertex 92.476 126 184.701
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.476 0 184.701
+   vertex 92.476 126 184.701
+   vertex 92.7213 0 184.403
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.476 126 184.701
+   vertex 92.476 0 184.701
+   vertex 92.2476 126 185.011
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.2476 126 185.011
+   vertex 92.476 0 184.701
+   vertex 92.2476 0 185.011
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.2476 126 185.011
+   vertex 92.2476 0 185.011
+   vertex 92.0366 126 185.334
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.0366 126 185.334
+   vertex 92.2476 0 185.011
+   vertex 92.0366 0 185.334
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.0366 126 185.334
+   vertex 92.0366 0 185.334
+   vertex 91.8437 126 185.668
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.8437 0 185.668
+   vertex 91.8437 126 185.668
+   vertex 92.0366 0 185.334
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.8437 126 185.668
+   vertex 91.8437 0 185.668
+   vertex 91.6695 126 186.013
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.6695 0 186.013
+   vertex 91.6695 126 186.013
+   vertex 91.8437 0 185.668
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.6695 126 186.013
+   vertex 91.6695 0 186.013
+   vertex 91.5145 126 186.366
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.5145 126 186.366
+   vertex 91.6695 0 186.013
+   vertex 91.5145 0 186.366
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.5145 126 186.366
+   vertex 91.5145 0 186.366
+   vertex 91.3793 126 186.727
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.3793 126 186.727
+   vertex 91.5145 0 186.366
+   vertex 91.3793 0 186.727
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.3793 126 186.727
+   vertex 91.3793 0 186.727
+   vertex 91.2641 126 187.095
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.2641 0 187.095
+   vertex 91.2641 126 187.095
+   vertex 91.3793 0 186.727
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.2641 126 187.095
+   vertex 91.2641 0 187.095
+   vertex 91.1694 126 187.469
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.1694 126 187.469
+   vertex 91.2641 0 187.095
+   vertex 91.1694 0 187.469
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.1694 126 187.469
+   vertex 91.1694 0 187.469
+   vertex 91.0955 126 187.848
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0955 0 187.848
+   vertex 91.0955 126 187.848
+   vertex 91.1694 0 187.469
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0955 126 187.848
+   vertex 91.0955 0 187.848
+   vertex 91.0425 126 188.23
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0425 0 188.23
+   vertex 91.0425 126 188.23
+   vertex 91.0955 0 187.848
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0425 126 188.23
+   vertex 91.0425 0 188.23
+   vertex 91.0106 126 188.614
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0106 126 188.614
+   vertex 91.0425 0 188.23
+   vertex 91.0106 0 188.614
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0106 126 188.614
+   vertex 91.0106 0 188.614
+   vertex 91 126 189
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91 0 189
+   vertex 91 126 189
+   vertex 91.0106 0 188.614
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91 126 189
+   vertex 91 0 189
+   vertex 91.0106 126 189.386
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0106 0 189.386
+   vertex 91.0106 126 189.386
+   vertex 91 0 189
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0106 126 189.386
+   vertex 91.0106 0 189.386
+   vertex 91.0425 126 189.77
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0425 126 189.77
+   vertex 91.0106 0 189.386
+   vertex 91.0425 0 189.77
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0425 126 189.77
+   vertex 91.0425 0 189.77
+   vertex 91.0955 126 190.152
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.0955 0 190.152
+   vertex 91.0955 126 190.152
+   vertex 91.0425 0 189.77
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.0955 126 190.152
+   vertex 91.0955 0 190.152
+   vertex 91.1694 126 190.531
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.1694 0 190.531
+   vertex 91.1694 126 190.531
+   vertex 91.0955 0 190.152
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.1694 126 190.531
+   vertex 91.1694 0 190.531
+   vertex 91.2641 126 190.905
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.2641 126 190.905
+   vertex 91.1694 0 190.531
+   vertex 91.2641 0 190.905
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.2641 126 190.905
+   vertex 91.2641 0 190.905
+   vertex 91.3793 126 191.273
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.3793 0 191.273
+   vertex 91.3793 126 191.273
+   vertex 91.2641 0 190.905
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.3793 126 191.273
+   vertex 91.3793 0 191.273
+   vertex 91.5145 126 191.634
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.5145 126 191.634
+   vertex 91.3793 0 191.273
+   vertex 91.5145 0 191.634
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.5145 126 191.634
+   vertex 91.5145 0 191.634
+   vertex 91.6695 126 191.987
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.6695 126 191.987
+   vertex 91.5145 0 191.634
+   vertex 91.6695 0 191.987
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.6695 126 191.987
+   vertex 91.6695 0 191.987
+   vertex 91.8437 126 192.332
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 91.8437 0 192.332
+   vertex 91.8437 126 192.332
+   vertex 91.6695 0 191.987
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 91.8437 126 192.332
+   vertex 91.8437 0 192.332
+   vertex 92.0366 126 192.666
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.0366 0 192.666
+   vertex 92.0366 126 192.666
+   vertex 91.8437 0 192.332
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.0366 126 192.666
+   vertex 92.0366 0 192.666
+   vertex 92.2476 126 192.989
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.2476 126 192.989
+   vertex 92.0366 0 192.666
+   vertex 92.2476 0 192.989
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.2476 126 192.989
+   vertex 92.2476 0 192.989
+   vertex 92.476 126 193.299
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.476 126 193.299
+   vertex 92.2476 0 192.989
+   vertex 92.476 0 193.299
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.476 126 193.299
+   vertex 92.476 0 193.299
+   vertex 92.7213 126 193.597
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.7213 0 193.597
+   vertex 92.7213 126 193.597
+   vertex 92.476 0 193.299
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.7213 126 193.597
+   vertex 92.7213 0 193.597
+   vertex 92.9825 126 193.881
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 92.9825 0 193.881
+   vertex 92.9825 126 193.881
+   vertex 92.7213 0 193.597
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 92.9825 126 193.881
+   vertex 92.9825 0 193.881
+   vertex 93.259 126 194.15
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.259 0 194.15
+   vertex 93.259 126 194.15
+   vertex 92.9825 0 193.881
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.259 126 194.15
+   vertex 93.259 0 194.15
+   vertex 93.5499 126 194.403
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.5499 0 194.403
+   vertex 93.5499 126 194.403
+   vertex 93.259 0 194.15
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.5499 126 194.403
+   vertex 93.5499 0 194.403
+   vertex 93.8544 126 194.64
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 93.8544 0 194.64
+   vertex 93.8544 126 194.64
+   vertex 93.5499 0 194.403
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 93.8544 126 194.64
+   vertex 93.8544 0 194.64
+   vertex 94.1714 126 194.86
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.1714 0 194.86
+   vertex 94.1714 126 194.86
+   vertex 93.8544 0 194.64
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.1714 126 194.86
+   vertex 94.1714 0 194.86
+   vertex 94.5 126 195.062
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.5 0 195.062
+   vertex 94.5 126 195.062
+   vertex 94.1714 0 194.86
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.5 126 195.062
+   vertex 94.5 0 195.062
+   vertex 94.8393 126 195.246
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 94.8393 126 195.246
+   vertex 94.5 0 195.062
+   vertex 94.8393 0 195.246
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 94.8393 126 195.246
+   vertex 94.8393 0 195.246
+   vertex 95.1881 126 195.41
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.1881 0 195.41
+   vertex 95.1881 126 195.41
+   vertex 94.8393 0 195.246
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.1881 126 195.41
+   vertex 95.1881 0 195.41
+   vertex 95.5455 126 195.556
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.5455 0 195.556
+   vertex 95.5455 126 195.556
+   vertex 95.1881 0 195.41
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.5455 126 195.556
+   vertex 95.5455 0 195.556
+   vertex 95.9104 126 195.681
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 95.9104 0 195.681
+   vertex 95.9104 126 195.681
+   vertex 95.5455 0 195.556
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 95.9104 126 195.681
+   vertex 95.9104 0 195.681
+   vertex 96.2816 126 195.786
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 96.2816 0 195.786
+   vertex 96.2816 126 195.786
+   vertex 95.9104 0 195.681
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 96.2816 126 195.786
+   vertex 96.2816 0 195.786
+   vertex 96.658 126 195.87
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 96.658 0 195.87
+   vertex 96.658 126 195.87
+   vertex 96.2816 0 195.786
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 96.658 126 195.87
+   vertex 96.658 0 195.87
+   vertex 97.0385 126 195.934
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.0385 0 195.934
+   vertex 97.0385 126 195.934
+   vertex 96.658 0 195.87
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.0385 126 195.934
+   vertex 97.0385 0 195.934
+   vertex 97.4219 126 195.976
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.4219 0 195.976
+   vertex 97.4219 126 195.976
+   vertex 97.0385 0 195.934
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.4219 126 195.976
+   vertex 97.4219 0 195.976
+   vertex 97.8071 126 195.997
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 97.8071 0 195.997
+   vertex 97.8071 126 195.997
+   vertex 97.4219 0 195.976
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 97.8071 126 195.997
+   vertex 97.8071 0 195.997
+   vertex 98.1929 126 195.997
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.1929 0 195.997
+   vertex 98.1929 126 195.997
+   vertex 97.8071 0 195.997
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.1929 126 195.997
+   vertex 98.1929 0 195.997
+   vertex 98.5781 126 195.976
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.5781 0 195.976
+   vertex 98.5781 126 195.976
+   vertex 98.1929 0 195.997
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.5781 126 195.976
+   vertex 98.5781 0 195.976
+   vertex 98.9615 126 195.934
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 98.9615 0 195.934
+   vertex 98.9615 126 195.934
+   vertex 98.5781 0 195.976
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 98.9615 126 195.934
+   vertex 98.9615 0 195.934
+   vertex 99.342 126 195.87
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 99.342 0 195.87
+   vertex 99.342 126 195.87
+   vertex 98.9615 0 195.934
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 99.342 126 195.87
+   vertex 99.342 0 195.87
+   vertex 99.7184 126 195.786
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 99.7184 0 195.786
+   vertex 99.7184 126 195.786
+   vertex 99.342 0 195.87
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 99.7184 126 195.786
+   vertex 99.7184 0 195.786
+   vertex 100.09 126 195.681
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.09 0 195.681
+   vertex 100.09 126 195.681
+   vertex 99.7184 0 195.786
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.09 126 195.681
+   vertex 100.09 0 195.681
+   vertex 100.454 126 195.556
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.454 0 195.556
+   vertex 100.454 126 195.556
+   vertex 100.09 0 195.681
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.454 126 195.556
+   vertex 100.454 0 195.556
+   vertex 100.812 126 195.41
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 100.812 0 195.41
+   vertex 100.812 126 195.41
+   vertex 100.454 0 195.556
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 100.812 126 195.41
+   vertex 100.812 0 195.41
+   vertex 101.161 126 195.246
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.161 0 195.246
+   vertex 101.161 126 195.246
+   vertex 100.812 0 195.41
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.161 126 195.246
+   vertex 101.161 0 195.246
+   vertex 101.5 126 195.062
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.5 126 195.062
+   vertex 101.161 0 195.246
+   vertex 101.5 0 195.062
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.5 126 195.062
+   vertex 101.5 0 195.062
+   vertex 101.829 126 194.86
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 101.829 0 194.86
+   vertex 101.829 126 194.86
+   vertex 101.5 0 195.062
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 101.829 126 194.86
+   vertex 101.829 0 194.86
+   vertex 102.146 126 194.64
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.146 0 194.64
+   vertex 102.146 126 194.64
+   vertex 101.829 0 194.86
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.146 126 194.64
+   vertex 102.146 0 194.64
+   vertex 102.45 126 194.403
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.45 0 194.403
+   vertex 102.45 126 194.403
+   vertex 102.146 0 194.64
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.45 126 194.403
+   vertex 102.45 0 194.403
+   vertex 102.741 126 194.15
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 102.741 0 194.15
+   vertex 102.741 126 194.15
+   vertex 102.45 0 194.403
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 102.741 126 194.15
+   vertex 102.741 0 194.15
+   vertex 103.017 126 193.881
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.017 0 193.881
+   vertex 103.017 126 193.881
+   vertex 102.741 0 194.15
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.017 126 193.881
+   vertex 103.017 0 193.881
+   vertex 103.279 126 193.597
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.279 0 193.597
+   vertex 103.279 126 193.597
+   vertex 103.017 0 193.881
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.279 126 193.597
+   vertex 103.279 0 193.597
+   vertex 103.524 126 193.299
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.524 0 193.299
+   vertex 103.524 126 193.299
+   vertex 103.279 0 193.597
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.524 126 193.299
+   vertex 103.524 0 193.299
+   vertex 103.752 126 192.989
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.752 126 192.989
+   vertex 103.524 0 193.299
+   vertex 103.752 0 192.989
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.752 126 192.989
+   vertex 103.752 0 192.989
+   vertex 103.963 126 192.666
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 103.963 126 192.666
+   vertex 103.752 0 192.989
+   vertex 103.963 0 192.666
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 103.963 126 192.666
+   vertex 103.963 0 192.666
+   vertex 104.156 126 192.332
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.156 0 192.332
+   vertex 104.156 126 192.332
+   vertex 103.963 0 192.666
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.156 126 192.332
+   vertex 104.156 0 192.332
+   vertex 104.33 126 191.987
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.33 0 191.987
+   vertex 104.33 126 191.987
+   vertex 104.156 0 192.332
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.33 126 191.987
+   vertex 104.33 0 191.987
+   vertex 104.485 126 191.634
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.485 126 191.634
+   vertex 104.33 0 191.987
+   vertex 104.485 0 191.634
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.485 126 191.634
+   vertex 104.485 0 191.634
+   vertex 104.621 126 191.273
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.621 126 191.273
+   vertex 104.485 0 191.634
+   vertex 104.621 0 191.273
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.621 126 191.273
+   vertex 104.621 0 191.273
+   vertex 104.736 126 190.905
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.736 0 190.905
+   vertex 104.736 126 190.905
+   vertex 104.621 0 191.273
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.736 126 190.905
+   vertex 104.736 0 190.905
+   vertex 104.831 126 190.531
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.831 126 190.531
+   vertex 104.736 0 190.905
+   vertex 104.831 0 190.531
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.831 126 190.531
+   vertex 104.831 0 190.531
+   vertex 104.905 126 190.152
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.905 0 190.152
+   vertex 104.905 126 190.152
+   vertex 104.831 0 190.531
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.905 126 190.152
+   vertex 104.905 0 190.152
+   vertex 104.958 126 189.77
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.958 0 189.77
+   vertex 104.958 126 189.77
+   vertex 104.905 0 190.152
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.958 126 189.77
+   vertex 104.958 0 189.77
+   vertex 104.989 126 189.386
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 104.989 126 189.386
+   vertex 104.958 0 189.77
+   vertex 104.989 0 189.386
+  endloop
+ endfacet
+ facet normal 0.99962 0 -0.0275497
+  outer loop
+   vertex 104.989 126 189.386
+   vertex 104.989 0 189.386
+   vertex 105 126 189
+  endloop
+ endfacet
+ facet normal -0.99962 0 0.0275497
+  outer loop
+   vertex 105 0 189
+   vertex 105 126 189
+   vertex 104.989 0 189.386
+  endloop
+ endfacet
+ facet normal 0.915772 0 -0.401698
+  outer loop
+   vertex 102.741 126 183.85
+   vertex 102.45 126 183.597
+   vertex 103.017 126 184.119
+  endloop
+ endfacet
+ facet normal -0.915772 0.000168664 0.401698
+  outer loop
+   vertex 103.017 126 184.119
+   vertex 102.45 126 183.597
+   vertex 103.279 126 184.403
+  endloop
+ endfacet
+ facet normal -0.926493 0 0.376311
+  outer loop
+   vertex 102.45 126 183.597
+   vertex 102.146 126 183.36
+   vertex 103.279 126 184.403
+  endloop
+ endfacet
+ facet normal 0.926493 0 -0.376311
+  outer loop
+   vertex 103.279 126 184.403
+   vertex 102.146 126 183.36
+   vertex 103.524 126 184.701
+  endloop
+ endfacet
+ facet normal -0.936511 0.00016866 0.350639
+  outer loop
+   vertex 103.524 126 184.701
+   vertex 102.146 126 183.36
+   vertex 103.752 126 185.011
+  endloop
+ endfacet
+ facet normal 0.936511 0 -0.350639
+  outer loop
+   vertex 103.752 126 185.011
+   vertex 102.146 126 183.36
+   vertex 103.963 126 185.334
+  endloop
+ endfacet
+ facet normal -0.945818 0.000252854 0.324698
+  outer loop
+   vertex 103.963 126 185.334
+   vertex 102.146 126 183.36
+   vertex 104.156 126 185.668
+  endloop
+ endfacet
+ facet normal 0.945818 0 -0.324698
+  outer loop
+   vertex 104.156 126 185.668
+   vertex 102.146 126 183.36
+   vertex 104.33 126 186.013
+  endloop
+ endfacet
+ facet normal -0.954405 0.000336805 0.298513
+  outer loop
+   vertex 104.33 126 186.013
+   vertex 102.146 126 183.36
+   vertex 104.485 126 186.366
+  endloop
+ endfacet
+ facet normal 0.954406 0 -0.298513
+  outer loop
+   vertex 104.485 126 186.366
+   vertex 102.146 126 183.36
+   vertex 104.621 126 186.727
+  endloop
+ endfacet
+ facet normal -0.962268 0.000420524 0.272102
+  outer loop
+   vertex 104.621 126 186.727
+   vertex 102.146 126 183.36
+   vertex 104.736 126 187.095
+  endloop
+ endfacet
+ facet normal 0.962269 0 -0.272102
+  outer loop
+   vertex 104.736 126 187.095
+   vertex 102.146 126 183.36
+   vertex 104.831 126 187.469
+  endloop
+ endfacet
+ facet normal -0.9694 0.000503865 0.245487
+  outer loop
+   vertex 104.831 126 187.469
+   vertex 102.146 126 183.36
+   vertex 104.905 126 187.848
+  endloop
+ endfacet
+ facet normal 0.9694 0 -0.245487
+  outer loop
+   vertex 104.905 126 187.848
+   vertex 102.146 126 183.36
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.962268 0.000586912 -0.272103
+  outer loop
+   vertex 102.146 126 183.36
+   vertex 101.829 126 183.14
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.962268 0 0.272103
+  outer loop
+   vertex 101.829 126 183.14
+   vertex 101.5 126 182.938
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.954404 0.000669558 -0.298517
+  outer loop
+   vertex 101.5 126 182.938
+   vertex 101.161 126 182.754
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.954404 0 0.298517
+  outer loop
+   vertex 101.161 126 182.754
+   vertex 100.812 126 182.59
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.945817 0.000751555 -0.3247
+  outer loop
+   vertex 100.812 126 182.59
+   vertex 100.454 126 182.444
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.945817 0 0.324701
+  outer loop
+   vertex 100.454 126 182.444
+   vertex 100.09 126 182.319
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.936511 0.00083305 -0.350638
+  outer loop
+   vertex 100.09 126 182.319
+   vertex 99.7184 126 182.214
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.936511 0 0.350638
+  outer loop
+   vertex 99.7184 126 182.214
+   vertex 99.342 126 182.13
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.926493 0.000913942 -0.37631
+  outer loop
+   vertex 99.342 126 182.13
+   vertex 98.9615 126 182.066
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.926494 0 0.37631
+  outer loop
+   vertex 98.9615 126 182.066
+   vertex 98.5781 126 182.024
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.915773 0.000994094 -0.401696
+  outer loop
+   vertex 98.5781 126 182.024
+   vertex 98.1929 126 182.003
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.915773 0 0.401696
+  outer loop
+   vertex 98.1929 126 182.003
+   vertex 97.8071 126 182.003
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.904357 0.00107347 -0.426776
+  outer loop
+   vertex 97.8071 126 182.003
+   vertex 97.4219 126 182.024
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.904357 0 0.426776
+  outer loop
+   vertex 97.4219 126 182.024
+   vertex 97.0385 126 182.066
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.892253 0.00115216 -0.451534
+  outer loop
+   vertex 97.0385 126 182.066
+   vertex 96.658 126 182.13
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.892254 0 0.451534
+  outer loop
+   vertex 96.658 126 182.13
+   vertex 96.2816 126 182.214
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.879472 0.00122983 -0.475948
+  outer loop
+   vertex 96.2816 126 182.214
+   vertex 95.9104 126 182.319
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.879473 0 0.475949
+  outer loop
+   vertex 95.9104 126 182.319
+   vertex 95.5455 126 182.444
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.866024 0.00130657 -0.5
+  outer loop
+   vertex 95.5455 126 182.444
+   vertex 95.1881 126 182.59
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 95.1881 126 182.59
+   vertex 94.8393 126 182.754
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.851918 0.00138241 -0.523673
+  outer loop
+   vertex 94.8393 126 182.754
+   vertex 94.5 126 182.938
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.851919 0 0.523673
+  outer loop
+   vertex 94.5 126 182.938
+   vertex 94.1714 126 183.14
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.837165 0.00145717 -0.546948
+  outer loop
+   vertex 94.1714 126 183.14
+   vertex 93.8544 126 183.36
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.837166 0 0.546949
+  outer loop
+   vertex 93.8544 126 183.36
+   vertex 93.5499 126 183.597
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.821777 0.00153078 -0.569808
+  outer loop
+   vertex 93.5499 126 183.597
+   vertex 93.259 126 183.85
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.821777 0 0.569809
+  outer loop
+   vertex 93.259 126 183.85
+   vertex 92.9825 126 184.119
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.805763 0.00160332 -0.592236
+  outer loop
+   vertex 92.9825 126 184.119
+   vertex 92.7213 126 184.403
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.805764 0 0.592236
+  outer loop
+   vertex 92.7213 126 184.403
+   vertex 92.476 126 184.701
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.789139 0.00167447 -0.614212
+  outer loop
+   vertex 92.476 126 184.701
+   vertex 92.2476 126 185.011
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.78914 0 0.614213
+  outer loop
+   vertex 92.2476 126 185.011
+   vertex 92.0366 126 185.334
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.771915 0.00174454 -0.635723
+  outer loop
+   vertex 92.0366 126 185.334
+   vertex 91.8437 126 185.668
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.771916 0 0.635724
+  outer loop
+   vertex 91.8437 126 185.668
+   vertex 91.6695 126 186.013
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.754105 0.00181316 -0.656751
+  outer loop
+   vertex 91.6695 126 186.013
+   vertex 91.5145 126 186.366
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.754106 0 0.656752
+  outer loop
+   vertex 91.5145 126 186.366
+   vertex 91.3793 126 186.727
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.735722 0.00188048 -0.677281
+  outer loop
+   vertex 91.3793 126 186.727
+   vertex 91.2641 126 187.095
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.735723 0 0.677282
+  outer loop
+   vertex 91.2641 126 187.095
+   vertex 91.1694 126 187.469
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal 0.716781 0.00194631 -0.697296
+  outer loop
+   vertex 91.1694 126 187.469
+   vertex 91.0955 126 187.848
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.716782 0 0.697297
+  outer loop
+   vertex 91.0955 126 187.848
+   vertex 91.0425 126 188.23
+   vertex 104.958 126 188.23
+  endloop
+ endfacet
+ facet normal -0.735722 0.00201074 0.67728
+  outer loop
+   vertex 104.958 126 188.23
+   vertex 91.0425 126 188.23
+   vertex 104.989 126 188.614
+  endloop
+ endfacet
+ facet normal 0.735724 0 -0.677282
+  outer loop
+   vertex 104.989 126 188.614
+   vertex 91.0425 126 188.23
+   vertex 105 126 189
+  endloop
+ endfacet
+ facet normal -0.654901 0.075013 -0.751982
+  outer loop
+   vertex 105 126 189
+   vertex 91.0425 126 188.23
+   vertex 104.989 126 189.386
+  endloop
+ endfacet
+ facet normal 0.656751 0 0.754107
+  outer loop
+   vertex 104.989 126 189.386
+   vertex 91.0425 126 188.23
+   vertex 104.958 126 189.77
+  endloop
+ endfacet
+ facet normal -0.635723 0.00219439 -0.771914
+  outer loop
+   vertex 104.958 126 189.77
+   vertex 91.0425 126 188.23
+   vertex 104.905 126 190.152
+  endloop
+ endfacet
+ facet normal 0.635724 0 0.771916
+  outer loop
+   vertex 104.905 126 190.152
+   vertex 91.0425 126 188.23
+   vertex 104.831 126 190.531
+  endloop
+ endfacet
+ facet normal -0.614211 0.00213487 -0.789139
+  outer loop
+   vertex 104.831 126 190.531
+   vertex 91.0425 126 188.23
+   vertex 104.736 126 190.905
+  endloop
+ endfacet
+ facet normal 0.614213 0 0.78914
+  outer loop
+   vertex 104.736 126 190.905
+   vertex 91.0425 126 188.23
+   vertex 104.621 126 191.273
+  endloop
+ endfacet
+ facet normal -0.592234 0.00207354 -0.805763
+  outer loop
+   vertex 104.621 126 191.273
+   vertex 91.0425 126 188.23
+   vertex 104.485 126 191.634
+  endloop
+ endfacet
+ facet normal 0.592236 0 0.805765
+  outer loop
+   vertex 104.485 126 191.634
+   vertex 91.0425 126 188.23
+   vertex 104.33 126 191.987
+  endloop
+ endfacet
+ facet normal -0.569807 0.00201075 -0.821776
+  outer loop
+   vertex 104.33 126 191.987
+   vertex 91.0425 126 188.23
+   vertex 104.156 126 192.332
+  endloop
+ endfacet
+ facet normal 0.569808 0 0.821778
+  outer loop
+   vertex 104.156 126 192.332
+   vertex 91.0425 126 188.23
+   vertex 103.963 126 192.666
+  endloop
+ endfacet
+ facet normal -0.546946 0.00194636 -0.837165
+  outer loop
+   vertex 103.963 126 192.666
+   vertex 91.0425 126 188.23
+   vertex 103.752 126 192.989
+  endloop
+ endfacet
+ facet normal 0.546947 0.00181322 0.837166
+  outer loop
+   vertex 91.0425 126 188.23
+   vertex 91.0106 126 188.614
+   vertex 103.752 126 192.989
+  endloop
+ endfacet
+ facet normal -0.569808 0 -0.821778
+  outer loop
+   vertex 91.0106 126 188.614
+   vertex 91 126 189
+   vertex 103.752 126 192.989
+  endloop
+ endfacet
+ facet normal 0.569807 0.0017445 0.821777
+  outer loop
+   vertex 91 126 189
+   vertex 91.0106 126 189.386
+   vertex 103.752 126 192.989
+  endloop
+ endfacet
+ facet normal 0.592235 0 0.805765
+  outer loop
+   vertex 103.752 126 192.989
+   vertex 91.0106 126 189.386
+   vertex 103.524 126 193.299
+  endloop
+ endfacet
+ facet normal -0.592234 0.00167452 -0.805764
+  outer loop
+   vertex 103.524 126 193.299
+   vertex 91.0106 126 189.386
+   vertex 103.279 126 193.597
+  endloop
+ endfacet
+ facet normal 0.569808 0 0.821778
+  outer loop
+   vertex 103.279 126 193.597
+   vertex 91.0106 126 189.386
+   vertex 103.017 126 193.881
+  endloop
+ endfacet
+ facet normal -0.569807 0.00160328 -0.821777
+  outer loop
+   vertex 103.017 126 193.881
+   vertex 91.0106 126 189.386
+   vertex 102.741 126 194.15
+  endloop
+ endfacet
+ facet normal 0.546948 0 0.837167
+  outer loop
+   vertex 102.741 126 194.15
+   vertex 91.0106 126 189.386
+   vertex 102.45 126 194.403
+  endloop
+ endfacet
+ facet normal -0.546947 0.00153079 -0.837166
+  outer loop
+   vertex 102.45 126 194.403
+   vertex 91.0106 126 189.386
+   vertex 102.146 126 194.64
+  endloop
+ endfacet
+ facet normal 0.523673 0 0.85192
+  outer loop
+   vertex 102.146 126 194.64
+   vertex 91.0106 126 189.386
+   vertex 101.829 126 194.86
+  endloop
+ endfacet
+ facet normal -0.523672 0.00145711 -0.851919
+  outer loop
+   vertex 101.829 126 194.86
+   vertex 91.0106 126 189.386
+   vertex 101.5 126 195.062
+  endloop
+ endfacet
+ facet normal 0.5 0 0.866025
+  outer loop
+   vertex 101.5 126 195.062
+   vertex 91.0106 126 189.386
+   vertex 101.161 126 195.246
+  endloop
+ endfacet
+ facet normal -0.5 0.00138245 -0.866024
+  outer loop
+   vertex 101.161 126 195.246
+   vertex 91.0106 126 189.386
+   vertex 100.812 126 195.41
+  endloop
+ endfacet
+ facet normal 0.475947 0 0.879474
+  outer loop
+   vertex 100.812 126 195.41
+   vertex 91.0106 126 189.386
+   vertex 100.454 126 195.556
+  endloop
+ endfacet
+ facet normal -0.475947 0.00130656 -0.879473
+  outer loop
+   vertex 100.454 126 195.556
+   vertex 91.0106 126 189.386
+   vertex 100.09 126 195.681
+  endloop
+ endfacet
+ facet normal 0.451534 0 0.892254
+  outer loop
+   vertex 100.09 126 195.681
+   vertex 91.0106 126 189.386
+   vertex 99.7184 126 195.786
+  endloop
+ endfacet
+ facet normal -0.451534 0.00122982 -0.892253
+  outer loop
+   vertex 99.7184 126 195.786
+   vertex 91.0106 126 189.386
+   vertex 99.342 126 195.87
+  endloop
+ endfacet
+ facet normal 0.426777 0 0.904357
+  outer loop
+   vertex 99.342 126 195.87
+   vertex 91.0106 126 189.386
+   vertex 98.9615 126 195.934
+  endloop
+ endfacet
+ facet normal -0.426777 0.0011521 -0.904356
+  outer loop
+   vertex 98.9615 126 195.934
+   vertex 91.0106 126 189.386
+   vertex 98.5781 126 195.976
+  endloop
+ endfacet
+ facet normal 0.401696 0 0.915773
+  outer loop
+   vertex 98.5781 126 195.976
+   vertex 91.0106 126 189.386
+   vertex 98.1929 126 195.997
+  endloop
+ endfacet
+ facet normal -0.401696 0.00107357 -0.915772
+  outer loop
+   vertex 98.1929 126 195.997
+   vertex 91.0106 126 189.386
+   vertex 97.8071 126 195.997
+  endloop
+ endfacet
+ facet normal 0.376309 0 0.926494
+  outer loop
+   vertex 97.8071 126 195.997
+   vertex 91.0106 126 189.386
+   vertex 97.4219 126 195.976
+  endloop
+ endfacet
+ facet normal -0.376309 0.000994031 -0.926494
+  outer loop
+   vertex 97.4219 126 195.976
+   vertex 91.0106 126 189.386
+   vertex 97.0385 126 195.934
+  endloop
+ endfacet
+ facet normal 0.350639 0 0.936511
+  outer loop
+   vertex 97.0385 126 195.934
+   vertex 91.0106 126 189.386
+   vertex 96.658 126 195.87
+  endloop
+ endfacet
+ facet normal -0.350639 0.000913918 -0.93651
+  outer loop
+   vertex 96.658 126 195.87
+   vertex 91.0106 126 189.386
+   vertex 96.2816 126 195.786
+  endloop
+ endfacet
+ facet normal 0.324701 0 0.945817
+  outer loop
+   vertex 96.2816 126 195.786
+   vertex 91.0106 126 189.386
+   vertex 95.9104 126 195.681
+  endloop
+ endfacet
+ facet normal -0.324701 0.00083313 -0.945816
+  outer loop
+   vertex 95.9104 126 195.681
+   vertex 91.0106 126 189.386
+   vertex 95.5455 126 195.556
+  endloop
+ endfacet
+ facet normal 0.298515 0 0.954405
+  outer loop
+   vertex 95.5455 126 195.556
+   vertex 91.0106 126 189.386
+   vertex 95.1881 126 195.41
+  endloop
+ endfacet
+ facet normal -0.298515 0.000751569 -0.954405
+  outer loop
+   vertex 95.1881 126 195.41
+   vertex 91.0106 126 189.386
+   vertex 94.8393 126 195.246
+  endloop
+ endfacet
+ facet normal 0.272104 0 0.962268
+  outer loop
+   vertex 94.8393 126 195.246
+   vertex 91.0106 126 189.386
+   vertex 94.5 126 195.062
+  endloop
+ endfacet
+ facet normal -0.272104 0.000669456 -0.962268
+  outer loop
+   vertex 94.5 126 195.062
+   vertex 91.0106 126 189.386
+   vertex 94.1714 126 194.86
+  endloop
+ endfacet
+ facet normal 0.245488 0 0.9694
+  outer loop
+   vertex 94.1714 126 194.86
+   vertex 91.0106 126 189.386
+   vertex 93.8544 126 194.64
+  endloop
+ endfacet
+ facet normal -0.245488 0.000586992 -0.969399
+  outer loop
+   vertex 93.8544 126 194.64
+   vertex 91.0106 126 189.386
+   vertex 93.5499 126 194.403
+  endloop
+ endfacet
+ facet normal 0.218681 0 0.975796
+  outer loop
+   vertex 93.5499 126 194.403
+   vertex 91.0106 126 189.386
+   vertex 93.259 126 194.15
+  endloop
+ endfacet
+ facet normal -0.218681 0.000503852 -0.975796
+  outer loop
+   vertex 93.259 126 194.15
+   vertex 91.0106 126 189.386
+   vertex 92.9825 126 193.881
+  endloop
+ endfacet
+ facet normal 0.191714 0 0.981451
+  outer loop
+   vertex 92.9825 126 193.881
+   vertex 91.0106 126 189.386
+   vertex 92.7213 126 193.597
+  endloop
+ endfacet
+ facet normal -0.191714 0.000420542 -0.981451
+  outer loop
+   vertex 92.7213 126 193.597
+   vertex 91.0106 126 189.386
+   vertex 92.476 126 193.299
+  endloop
+ endfacet
+ facet normal 0.164597 0 0.986361
+  outer loop
+   vertex 92.476 126 193.299
+   vertex 91.0106 126 189.386
+   vertex 92.2476 126 192.989
+  endloop
+ endfacet
+ facet normal -0.164597 0.000336776 -0.986361
+  outer loop
+   vertex 92.2476 126 192.989
+   vertex 91.0106 126 189.386
+   vertex 92.0366 126 192.666
+  endloop
+ endfacet
+ facet normal 0.137358 0 0.990521
+  outer loop
+   vertex 92.0366 126 192.666
+   vertex 91.0106 126 189.386
+   vertex 91.8437 126 192.332
+  endloop
+ endfacet
+ facet normal -0.137358 0.000252864 -0.990521
+  outer loop
+   vertex 91.8437 126 192.332
+   vertex 91.0106 126 189.386
+   vertex 91.6695 126 191.987
+  endloop
+ endfacet
+ facet normal 0.110009 0 0.993931
+  outer loop
+   vertex 91.6695 126 191.987
+   vertex 91.0106 126 189.386
+   vertex 91.5145 126 191.634
+  endloop
+ endfacet
+ facet normal -0.110009 0.000168636 -0.993931
+  outer loop
+   vertex 91.5145 126 191.634
+   vertex 91.0106 126 189.386
+   vertex 91.3793 126 191.273
+  endloop
+ endfacet
+ facet normal 0.0825829 0 0.996584
+  outer loop
+   vertex 91.3793 126 191.273
+   vertex 91.0106 126 189.386
+   vertex 91.2641 126 190.905
+  endloop
+ endfacet
+ facet normal -0.0825829 8.43349e-05 -0.996584
+  outer loop
+   vertex 91.2641 126 190.905
+   vertex 91.0106 126 189.386
+   vertex 91.1694 126 190.531
+  endloop
+ endfacet
+ facet normal 0.0550998 0 0.998481
+  outer loop
+   vertex 91.1694 126 190.531
+   vertex 91.0106 126 189.386
+   vertex 91.0955 126 190.152
+  endloop
+ endfacet
+ facet normal -0.0550998 0 -0.998481
+  outer loop
+   vertex 91.0425 126 189.77
+   vertex 91.0955 126 190.152
+   vertex 91.0106 126 189.386
+  endloop
+ endfacet
+ facet normal -0.936511 0 0.350638
+  outer loop
+   vertex 102.741 0 194.15
+   vertex 102.45 0 194.403
+   vertex 103.017 0 193.881
+  endloop
+ endfacet
+ facet normal 0.936511 0 -0.350638
+  outer loop
+   vertex 103.017 0 193.881
+   vertex 102.45 0 194.403
+   vertex 103.279 0 193.597
+  endloop
+ endfacet
+ facet normal 0.926493 8.43648e-05 -0.376311
+  outer loop
+   vertex 102.45 0 194.403
+   vertex 102.146 0 194.64
+   vertex 103.279 0 193.597
+  endloop
+ endfacet
+ facet normal -0.926493 0.000252832 0.376311
+  outer loop
+   vertex 103.279 0 193.597
+   vertex 102.146 0 194.64
+   vertex 103.524 0 193.299
+  endloop
+ endfacet
+ facet normal 0.936511 0 -0.350639
+  outer loop
+   vertex 103.524 0 193.299
+   vertex 102.146 0 194.64
+   vertex 103.752 0 192.989
+  endloop
+ endfacet
+ facet normal -0.936511 0.00033684 0.350639
+  outer loop
+   vertex 103.752 0 192.989
+   vertex 102.146 0 194.64
+   vertex 103.963 0 192.666
+  endloop
+ endfacet
+ facet normal 0.945818 0 -0.324698
   outer loop
-   vertex 98.910003662109375 126 198.510986328125
-   vertex 98.910003662109375 0 198.510986328125
-   vertex 105.08999633789062 126 198.510986328125
+   vertex 103.963 0 192.666
+   vertex 102.146 0 194.64
+   vertex 104.156 0 192.332
   endloop
  endfacet
- facet normal 0 0 1
+ facet normal -0.945818 0.000420525 0.324698
+  outer loop
+   vertex 104.156 0 192.332
+   vertex 102.146 0 194.64
+   vertex 104.33 0 191.987
+  endloop
+ endfacet
+ facet normal 0.954406 0 -0.298513
+  outer loop
+   vertex 104.33 0 191.987
+   vertex 102.146 0 194.64
+   vertex 104.485 0 191.634
+  endloop
+ endfacet
+ facet normal -0.954405 0.000503926 0.298513
+  outer loop
+   vertex 104.485 0 191.634
+   vertex 102.146 0 194.64
+   vertex 104.621 0 191.273
+  endloop
+ endfacet
+ facet normal 0.962269 0 -0.272102
+  outer loop
+   vertex 104.621 0 191.273
+   vertex 102.146 0 194.64
+   vertex 104.736 0 190.905
+  endloop
+ endfacet
+ facet normal -0.962268 0.000586871 0.272102
+  outer loop
+   vertex 104.736 0 190.905
+   vertex 102.146 0 194.64
+   vertex 104.831 0 190.531
+  endloop
+ endfacet
+ facet normal 0.9694 0 -0.245487
+  outer loop
+   vertex 104.831 0 190.531
+   vertex 102.146 0 194.64
+   vertex 104.905 0 190.152
+  endloop
+ endfacet
+ facet normal -0.9694 0.00066954 0.245487
+  outer loop
+   vertex 104.905 0 190.152
+   vertex 102.146 0 194.64
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.975796 0 0.218681
+  outer loop
+   vertex 102.146 0 194.64
+   vertex 101.829 0 194.86
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.975796 0.000751546 -0.218681
+  outer loop
+   vertex 101.829 0 194.86
+   vertex 101.5 0 195.062
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.9694 0 0.245485
+  outer loop
+   vertex 101.5 0 195.062
+   vertex 101.161 0 195.246
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.9694 0.000833124 -0.245485
+  outer loop
+   vertex 101.161 0 195.246
+   vertex 100.812 0 195.41
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.962268 0 0.272104
+  outer loop
+   vertex 100.812 0 195.41
+   vertex 100.454 0 195.556
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.962267 0.000913913 -0.272104
+  outer loop
+   vertex 100.454 0 195.556
+   vertex 100.09 0 195.681
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.954405 0 0.298515
+  outer loop
+   vertex 100.09 0 195.681
+   vertex 99.7184 0 195.786
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.954404 0.000994073 -0.298515
+  outer loop
+   vertex 99.7184 0 195.786
+   vertex 99.342 0 195.87
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.945817 0 0.324699
+  outer loop
+   vertex 99.342 0 195.87
+   vertex 98.9615 0 195.934
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.945817 0.00107352 -0.324699
+  outer loop
+   vertex 98.9615 0 195.934
+   vertex 98.5781 0 195.976
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.936511 0 0.350638
+  outer loop
+   vertex 98.5781 0 195.976
+   vertex 98.1929 0 195.997
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.936511 0.0011521 -0.350637
+  outer loop
+   vertex 98.1929 0 195.997
+   vertex 97.8071 0 195.997
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.926494 0 0.376309
+  outer loop
+   vertex 97.8071 0 195.997
+   vertex 97.4219 0 195.976
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.926493 0.00122979 -0.376309
+  outer loop
+   vertex 97.4219 0 195.976
+   vertex 97.0385 0 195.934
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.915774 0 0.401695
+  outer loop
+   vertex 97.0385 0 195.934
+   vertex 96.658 0 195.87
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.915773 0.00130667 -0.401694
+  outer loop
+   vertex 96.658 0 195.87
+   vertex 96.2816 0 195.786
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.904357 0 0.426777
+  outer loop
+   vertex 96.2816 0 195.786
+   vertex 95.9104 0 195.681
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.904356 0.00138242 -0.426776
+  outer loop
+   vertex 95.9104 0 195.681
+   vertex 95.5455 0 195.556
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.892254 0 0.451534
+  outer loop
+   vertex 95.5455 0 195.556
+   vertex 95.1881 0 195.41
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.892253 0.00145712 -0.451533
+  outer loop
+   vertex 95.1881 0 195.41
+   vertex 94.8393 0 195.246
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.879474 0 0.475947
+  outer loop
+   vertex 94.8393 0 195.246
+   vertex 94.5 0 195.062
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.879473 0.00153079 -0.475947
+  outer loop
+   vertex 94.5 0 195.062
+   vertex 94.1714 0 194.86
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.866025 0 0.5
+  outer loop
+   vertex 94.1714 0 194.86
+   vertex 93.8544 0 194.64
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.866024 0.00160329 -0.499999
+  outer loop
+   vertex 93.8544 0 194.64
+   vertex 93.5499 0 194.403
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.851919 0 0.523673
+  outer loop
+   vertex 93.5499 0 194.403
+   vertex 93.259 0 194.15
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.851918 0.00167452 -0.523672
+  outer loop
+   vertex 93.259 0 194.15
+   vertex 92.9825 0 193.881
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.837166 0 0.546948
+  outer loop
+   vertex 92.9825 0 193.881
+   vertex 92.7213 0 193.597
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.837165 0.00174457 -0.546947
+  outer loop
+   vertex 92.7213 0 193.597
+   vertex 92.476 0 193.299
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.821777 0 0.569809
+  outer loop
+   vertex 92.476 0 193.299
+   vertex 92.2476 0 192.989
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.821776 0.00181312 -0.569808
+  outer loop
+   vertex 92.2476 0 192.989
+   vertex 92.0366 0 192.666
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.805765 0 0.592235
+  outer loop
+   vertex 92.0366 0 192.666
+   vertex 91.8437 0 192.332
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.805764 0.00188049 -0.592234
+  outer loop
+   vertex 91.8437 0 192.332
+   vertex 91.6695 0 191.987
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.78914 0 0.614213
+  outer loop
+   vertex 91.6695 0 191.987
+   vertex 91.5145 0 191.634
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.789139 0.00194631 -0.614212
+  outer loop
+   vertex 91.5145 0 191.634
+   vertex 91.3793 0 191.273
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.771917 0 0.635724
+  outer loop
+   vertex 91.3793 0 191.273
+   vertex 91.2641 0 190.905
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.771915 0.00201072 -0.635722
+  outer loop
+   vertex 91.2641 0 190.905
+   vertex 91.1694 0 190.531
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal -0.754106 0 0.656752
+  outer loop
+   vertex 91.1694 0 190.531
+   vertex 91.0955 0 190.152
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.754105 0.00207354 -0.656751
+  outer loop
+   vertex 91.0955 0 190.152
+   vertex 91.0425 0 189.77
+   vertex 104.958 0 189.77
+  endloop
+ endfacet
+ facet normal 0.735724 0 -0.677282
+  outer loop
+   vertex 104.958 0 189.77
+   vertex 91.0425 0 189.77
+   vertex 104.989 0 189.386
+  endloop
+ endfacet
+ facet normal -0.733403 0.0793611 0.675145
+  outer loop
+   vertex 104.989 0 189.386
+   vertex 91.0425 0 189.77
+   vertex 105 0 189
+  endloop
+ endfacet
+ facet normal 0.656751 0 0.754107
+  outer loop
+   vertex 105 0 189
+   vertex 91.0425 0 189.77
+   vertex 104.989 0 188.614
+  endloop
+ endfacet
+ facet normal -0.65675 0.00213473 -0.754105
+  outer loop
+   vertex 104.989 0 188.614
+   vertex 91.0425 0 189.77
+   vertex 104.958 0 188.23
+  endloop
+ endfacet
+ facet normal 0.635724 0 0.771916
+  outer loop
+   vertex 104.958 0 188.23
+   vertex 91.0425 0 189.77
+   vertex 104.905 0 187.848
+  endloop
+ endfacet
+ facet normal -0.635723 0.00207359 -0.771915
+  outer loop
+   vertex 104.905 0 187.848
+   vertex 91.0425 0 189.77
+   vertex 104.831 0 187.469
+  endloop
+ endfacet
+ facet normal 0.614213 0 0.78914
+  outer loop
+   vertex 104.831 0 187.469
+   vertex 91.0425 0 189.77
+   vertex 104.736 0 187.095
+  endloop
+ endfacet
+ facet normal -0.614212 0.00201069 -0.789139
+  outer loop
+   vertex 104.736 0 187.095
+   vertex 91.0425 0 189.77
+   vertex 104.621 0 186.727
+  endloop
+ endfacet
+ facet normal 0.592236 0 0.805765
+  outer loop
+   vertex 104.621 0 186.727
+   vertex 91.0425 0 189.77
+   vertex 104.485 0 186.366
+  endloop
+ endfacet
+ facet normal -0.592234 0.00194637 -0.805763
+  outer loop
+   vertex 104.485 0 186.366
+   vertex 91.0425 0 189.77
+   vertex 104.33 0 186.013
+  endloop
+ endfacet
+ facet normal 0.569808 0 0.821778
+  outer loop
+   vertex 104.33 0 186.013
+   vertex 91.0425 0 189.77
+   vertex 104.156 0 185.668
+  endloop
+ endfacet
+ facet normal -0.569807 0.0018805 -0.821777
+  outer loop
+   vertex 104.156 0 185.668
+   vertex 91.0425 0 189.77
+   vertex 103.963 0 185.334
+  endloop
+ endfacet
+ facet normal 0.546947 0 0.837167
+  outer loop
+   vertex 103.963 0 185.334
+   vertex 91.0425 0 189.77
+   vertex 103.752 0 185.011
+  endloop
+ endfacet
+ facet normal -0.546947 0 -0.837167
+  outer loop
+   vertex 91.0425 0 189.77
+   vertex 91.0106 0 189.386
+   vertex 103.752 0 185.011
+  endloop
+ endfacet
+ facet normal 0.569807 0.00188051 0.821777
+  outer loop
+   vertex 91.0106 0 189.386
+   vertex 91 0 189
+   vertex 103.752 0 185.011
+  endloop
+ endfacet
+ facet normal -0.569808 0 -0.821778
+  outer loop
+   vertex 91 0 189
+   vertex 91.0106 0 188.614
+   vertex 103.752 0 185.011
+  endloop
+ endfacet
+ facet normal -0.546947 0.00181317 -0.837165
+  outer loop
+   vertex 103.752 0 185.011
+   vertex 91.0106 0 188.614
+   vertex 103.524 0 184.701
+  endloop
+ endfacet
+ facet normal 0.546948 0 0.837167
+  outer loop
+   vertex 103.524 0 184.701
+   vertex 91.0106 0 188.614
+   vertex 103.279 0 184.403
+  endloop
+ endfacet
+ facet normal -0.523672 0.00174452 -0.851918
   outer loop
-   vertex 105.08999633789062 0 198.510986328125
-   vertex 105.08999633789062 126 198.510986328125
-   vertex 98.910003662109375 0 198.510986328125
+   vertex 103.279 0 184.403
+   vertex 91.0106 0 188.614
+   vertex 103.017 0 184.119
   endloop
  endfacet
- facet normal 0.58781521760400901 -0 0.80899522245384836
+ facet normal 0.523673 0 0.85192
   outer loop
-   vertex 105.08999633789062 126 198.510986328125
-   vertex 105.08999633789062 0 198.510986328125
-   vertex 110.08999633789062 126 194.87799072265625
+   vertex 103.017 0 184.119
+   vertex 91.0106 0 188.614
+   vertex 102.741 0 183.85
   endloop
  endfacet
- facet normal 0.58781521760400901 0 0.80899522245384836
+ facet normal -0.499999 0.00167452 -0.866024
   outer loop
-   vertex 110.08999633789062 0 194.87799072265625
-   vertex 110.08999633789062 126 194.87799072265625
-   vertex 105.08999633789062 0 198.510986328125
+   vertex 102.741 0 183.85
+   vertex 91.0106 0 188.614
+   vertex 102.45 0 183.597
   endloop
  endfacet
- facet normal 0.95105039614603315 -0 0.30903582962251064
+ facet normal 0.5 0 0.866025
   outer loop
-   vertex 110.08999633789062 126 194.87799072265625
-   vertex 110.08999633789062 0 194.87799072265625
-   vertex 112 126 189
+   vertex 102.45 0 183.597
+   vertex 91.0106 0 188.614
+   vertex 102.146 0 183.36
   endloop
  endfacet
- facet normal 0.95105039614603315 0 0.30903582962251064
+ facet normal -0.475947 0.00160323 -0.879472
   outer loop
-   vertex 112 0 189
-   vertex 112 126 189
-   vertex 110.08999633789062 0 194.87799072265625
+   vertex 102.146 0 183.36
+   vertex 91.0106 0 188.614
+   vertex 101.829 0 183.14
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal 0.475948 0 0.879473
   outer loop
-   vertex 112 126 189
-   vertex 110.08999633789062 126 183.12199401855469
-   vertex 110.08999633789062 126 194.87799072265625
+   vertex 101.829 0 183.14
+   vertex 91.0106 0 188.614
+   vertex 101.5 0 182.938
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal -0.451533 0.00153084 -0.892253
   outer loop
-   vertex 110.08999633789062 126 183.12199401855469
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 110.08999633789062 126 194.87799072265625
+   vertex 101.5 0 182.938
+   vertex 91.0106 0 188.614
+   vertex 101.161 0 182.754
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal 0.451533 0 0.892254
   outer loop
-   vertex 110.08999633789062 126 194.87799072265625
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 105.08999633789062 126 198.510986328125
+   vertex 101.161 0 182.754
+   vertex 91.0106 0 188.614
+   vertex 100.812 0 182.59
   endloop
  endfacet
- facet normal 0 1 -0
+ facet normal -0.426777 0.0014571 -0.904356
   outer loop
-   vertex 105.08999633789062 126 198.510986328125
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 98.910003662109375 126 198.510986328125
+   vertex 100.812 0 182.59
+   vertex 91.0106 0 188.614
+   vertex 100.454 0 182.444
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal 0.426777 0 0.904357
   outer loop
-   vertex 98.910003662109375 126 198.510986328125
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 93.910003662109375 126 194.87799072265625
+   vertex 100.454 0 182.444
+   vertex 91.0106 0 188.614
+   vertex 100.09 0 182.319
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal -0.401696 0.0013824 -0.915772
   outer loop
-   vertex 93.910003662109375 126 194.87799072265625
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 92 126 189
+   vertex 100.09 0 182.319
+   vertex 91.0106 0 188.614
+   vertex 99.7184 0 182.214
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal 0.401696 0 0.915773
   outer loop
-   vertex 92 126 189
-   vertex 105.08999633789062 126 179.48899841308594
-   vertex 93.910003662109375 126 183.12199401855469
+   vertex 99.7184 0 182.214
+   vertex 91.0106 0 188.614
+   vertex 99.342 0 182.13
   endloop
  endfacet
- facet normal 0 1 0
+ facet normal -0.37631 0.00130661 -0.926493
   outer loop
-   vertex 98.910003662109375 126 179.48899841308594
-   vertex 93.910003662109375 126 183.12199401855469
-   vertex 105.08999633789062 126 179.48899841308594
+   vertex 99.342 0 182.13
+   vertex 91.0106 0 188.614
+   vertex 98.9615 0 182.066
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal 0.376311 0 0.926494
   outer loop
-   vertex 92 0 189
-   vertex 93.910003662109375 0 183.12199401855469
-   vertex 93.910003662109375 0 194.87799072265625
+   vertex 98.9615 0 182.066
+   vertex 91.0106 0 188.614
+   vertex 98.5781 0 182.024
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal -0.350637 0.00122989 -0.936511
   outer loop
-   vertex 93.910003662109375 0 183.12199401855469
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 93.910003662109375 0 194.87799072265625
+   vertex 98.5781 0 182.024
+   vertex 91.0106 0 188.614
+   vertex 98.1929 0 182.003
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal 0.350637 0 0.936511
   outer loop
-   vertex 93.910003662109375 0 194.87799072265625
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 98.910003662109375 0 198.510986328125
+   vertex 98.1929 0 182.003
+   vertex 91.0106 0 188.614
+   vertex 97.8071 0 182.003
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal -0.324701 0.00115203 -0.945816
   outer loop
-   vertex 98.910003662109375 0 198.510986328125
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 105.08999633789062 0 198.510986328125
+   vertex 97.8071 0 182.003
+   vertex 91.0106 0 188.614
+   vertex 97.4219 0 182.024
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal 0.324701 0 0.945817
   outer loop
-   vertex 105.08999633789062 0 198.510986328125
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 110.08999633789062 0 194.87799072265625
+   vertex 97.4219 0 182.024
+   vertex 91.0106 0 188.614
+   vertex 97.0385 0 182.066
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal -0.298516 0.0010735 -0.954404
   outer loop
-   vertex 110.08999633789062 0 194.87799072265625
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 112 0 189
+   vertex 97.0385 0 182.066
+   vertex 91.0106 0 188.614
+   vertex 96.658 0 182.13
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal 0.298517 0 0.954404
   outer loop
-   vertex 112 0 189
-   vertex 98.910003662109375 0 179.48899841308594
-   vertex 110.08999633789062 0 183.12199401855469
+   vertex 96.658 0 182.13
+   vertex 91.0106 0 188.614
+   vertex 96.2816 0 182.214
   endloop
  endfacet
- facet normal 0 -1 0
+ facet normal -0.272103 0.000994163 -0.962267
+  outer loop
+   vertex 96.2816 0 182.214
+   vertex 91.0106 0 188.614
+   vertex 95.9104 0 182.319
+  endloop
+ endfacet
+ facet normal 0.272104 0 0.962268
+  outer loop
+   vertex 95.9104 0 182.319
+   vertex 91.0106 0 188.614
+   vertex 95.5455 0 182.444
+  endloop
+ endfacet
+ facet normal -0.245486 0.000913921 -0.9694
+  outer loop
+   vertex 95.5455 0 182.444
+   vertex 91.0106 0 188.614
+   vertex 95.1881 0 182.59
+  endloop
+ endfacet
+ facet normal 0.245486 0 0.9694
+  outer loop
+   vertex 95.1881 0 182.59
+   vertex 91.0106 0 188.614
+   vertex 94.8393 0 182.754
+  endloop
+ endfacet
+ facet normal -0.218684 0.000833004 -0.975795
+  outer loop
+   vertex 94.8393 0 182.754
+   vertex 91.0106 0 188.614
+   vertex 94.5 0 182.938
+  endloop
+ endfacet
+ facet normal 0.218684 0 0.975796
+  outer loop
+   vertex 94.5 0 182.938
+   vertex 91.0106 0 188.614
+   vertex 94.1714 0 183.14
+  endloop
+ endfacet
+ facet normal -0.191711 0.000751638 -0.981451
+  outer loop
+   vertex 94.1714 0 183.14
+   vertex 91.0106 0 188.614
+   vertex 93.8544 0 183.36
+  endloop
+ endfacet
+ facet normal 0.191711 0 0.981451
+  outer loop
+   vertex 93.8544 0 183.36
+   vertex 91.0106 0 188.614
+   vertex 93.5499 0 183.597
+  endloop
+ endfacet
+ facet normal -0.164598 0.000669433 -0.98636
+  outer loop
+   vertex 93.5499 0 183.597
+   vertex 91.0106 0 188.614
+   vertex 93.259 0 183.85
+  endloop
+ endfacet
+ facet normal 0.164598 0 0.986361
+  outer loop
+   vertex 93.259 0 183.85
+   vertex 91.0106 0 188.614
+   vertex 92.9825 0 184.119
+  endloop
+ endfacet
+ facet normal -0.137356 0.000586964 -0.990522
+  outer loop
+   vertex 92.9825 0 184.119
+   vertex 91.0106 0 188.614
+   vertex 92.7213 0 184.403
+  endloop
+ endfacet
+ facet normal 0.137356 0 0.990522
+  outer loop
+   vertex 92.7213 0 184.403
+   vertex 91.0106 0 188.614
+   vertex 92.476 0 184.701
+  endloop
+ endfacet
+ facet normal -0.110012 0.000503894 -0.99393
+  outer loop
+   vertex 92.476 0 184.701
+   vertex 91.0106 0 188.614
+   vertex 92.2476 0 185.011
+  endloop
+ endfacet
+ facet normal 0.110012 0 0.99393
+  outer loop
+   vertex 92.2476 0 185.011
+   vertex 91.0106 0 188.614
+   vertex 92.0366 0 185.334
+  endloop
+ endfacet
+ facet normal -0.0825797 0.000420575 -0.996584
+  outer loop
+   vertex 92.0366 0 185.334
+   vertex 91.0106 0 188.614
+   vertex 91.8437 0 185.668
+  endloop
+ endfacet
+ facet normal 0.0825797 0 0.996584
+  outer loop
+   vertex 91.8437 0 185.668
+   vertex 91.0106 0 188.614
+   vertex 91.6695 0 186.013
+  endloop
+ endfacet
+ facet normal -0.0550903 0.000336774 -0.998481
+  outer loop
+   vertex 91.6695 0 186.013
+   vertex 91.0106 0 188.614
+   vertex 91.5145 0 186.366
+  endloop
+ endfacet
+ facet normal 0.0550903 0 0.998481
+  outer loop
+   vertex 91.5145 0 186.366
+   vertex 91.0106 0 188.614
+   vertex 91.3793 0 186.727
+  endloop
+ endfacet
+ facet normal -0.0275606 0.000252789 -0.99962
+  outer loop
+   vertex 91.3793 0 186.727
+   vertex 91.0106 0 188.614
+   vertex 91.2641 0 187.095
+  endloop
+ endfacet
+ facet normal 0.0275606 0 0.99962
+  outer loop
+   vertex 91.2641 0 187.095
+   vertex 91.0106 0 188.614
+   vertex 91.1694 0 187.469
+  endloop
+ endfacet
+ facet normal 0 0.000168694 -1
+  outer loop
+   vertex 91.1694 0 187.469
+   vertex 91.0106 0 188.614
+   vertex 91.0955 0 187.848
+  endloop
+ endfacet
+ facet normal 0 0 1
   outer loop
-   vertex 105.08999633789062 0 179.48899841308594
-   vertex 110.08999633789062 0 183.12199401855469
-   vertex 98.910003662109375 0 179.48899841308594
+   vertex 91.0425 0 188.23
+   vertex 91.0955 0 187.848
+   vertex 91.0106 0 188.614
   endloop
  endfacet
 endsolid
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index 64ddb3961..a9b33144e 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -1,14 +1,14 @@
 ##################################################
 #informations for Writing
 ##################################################
-Path = /work/y0078217/Results/ActuatorLine
+Path = /work/y0078217/Results/ActuatorLine105
 ##################################################
 #informations for reading
 ##################################################
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=100
+NodesPerDiameter=105
 Velocity=9
 ##################################################
 tStartOut=0
diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
index 1bad79fa5..c4598415b 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge_Device.cu
@@ -358,8 +358,8 @@ __global__ void LB_Kernel_CumulantK17Sponge(
     // 3.
     
     // Calculate modified omega for sponge bob layer
-    real startXsponge = 504.0f;
-    real endXsponge = 454.0f;
+    real startXsponge = 441.0f;
+    real endXsponge = 381.0f;
     real sizeSponge = endXsponge - startXsponge;
 
     real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega);
-- 
GitLab


From 6d1fdd2150af9499704e6ec7feb0c30384115d81 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:17:30 +0000
Subject: [PATCH 177/179] OhnePole

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 22 ++++++++++---------
 .../LBM/ActuatorLine/configActuatorLine.txt   |  4 ++--
 src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp  |  4 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 820b6d8d4..77fa28738 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -132,7 +132,7 @@ void multipleLevel(const std::string& configPath)
 
     const real viscosity = 1.56e-5;
 
-    const real mach = 0.2;
+    const real mach = 0.1;
 
 
     const float tStartOut   = config.getValue<real>("tStartOut");
@@ -164,10 +164,9 @@ void multipleLevel(const std::string& configPath)
     para->setMaxLevel(2);
     scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible);
 
-    std::string stlPath = "./VirtualFluids_dev/apps/gpu/LBM/ActuatorLine/Pole.stl";
-
-    Object *sphere = TriangularMesh::make(stlPath);
-    gridBuilder->addGeometry(sphere);
+    // std::string stlPath = "./VirtualFluids_dev/apps/gpu/LBM/ActuatorLine/Pole.stl";
+    // Object *sphere = TriangularMesh::make(stlPath);
+    // gridBuilder->addGeometry(sphere);
 
     gridBuilder->setPeriodicBoundaryCondition(false, false, false);
 
@@ -189,6 +188,7 @@ void multipleLevel(const std::string& configPath)
     VF_LOG_INFO("velocity  [m/s] = {}", velocity);
     VF_LOG_INFO("velocity  [dx/dt] = {}", velocityLB);
     VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8);
+    VF_LOG_INFO("Ma = {}", mach);
     VF_LOG_INFO("nodes/turbine diameter = {}", reference_diameter/dx);
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -227,15 +227,16 @@ void multipleLevel(const std::string& configPath)
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     gridBuilder->setVelocityBoundaryCondition(SideType::MX,  velocityLB, 0.0, 0.0);
-    gridBuilder->setVelocityBoundaryCondition(SideType::MY,  0.0, 0.0, 0.0);
+    gridBuilder->setSlipBoundaryCondition(SideType::MY,0.0, 0.0, 0.0 );
     gridBuilder->setVelocityBoundaryCondition(SideType::PY,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::MZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  velocityLB, 0.0, 0.0);
     gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0);
 
-    gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0);
-    bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
+    // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0);
+    // bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible);
 
+    bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipCompressible);
     bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible);
     bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective);
 
@@ -247,10 +248,11 @@ void multipleLevel(const std::string& configPath)
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     int level = 1; // grid level at which the turbine samples velocities and distributes forces
-    const real epsilon = dx*exp2(-level)*1.5; // width of gaussian smearing
+    const real epsilon = dx*exp2(-level)*2.0; // width of gaussian smearing
     const real density = 1.225f;
     const uint nBlades = 3;
-    const uint nBladeNodes = 401; // passt zu auflösung von 105 Knoten
+    const uint nBladeNodes = 404; // passt zu auflösung von 105 Knoten
+    VF_LOG_INFO("number of blade nodes ALM = {}", nBladeNodes);
     const real tipspeed_ratio = 7.5f; // tipspeed ratio = angular vel * radius / inflow vel
     const real omega = 2*tipspeed_ratio*velocity/reference_diameter;
 
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index a9b33144e..f637c47f2 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -12,8 +12,8 @@ NodesPerDiameter=105
 Velocity=9
 ##################################################
 tStartOut=0
-tOut=10000
-tEnd=10000
+tOut=5000
+tEnd=5000
 ##################################################
 
 # tStartTmpAveraging=100
diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
index 74e37b4cb..83f39ee82 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
+++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -370,8 +370,8 @@ void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFa
     //////////////////////////////////////////////////////////////////////////
     // Write Initialized Files
     //////////////////////////////////////////////////////////////////////////
-    VF_LOG_INFO("Write initialized Files ...");
-    dataWriter->writeInit(para, cudaMemoryManager);
+    // VF_LOG_INFO("Write initialized Files ...");
+    // dataWriter->writeInit(para, cudaMemoryManager);
     if (para->getCalcParticles())
         copyAndPrintParticles(para.get(), cudaMemoryManager.get(), 0, true);
     VF_LOG_INFO("... done.");
-- 
GitLab


From 40f6c9ed16d1d23cb1b58837943cc16a7d71e160 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Wed, 21 Dec 2022 08:32:32 +0000
Subject: [PATCH 178/179] Fix build error

---
 .../Compressible/CumulantK17Sponge/CumulantK17Sponge.cu         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
index 2788cda23..b6b6b78f5 100644
--- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
+++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Sponge/CumulantK17Sponge.cu
@@ -83,7 +83,7 @@ void CumulantK17Sponge<turbulenceModel>::runOnIndices( const unsigned int *indic
 				size_indices);
 			break;
 
-		case CollisionTemplate::Border:
+		case CollisionTemplate::SubDomainBorder:
 		case CollisionTemplate::AllFeatures:
 			LB_Kernel_CumulantK17Sponge < turbulenceModel, true, true  > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(
 				para->getParD(level)->omega,
-- 
GitLab


From f8794af18e1430e9653e11d14b059cc61797342d Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Tue, 3 Jan 2023 09:26:35 +0000
Subject: [PATCH 179/179] Add timers for performance optimization

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    |  2 +-
 .../LBM/ActuatorLine/configActuatorLine.txt   |  6 +-
 .../Calculation/UpdateGrid27.cpp              | 31 ++++++++++
 .../Calculation/UpdateGrid27.h                |  4 ++
 src/gpu/VirtualFluids_GPU/Output/Timer.cpp    |  7 +++
 src/gpu/VirtualFluids_GPU/Output/Timer.h      |  2 +
 .../PreCollisionInteractor/ActuatorFarm.cu    | 60 ++++++++++++++++---
 .../PreCollisionInteractor/ActuatorFarm.h     |  3 +
 8 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 77fa28738..8b5502329 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -251,7 +251,7 @@ void multipleLevel(const std::string& configPath)
     const real epsilon = dx*exp2(-level)*2.0; // width of gaussian smearing
     const real density = 1.225f;
     const uint nBlades = 3;
-    const uint nBladeNodes = 404; // passt zu auflösung von 105 Knoten
+    const uint nBladeNodes = reference_diameter * 4 + 3; // passt zu auflösung von 105 Knoten
     VF_LOG_INFO("number of blade nodes ALM = {}", nBladeNodes);
     const real tipspeed_ratio = 7.5f; // tipspeed ratio = angular vel * radius / inflow vel
     const real omega = 2*tipspeed_ratio*velocity/reference_diameter;
diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
index f637c47f2..fc8403bab 100644
--- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
+++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt
@@ -8,12 +8,12 @@ Path = /work/y0078217/Results/ActuatorLine105
 GridPath=.
 ##################################################
 ReferenceDiameter=126
-NodesPerDiameter=105
+NodesPerDiameter=32
 Velocity=9
 ##################################################
 tStartOut=0
-tOut=5000
-tEnd=5000
+tOut=1
+tEnd=1
 ##################################################
 
 # tStartTmpAveraging=100
diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp
index 4136614df..26632f18d 100644
--- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp
+++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp
@@ -13,8 +13,13 @@
 #include "CollisionStrategy.h"
 #include "RefinementStrategy.h"
 
+#include "Output/Timer.h"
+
 void UpdateGrid27::updateGrid(int level, unsigned int t)
 {
+
+    timer->startTimer();
+
     //////////////////////////////////////////////////////////////////////////
 
     if (level != para->getFine()) {
@@ -22,18 +27,27 @@ void UpdateGrid27::updateGrid(int level, unsigned int t)
         updateGrid(level + 1, t);
     }
 
+
     //////////////////////////////////////////////////////////////////////////
+    std::cout << "updateGrid: level = " << level << ", t = " << t << std::endl;
+
     
     interactWithProbes(level, t);
+            std::cout << " interactWithProbes, " << timer->startStopGetElapsed() << std::endl;
 
     //////////////////////////////////////////////////////////////////////////
 
     collision(this, para.get(), level, t);
 
+            std::cout << " collision, " << timer->startStopGetElapsed() << std::endl;
+
     //////////////////////////////////////////////////////////////////////////
 
     postCollisionBC(level, t);
 
+                std::cout << " postCollisionBC, " << timer->startStopGetElapsed() << std::endl;
+
+
     //////////////////////////////////////////////////////////////////////////
 
     swapBetweenEvenAndOddTimestep(level);
@@ -45,20 +59,35 @@ void UpdateGrid27::updateGrid(int level, unsigned int t)
 
     calcTurbulentViscosity(level);
 
+    
+                    std::cout << " calcTurbulentViscosity, " << timer->startStopGetElapsed() << std::endl;
+
     //////////////////////////////////////////////////////////////////////////
 
     this->preCollisionBC(level, t);
 
+                        std::cout << " preCollisionBC, " << timer->startStopGetElapsed() << std::endl;
+
+
     //////////////////////////////////////////////////////////////////////////
     if( level != para->getFine() )
     {   
         refinement(this, para.get(), level);
     }
 
+    
+                        std::cout << " refinement, " << timer->startStopGetElapsed() << std::endl;
+
     //////////////////////////////////////////////////////////////////////////
     
     interactWithActuators(level, t);
 
+                            std::cout << " interactWithActuators, " << timer->startStopGetElapsed() << std::endl;
+                                std::cout << "total time, " << timer->getTotalElapsedTime() << std::endl;
+                                timer->resetTimer();
+
+
+
 }
 
 void UpdateGrid27::collisionAllNodes(int level, unsigned int t)
@@ -391,4 +420,6 @@ UpdateGrid27::UpdateGrid27(SPtr<Parameter> para, vf::gpu::Communicator &comm, SP
     this->bcKernelManager = std::make_shared<BCKernelManager>(para, bcFactory);
     this->adKernelManager = std::make_shared<ADKernelManager>(para);
     this->gridScalingKernelManager = std::make_shared<GridScalingKernelManager>(para, scalingFactory);
+        timer = new Timer("ALM blade performance");
+    timer->initTimer();
 }
diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h
index 8ce2cf5bf..da6d53c17 100644
--- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h
+++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h
@@ -17,6 +17,8 @@ class BoundaryConditionFactory;
 class GridScalingFactory;
 class TurbulenceModelFactory;
 class UpdateGrid27;
+class Timer;
+
 using CollisionStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level, unsigned int t)>;
 using RefinementStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level)>;
 
@@ -84,6 +86,8 @@ private:
     std::shared_ptr<GridScalingKernelManager> gridScalingKernelManager;
     //! \property tmFactory is a shared pointer to an object of TurbulenceModelFactory
     std::shared_ptr<TurbulenceModelFactory> tmFactory;
+
+    Timer* timer = nullptr;
 };
 
 #endif
diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.cpp b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp
index 74a706165..b9ec5d9ba 100644
--- a/src/gpu/VirtualFluids_GPU/Output/Timer.cpp
+++ b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp
@@ -25,6 +25,13 @@ void Timer::stopTimer()
         this->totalElapsedTime += this->elapsedTime;
 }
 
+float Timer::startStopGetElapsed()
+{
+    this->stopTimer();
+    this->startTimer();
+    return this->elapsedTime;
+}
+
 void Timer::resetTimer()
 {
         this->elapsedTime = 0.0;
diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.h b/src/gpu/VirtualFluids_GPU/Output/Timer.h
index d035cbb6c..f6b6bad3c 100644
--- a/src/gpu/VirtualFluids_GPU/Output/Timer.h
+++ b/src/gpu/VirtualFluids_GPU/Output/Timer.h
@@ -34,6 +34,8 @@ class Timer
     float getElapsedTime(){ return this->elapsedTime; }
     float getTotalElapsedTime(){ return this->totalElapsedTime; }
 
+    float startStopGetElapsed();
+
     private:
     
     cudaEvent_t start_t, stop_t;
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
index 0e70df88e..72d349ff5 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu
@@ -14,6 +14,9 @@
 #include "GPU/CudaMemoryManager.h"
 #include <lbm/constants/NumericConstants.h>
 #include <logger/Logger.h>
+#include <ostream>
+
+#include "Output/Timer.h"
 
 using namespace vf::lbm::constant;
 
@@ -267,26 +270,38 @@ void ActuatorFarm::addTurbine(real posX, real posY, real posZ, real diameter, re
 
 void ActuatorFarm::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager)
 {
-    if(!para->getIsBodyForce()) throw std::runtime_error("try to allocate ActuatorFarm but BodyForce is not set in Parameter.");
+    if (!para->getIsBodyForce())
+        throw std::runtime_error("try to allocate ActuatorFarm but BodyForce is not set in Parameter.");
     this->forceRatio = para->getForceRatio();
     this->initTurbineGeometries(cudaMemoryManager);
-    this->initBladeCoords(cudaMemoryManager);    
+    this->initBladeCoords(cudaMemoryManager);
     this->initBladeIndices(para, cudaMemoryManager);
     this->initBladeVelocities(cudaMemoryManager);
-    this->initBladeForces(cudaMemoryManager);    
-    this->initBoundingSpheres(para, cudaMemoryManager);  
+    this->initBladeForces(cudaMemoryManager);
+    this->initBoundingSpheres(para, cudaMemoryManager);
     this->streamIndex = 0;
+
+    bladeTimer = new Timer("ALM blade performance");
+    bladeTimer->initTimer();
 }
 
-void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, unsigned int t)
+void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int currentLevel, unsigned int t)
 {
-    if (level != this->level) return;
+    if (currentLevel != this->level) return;
+    bool useTimer = false;
 
     cudaStream_t stream = para->getStreamManager()->getStream(CudaStreamIndex::ActuatorFarm, this->streamIndex);
 
+    if (useTimer)
+    std::cout << "ActuatorFarm::interact: level = " << currentLevel << ", t = " << t << " useHostArrays = " << useHostArrays <<std::endl;
+    bladeTimer->startTimer();
+
     if(useHostArrays) cudaMemoryManager->cudaCopyBladeCoordsHtoD(this);
 
-    vf::cuda::CudaGrid bladeGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->numberOfNodes);
+    vf::cuda::CudaGrid bladeGrid = vf::cuda::CudaGrid(para->getParH(currentLevel)->numberofthreads, this->numberOfNodes);
+
+    if (useTimer)
+    std::cout << " cudaCopyBladeCoordsHtoD, " << bladeTimer->startStopGetElapsed() << std::endl;
 
     interpolateVelocities<<< bladeGrid.grid, bladeGrid.threads, 0, stream >>>(
         para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ,        
@@ -299,14 +314,28 @@ void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManage
         this->turbinePosXD, this->turbinePosYD, this->turbinePosZD,
         this->bladeIndicesD, para->getVelocityRatio(), this->invDeltaX);
 
+    if (useTimer)
+    std::cout << " interpolateVelocities, " << bladeTimer->startStopGetElapsed() << std::endl;
+
     cudaStreamSynchronize(stream);
     if(useHostArrays) cudaMemoryManager->cudaCopyBladeVelocitiesDtoH(this);
+
+    if (useTimer)
+    std::cout << " cudaCopyBladeVelocitiesDtoH, " << bladeTimer->startStopGetElapsed() << std::endl;
+
     this->calcBladeForces();
+    
+    if (useTimer)
+    std::cout << " calcBladeForces, " << bladeTimer->startStopGetElapsed() << std::endl;
+
     this->swapDeviceArrays();
 
     if(useHostArrays) cudaMemoryManager->cudaCopyBladeForcesHtoD(this);
 
-    vf::cuda::CudaGrid sphereGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->numberOfIndices);
+    if (useTimer)
+    std::cout << " cudaCopyBladeForcesHtoD, " << bladeTimer->startStopGetElapsed() << std::endl;
+
+    vf::cuda::CudaGrid sphereGrid = vf::cuda::CudaGrid(para->getParH(currentLevel)->numberofthreads, this->numberOfIndices);
 
     applyBodyForces<<<sphereGrid.grid, sphereGrid.threads, 0, stream>>>(
         para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ,        
@@ -318,12 +347,25 @@ void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManage
         this->turbinePosXD, this->turbinePosYD, this->turbinePosZD,
         this->boundingSphereIndicesD, this->numberOfIndices,
         this->invEpsilonSqrd, this->factorGaussian);
+
+    if (useTimer)
+    std::cout << " applyBodyForces, " << bladeTimer->startStopGetElapsed() << std::endl;
+
     cudaMemoryManager->cudaCopyBladeOrientationsHtoD(this);
+
+        if (useTimer)
+    std::cout << " cudaCopyBladeOrientationsHtoD, " << bladeTimer->startStopGetElapsed()  << std::endl;
+    if (useTimer)
+    std::cout << "total time, " << bladeTimer->getTotalElapsedTime() << std::endl;
+                                    bladeTimer->resetTimer();
+
     cudaStreamSynchronize(stream);
+
+
 }
 
 
-void ActuatorFarm::free(Parameter* para, CudaMemoryManager* cudaMemoryManager)
+void ActuatorFarm::free(Parameter*  /*para*/, CudaMemoryManager* cudaMemoryManager)
 {
     cudaMemoryManager->cudaFreeBladeGeometries(this);
     cudaMemoryManager->cudaFreeBladeOrientations(this);
diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
index 8e21cdb6b..e6066e286 100644
--- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
+++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h
@@ -10,6 +10,7 @@ using namespace vf::lbm::constant;
 
 class Parameter;
 class GridProvider;
+class Timer;
 using namespace vf::lbm::constant;
 
 class ActuatorFarm : public PreCollisionInteractor
@@ -192,6 +193,8 @@ private:
     uint numberOfNodes;
     real forceRatio, factorGaussian, invEpsilonSqrd, invDeltaX;
     int streamIndex;
+
+    Timer* bladeTimer = nullptr;
 };
 
 #endif
-- 
GitLab