diff --git a/.gitignore b/.gitignore index e3c73e0775977555049ebcbd27dd12fb783733a9..d3e29c184e8e90ec5899b7b7241bd9fb34385cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin/ cmake-build-debug/ run/ buildGCC +buildWSL # Python _skbuild/ diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake index 3c71d51344030980071addc6f9831a74d0daa53c..f0ccf3a5796013f92fd85bd7fd77890ad899e1b5 100644 --- a/apps/cpu/Applications.cmake +++ b/apps/cpu/Applications.cmake @@ -1,25 +1,31 @@ add_subdirectory(${APPS_ROOT_CPU}/PoiseuilleFlow) -add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleySphere) -add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleyModel) -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}/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(${APPS_ROOT_CPU}/JetBreakup) - add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex) -IF(${USE_LIGGGHTS}) +IF(${VFCPU_ENABLE_LiggghtsCoupling}) add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp) add_subdirectory(${APPS_ROOT_CPU}/FallingSphere) add_subdirectory(${APPS_ROOT_CPU}/Nozzle) ENDIF() +IF(${VFCPU_ENABLE_NonNewtonianFluids}) + add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleySphere) + add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleyModel) + add_subdirectory(${APPS_ROOT_CPU}/rheometer) + add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL) +ENDIF() + +IF(${VFCPU_ENABLE_MultiphaseFlow}) + add_subdirectory(${APPS_ROOT_CPU}/Multiphase) + add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest) + add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D) + add_subdirectory(${APPS_ROOT_CPU}/JetBreakup) +ENDIF() + + #add_subdirectory(tests) #add_subdirectory(Applications/gridRf) #add_subdirectory(Applications/greenvortex) diff --git a/apps/cpu/ConvectionOfVortex/cov.cpp b/apps/cpu/ConvectionOfVortex/cov.cpp index 45b9489397df760be5d1247f1f2961393b2c22fe..baa136d6a3a96e1e4ce86ce187f116e2c560530c 100644 --- a/apps/cpu/ConvectionOfVortex/cov.cpp +++ b/apps/cpu/ConvectionOfVortex/cov.cpp @@ -112,14 +112,14 @@ void run() GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB)); - outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(outflowBCAdapter); + bcVisitor.addBC(outflowBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); SPtr<GbObject3D> refCube(new GbCuboid3D(g_minX1-blockLength,-0.02,-0.02,g_maxX1+blockLength,0.02,0.02)); if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance()); @@ -133,24 +133,24 @@ void run() if (myid==0) UBLOG(logINFO, "Refinement - end"); } - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); //outflow GbCuboid3DPtr geoOutflow1(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength)); if (myid==0) GbSystem3D::writeGeoObject(geoOutflow1.get(), pathname+"/geo/geoOutflow1", WbWriterVtkXmlASCII::getInstance()); - SPtr<D3Q27Interactor> outflowIntr1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow1, grid, outflowBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowIntr1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow1, grid, outflowBC, Interactor3D::SOLID)); GbCuboid3DPtr geoOutflow2(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); if (myid==0) GbSystem3D::writeGeoObject(geoOutflow2.get(), pathname+"/geo/geoOutflow2", WbWriterVtkXmlASCII::getInstance()); - SPtr<D3Q27Interactor> outflowIntr2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow2, grid, outflowBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowIntr2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow2, grid, outflowBC, Interactor3D::SOLID)); GbCuboid3DPtr geoOutflow3(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3)); if (myid==0) GbSystem3D::writeGeoObject(geoOutflow3.get(), pathname+"/geo/geoOutflow3", WbWriterVtkXmlASCII::getInstance()); - SPtr<D3Q27Interactor> outflowIntr3 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow3, grid, outflowBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowIntr3 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow3, grid, outflowBC, Interactor3D::SOLID)); GbCuboid3DPtr geoOutflow4(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); 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<D3Q27Interactor> outflowIntr4 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow4, grid, outflowBC, Interactor3D::SOLID)); SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_00M)); InteractorsHelper intHelper(grid, metisVisitor); @@ -160,7 +160,7 @@ void run() //intHelper.addInteractor(outflowIntr4); intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); //set connectors @@ -211,9 +211,9 @@ void run() //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); //dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true); // - SPtr<BCProcessor> bcProcessor(new BCProcessor()); + SPtr<BCSet> bcSet(new BCSet()); - kernel->setBCProcessor(bcProcessor); + kernel->setBCSet(bcSet); SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); grid->accept(kernelVisitor); @@ -264,8 +264,8 @@ void run() //Postrozess SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + SPtr<SimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); ppgeo.reset(); if (myid==0) UBLOG(logINFO, "Preprozess - end"); @@ -278,27 +278,27 @@ void run() } SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); - writeMQCoProcessor->process(0); + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + writeMQSimulationObserver->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + std::shared_ptr<NUPSCounterSimulationObserver> nupsSimulationObserver(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); //SPtr<UbScheduler> tavSch(new UbScheduler(1, 0, endTime)); - //SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm, - // TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations)); + //SPtr<TimeAveragedValuesSimulationObserver> tav(new TimeAveragedValuesSimulationObserver(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm, + // TimeAveragedValuesSimulationObserver::Density | TimeAveragedValuesSimulationObserver::Velocity | TimeAveragedValuesSimulationObserver::Fluctuations)); //tav->setWithGhostLayer(true); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); - calculator->addCoProcessor(nupsCoProcessor); - calculator->addCoProcessor(writeMQCoProcessor); - //calculator->addCoProcessor(tav); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); + //simulation->addSimulationObserver(tav); //omp_set_num_threads(1); if (myid==0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid==0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/CouetteFlow/CMakeLists.txt b/apps/cpu/CouetteFlow/CMakeLists.txt index 56931592d831ded425580f40af35e5f4c4a7c1c2..9f28e30c5aeb0722fb9d0b9b13a135ecae0f9799 100644 --- a/apps/cpu/CouetteFlow/CMakeLists.txt +++ b/apps/cpu/CouetteFlow/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(CouetteFlow) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES cflow.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES cflow.cpp ) \ No newline at end of file diff --git a/apps/cpu/CouetteFlow/cflow.cpp b/apps/cpu/CouetteFlow/cflow.cpp index a60031096a0197e129a6c01c1dd9d5881dc2699f..e81c3bb008948814d79577311498dbfd5f1a76f2 100644 --- a/apps/cpu/CouetteFlow/cflow.cpp +++ b/apps/cpu/CouetteFlow/cflow.cpp @@ -1,7 +1,8 @@ #include <iostream> #include <string> -#include <VirtualFluids.h> +#include "VirtualFluids.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -112,24 +113,24 @@ void bflow(string configname) thix->setC(c); thix->setMu0(mu0); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyPowellEyringModelNoSlipBCAlgorithm())); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyPowellEyringModelNoSlipBCStrategy())); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); + bcVisitor.addBC(noSlipBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new PowellEyringModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyK17LBMKernel()); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel()); kernel->setForcingX1(forcing); kernel->setWithForcing(true); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); SPtr<Grid3D> grid(new Grid3D(comm)); @@ -178,11 +179,11 @@ void bflow(string configname) if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance()); //wall interactors - //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBC, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBC, Interactor3D::SOLID)); //////////////////////////////////////////// //METIS @@ -199,8 +200,8 @@ void bflow(string configname) if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end"); ////////////////////////////////////// - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->process(0); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); unsigned long nob = grid->getNumberOfBlocks(); int gl = 3; @@ -252,29 +253,29 @@ void bflow(string configname) grid->accept(bcVisitor); SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm); - ppgeo.process(1); + WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm); + ppgeo.update(1); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); //write data for visualization of macroscopic quantities SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); - SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + SPtr<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime)); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); - calculator->addCoProcessor(npr); - calculator->addCoProcessor(writeMQCoProcessor); - calculator->addCoProcessor(writeThixotropicMQCoProcessor); - //calculator->addCoProcessor(migCoProcessor); - //calculator->addCoProcessor(restartCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(writeMQSimulationObserver); + simulation->addSimulationObserver(writeThixotropicMQSimulationObserver); + //simulation->addSimulationObserver(migSimulationObserver); + //simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp index 5f399c547e697199cbbde82b906169a8c1d5fd59..ba837fcf15b32a65983b633c768aea6250a976a7 100644 --- a/apps/cpu/FallingSphere/FallingSphere.cpp +++ b/apps/cpu/FallingSphere/FallingSphere.cpp @@ -4,9 +4,7 @@ #include "VirtualFluids.h" -#include "LiggghtsCouplingCoProcessor.h" -#include "LiggghtsCouplingWrapper.h" -#include "IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/LiggghtsCoupling.h" using namespace std; @@ -39,15 +37,15 @@ int main(int argc, char *argv[]) double nuLB = 1e-2; SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); - SPtr<BCProcessor> bcProc = make_shared<BCProcessor>(); - kernel->setBCProcessor(bcProc); + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); + bcVisitor.addBC(noSlipBC); SPtr<Grid3D> grid = make_shared<Grid3D>(comm); grid->setPeriodicX1(true); @@ -61,7 +59,7 @@ int main(int argc, char *argv[]) UbSystem::makeDirectory(outputPath); UbSystem::makeDirectory(outputPath + "/liggghts"); - SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE)); + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::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) @@ -70,10 +68,10 @@ int main(int argc, char *argv[]) GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<CoProcessor> ppblocks = - make_shared <WriteBlocksCoProcessor>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, + SPtr<SimulationObserver> ppblocks = + make_shared <WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); double dx2 = 2.0 * dx; @@ -84,8 +82,8 @@ int main(int argc, char *argv[]) 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)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); InteractorsHelper intHelper(grid, metisVisitor, true); intHelper.addInteractor(wallZminInt); @@ -136,15 +134,15 @@ 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, units); + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = + make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor( + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + ppgeo->update(0); ppgeo.reset(); } @@ -156,17 +154,17 @@ int main(int argc, char *argv[]) // write data for visualization of macroscopic quantities SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor( - new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver( + new WriteMacroscopicQuantitiesSimulationObserver(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); + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp b/apps/cpu/FlowAroundCylinder/cylinder.cpp index d66222495986cc6eaa26c078d7eaf225834ffaab..f8c2ac4674a7bfa98d42c0be4ebf20365f579695 100644 --- a/apps/cpu/FlowAroundCylinder/cylinder.cpp +++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp @@ -80,29 +80,29 @@ void run(string configname) SPtr<Grid3D> grid(new Grid3D(comm)); //BC - SPtr<BCAdapter> noSlipAdapter(new NoSlipBCAdapter()); - noSlipAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + SPtr<BC> noSlipAdapter(new NoSlipBC()); + noSlipAdapter->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); mu::Parser fct; fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4"); fct.DefineConst("U", uLB); fct.DefineConst("H", H); - SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); - velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm())); + SPtr<BC> velBC(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + velBC->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); - SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); BoundaryConditionsBlockVisitor bcVisitor; bcVisitor.addBC(noSlipAdapter); - bcVisitor.addBC(velBCAdapter); - bcVisitor.addBC(denBCAdapter); + bcVisitor.addBC(velBC); + bcVisitor.addBC(denBC); ////////////////////////////////////////////////////////////////////////// //restart SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart)); - //RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::BINARY); - MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm); + //RestartSimulationObserver rp(grid, rSch, comm, pathOut, RestartSimulationObserver::BINARY); + MPIIORestartSimulationObserver rcp(grid, rSch, pathOut, comm); ////////////////////////////////////////////////////////////////////////// ////cylinder @@ -181,7 +181,7 @@ void run(string configname) GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); if (refineLevel>0) { @@ -199,10 +199,10 @@ void run(string configname) SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipAdapter, Interactor3D::SOLID)); //inflow - SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBC, Interactor3D::SOLID)); //outflow - SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_00M)); @@ -217,7 +217,7 @@ void run(string configname) intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -247,8 +247,8 @@ void run(string configname) SPtr<LBMKernel> kernel(new CompressibleCumulantLBMKernel()); - SPtr<BCProcessor> bcProc(new BCProcessor()); - kernel->setBCProcessor(bcProc); + SPtr<BCSet> bcProc(new BCSet()); + kernel->setBCSet(bcProc); SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem); grid->accept(kernelVisitor); @@ -275,9 +275,9 @@ void run(string configname) //Postrozess SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<CoProcessor> ppgeo( - new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + SPtr<SimulationObserver> ppgeo( + new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); ppgeo.reset(); if (myid==0) UBLOG(logINFO, "Preprozess - end"); @@ -302,26 +302,26 @@ void run(string configname) SPtr<UbScheduler> stepSch(new UbScheduler(outTime)); - SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + SPtr<SimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm)); real area = (2.0*radius*H)/(dx*dx); real v = 4.0*uLB/9.0; SPtr<UbScheduler> forceSch(new UbScheduler(100)); - SPtr<CalculateForcesCoProcessor> fp = make_shared<CalculateForcesCoProcessor>(grid, forceSch, pathOut + "/results/forces.txt", comm, v, area); + SPtr<CalculateForcesSimulationObserver> fp = make_shared<CalculateForcesSimulationObserver>(grid, forceSch, pathOut + "/results/forces.txt", comm, v, area); fp->addInteractor(cylinderInt); SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2])); - std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + std::shared_ptr<SimulationObserver> nupsSimulationObserver(new NUPSCounterSimulationObserver(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(nupsCoProcessor); - calculator->addCoProcessor(fp); - calculator->addCoProcessor(writeMQCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(writeMQSimulationObserver); if(myid == 0) UBLOG(logINFO,"Simulation-start"); - calculator->calculate(); + simulation->run(); if(myid == 0) UBLOG(logINFO,"Simulation-end"); } catch(std::exception& e) diff --git a/apps/cpu/HerschelBulkleyModel/CMakeLists.txt b/apps/cpu/HerschelBulkleyModel/CMakeLists.txt index fe04d5c61fdbf66fb1ab0966745301330ad0866e..537402905309fe65441d9b5fbe2d48523c55947f 100644 --- a/apps/cpu/HerschelBulkleyModel/CMakeLists.txt +++ b/apps/cpu/HerschelBulkleyModel/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(HerschelBulkleyModel) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES hbflow.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES hbflow.cpp ) \ No newline at end of file diff --git a/apps/cpu/HerschelBulkleyModel/hbflow.cpp b/apps/cpu/HerschelBulkleyModel/hbflow.cpp index 567fd661cd2e131e3f4f311285bd636f471dccb6..83686a88495ef5fc2a3ce8529453f2d59d30dab7 100644 --- a/apps/cpu/HerschelBulkleyModel/hbflow.cpp +++ b/apps/cpu/HerschelBulkleyModel/hbflow.cpp @@ -1,7 +1,8 @@ #include <iostream> #include <string> -#include <VirtualFluids.h> +#include "VirtualFluids.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -132,29 +133,41 @@ void bflow(string configname) thix->setC(c); thix->setMu0(mu0); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyPowellEyringModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyPowellEyringModelNoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy())); + + mu::Parser fctVx; + fctVx.SetExpr("u"); + fctVx.DefineConst("u", 0.001); + + + SPtr<BC> velocityBC(new VelocityBC(true, false, false, fctVx, 0, BCFunction::INFCONST)); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + velocityBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelVelocityBCStrategy())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - //bcVisitor.addBC(noSlipBCAdapter); + //bcVisitor.addBC(noSlipBC); + //bcVisitor.addBC(velocityBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new PowellEyringModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel()); - SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyK17LBMKernel()); + //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyK17LBMKernel()); + SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BinghamModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); //double forcingXY = forcing / sqrt(2.0); //kernel->setForcingX1(forcingXY); //kernel->setForcingX2(forcingXY); + kernel->setForcingX1(forcing); kernel->setWithForcing(true); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); SPtr<Grid3D> grid(new Grid3D(comm)); @@ -210,13 +223,13 @@ void bflow(string configname) //wall interactors - //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBC, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBC, Interactor3D::SOLID)); - //SPtr<D3Q27TriFaceMeshInteractor> wall45Int(new D3Q27TriFaceMeshInteractor(wall45, grid, noSlipBCAdapter, Interactor3D::SOLID)); + //SPtr<D3Q27TriFaceMeshInteractor> wall45Int(new D3Q27TriFaceMeshInteractor(wall45, grid, noSlipBC, Interactor3D::SOLID)); //////////////////////////////////////////// //METIS @@ -234,8 +247,8 @@ void bflow(string configname) if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end"); ////////////////////////////////////// - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->process(0); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); unsigned long nob = grid->getNumberOfBlocks(); int gl = 3; @@ -287,29 +300,39 @@ void bflow(string configname) grid->accept(bcVisitor); SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm); - ppgeo.process(1); + WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm); + ppgeo.update(1); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); + + SPtr<UbScheduler> forceSch(new UbScheduler(1000)); + //real dummy = 1; + SPtr<CalculateTorqueSimulationObserver> fp = std::make_shared<CalculateTorqueSimulationObserver>(grid, forceSch, pathname + "/forces/forces.csv", comm); + fp->addInteractor(addWallYminInt); + + SPtr<CalculateTorqueSimulationObserver> fp2 = std::make_shared<CalculateTorqueSimulationObserver>(grid, forceSch, pathname + "/forces/forces2.csv", comm); + fp2->addInteractor(addWallYmaxInt); //write data for visualization of macroscopic quantities SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); - SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + SPtr<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime)); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); - calculator->addCoProcessor(npr); - calculator->addCoProcessor(writeMQCoProcessor); - calculator->addCoProcessor(writeThixotropicMQCoProcessor); - //calculator->addCoProcessor(migCoProcessor); - //calculator->addCoProcessor(restartCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(writeMQSimulationObserver); + simulation->addSimulationObserver(writeThixotropicMQSimulationObserver); + simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(fp2); + //simulation->addSimulationObserver(migSimulationObserver); + //simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/HerschelBulkleySphere/CMakeLists.txt b/apps/cpu/HerschelBulkleySphere/CMakeLists.txt index 6902b6c6cca28ff3dccd765d9e16dd5e92a772bd..69fe09a4f0eb5b11ecf15f3bd609c9afbf79cae6 100644 --- a/apps/cpu/HerschelBulkleySphere/CMakeLists.txt +++ b/apps/cpu/HerschelBulkleySphere/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(HerschelBulkleySphere) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES hbsphere.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES hbsphere.cpp ) \ No newline at end of file diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp index ae71a3a44926c52e04eb0df682b0495ce37c173d..221b106123b5fadffcf60427481800ef0d673b76 100644 --- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp +++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp @@ -1,7 +1,8 @@ #include <iostream> #include <string> -#include <VirtualFluids.h> +#include "VirtualFluids.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -102,13 +103,13 @@ void bflow(string configname) 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<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy())); - SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); - slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); + SPtr<BC> slipBC(new SlipBC()); + slipBC->setBCStrategy(SPtr<BCStrategy>(new SimpleSlipBCStrategy())); mu::Parser fct; fct.SetExpr("U"); @@ -118,31 +119,31 @@ void bflow(string configname) //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4"); //fct.DefineConst("U", U); //fct.DefineConst("H", H); - SPtr<BCAdapter> velocityBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); - velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm())); - //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm())); + SPtr<BC> velocityBC(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + velocityBC->setBCStrategy(SPtr<BCStrategy>(new SimpleVelocityBCStrategy())); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); - SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter()); - densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); - //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + SPtr<BC> densityBC(new DensityBC()); + densityBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + //densityBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(slipBCAdapter); - bcVisitor.addBC(velocityBCAdapter); - bcVisitor.addBC(densityBCAdapter); + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(slipBC); + bcVisitor.addBC(velocityBC); + bcVisitor.addBC(densityBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyK17LBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BinghamModelLBMKernel()); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); //kernel->setForcingX1(forcing); //kernel->setWithForcing(true); @@ -159,7 +160,7 @@ void bflow(string configname) //sphere SPtr<GbObject3D> sphere(new GbSphere3D(sphereCenter[0], sphereCenter[1], sphereCenter[2], radius)); GbSystem3D::writeGeoObject(sphere.get(), outputPath + "/geo/sphere", WbWriterVtkXmlBinary::getInstance()); - SPtr<D3Q27Interactor> sphereInt(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> sphereInt(new D3Q27Interactor(sphere, grid, noSlipBC, Interactor3D::SOLID)); //////////////////////////////////////////// //METIS @@ -168,10 +169,10 @@ void bflow(string configname) ////////////////////////////////////////////////////////////////////////// //restart SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); - SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, outputPath, comm)); - restartCoProcessor->setLBMKernel(kernel); - restartCoProcessor->setBCProcessor(bcProc); - //restartCoProcessor->setNu(k); + SPtr<MPIIOMigrationSimulationObserver> restartSimulationObserver(new MPIIOMigrationSimulationObserver(grid, mSch, metisVisitor, outputPath, comm)); + restartSimulationObserver->setLBMKernel(kernel); + restartSimulationObserver->setBCSet(bcProc); + //restartSimulationObserver->setNu(k); ////////////////////////////////////////////////////////////////////////// if (myid == 0) @@ -234,14 +235,14 @@ void bflow(string configname) if (myid == 0) GbSystem3D::writeGeoObject(wallXmax.get(), outputPath + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance()); //wall interactors - SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, slipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, slipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, slipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, slipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, velocityBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, densityBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, velocityBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, densityBC, Interactor3D::SOLID)); //////////////////////////////////////////// //METIS @@ -261,8 +262,8 @@ void bflow(string configname) 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); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); unsigned long nob = grid->getNumberOfBlocks(); int gl = 3; @@ -310,7 +311,7 @@ void bflow(string configname) } else { - restartCoProcessor->restart((int)restartStep); + restartSimulationObserver->restart((int)restartStep); grid->setTimeStep(restartStep); SetBcBlocksBlockVisitor v(sphereInt); grid->accept(v); @@ -331,35 +332,35 @@ void bflow(string configname) grid->accept(bcVisitor); SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlASCII::getInstance(), comm); - ppgeo.process(0); + WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlASCII::getInstance(), comm); + ppgeo.update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(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(0); + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); real area = UbMath::PI*radius*radius; SPtr<UbScheduler> forceSch(new UbScheduler(100)); - SPtr<CalculateForcesCoProcessor> fp = make_shared<CalculateForcesCoProcessor>(grid, forceSch, outputPath + "/forces/forces.txt", comm, velocity, area); + SPtr<CalculateForcesSimulationObserver> fp = make_shared<CalculateForcesSimulationObserver>(grid, forceSch, outputPath + "/forces/forces.txt", comm, velocity, area); fp->addInteractor(sphereInt); - SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + SPtr<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(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(writeMQCoProcessor); - calculator->addCoProcessor(writeThixotropicMQCoProcessor); - calculator->addCoProcessor(restartCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(writeMQSimulationObserver); + simulation->addSimulationObserver(writeThixotropicMQSimulationObserver); + simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/JetBreakup/CMakeLists.txt b/apps/cpu/JetBreakup/CMakeLists.txt index 19553ec4c1cca9dde298d377f82f8730f48269d0..b5bb536cf0c0b4820953ade37b1b5ccca265d7f2 100644 --- a/apps/cpu/JetBreakup/CMakeLists.txt +++ b/apps/cpu/JetBreakup/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(JetBreakup) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES JetBreakup.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow FILES JetBreakup.cpp ) \ No newline at end of file diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp index 2115b515f1c77cd97b587449ab9881642aa6e1be..f4b74ca379edaf8840cb6875ca0ff9fc7f296509 100644 --- a/apps/cpu/JetBreakup/JetBreakup.cpp +++ b/apps/cpu/JetBreakup/JetBreakup.cpp @@ -3,6 +3,7 @@ #include <string> #include "VirtualFluids.h" +#include "MultiphaseFlow/MultiphaseFlow.h" using namespace std; @@ -209,10 +210,10 @@ void run(string configname) kernel->setInterfaceWidth(interfaceWidth); //dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0); - SPtr<BCProcessor> bcProc(new BCProcessor()); - // BCProcessorPtr bcProc(new ThinWallBCProcessor()); + SPtr<BCSet> bcProc(new BCSet()); + // BCSetPtr bcProc(new ThinWallBCSet()); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); SPtr<Grid3D> grid(new Grid3D(comm)); // grid->setPeriodicX1(true); @@ -226,15 +227,15 @@ 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)); + // SPtr<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + // SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); // rcp->setNu(nuLB); // rcp->setNuLG(nuL, nuG); // rcp->setDensityRatio(densityRatio); rcp->setLBMKernel(kernel); - rcp->setBCProcessor(bcProc); + rcp->setBCSet(bcProc); ////////////////////////////////////////////////////////////////////////// // BC Adapter ////////////////////////////////////////////////////////////////////////////// @@ -246,24 +247,24 @@ void run(string configname) 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)); + // SPtr<BC> velBCF1( + // new MultiphaseVelocityBC(false, true, false, fctF1, phiH, 0.0, BCFunction::INFCONST)); mu::Parser fctF2; fctF2.SetExpr("vy1"); fctF2.DefineConst("vy1", U_LB); real 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<BC> velBCF1( + new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, startTime)); + SPtr<BC> velBCF2( + new MultiphaseVelocityBC(true, false, false, fctF2, phiH, startTime, endTime)); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); - SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm())); + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); mu::Parser fctPhi_F1; fctPhi_F1.SetExpr("phiH"); @@ -277,13 +278,13 @@ void run(string configname) fctvel_F2_init.SetExpr("U"); fctvel_F2_init.DefineConst("U", 0); - velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm())); + velBCF1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(denBCAdapter); // Ohne das BB? - bcVisitor.addBC(velBCAdapterF1); + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(denBC); // Ohne das BB? + bcVisitor.addBC(velBCF1); //SPtr<D3Q27Interactor> inflowF1Int; //SPtr<D3Q27Interactor> cylInt; @@ -370,17 +371,17 @@ void run(string configname) GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor( + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver( grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - //SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBCAdapter, + //SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBC, // Interactor3D::SOLID, Interactor3D::POINTS)); // inflowF1Int = - // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBCAdapter, Interactor3D::SOLID)); - // inflowF1Int->addBCAdapter(velBCAdapterF2); + // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBC, Interactor3D::SOLID)); + // inflowF1Int->addBC(velBCF2); - SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); // Create boundary conditions geometry GbCuboid3DPtr wallXmin( @@ -404,28 +405,28 @@ void run(string configname) // Add boundary conditions to grid generator SPtr<D3Q27Interactor> wallXminInt( - new D3Q27Interactor(wallXmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallXmaxInt( - new D3Q27Interactor(wallXmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallXmax, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallZminInt( - new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallZmaxInt( - new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallYminInt( - new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallYmaxInt( - new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); - //cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCAdapterF1, Interactor3D::SOLID)); - //cylInt->addBCAdapter(velBCAdapterF2); - // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBCAdapter, + //cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCF1, Interactor3D::SOLID)); + //cylInt->addBC(velBCF2); + // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBC, // Interactor3D::SOLID)); - inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapterF1, Interactor3D::SOLID)); - inflowInt->addBCAdapter(velBCAdapterF2); + inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCF1, Interactor3D::SOLID)); + inflowInt->addBC(velBCF2); SPtr<D3Q27Interactor> solidInt = - SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBC, Interactor3D::SOLID)); InteractorsHelper intHelper(grid, metisVisitor, true); //intHelper.addInteractor(cylInt); @@ -444,7 +445,7 @@ void run(string configname) intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -533,7 +534,7 @@ void run(string configname) //} // SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0); // SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel()); - // SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + // SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); // for (int ix3 = 0; ix3 <= 13; ix3++) { // for (int ix2 = 0; ix2 <= 13; ix2++) { @@ -548,9 +549,9 @@ void run(string configname) // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor( + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + ppgeo->update(0); ppgeo.reset(); } @@ -580,15 +581,15 @@ void run(string configname) 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( + SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); - pp->process(0); + pp->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); - auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch)); + auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); timeDepBC->addInteractor(inflowInt); #ifdef _OPENMP @@ -596,15 +597,15 @@ void run(string configname) #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); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + simulation->addSimulationObserver(timeDepBC); + simulation->addSimulationObserver(rcp); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception &e) { diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp index cbafef30c489a26b5f8df9610ec3e6ad7aa1da79..c70c2c19e7a02129ff00f8ca3bd0d7e53894831c 100644 --- a/apps/cpu/LaminarTubeFlow/ltf.cpp +++ b/apps/cpu/LaminarTubeFlow/ltf.cpp @@ -66,60 +66,60 @@ void run(string configname) //BC Adapter ////////////////////////////////////////////////////////////////////////////// - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm())); - //SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new ThinWallNoSlipBCStrategy())); + //SPtr<BC> denBC(new DensityBC(rhoLB)); + //denBC->setBCStrategy(SPtr<BCStrategy>(new EqDensityBCStrategy())); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); - SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); - //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); + //denBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); //double startTime = 5; mu::Parser fct1; fct1.SetExpr("U"); 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())); + SPtr<BC> velBC1(new VelocityBC(true, false, false, fct1, 0, BCFunction::INFCONST)); + //velBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + velBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); //mu::Parser fct2; //fct2.SetExpr("U"); //fct2.DefineConst("U", uLB); - //SPtr<BCAdapter> velBCAdapter2(new VelocityBCAdapter(true, false, false, fct2, startTime, BCFunction::INFCONST)); + //SPtr<BC> velBC2(new VelocityBC(true, false, false, fct2, startTime, BCFunction::INFCONST)); ////////////////////////////////////////////////////////////////////////////////// //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(denBCAdapter); - //bcVisitor.addBC(velBCAdapter1); + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(denBC); + //bcVisitor.addBC(velBC1); SPtr<Grid3D> grid(new Grid3D(comm)); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); //double bulckViscosity = 3700*nuLB; //dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); - kernel->setBCProcessor(bcProc); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); + kernel->setBCSet(bcProc); ////////////////////////////////////////////////////////////////////////// SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_00M)); //restart SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); - //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); - migCoProcessor->setNuLG(0.01, 0.01); - migCoProcessor->setDensityRatio(1); + //SPtr<MPIIOMigrationSimulationObserver> migSimulationObserver(new MPIIOMigrationSimulationObserver(grid, mSch, metisVisitor, pathname + "/mig", comm)); + SPtr<MPIIOMigrationBESimulationObserver> migSimulationObserver(new MPIIOMigrationBESimulationObserver(grid, mSch, metisVisitor, pathname + "/mig", comm)); + migSimulationObserver->setLBMKernel(kernel); + migSimulationObserver->setBCSet(bcProc); + migSimulationObserver->setNu(nuLB); + migSimulationObserver->setNuLG(0.01, 0.01); + migSimulationObserver->setDensityRatio(1); ////////////////////////////////////////////////////////////////////////// SPtr<D3Q27Interactor> inflowInt; @@ -189,11 +189,11 @@ void run(string configname) GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->process(0); + ppblocks->update(0); - SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID)); + SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBC, Interactor3D::INVERSESOLID)); //double r = dynamicPointerCast<GbCylinder3D>(cylinder)->getRadius(); //double cx1 = g_minX1; @@ -211,16 +211,16 @@ void run(string configname) ////fct.DefineConst("y0", cx2); ////fct.DefineConst("z0", cx3); ////fct.DefineConst("nue", nuLB); - //SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); - //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm())); - //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm())); + //SPtr<BC> velBC(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + //velBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //velBC->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); - inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter1, Interactor3D::SOLID)); - //inflowInt->addBCAdapter(velBCAdapter2); + inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBC1, Interactor3D::SOLID)); + //inflowInt->addBC(velBC2); //outflow - SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_00M)); InteractorsHelper intHelper(grid, metisVisitor); @@ -229,7 +229,7 @@ void run(string configname) intHelper.addInteractor(outflowInt); intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -268,7 +268,7 @@ void run(string configname) intHelper.setBC(); - bcVisitor.addBC(velBCAdapter1); + bcVisitor.addBC(velBC1); grid->accept(bcVisitor); //initialization of distributions @@ -280,8 +280,8 @@ void run(string configname) //boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + SPtr<SimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); ppgeo.reset(); } @@ -302,7 +302,7 @@ void run(string configname) VF_LOG_INFO("path = {}", pathname); } - migCoProcessor->restart((int)restartStep); + migSimulationObserver->restart((int)restartStep); grid->setTimeStep(restartStep); if (myid == 0) VF_LOG_INFO("Restart - end"); @@ -316,26 +316,26 @@ void run(string configname) grid->accept(setInterConnsVisitor); SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<CoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + SPtr<SimulationObserver> pp(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); SPtr<UbScheduler> nupsSch(new UbScheduler(100, 100, 100000000)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); //SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); - //auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch)); + //auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); //timeDepBC->addInteractor(inflowInt); omp_set_num_threads(numOfThreads); numOfThreads = 1; SPtr<UbScheduler> stepGhostLayer(visSch); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, int(endTime))); - calculator->addCoProcessor(npr); - calculator->addCoProcessor(pp); - calculator->addCoProcessor(migCoProcessor); - //calculator->addCoProcessor(timeDepBC); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, int(endTime))); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + simulation->addSimulationObserver(migSimulationObserver); + //simulation->addSimulationObserver(timeDepBC); if (myid == 0) VF_LOG_INFO("Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) VF_LOG_INFO("Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp index b3c49ccaec94747efea9c28a1b1cb8a937c03444..969243a0516871033c9c4d001d92468dc0164e8c 100644 --- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp +++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp @@ -10,9 +10,7 @@ //#include "modify.h" //#include "fix_lb_coupling_onetoone.h" -#include "LiggghtsCouplingCoProcessor.h" -#include "LiggghtsCouplingWrapper.h" -#include "IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/LiggghtsCoupling.h" using namespace std; @@ -53,15 +51,15 @@ int main(int argc, char *argv[]) double nuLB = 1e-2; // 5e-5; SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); - SPtr<BCProcessor> bcProc = make_shared<BCProcessor>(); - kernel->setBCProcessor(bcProc); + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); + bcVisitor.addBC(noSlipBC); @@ -77,7 +75,7 @@ int main(int argc, char *argv[]) UbSystem::makeDirectory(outputPath); UbSystem::makeDirectory(outputPath + "/liggghts"); - SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::DIR_MMM, MetisPartitioner::RECURSIVE)); + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::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) @@ -86,10 +84,10 @@ int main(int argc, char *argv[]) GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<CoProcessor> ppblocks = - make_shared <WriteBlocksCoProcessor>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, + SPtr<SimulationObserver> ppblocks = + make_shared <WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); double dx2 = 2.0 * dx; @@ -100,8 +98,8 @@ int main(int argc, char *argv[]) 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)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); InteractorsHelper intHelper(grid, metisVisitor, true); intHelper.addInteractor(wallZminInt); @@ -148,15 +146,15 @@ int main(int argc, char *argv[]) wrapper.runUpto(demSubsteps - 1); - SPtr<LiggghtsCouplingCoProcessor> lcCoProcessor = - make_shared<LiggghtsCouplingCoProcessor>(grid, lScheduler, comm, wrapper, demSubsteps, units); + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = + make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor( + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + ppgeo->update(0); ppgeo.reset(); } @@ -168,17 +166,17 @@ int main(int argc, char *argv[]) // write data for visualization of macroscopic quantities SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor( - new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver( + new WriteMacroscopicQuantitiesSimulationObserver(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); + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); //MPI_Init(&argc, &argv); diff --git a/apps/cpu/Multiphase/CMakeLists.txt b/apps/cpu/Multiphase/CMakeLists.txt index 3daebaf854a900fa1fdb9bc31b015969167de15d..0c7e43dcaf2185360c49ee78b86f34840b06b4df 100644 --- a/apps/cpu/Multiphase/CMakeLists.txt +++ b/apps/cpu/Multiphase/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(Multiphase) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES Multiphase.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow FILES Multiphase.cpp ) diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp index 4d4bc9cf82afe16309f22b69c0973acb3f96324c..79d969dd93c5bd87b0d327f5275d2c6b9a8a1448 100644 --- a/apps/cpu/Multiphase/Multiphase.cpp +++ b/apps/cpu/Multiphase/Multiphase.cpp @@ -3,6 +3,7 @@ #include <memory> #include "VirtualFluids.h" +#include "MultiphaseFlow/MultiphaseFlow.h" using namespace std; @@ -112,10 +113,10 @@ void run(string configname) kernel->setContactAngle(theta); kernel->setInterfaceWidth(interfaceWidth); - SPtr<BCProcessor> bcProc(new BCProcessor()); - // BCProcessorPtr bcProc(new ThinWallBCProcessor()); + SPtr<BCSet> bcProc(new BCSet()); + // BCSetPtr bcProc(new ThinWallBCSet()); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); SPtr<Grid3D> grid(new Grid3D(comm)); //grid->setPeriodicX1(true); @@ -129,15 +130,15 @@ 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)); + //SPtr<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + //SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); //rcp->setNu(nuLB); //rcp->setNuLG(nuL, nuG); //rcp->setDensityRatio(densityRatio); rcp->setLBMKernel(kernel); - rcp->setBCProcessor(bcProc); + rcp->setBCSet(bcProc); ////////////////////////////////////////////////////////////////////////// // BC Adapter ////////////////////////////////////////////////////////////////////////////// @@ -149,22 +150,22 @@ void run(string configname) 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)); + //SPtr<BC> velBCF1( + // new MultiphaseVelocityBC(false, true, false, fctF1, phiH, 0.0, BCFunction::INFCONST)); mu::Parser fctF2; fctF2.SetExpr("vy1"); fctF2.DefineConst("vy1", uLB); real 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<BC> velBCF1(new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, startTime)); + SPtr<BC> velBCF2(new MultiphaseVelocityBC(true, false, false, fctF2, phiH, startTime, endTime)); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); - SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm())); + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); mu::Parser fctPhi_F1; fctPhi_F1.SetExpr("phiH"); @@ -178,13 +179,13 @@ void run(string configname) fctvel_F2_init.SetExpr("U"); fctvel_F2_init.DefineConst("U", 0); - velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm())); + velBCF1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(denBCAdapter); //Ohne das BB? - bcVisitor.addBC(velBCAdapterF1); + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(denBC); //Ohne das BB? + bcVisitor.addBC(velBCF1); SPtr<D3Q27Interactor> inflowF1Int; SPtr<D3Q27Interactor> cylInt; @@ -265,16 +266,16 @@ void run(string configname) GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor( + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver( grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::POINTS)); + SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS)); //inflowF1Int = - // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBCAdapter, Interactor3D::SOLID)); - //inflowF1Int->addBCAdapter(velBCAdapterF2); + // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBC, Interactor3D::SOLID)); + //inflowF1Int->addBC(velBCF2); - SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); // Create boundary conditions geometry GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2 + dx, g_maxX3)); @@ -291,17 +292,17 @@ void run(string configname) 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)); + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, 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)); + cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCF1, Interactor3D::SOLID)); + cylInt->addBC(velBCF2); + //SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBC, Interactor3D::SOLID)); InteractorsHelper intHelper(grid, metisVisitor, true); @@ -322,7 +323,7 @@ void run(string configname) intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -400,7 +401,7 @@ void run(string configname) //} // SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0); // SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel()); - // SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + // SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); // for (int ix3 = 0; ix3 <= 13; ix3++) { // for (int ix2 = 0; ix2 <= 13; ix2++) { @@ -415,9 +416,9 @@ void run(string configname) // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor( + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + ppgeo->update(0); ppgeo.reset(); } @@ -455,16 +456,16 @@ void run(string configname) grid->accept(setConnsVisitor); SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<WriteMultiphaseQuantitiesCoProcessor> pp(new WriteMultiphaseQuantitiesCoProcessor( - //SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor( + SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( + //SPtr<WriteMacroscopicQuantitiesSimulationObserver> pp(new WriteMacroscopicQuantitiesSimulationObserver( grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); - pp->process(0); + pp->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); - auto timeDepBC = make_shared<TimeDependentBCCoProcessor>(TimeDependentBCCoProcessor(grid, timeBCSch)); + auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); timeDepBC->addInteractor(cylInt); #ifdef _OPENMP @@ -472,18 +473,18 @@ void run(string configname) #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); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + simulation->addSimulationObserver(timeDepBC); + simulation->addSimulationObserver(rcp); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception &e) { diff --git a/apps/cpu/MultiphaseDropletTest/CMakeLists.txt b/apps/cpu/MultiphaseDropletTest/CMakeLists.txt index 3f01ad73a0b28f7050667dde7b9408ac00b76e42..b70fdf8fb1e93807e7812988374b28a4f9a969b4 100644 --- a/apps/cpu/MultiphaseDropletTest/CMakeLists.txt +++ b/apps/cpu/MultiphaseDropletTest/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(MultiphaseDropletTest) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES droplet.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow FILES droplet.cpp ) diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp index a9d561930a77cc447bbe6c959bd7e8464f314d69..eaa3e550f873113bf2ffdeba4ed8a962ccae5046 100644 --- a/apps/cpu/MultiphaseDropletTest/droplet.cpp +++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp @@ -8,6 +8,7 @@ #endif #include "VirtualFluids.h" +#include "MultiphaseFlow/MultiphaseFlow.h" using namespace std; @@ -169,17 +170,17 @@ void run(string configname) kernel->setMultiphaseModelParameters(beta, kappa); kernel->setContactAngle(theta); - SPtr<BCProcessor> bcProc(new BCProcessor()); - // BCProcessorPtr bcProc(new ThinWallBCProcessor()); + SPtr<BCSet> bcProc(new BCSet()); + // BCSetPtr bcProc(new ThinWallBCSet()); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); + bcVisitor.addBC(noSlipBC); SPtr<Grid3D> grid(new Grid3D(comm)); grid->setDeltaX(dx); @@ -194,15 +195,15 @@ 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)); + //SPtr<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + //SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); // rcp->setNu(nuLB); // rcp->setNuLG(nuL, nuG); // rcp->setDensityRatio(densityRatio); rcp->setLBMKernel(kernel); - rcp->setBCProcessor(bcProc); + rcp->setBCSet(bcProc); ////////////////////////////////////////////////////////////////////////// if (newStart) { @@ -233,10 +234,10 @@ 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> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<WriteBlocksCoProcessor> ppblocks(new WriteBlocksCoProcessor( + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver( grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); InteractorsHelper intHelper(grid, metisVisitor, true); @@ -244,7 +245,7 @@ void run(string configname) intHelper.addInteractor(wallYmaxInt); intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -317,9 +318,9 @@ void run(string configname) // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsCoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor( + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + ppgeo->update(0); ppgeo.reset(); } @@ -380,26 +381,26 @@ 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( + SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); if(grid->getTimeStep() == 0) - pp->process(0); + pp->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(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); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + simulation->addSimulationObserver(rcp); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); diff --git a/apps/cpu/Nozzle/CMakeLists.txt b/apps/cpu/Nozzle/CMakeLists.txt index b653be79cefa91cb64408bdb7e7507bd79a57b26..f9e90c7e95115d4b4dfc436721a192100ad95e98 100644 --- a/apps/cpu/Nozzle/CMakeLists.txt +++ b/apps/cpu/Nozzle/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(Nozzle) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling FILES nozzle.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow NonNewtonianFluids FILES nozzle.cpp ) diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp index 54a306729006a60ec02c04cf029f529163acbe0f..babee1900c0bd9bb10bca3bccd790e83d25d14b8 100644 --- a/apps/cpu/Nozzle/nozzle.cpp +++ b/apps/cpu/Nozzle/nozzle.cpp @@ -1,544 +1,762 @@ #include <iostream> -#include <string> #include <memory> +#include <string> #include "VirtualFluids.h" -#include "LiggghtsCouplingCoProcessor.h" -#include "LiggghtsCouplingWrapper.h" -#include "IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/LiggghtsCoupling.h" -using namespace std; +#include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" + +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(); - - - // 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; + // Sleep(30000); - //int blockNX[3] = { 10, 10, 10 }; + try { - double g_minX1 = -1.31431; - double g_minX2 = 0.375582; - double g_minX3 = -210e-3 - 1e-3; + std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); - double g_maxX1 = -1.28831; - double g_maxX2 = 0.401582; - double g_maxX3 = 0.206; + // bounding box + // double g_minX1 = -1341.81e-3; + // double g_minX2 = 348.087e-3; + // double g_minX3 = -210e-3; - int blockNX[3] = { 26, 26, 26 }; + // double g_maxX1 = -1260.81e-3; + // double g_maxX2 = 429.087e-3; + // double g_maxX3 = 214.5e-3; - double dx = 1e-3; + // double g_minX1 = -1341.81e-3 + 10e-3; + // double g_minX2 = 0.360872; + // double g_minX3 = -210e-3; - double uLB = 0.00001; - //double rhoLB = 0.0; + // double g_maxX1 = -1260.81e-3 - 10e-3; + // double g_maxX2 = 0.416302; + // double g_maxX3 = 210e-3; - // 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 rhoAir = 1.2041; // [kg/m^3] - double tau0 = 715.218181094648; // - double rhoConcrete = 2400; // [kg/m^3] - double nu = muConcrete / rhoConcrete; + // int blockNX[3] = { 10, 10, 10 }; - //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); - if (myid == 0) std::cout << units->toString() << std::endl; + double g_minX1 = -1.31431; + double g_minX2 = 0.375582; + double g_minX3 = 0.1; //-210e-3 - 0.2 - 6e-3; //- 1e-3; - double interfaceThickness = 4.096; - double sigma = 0.03; - double Re = rhoConcrete * u * d_part / muConcrete; - double We = rhoConcrete * u * u * d_part / sigma; + double g_maxX1 = -1.28831; + double g_maxX2 = 0.401582; + double g_maxX3 = 0.206; - + int blockNX[3] = { 26, 26, 35 }; - double nu_h_LB = uLB * d_part * units->getFactorLentghWToLb() / Re; - double nu_l_LB = 0;// = nu_h_LB; - + double dx = 1e-3; - double rho_h_LB = 1; - - // surface tension - double sigma_LB = rho_h_LB * uLB * uLB * d_part * units->getFactorLentghWToLb() / We; - - - // 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); - - - //SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); + double uLB_ref = 0.001; + // double rhoLB = 0.0; + // 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 rhoAir = 1.2041; // [kg/m^3] + double tau0 = 715.218181094648; // Pa + double rhoConcrete = 2400; // [kg/m^3] + double nu = muConcrete / rhoConcrete; + // 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_ref); + if (myid == 0) std::cout << units->toString() << std::endl; + + double interfaceThickness = 3; // 4.096; + double sigma = 0.3; //0.03; + double Re = rhoConcrete * u * d_part / muConcrete; + double We = rhoConcrete * u * u * d_part / sigma; + + double u_LB_con = u * units->getFactorVelocityWToLb(); + double nu_h_LB = nu * units->getFactorViscosityWToLb(); // uLB_ref * d_part * units->getFactorLentghWToLb() / Re; + double nu_l_LB = 0; // = nu_h_LB; + + double rho_h_LB = 1; + + // surface tension + double sigma_LB = rho_h_LB *u_LB_con *u_LB_con *d_part * units->getFactorLentghWToLb() / We; + + // LBMReal dLB = 0; // = length[1] / dx; + LBMReal rhoLB = 0.0; + // LBMReal nuLB = nu_l; //(uLB_ref*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_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uRef); + + double Bm = (tau0 * d_part) / (muConcrete * u); + double tau0_LB = Bm * nu_h_LB * u_LB_con / (d_part * units->getFactorLentghWToLb()); + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(tau0_LB); + + if (myid == 0) VF_LOG_INFO("Yield stress = {} Pa", tau0); + if (myid == 0) VF_LOG_INFO("Yield stress LB = {} ", tau0_LB); + + // SPtr<BC> noSlipBC(new NoSlipBC()); + // noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + // concrete inflow boundary condition + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", -u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} m/s", u); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} dx/dt", u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete Re = {}", Re); + + // // Ã… 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 = 1e5; // Pa = 1 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_ref * (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_ref * ((N + 3) / (N + 1))); + // fct.DefineConst("NplusOne", N + 1.0); + + // SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); + // inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowConcreteBC(new MultiphaseVelocityBC(false, false, true, fct, phiH, 0, BCFunction::INFCONST)); + inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); - - // concrete inflow boundary condition - mu::Parser fct; - fct.SetExpr("U"); - fct.DefineConst("U", -u*units->getFactorVelocityWToLb()); - if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} m/s", u); - if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} dx/dt", u * units->getFactorVelocityWToLb()); - if (myid == 0) VF_LOG_INFO("Concrete Re = {}", Re); - - // // Ã… 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 = 1e5; // Pa = 1 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(); + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + // 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_ref = 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) VF_LOG_INFO("Air inflow velocity = {} m/s", u); - //if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB); + // 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) VF_LOG_INFO("Air inflow velocity = {} m/s", u); + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_ref); // - //double nu = mu / rhoConcrete; - //double Re = d_part * u / nu; - //if (myid == 0) VF_LOG_INFO("Re_air = {}", Re); - - //double nuLB = d_part * unitsAir->getFactorLentghWToLb() * uLB / Re; - //if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB); - //nu_l_LB = nuLB; - - - SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB); - double V_air = 40; // flow rate [m^3/h] - double D_air = 0.00553; // air inlet diameter [m] - double R_air = D_air / 2.0; // radius [m] - double A_air = UbMath::PI * R_air * R_air; - double u_air = V_air / 3600 / A_air; - double uLB_air = u_air * unitsAir->getFactorVelocityWToLb(); - // double cx1 = -1.2788 + R; - double cx2 = 0.385822 + R_air; - double cx3 = 0.135562 + R_air; - double L_air = 0.00747; - double p_air = 7e5; // Pa = 7 Bar - double p1 = p_air; - double p2 = 1e5; - double mu_air = 17.2e-6; // Pa s, air 20° C - double rho_air = 1.2041; // [kg/m^3] - double N = R_air * R_air / 2 * mu_air * u_air * (p1 - p2) / L_air - 3; - if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u_air); - if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_air); - - double nu_air = mu_air / rho_air; - double Re_air = d_part * u_air / nu_air; - if (myid == 0) VF_LOG_INFO("Air Re = {}", Re_air); - - double nuLB_air = d_part * unitsAir->getFactorLentghWToLb() * uLB_air / Re_air; - if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB_air); - nu_l_LB = nuLB_air; - - if (myid == 0) VF_LOG_INFO("nu_h = {}", nu_h_LB); - if (myid == 0) VF_LOG_INFO("nu_l = {}", nu_l_LB); - if (myid == 0) VF_LOG_INFO("sigma_LB = {}", sigma_LB); - - - - mu::Parser fctVx1; - //fctVx1.SetExpr("U"); - //fctVx1.DefineConst("U", uLB_air); - mu::Parser fctVx2; - fctVx2.SetExpr("U"); - fctVx2.DefineConst("U", 0); - mu::Parser fctVx3; - //fctVx3.SetExpr("U"); - //fctVx3.DefineConst("U", -uLB_air); - - fctVx1.SetExpr("U*(1-(((((x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); - //fct.DefineConst("x0", cx1); - fctVx1.DefineConst("y0", cx2); - fctVx1.DefineConst("z0", cx3); - fctVx1.DefineConst("R", R); - fctVx1.DefineConst("U", uLB_air * ((N + 3) / (N + 1))); - fctVx1.DefineConst("NplusOne", N + 1.0); - - fctVx3.SetExpr("U*(1-(((((x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); - // fc3.DefineConst("x0", cx1); - fctVx3.DefineConst("y0", cx2); - fctVx3.DefineConst("z0", cx3); - fctVx3.DefineConst("R", R); - fctVx3.DefineConst("U", -uLB_air * ((N + 3) / (N + 1))); - fctVx3.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, true, fctVx1, fctVx3, fctVx3, phiL, 0, BCFunction::INFCONST)); - inflowAirBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm())); - - SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB)); - //outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); - //SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB)); - outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm())); - ////////////////////////////////////////////////////////////////////////////////// - // BC visitor - //BoundaryConditionsBlockVisitor bcVisitor;♣ - MultiphaseBoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(inflowConcreteBCAdapter); - bcVisitor.addBC(inflowAirBCAdapter); - bcVisitor.addBC(outflowBCAdapter); - - // 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<Grid3D> grid = make_shared<Grid3D>(comm); - 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 = "d:/temp/NozzleFlowTest_Multiphase2"; - 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, vf::lbm::dir::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) - 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::POINTS); - /////////////////////////////////////////////////////////// - //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", WbWriterVtkXmlBinary::getInstance()); - 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)); - //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, g_minX3, -1.30181+0.0005, 0.390872-0.00229, -0.21, 0.013)); - if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlBinary::getInstance()); - 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); - ///////////////////////////////////////////////////////////// - //Fluid area - GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181+0.0005, 0.390872-0.00229, g_minX3, -1.30181+0.0005, 0.390872-0.00229, g_maxX3, 0.013)); - if (myid == 0) GbSystem3D::writeGeoObject(geoFluidArea.get(), outputPath + "/geo/geoFluidArea", WbWriterVtkXmlBinary::getInstance()); - SPtr<D3Q27Interactor> intrFluidArea = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoFluidArea, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID)); - /////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////// - GbCylinder3DPtr geoAirInflow(new GbCylinder3D(-1.31431 - 0.0005, 0.388587, 0.1383275, -1.31431, 0.388587, 0.1383275, 0.002765)); - if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); - SPtr<Interactor3D> intrAirInflow = std::make_shared<D3Q27Interactor>(geoAirInflow, grid, inflowAirBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES); - /////////////////////////////////////////////////////////// - - InteractorsHelper intHelper(grid, metisVisitor, true); - - intHelper.addInteractor(intrFluidArea); - intHelper.addInteractor(intrNozzleVolcanNozzle2); - //intHelper.addInteractor(intrBox); - intHelper.addInteractor(intrInflow); - intHelper.addInteractor(intrAirInflow); - intHelper.addInteractor(intrOutflow); - - - //intHelper.addInteractor(intrNozzleAirDistributor); - //intHelper.addInteractor(intrNozzleAirInlet); - //intHelper.addInteractor(intrNozzleSpacer); - //intHelper.addInteractor(intrNozzleAccDistributor); - //intHelper.addInteractor(intrNozzleAccInlet); - //intHelper.addInteractor(intrNozzleVolcanNozzle1); - - - - 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()); - MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1); - grid->accept(kernelVisitor); - - intHelper.setBC(); - - //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); + // double nu = mu / rhoConcrete; + // double Re = d_part * u / nu; + // if (myid == 0) VF_LOG_INFO("Re_air = {}", Re); + // double nuLB = d_part * unitsAir->getFactorLentghWToLb() * uLB_ref / Re; + // if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB); + // nu_l_LB = nuLB; - 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); - - double v_frac = 0.1; - double dt_phys = units->getFactorTimeLbToW(); - int demSubsteps = 10; - double dt_dem = dt_phys / (double)demSubsteps; - int vtkSteps = 1000; - 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(); + SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + //SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + double V_air = 40./6./10.; // flow rate [m^3/h] + double D_air = 0.00553; // air inlet diameter [m] + double R_air = D_air / 2.0; // radius [m] + double A_air = UbMath::PI * (R_air * R_air); + double u_air = V_air / 3600 / A_air; + double uLB_air = u_air * unitsAir->getFactorVelocityWToLb(); + // double cx1 = -1.2788 + R; + double cx2 = 0.385822 + R_air; + double cx3 = 0.135562 + R_air; + double L_air = 0.00747; + double p_air = 7e5; // Pa = 7 Bar + double p1 = p_air; + double p2 = 1e5; + double mu_air = 17.2e-6; // Pa s, air 20° C + double rho_air = 1.2041; // [kg/m^3] + double Re_inlet = D_air * u_air * rho_air / mu_air; + double lambda = 0.3164 / pow(Re_inlet, 0.25); + double deltaP = (lambda / (2. * R_air)) * (rho_air * pow(u_air, 2) / 2.); // Darcy friction factor (Rohrreibungszahl) + double N = pow(R_air, 2) / (2. * mu_air * u_air) * deltaP - 3.; + // double N = R_air * R_air / 2 * mu_air * u_air * (p1 - p2) / L_air - 3; + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u_air); + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_air); + + double nu_air = mu_air / rho_air; + double Re_air = d_part * u_air / nu_air; + if (myid == 0) VF_LOG_INFO("Air Re = {}", Re_air); + + double nuLB_air = nu_air * unitsAir->getFactorViscosityWToLb(); // d_part * unitsAir->getFactorLentghWToLb() * uLB_air / Re_air; + if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB_air); + nu_l_LB = nuLB_air; + + if (myid == 0) VF_LOG_INFO("nu_h = {}", nu_h_LB); + if (myid == 0) VF_LOG_INFO("nu_l = {}", nu_l_LB); + if (myid == 0) VF_LOG_INFO("sigma_LB = {}", sigma_LB); + + double p_air_LB = p_air * unitsAir->getFactorPressureWToLb(); + if (myid == 0) VF_LOG_INFO("p_air_LB = {}", p_air_LB); + + // mu::Parser fctVx1; + ////fctVx1.SetExpr("U"); + ////fctVx1.DefineConst("U", uLB_air); + // mu::Parser fctVx2; + // fctVx2.SetExpr("U"); + // fctVx2.DefineConst("U", 0); + // mu::Parser fctVx3; + ////fctVx3.SetExpr("U"); + ////fctVx3.DefineConst("U", -uLB_air); + + double cx1 = 0; + double alpha = 0; + double gamma = 0; + double U = uLB_air;// * ((N + 3.) / (N + 1.)); + + mu::Parser fctVx1; + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + // fctVx1.SetExpr("(((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5/R)^NplusOne"); + fctVx1.SetExpr("U*cos(alpha*_pi/180)"); + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("R", R_air); + fctVx1.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx1.DefineConst("NplusOne", N + 1.0); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + + mu::Parser fctVx2; + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx2.SetExpr("U*sin(alpha*_pi/180)"); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("R", R_air); + fctVx2.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx2.DefineConst("NplusOne", N + 1.0); + fctVx2.DefineConst("alpha", alpha); + + mu::Parser fctVx3; + //fctVx3.SetExpr("U*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx3.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx3.SetExpr("U"); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("R", R_air); + fctVx3.DefineConst("U", -U); //* ((N + 3.) / (N + 1.))); + fctVx3.DefineConst("NplusOne", N + 1.0); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + // SPtr<BC> inflowAirBC1(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + // t = U * sin(alpha * _pi / 180) * (1 - (((((x1 - x0) ^ 2 + (x2 - y0) ^ 2 + (x3 - z0) ^ 2) ^ 0.5) / R) ^ NplusOne)); + cx1 = -1.31416; + cx2 = 0.388684; + cx3 = 0.138177; + alpha = 0; + gamma = 225; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx2.DefineConst("gamma", gamma); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + SPtr<BC> inflowAirBC1(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + fctVx1.DefineVar("x1", &cx1); + fctVx1.DefineVar("x2", &cx2); + fctVx1.DefineVar("x3", &cx3); + fctVx2.DefineVar("x1", &cx1); + fctVx2.DefineVar("x2", &cx2); + fctVx2.DefineVar("x3", &cx3); + fctVx3.DefineVar("x1", &cx1); + fctVx3.DefineVar("x2", &cx2); + fctVx3.DefineVar("x3", &cx3); + + VF_LOG_INFO("fctVx1 = {}", fctVx1.Eval()); + VF_LOG_INFO("fctVx2 = {}", fctVx2.Eval()); + VF_LOG_INFO("fctVx3 = {}", fctVx3.Eval()); + VF_LOG_INFO("N = {}", N); + VF_LOG_INFO("NplusOne = {}", N + 1.0); + //return 0; + + cx1 = -1.31303; + cx2 = 0.377234; + cx3 = 0.138174; + alpha = 60; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC2(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.2948374155694822; + cx2 = 0.37733728717266285; + cx3 = 0.13840460401111598; + alpha = 120; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC3(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.28847; + cx2 = 0.3885; + cx3 = 0.1385; + alpha = 180; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC4(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.294771417778694; + cx2 = 0.399787947463142; + cx3 = 0.1383429692754194; + alpha = 240; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC5(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.3077338898450492; + cx2 = 0.3998516560596088; + cx3 = 0.13843501416896437; + alpha = 300; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC6(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // Pressure BC for air inlet + // SPtr<BC> inflowAirBC1(new DensityBC(p_air_LB)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + // SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + // BoundaryConditionsBlockVisitor bcVisitor;♣ + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(inflowConcreteBC); + bcVisitor.addBC(inflowAirBC1); + //bcVisitor.addBC(outflowBC); + + // SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<CumulantK17LBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(); + SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + + kernel->setWithForcing(false); + 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); + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); + + SPtr<Grid3D> grid = make_shared<Grid3D>(comm); + 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/NozzleFlowTest_SharpInterface_OutflowPress"; + 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, vf::lbm::dir::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) 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, noSlipBC, 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, noSlipBC, 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, noSlipBC, 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, noSlipBC, 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, noSlipBC, 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, noSlipBC, 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, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + // box + SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBC, 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", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, 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)); + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.426, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.415, 0.013)); + GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3+2.*dx, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBC, 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, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + ///////////////////////////////////////////////////////////// + // Fluid area + GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoFluidArea.get(), outputPath + "/geo/geoFluidArea", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrFluidArea = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoFluidArea, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(-1.31431 - 0.0005, 0.388587, 0.1383275, -1.31431, 0.388587, 0.1383275, 0.002765)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrAirInflow = std::make_shared<D3Q27Interactor>(geoAirInflow, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:start"); + meshAirInlet1->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_1.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet1.get(), outputPath + "/geo/meshAirInlet1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet1, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:start"); + meshAirInlet2->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_2.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet2.get(), outputPath + "/geo/meshAirInlet2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet2, grid, inflowAirBC2, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet3 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:start"); + meshAirInlet3->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_3.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet3.get(), outputPath + "/geo/meshAirInlet3", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet3 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet3, grid, inflowAirBC3, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet4 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:start"); + meshAirInlet4->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_4.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet4.get(), outputPath + "/geo/meshAirInlet4", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet4 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet4, grid, inflowAirBC4, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet5 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:start"); + meshAirInlet5->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_5.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet5.get(), outputPath + "/geo/meshAirInlet5", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet5 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet5, grid, inflowAirBC5, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet6 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:start"); + meshAirInlet6->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_6.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet6.get(), outputPath + "/geo/meshAirInlet6", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet6 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet6, grid, inflowAirBC6, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + + InteractorsHelper intHelper(grid, metisVisitor, true); + + intHelper.addInteractor(intrFluidArea); + intHelper.addInteractor(intrNozzleVolcanNozzle2); + // intHelper.addInteractor(intrBox); + intHelper.addInteractor(intrInflow); + // intHelper.addInteractor(intrAirInflow); + intHelper.addInteractor(intAirInlet1); + intHelper.addInteractor(intAirInlet2); + intHelper.addInteractor(intAirInlet3); + intHelper.addInteractor(intAirInlet4); + intHelper.addInteractor(intAirInlet5); + intHelper.addInteractor(intAirInlet6); + intHelper.addInteractor(intrOutflow); + + // intHelper.addInteractor(intrNozzleAirDistributor); + // intHelper.addInteractor(intrNozzleAirInlet); + // intHelper.addInteractor(intrNozzleSpacer); + // intHelper.addInteractor(intrNozzleAccDistributor); + // intHelper.addInteractor(intrNozzleAccInlet); + // intHelper.addInteractor(intrNozzleVolcanNozzle1); + + intHelper.selectBlocks(); + + SPtr<SimulationObserver> ppblocks = make_shared<WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks->update(0); + ppblocks.reset(); + + // if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, 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; + // grid->accept(initVisitor); + + double x1c = -1.31431 + R; + double x2c = 0.375582 + R; + double x3c = 0.20105; + + R = 0.2 - 0.145; // 0.078-0.04; // 0.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(" 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); + + 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); + + 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<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + grid->accept(bcVisitor); + + // OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + int numOfThreads = 18; + omp_set_num_threads(numOfThreads); + + SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100); + SPtr<NUPSCounterSimulationObserver> nupsSimulationObserver = make_shared<NUPSCounterSimulationObserver>(grid, nupsSch, numOfThreads, comm); + + //// 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<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + + int endTime = 10000000; + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + // Simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + 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; } - - grid->accept(bcVisitor); - - //OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); - //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); - ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor 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<UbScheduler> visSch(new UbScheduler(1, 8700, 8800)); - // 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 = 1000000; - 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/PoiseuilleFlow/pf1.cpp b/apps/cpu/PoiseuilleFlow/pf1.cpp index 93680117551c13a23ecc08c5dc4731d92ec78b77..0e21dea4d252dc141fa5fd75feebe24c0b80042d 100644 --- a/apps/cpu/PoiseuilleFlow/pf1.cpp +++ b/apps/cpu/PoiseuilleFlow/pf1.cpp @@ -68,24 +68,24 @@ void pf1() //boundary conditions definition //boundary conditions adapters ////////////////////////////////////////////////////////////////////////////// - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); //boundary conditions visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); + bcVisitor.addBC(noSlipBC); ////////////////////////////////////////////////////////////////////////////////// //set boundary conditions for blocks and create process decomposition for MPI - SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID)); + SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBC, Interactor3D::INVERSESOLID)); SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_00M)); InteractorsHelper intHelper(grid, metisVisitor); intHelper.addInteractor(cylinderInt); intHelper.selectBlocks(); //write data for visualization of block grid - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->process(0); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); //ppblocks.reset(); unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); @@ -116,8 +116,8 @@ void pf1() //LBM kernel definition SPtr<LBMKernel> kernel; kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); - SPtr<BCProcessor> bcProc(new BCProcessor()); - kernel->setBCProcessor(bcProc); + SPtr<BCSet> bcProc(new BCSet()); + kernel->setBCSet(bcProc); //set forcing mu::Parser fctForcingX1; @@ -143,18 +143,18 @@ void pf1() grid->accept(setConnsVisitor); SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); - //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, mSch, pathOut, comm)); - //restartCoProcessor->setLBMKernel(kernel); - //restartCoProcessor->setBCProcessor(bcProc); + //SPtr<MPIIORestartSimulationObserver> restartSimulationObserver(new MPIIORestartSimulationObserver(grid, mSch, pathOut, comm)); + //restartSimulationObserver->setLBMKernel(kernel); + //restartSimulationObserver->setBCSet(bcProc); - /*SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut + "/mig", comm)); - migCoProcessor->setLBMKernel(kernel); - migCoProcessor->setBCProcessor(bcProc);*/ + /*SPtr<MPIIOMigrationSimulationObserver> migSimulationObserver(new MPIIOMigrationSimulationObserver(grid, mSch, pathOut + "/mig", comm)); + migSimulationObserver->setLBMKernel(kernel); + migSimulationObserver->setBCSet(bcProc);*/ - //SPtr<MPIIOMigrationBECoProcessor> migCoProcessor(new MPIIOMigrationBECoProcessor(grid, mSch, pathOut + "/mig", comm)); - //migCoProcessor->setLBMKernel(kernel); - //migCoProcessor->setBCProcessor(bcProc); - //migCoProcessor->setNu(nuLB); + //SPtr<MPIIOMigrationBESimulationObserver> migSimulationObserver(new MPIIOMigrationBESimulationObserver(grid, mSch, pathOut + "/mig", comm)); + //migSimulationObserver->setLBMKernel(kernel); + //migSimulationObserver->setBCSet(bcProc); + //migSimulationObserver->setNu(nuLB); //SPtr<UtilConvertor> convertProcessor(new UtilConvertor(grid, pathOut, comm)); //convertProcessor->convert(300, 4); @@ -163,45 +163,45 @@ void pf1() //write data for visualization of boundary conditions { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), /*SPtr<LBMUnitConverter>(new LBMUnitConverter()),*/ comm); - ppgeo.process(0); + WriteBoundaryConditionsSimulationObserver ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), /*SPtr<LBMUnitConverter>(new LBMUnitConverter()),*/ comm); + ppgeo.update(0); } if (myid == 0) UBLOG(logINFO, "Preprocess - end"); //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); + //restartSimulationObserver->restart(200); + //SPtr<MPIIOMigrationBESimulationObserver> migSimulationObserver(new MPIIOMigrationBESimulationObserver(grid, mSch, metisVisitor, pathOut + "/mig", comm)); + //migSimulationObserver->setLBMKernel(kernel); + //migSimulationObserver->setBCSet(bcProc); + //migSimulationObserver->setNu(nuLB); + //migSimulationObserver->restart(10); - ppblocks->process(1); + ppblocks->update(1); //write data for visualization of macroscopic quantities SPtr<UbScheduler> visSch(new UbScheduler(outTime)); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathOut, + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathOut, WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); //performance control SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); //start simulation //omp_set_num_threads(numOfThreads); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime)); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); - calculator->addCoProcessor(npr); - calculator->addCoProcessor(writeMQCoProcessor); - //calculator->addCoProcessor(migCoProcessor); - //calculator->addCoProcessor(restartCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(writeMQSimulationObserver); + //simulation->addSimulationObserver(migSimulationObserver); + //simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); - ppblocks->process(10); + ppblocks->update(10); } diff --git a/apps/cpu/RisingBubble2D/CMakeLists.txt b/apps/cpu/RisingBubble2D/CMakeLists.txt index 5741f1441d806d59a9efd1dd689e5ddba0e5eafc..3f8f3e56cd7ab41979f72121a405b93c862dcce2 100644 --- a/apps/cpu/RisingBubble2D/CMakeLists.txt +++ b/apps/cpu/RisingBubble2D/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(RisingBubble2D) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES RisingBubble2D.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES RisingBubble2D.cpp ) diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp index 92495242f11659b3a90b30f4df836642dee5aea8..c9a28efc4033ceb0be8cbabc4976055f994c1932 100644 --- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp +++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp @@ -1,6 +1,6 @@ #include <iostream> -#include <string> #include <memory> +#include <string> #if defined(__unix__) #include <stdio.h> @@ -8,6 +8,8 @@ #endif #include "VirtualFluids.h" +#include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -16,45 +18,44 @@ void run(string configname) using namespace vf::lbm::dir; try { - vf::basics::ConfigurationFile config; + vf::basics::ConfigurationFile config; config.load(configname); - string pathname = config.getValue<string>("pathname"); - int numOfThreads = config.getValue<int>("numOfThreads"); - vector<int> blocknx = config.getVector<int>("blocknx"); + string pathname = config.getValue<string>("pathname"); + int numOfThreads = config.getValue<int>("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); vector<real> boundingBox = config.getVector<real>("boundingBox"); - real uLB = config.getValue<real>("uLB"); - real nuL = config.getValue<real>("nuL"); - real nuG = config.getValue<real>("nuG"); - real densityRatio = config.getValue<real>("densityRatio"); - //double sigma = config.getValue<double>("sigma"); + real uLB = config.getValue<real>("uLB"); + real nuL = config.getValue<real>("nuL"); + real nuG = config.getValue<real>("nuG"); + real densityRatio = config.getValue<real>("densityRatio"); + // double sigma = config.getValue<double>("sigma"); int interfaceThickness = config.getValue<int>("interfaceThickness"); - real radius = config.getValue<real>("radius"); - real theta = config.getValue<real>("contactAngle"); - real phiL = config.getValue<real>("phi_L"); - real phiH = config.getValue<real>("phi_H"); - real tauH = config.getValue<real>("Phase-field Relaxation"); - real mob = config.getValue<real>("Mobility"); - - real endTime = config.getValue<real>("endTime"); - real outTime = config.getValue<real>("outTime"); - real availMem = config.getValue<real>("availMem"); - int refineLevel = config.getValue<int>("refineLevel"); - real Re = config.getValue<real>("Re"); - real Eo = config.getValue<real>("Eo"); - real dx = config.getValue<real>("dx"); - bool logToFile = config.getValue<bool>("logToFile"); + real radius = config.getValue<real>("radius"); + real theta = config.getValue<real>("contactAngle"); + real phiL = config.getValue<real>("phi_L"); + real phiH = config.getValue<real>("phi_H"); + real tauH = config.getValue<real>("Phase-field Relaxation"); + real mob = config.getValue<real>("Mobility"); + + real endTime = config.getValue<real>("endTime"); + real outTime = config.getValue<real>("outTime"); + real availMem = config.getValue<real>("availMem"); + int refineLevel = config.getValue<int>("refineLevel"); + real Re = config.getValue<real>("Re"); + real Eo = config.getValue<real>("Eo"); + real dx = config.getValue<real>("dx"); + bool logToFile = config.getValue<bool>("logToFile"); real restartStep = config.getValue<real>("restartStep"); - real cpStart = config.getValue<real>("cpStart"); - real cpStep = config.getValue<real>("cpStep"); - bool newStart = config.getValue<bool>("newStart"); - //double rStep = config.getValue<double>("rStep"); + real cpStart = config.getValue<real>("cpStart"); + real cpStep = config.getValue<real>("cpStep"); + bool newStart = config.getValue<bool>("newStart"); + // double rStep = config.getValue<double>("rStep"); std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); - int myid = comm->getProcessID(); + int myid = comm->getProcessID(); - if (myid == 0) - UBLOG(logINFO, "2D Rising Bubble: Start!"); + if (myid == 0) UBLOG(logINFO, "2D Rising Bubble: Start!"); if (logToFile) { #if defined(__unix__) @@ -70,83 +71,84 @@ 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(20000); + // #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(20000); // LBMReal dLB = 0; // = length[1] / dx; real rhoLB = 0.0; - real nuLB = nuL; //(uLB*dLB) / Re; + real nuLB = nuL; //(uLB*dLB) / Re; - //diameter of circular droplet - real D = 2.0*radius; + // diameter of circular droplet + real D = 2.0 * radius; - //density retio - //LBMReal r_rho = densityRatio; + // density retio + // LBMReal r_rho = densityRatio; - //density of heavy fluid + // density of heavy fluid real rho_h = 1.0; - //density of light fluid - //LBMReal rho_l = rho_h / r_rho; + // density of light fluid + // LBMReal rho_l = rho_h / r_rho; - //kinimatic viscosity + // kinimatic viscosity real nu_h = nuL; - //LBMReal nu_l = nuG; - //#dynamic viscosity - //LBMReal mu_h = rho_h * nu_h; - - //gravity - real g_y = Re * Re * nu_h * nu_h / (D*D*D); - //Eotvos number - //LBMReal Eo = 100; - //surface tension + // LBMReal nu_l = nuG; + // #dynamic viscosity + // LBMReal mu_h = rho_h * nu_h; + + // gravity + real g_y = Re * Re * nu_h * nu_h / (D * D * D); + // Eotvos number + // LBMReal Eo = 100; + // surface tension real sigma = rho_h * g_y * D * D / Eo; - //g_y = 0; + // g_y = 0; - real beta = 12.0 * sigma / interfaceThickness; + real beta = 12.0 * sigma / interfaceThickness; real 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"); + // 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; + // 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()); - + // kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); + //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + //kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); mu::Parser fgr; fgr.SetExpr("-rho*g_y"); fgr.DefineConst("g_y", g_y); @@ -162,26 +164,25 @@ void run(string configname) kernel->setMobility(mob); kernel->setInterfaceWidth(interfaceThickness); - kernel->setCollisionFactorMultiphase(nuL, nuG); kernel->setDensityRatio(densityRatio); kernel->setMultiphaseModelParameters(beta, kappa); kernel->setContactAngle(theta); - dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(1.0); - - SPtr<BCProcessor> bcProc(new BCProcessor()); + //dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(1.0); + kernel->setSigma(sigma); + SPtr<BCSet> bcProc(new BCSet()); - kernel->setBCProcessor(bcProc); + kernel->setBCSet(bcProc); - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); - SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); - slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + //SPtr<BC> slipBC(new SlipBC()); + //slipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseSlipBCStrategy())); ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(slipBCAdapter); + bcVisitor.addBC(noSlipBC); + //bcVisitor.addBC(slipBC); SPtr<Grid3D> grid(new Grid3D(comm)); grid->setDeltaX(dx); @@ -196,15 +197,15 @@ 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<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + // SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + // SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); + // rcp->setNu(nuLB); + // rcp->setNuLG(nuL, nuG); + // rcp->setDensityRatio(densityRatio); rcp->setLBMKernel(kernel); - rcp->setBCProcessor(bcProc); + rcp->setBCSet(bcProc); ////////////////////////////////////////////////////////////////////////// if (newStart) { @@ -220,11 +221,7 @@ void run(string configname) // 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) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); @@ -240,14 +237,13 @@ 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, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBC, Interactor3D::SOLID)); + + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, 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)); + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); InteractorsHelper intHelper(grid, metisVisitor, true); intHelper.addInteractor(wallXminInt); @@ -256,18 +252,15 @@ void run(string configname) intHelper.addInteractor(wallYmaxInt); intHelper.selectBlocks(); - ppblocks->process(0); + ppblocks->update(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]); + 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); - real needMemAll = - real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); + unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + real needMemAll = real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); real needMem = needMemAll / real(comm->getNumberOfProcesses()); if (myid == 0) { @@ -294,16 +287,15 @@ void run(string configname) grid->accept(undefNodesVisitor); } - intHelper.setBC(); // initialization of distributions - real x1c = D; - real x2c = D; - real x3c = 1.5; - //LBMReal x3c = 2.5 * D; + real x1c = D; + real x2c = D; + real 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.SetExpr("0.5+0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+0*(x3-x3c)^2)-radius)/interfaceThickness)"); fct1.DefineConst("x1c", x1c); fct1.DefineConst("x2c", x2c); fct1.DefineConst("x3c", x3c); @@ -311,8 +303,8 @@ void run(string configname) 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.SetExpr("0.5*uLB+uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+0*(x3-x3c)^2)-radius)/interfaceThickness)"); + // fct2.SetExpr("uLB"); fct2.DefineConst("uLB", uLB); fct2.DefineConst("x1c", x1c); fct2.DefineConst("x2c", x2c); @@ -320,23 +312,21 @@ void run(string configname) fct2.DefineConst("radius", radius); fct2.DefineConst("interfaceThickness", interfaceThickness); - //MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio); + // MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio); MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; initVisitor.setPhi(fct1); - initVisitor.setVx1(fct2); + //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); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); ppgeo.reset(); } - if (myid == 0) - UBLOG(logINFO, "Preprocess - end"); + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); } else { if (myid == 0) { UBLOG(logINFO, "Parameters:"); @@ -353,88 +343,83 @@ void run(string configname) rcp->restart((int)restartStep); grid->setTimeStep(restartStep); - if (myid == 0) - UBLOG(logINFO, "Restart - end"); + if (myid == 0) UBLOG(logINFO, "Restart - end"); } grid->accept(bcVisitor); - //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); - //grid->accept(setConnsVisitor); + // TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); + // grid->accept(setConnsVisitor); - //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); - //grid->accept(setConnsVisitor); + // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + // grid->accept(setConnsVisitor); TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); 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)); - //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); + // 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)); + 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<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> pp(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + if (grid->getTimeStep() == 0) pp->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(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)); - 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 + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + //simulation->addSimulationObserver(rcp); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + 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; diff --git a/apps/cpu/ViskomatXL/CMakeLists.txt b/apps/cpu/ViskomatXL/CMakeLists.txt index 1b72b8765177c13a3f747b5f03e80f0ef5823ae1..6dcfeabc73259c72138c2c4ac84c017c6e96463a 100644 --- a/apps/cpu/ViskomatXL/CMakeLists.txt +++ b/apps/cpu/ViskomatXL/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(viskomat) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES viskomat.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES viskomat.cpp ) \ No newline at end of file diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp index be1f8bab3f99f5577e5a9ca0b426572a87c5a6af..327f25e599c80b059fe273cfd2a0c526ed4279f7 100644 --- a/apps/cpu/ViskomatXL/viskomat.cpp +++ b/apps/cpu/ViskomatXL/viskomat.cpp @@ -1,7 +1,8 @@ #include <iostream> #include <string> -#include <VirtualFluids.h> +#include "VirtualFluids.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -106,14 +107,14 @@ void bflow(string configname) 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())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy())); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy())); - SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); - slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); - //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm())); + SPtr<BC> slipBC(new SlipBC()); + slipBC->setBCStrategy(SPtr<BCStrategy>(new SimpleSlipBCStrategy())); + //slipBC->setBCStrategy(SPtr<BCStrategy>(new SlipBCStrategy())); //// rotation around X-axis mu::Parser fctVy; @@ -148,26 +149,26 @@ void bflow(string configname) //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<BC> velocityBC(new VelocityBC(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST)); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + velocityBC->setBCStrategy(SPtr<BCStrategy>(new SimpleVelocityBCStrategy())); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelVelocityBCStrategy())); - //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter()); - //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); - ////densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + //SPtr<BC> densityBC(new DensityBC()); + //densityBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + ////densityBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - //bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(slipBCAdapter); - bcVisitor.addBC(velocityBCAdapter); - //bcVisitor.addBC(densityBCAdapter); + //bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(slipBC); + bcVisitor.addBC(velocityBC); + //bcVisitor.addBC(densityBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BGKLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel()); @@ -177,7 +178,7 @@ void bflow(string configname) 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->setBCSet(bcProc); //kernel->setForcingX1(forcing); //kernel->setWithForcing(true); @@ -198,11 +199,11 @@ void bflow(string configname) ////////////////////////////////////////////////////////////////////////// //restart SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); - 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); - //restartCoProcessor->setNu(k); + SPtr<MPIIOMigrationSimulationObserver> restartSimulationObserver(new MPIIOMigrationSimulationObserver(grid, mSch, metisVisitor, outputPath, comm)); + //SPtr<MPIIORestartSimulationObserver> restartSimulationObserver(new MPIIORestartSimulationObserver(grid, mSch, outputPath, comm)); + restartSimulationObserver->setLBMKernel(kernel); + restartSimulationObserver->setBCSet(bcProc); + //restartSimulationObserver->setNu(k); ////////////////////////////////////////////////////////////////////////// ////stator @@ -222,7 +223,7 @@ void bflow(string configname) //// // 0.5 * (g_maxX3 - g_minX3) * 0.5)); // SPtr<D3Q27Interactor> statorInt = - // SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID)); + // SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBC, Interactor3D::SOLID)); SPtr<GbTriFaceMesh3D> stator = make_shared<GbTriFaceMesh3D>(); stator->readMeshFromSTLFileBinary(geoPath + "/" + geoFile, false); @@ -231,7 +232,7 @@ void bflow(string configname) //stator->translate(4.0, -73.0, -6.0); SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27TriFaceMeshInteractor>( - new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES)); + new D3Q27TriFaceMeshInteractor(stator, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::EDGES)); GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance()); @@ -250,7 +251,7 @@ void bflow(string configname) GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance()); SPtr<D3Q27Interactor> rotorInt = - SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBCAdapter, Interactor3D::INVERSESOLID)); + SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBC, Interactor3D::INVERSESOLID)); //walls GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - deltax, g_minX2 - deltax, g_minX3 - deltax, g_minX1, @@ -262,8 +263,8 @@ 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> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, slipBC, Interactor3D::SOLID)); if (myid == 0) { @@ -320,8 +321,8 @@ void bflow(string configname) 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); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); unsigned long nob = grid->getNumberOfBlocks(); int gl = 3; @@ -365,18 +366,18 @@ void bflow(string configname) grid->accept(initVisitor); SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm); - ppgeo.process(0); + WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppgeo.update(0); if (myid == 0) UBLOG(logINFO, "Preprozess - end"); } else { - restartCoProcessor->restart((int)restartStep); + restartSimulationObserver->restart((int)restartStep); - //restartCoProcessor->readBlocks((int)restartStep); - //restartCoProcessor->readDataSet((int)restartStep); - ////restartCoProcessor->readBoundaryConds((int)restartStep); + //restartSimulationObserver->readBlocks((int)restartStep); + //restartSimulationObserver->readDataSet((int)restartStep); + ////restartSimulationObserver->readBoundaryConds((int)restartStep); //grid->setTimeStep((int)restartStep); SetBcBlocksBlockVisitor v2(wallXmaxInt); @@ -395,9 +396,9 @@ void bflow(string configname) grid->accept(v1); wallXminInt->initInteractor(); - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->process(1); + ppblocks->update(1); } //omp_set_num_threads(numOfThreads); @@ -414,33 +415,33 @@ void bflow(string configname) grid->accept(bcVisitor); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(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<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(100); SPtr<UbScheduler> forceSch(new UbScheduler(100)); - SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm); + SPtr<CalculateTorqueSimulationObserver> fp = make_shared<CalculateTorqueSimulationObserver>(grid, forceSch, outputPath + "/torque/TorqueRotor.csv", comm); fp->addInteractor(rotorInt); - SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.csv", comm); + SPtr<CalculateTorqueSimulationObserver> fp2 = make_shared<CalculateTorqueSimulationObserver>(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<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(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); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + //simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(fp2); + //simulation->addSimulationObserver(writeMQSimulationObserver); + //simulation->addSimulationObserver(writeThixotropicMQSimulationObserver); + simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/rheometer/CMakeLists.txt b/apps/cpu/rheometer/CMakeLists.txt index d8a534096569e7c70ad4db41e0bb72decfcc5a8c..58177bdd14a1c55985818bd70e336072c62f6dc5 100644 --- a/apps/cpu/rheometer/CMakeLists.txt +++ b/apps/cpu/rheometer/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(rheometer) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES rheometer.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES rheometer.cpp ) \ No newline at end of file diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp index 1506bde80f21bce580c6aa781d1075fdc86bcd62..ca3378bd5d6a4322b66877b25fca89d5ae478aac 100644 --- a/apps/cpu/rheometer/rheometer.cpp +++ b/apps/cpu/rheometer/rheometer.cpp @@ -1,7 +1,8 @@ #include <iostream> #include <string> -#include <VirtualFluids.h> +#include "VirtualFluids.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -141,13 +142,13 @@ void bflow(string configname) 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<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy())); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy())); - //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); - //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); + //SPtr<BC> slipBC(new SlipBC()); + //slipBC->setBCStrategy(SPtr<BCStrategy>(new SimpleSlipBCStrategy())); mu::Parser fctVx; //fctVx.SetExpr("omega*(r-x2)"); @@ -180,36 +181,36 @@ void bflow(string configname) //mu::Parser fctVx; //fctVx.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<BC> velocityBC(new VelocityBC(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST)); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new SimpleVelocityBCStrategy())); + //velocityBC->setBCStrategy(SPtr<BCStrategy>(new VelocityWithDensityBCStrategy())); + velocityBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelVelocityBCStrategy())); - //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter()); - //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); - ////densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + //SPtr<BC> densityBC(new DensityBC()); + //densityBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + ////densityBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - //bcVisitor.addBC(slipBCAdapter); - bcVisitor.addBC(velocityBCAdapter); - //bcVisitor.addBC(densityBCAdapter); + bcVisitor.addBC(noSlipBC); + //bcVisitor.addBC(slipBC); + bcVisitor.addBC(velocityBC); + //bcVisitor.addBC(densityBC); - SPtr<BCProcessor> bcProc; - bcProc = SPtr<BCProcessor>(new BCProcessor()); + SPtr<BCSet> bcProc; + bcProc = SPtr<BCSet>(new BCSet()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new BGKLBMKernel()); - SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); + //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CumulantK17LBMKernel()); - //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel()); + 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->setBCSet(bcProc); //kernel->setForcingX1(forcing); //kernel->setWithForcing(true); @@ -230,10 +231,10 @@ void bflow(string configname) ////////////////////////////////////////////////////////////////////////// //restart SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); - SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, metisVisitor, outputPath, comm)); - restartCoProcessor->setLBMKernel(kernel); - restartCoProcessor->setBCProcessor(bcProc); - //restartCoProcessor->setNu(k); + SPtr<MPIIOMigrationSimulationObserver> restartSimulationObserver(new MPIIOMigrationSimulationObserver(grid, mSch, metisVisitor, outputPath, comm)); + restartSimulationObserver->setLBMKernel(kernel); + restartSimulationObserver->setBCSet(bcProc); + //restartSimulationObserver->setNu(k); ////////////////////////////////////////////////////////////////////////// ////stator @@ -243,10 +244,10 @@ void bflow(string configname) //around x //SPtr<GbObject3D> stator(new GbCylinder3D(g_minX1 - 3.0 * deltax, 0.5 * g_maxX2, 0.5 * g_maxX3, g_maxX1 + 3.0 * deltax, 0.5 * g_maxX2, 0.5 * g_maxX3, 0.5 * g_maxX3)); - GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance()); + GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance()); SPtr<D3Q27Interactor> rotorInt = - SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBCAdapter, Interactor3D::INVERSESOLID)); + SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, velocityBC, Interactor3D::INVERSESOLID)); ////rotor (cylinder) SPtr<GbObject3D> stator(new GbCylinder3D(0.5 * g_maxX1, 0.5 * g_maxX2, g_minX3- 2.0 * deltax, 0.5 * g_maxX1, 0.5 * g_maxX2, g_maxX3+ 2.0 * deltax, 0.25 * g_maxX1)); @@ -254,9 +255,9 @@ void bflow(string configname) //around x //SPtr<GbObject3D> rotor(new GbCylinder3D(g_minX1 - 3.0 * deltax, 0.5 * g_maxX2, 0.5 * g_maxX3, g_maxX1 + 3.0 * deltax, 0.5 * g_maxX2, 0.5 * g_maxX3, 0.25 * g_maxX3)); - GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance()); + GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance()); - SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, noSlipBC, Interactor3D::SOLID)); if (myid == 0) { @@ -310,8 +311,8 @@ void bflow(string configname) //if (myid == 0) GbSystem3D::writeGeoObject(wallZmax.get(), outputPath + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance()); ////wall interactors - //SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); - //SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + //SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); //////////////////////////////////////////// //METIS @@ -328,8 +329,8 @@ void bflow(string configname) 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); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(0); unsigned long nob = grid->getNumberOfBlocks(); int gl = 3; @@ -377,7 +378,7 @@ void bflow(string configname) } else { - restartCoProcessor->restart((int)restartStep); + restartSimulationObserver->restart((int)restartStep); grid->setTimeStep(restartStep); SetBcBlocksBlockVisitor v1(rotorInt); grid->accept(v1); @@ -401,37 +402,37 @@ void bflow(string configname) grid->accept(bcVisitor); SPtr<UbScheduler> geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlASCII::getInstance(), comm); - ppgeo.process(0); + WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlASCII::getInstance(), comm); + ppgeo.update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(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(0); + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); SPtr<UbScheduler> forceSch(new UbScheduler(100)); - SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.txt", comm); + SPtr<CalculateTorqueSimulationObserver> fp = make_shared<CalculateTorqueSimulationObserver>(grid, forceSch, outputPath + "/torque/TorqueRotor.txt", comm); fp->addInteractor(rotorInt); - SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueStator.txt", comm); + SPtr<CalculateTorqueSimulationObserver> fp2 = make_shared<CalculateTorqueSimulationObserver>(grid, forceSch, outputPath + "/torque/TorqueStator.txt", comm); fp2->addInteractor(statorInt); - SPtr<WriteThixotropyQuantitiesCoProcessor> writeThixotropicMQCoProcessor(new WriteThixotropyQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + SPtr<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(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); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(fp2); + simulation->addSimulationObserver(writeMQSimulationObserver); + simulation->addSimulationObserver(writeThixotropicMQSimulationObserver); + //simulation->addSimulationObserver(restartSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception& e) diff --git a/apps/cpu/sphere/sphere.cpp b/apps/cpu/sphere/sphere.cpp index 70dcc0ddd189f3906575e92877800ec709199a78..8a5ef89b8bf09e765236153f37cb259e075bf15e 100644 --- a/apps/cpu/sphere/sphere.cpp +++ b/apps/cpu/sphere/sphere.cpp @@ -43,10 +43,10 @@ void run(string configname) real dp_LB = 1e-6; // double rhoLBinflow = dp_LB*3.0; - SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); - SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); - slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + SPtr<BC> slipBC(new SlipBC()); + slipBC->setBCStrategy(SPtr<BCStrategy>(new SimpleSlipBCStrategy())); real H = 50; mu::Parser fct; @@ -56,18 +56,18 @@ void run(string configname) //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4"); //fct.DefineConst("U", uLB); //fct.DefineConst("H", H); - SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); - //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm())); - velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm())); + SPtr<BC> velBC(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + //velBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + velBC->setBCStrategy(SPtr<BCStrategy>(new SimpleVelocityBCStrategy())); - SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); BoundaryConditionsBlockVisitor bcVisitor; - bcVisitor.addBC(noSlipBCAdapter); - bcVisitor.addBC(slipBCAdapter); - bcVisitor.addBC(velBCAdapter); - bcVisitor.addBC(denBCAdapter); + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(slipBC); + bcVisitor.addBC(velBC); + bcVisitor.addBC(denBC); real dx = 1; @@ -94,7 +94,7 @@ void run(string configname) //SPtr<GbObject3D> sphere(new GbSphere3D(L1 * 0.5, L2 * 0.5, L3 * 0.5, radius)); SPtr<GbObject3D> sphere(new GbSphere3D(75, 25, 25, radius)); GbSystem3D::writeGeoObject(sphere.get(), outputPath + "/geo/sphere", WbWriterVtkXmlBinary::getInstance()); - SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBC, Interactor3D::SOLID)); if (true) { @@ -164,23 +164,23 @@ void run(string configname) GbCuboid3DPtr geoOutflow(new GbCuboid3D(d_maxX1, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength)); if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); - SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); //walls - SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, slipBCAdapter, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, slipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBC, Interactor3D::SOLID)); //inflow - SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBC, Interactor3D::SOLID)); - //D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow)); - //denBCAdapterInflow->setSecondaryBcOption(0); - //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID)); + //D3Q27BoundaryConditionAdapterPtr denBCInflow(new D3Q27DensityBC(rhoLBinflow)); + //denBCInflow->setSecondaryBcOption(0); + //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCInflow, Interactor3D::SOLID)); //outflow - SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_00M)); InteractorsHelper intHelper(grid, metisVisitor); @@ -197,7 +197,7 @@ void run(string configname) //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); //grid->accept(pqPartVisitor); - ppblocks->process(0); + ppblocks->update(0); ppblocks.reset(); unsigned long nob = grid->getNumberOfBlocks(); @@ -219,10 +219,10 @@ void run(string configname) SPtr<LBMKernel> kernel(new IncompressibleCumulantLBMKernel()); //SPtr<LBMKernel> kernel(new CompressibleCumulantLBMKernel()); - SPtr<BCProcessor> bcProcessor(new BCProcessor()); + SPtr<BCSet> bcSet(new BCSet()); - kernel->setBCProcessor(bcProcessor); + kernel->setBCSet(bcSet); SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); grid->accept(kernelVisitor); @@ -251,9 +251,9 @@ void run(string configname) //Postrozess SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<CoProcessor> ppgeo( - new WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); - ppgeo->process(0); + SPtr<SimulationObserver> ppgeo( + new WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); ppgeo.reset(); if (myid == 0) UBLOG(logINFO, "Preprozess - end"); @@ -282,25 +282,25 @@ void run(string configname) SPtr<UbScheduler> stepSch(new UbScheduler(outstep)); //stepSch->addSchedule(10000, 0, 1000000); - SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, outputPath, WbWriterVtkXmlBinary::getInstance(), conv,comm)); + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, stepSch, outputPath, WbWriterVtkXmlBinary::getInstance(), conv,comm)); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); - SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); real area = UbMath::PI * radius * radius; SPtr<UbScheduler> forceSch(new UbScheduler(100)); - SPtr<CalculateForcesCoProcessor> fp = make_shared<CalculateForcesCoProcessor>(grid, forceSch, outputPath + "/forces/forces.txt", comm, uLB, area); + SPtr<CalculateForcesSimulationObserver> fp = make_shared<CalculateForcesSimulationObserver>(grid, forceSch, outputPath + "/forces/forces.txt", comm, uLB, area); fp->addInteractor(sphereInt); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); - SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endstep)); - calculator->addCoProcessor(npr); - calculator->addCoProcessor(fp); - calculator->addCoProcessor(writeMQCoProcessor); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endstep)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(fp); + simulation->addSimulationObserver(writeMQSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); - calculator->calculate(); + simulation->run(); if (myid == 0) UBLOG(logINFO, "Simulation-end"); } diff --git a/cpu.cmake b/cpu.cmake index 1a93590bd0dde7e9c1556b9b150656a0ed93c8d0..78034bc927f8c01ce25d882e7d04f9f5e278ba01 100644 --- a/cpu.cmake +++ b/cpu.cmake @@ -22,13 +22,19 @@ #SET(CMAKE_BUILD_TYPE DEBUG) #ENDIF() -SET(USE_METIS ON CACHE BOOL "include METIS library support") -SET(USE_VTK OFF CACHE BOOL "include VTK library support") -SET(USE_CATALYST OFF CACHE BOOL "include Paraview Catalyst support") +SET(VFCPU_USE_METIS ON CACHE BOOL "include METIS library support") +SET(VFCPU_USE_VTK OFF CACHE BOOL "include VTK library support") +SET(VFCPU_USE_CATALYST OFF CACHE BOOL "include Paraview Catalyst support") +SET(VFCPU_USE_HLRN_LUSTRE OFF CACHE BOOL "include HLRN Lustre support") -SET(USE_HLRN_LUSTRE OFF CACHE BOOL "include HLRN Lustre support") +SET(VFCPU_ENABLE_LiggghtsCoupling OFF CACHE BOOL "enable coupling with LIGGGHTS library") +SET(VFCPU_ENABLE_NonNewtonianFluids ON CACHE BOOL "enable non-Newtonian fluids module") +SET(VFCPU_ENABLE_MultiphaseFlow ON CACHE BOOL "enable multiphase flow module") -SET(USE_LIGGGHTS OFF CACHE BOOL "include LIGGGHTS library support") +if(BUILD_VF_ALL_SAMPLES) + set(VFCPU_ENABLE_NonNewtonianFluids ON) + set(VFCPU_ENABLE_MultiphaseFlow ON) +endif() #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) @@ -36,32 +42,38 @@ IF((NOT ${CMAKE_CXX_COMPILER} MATCHES mpicxx) AND (NOT ${CMAKE_CXX_COMPILER} MAT ENDIF() #SET(MPI_CXX_LINK_FLAGS -mpe=mpilog) +if(VFCPU_ENABLE_LiggghtsCoupling) + add_subdirectory(src/cpu/LiggghtsCoupling) + SET(VFCPU_USE_VTK ON CACHE BOOL "include VTK library support" FORCE) +endif() + + #VTK -IF(${USE_VTK}) +IF(${VFCPU_USE_VTK}) FIND_PACKAGE(VTK REQUIRED) INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) ENDIF() -IF(${USE_CATALYST}) +IF(${VFCPU_USE_CATALYST}) find_package(ParaView 4.3 REQUIRED COMPONENTS vtkPVPythonCatalyst) include("${PARAVIEW_USE_FILE}") ENDIF() -IF(${USE_METIS}) +IF(${VFCPU_USE_METIS}) list(APPEND VF_COMPILER_DEFINITION VF_METIS) ENDIF() -IF(${USE_VTK}) +IF(${VFCPU_USE_VTK}) list(APPEND VF_COMPILER_DEFINITION VF_VTK) ENDIF() -IF(${USE_CATALYST}) +IF(${VFCPU_USE_CATALYST}) list(APPEND VF_COMPILER_DEFINITION VF_CATALYST) ENDIF() -IF(${USE_BOOST}) +IF(${VFCPU_USE_BOOST}) list(APPEND VF_COMPILER_DEFINITION VF_BOOST) ENDIF() -IF(${USE_HLRN_LUSTRE}) +IF(${VFCPU_USE_HLRN_LUSTRE}) list(APPEND VF_COMPILER_DEFINITION HLRN_LUSTRE) ENDIF() @@ -70,12 +82,10 @@ IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ia64") LIST(APPEND VF_COMPILER_DEFINITION _M_IA64) ENDIF() -if(${USE_METIS} AND NOT METIS_INCLUDEDIR) +if(${VFCPU_USE_METIS} AND NOT METIS_INCLUDEDIR) add_subdirectory(${VF_THIRD_DIR}/metis/metis-5.1.0) endif() - - add_subdirectory(${VF_THIRD_DIR}/MuParser) add_subdirectory(src/cpu/VirtualFluidsCore) @@ -84,8 +94,12 @@ if(BUILD_VF_PYTHON_BINDINGS) add_subdirectory(src/cpu/simulationconfig) endif() -if(USE_LIGGGHTS) - add_subdirectory(src/cpu/LiggghtsCoupling) +if(VFCPU_ENABLE_NonNewtonianFluids) + add_subdirectory(src/cpu/NonNewtonianFluids) +endif() + +if(VFCPU_ENABLE_MultiphaseFlow) + add_subdirectory(src/cpu/MultiphaseFlow) endif() set (APPS_ROOT_CPU "${VF_ROOT_DIR}/apps/cpu/") diff --git a/src/basics/geometry3d/CoordinateTransformation3D.h b/src/basics/geometry3d/CoordinateTransformation3D.h index a0f88c1f6b22bfe0655736802c423a00ee2357e2..d5560e84c6c18b1878d236b06dff688bcc709451 100644 --- a/src/basics/geometry3d/CoordinateTransformation3D.h +++ b/src/basics/geometry3d/CoordinateTransformation3D.h @@ -137,10 +137,10 @@ private: bool active; bool transformation; - friend class MPIIOCoProcessor; - friend class MPIIORestartCoProcessor; - friend class MPIIOMigrationCoProcessor; - friend class MPIIOMigrationBECoProcessor; + friend class MPIIOSimulationObserver; + friend class MPIIORestartSimulationObserver; + friend class MPIIOMigrationSimulationObserver; + friend class MPIIOMigrationBESimulationObserver; friend class CheckpointConverter; }; diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp b/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp similarity index 100% rename from src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.cpp rename to src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h b/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h similarity index 100% rename from src/cpu/LiggghtsCoupling/LiggghtsCouplingWrapper.h rename to src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h diff --git a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp similarity index 99% rename from src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp rename to src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp index 873bbd88aa43c59429eaff42a0a42d11c80e32bc..ea39fc17d606498a4b977d77a5151f4fff6e216c 100644 --- a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.cpp +++ b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp @@ -84,7 +84,7 @@ SPtr<LBMKernel> IBcumulantK17LBMKernel::clone() kernel->setNX(nx); std::dynamic_pointer_cast<IBcumulantK17LBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -138,7 +138,7 @@ void IBcumulantK17LBMKernel::calculate(int step) nonLocalDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); restDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h similarity index 99% rename from src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h rename to src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h index 58191d27e4de872aeef87d888fff4a35b90d962b..985ba75df5f0d726868e4ff854c384ad62eeb630 100644 --- a/src/cpu/LiggghtsCoupling/IBcumulantK17LBMKernel.h +++ b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h @@ -35,7 +35,7 @@ #define IBcumulantK17LBMKernel_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "UbTiming.h" #include "CbArray4D.h" diff --git a/src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h b/src/cpu/LiggghtsCoupling/LBM/IBdynamicsParticleData.h similarity index 100% rename from src/cpu/LiggghtsCoupling/IBdynamicsParticleData.h rename to src/cpu/LiggghtsCoupling/LBM/IBdynamicsParticleData.h diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h b/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h new file mode 100644 index 0000000000000000000000000000000000000000..88e5be001b5f71f97b4369ab3795ee5e3e972210 --- /dev/null +++ b/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h @@ -0,0 +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 MultiphasePressureBCStrategy.h +//! \ingroup BoundarConditions +//! \author Hesameddin Safari +//======================================================================================= + +#pragma once + +#include "LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h" +#include "LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h" \ No newline at end of file diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp similarity index 89% rename from src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp rename to src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp index bf923b2a216df1c6b82c9538daf4f33a65b24fd6..7b7fafd8a653f9a33559d9f569c6add4fba929f9 100644 --- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp +++ b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp @@ -1,34 +1,34 @@ -#include "LiggghtsCouplingCoProcessor.h" +#include "LiggghtsCouplingSimulationObserver.h" #include "GbSphere3D.h" #include "mpi/MPICommunicator.h" -#include "CoProcessor.h" -#include "LiggghtsCouplingWrapper.h" +#include "SimulationObserver.h" +#include "LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h" #include "Grid3D.h" #include "Block3D.h" #include "LBMKernel.h" #include "DistributionArray3D.h" #include "DataSet3D.h" -#include "IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h" #include "LBMUnitConverter.h" #include "fix_lb_coupling_onetoone.h" -LiggghtsCouplingCoProcessor::LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +LiggghtsCouplingSimulationObserver::LiggghtsCouplingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::mpi::Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units) - : CoProcessor(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units) + : SimulationObserver(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units) { } -LiggghtsCouplingCoProcessor::~LiggghtsCouplingCoProcessor() +LiggghtsCouplingSimulationObserver::~LiggghtsCouplingSimulationObserver() { } -void LiggghtsCouplingCoProcessor::process(double actualTimeStep) +void LiggghtsCouplingSimulationObserver::update(double actualTimeStep) { if (comm->getProcessID() == 0) - std::cout << "LiggghtsCouplingCoProcessor step: " << actualTimeStep << "\n"; + std::cout << "LiggghtsCouplingSimulationObserver step: " << actualTimeStep << "\n"; //comm->barrier(); @@ -45,7 +45,7 @@ void LiggghtsCouplingCoProcessor::process(double actualTimeStep) //comm->barrier(); } -void LiggghtsCouplingCoProcessor::setSpheresOnLattice() +void LiggghtsCouplingSimulationObserver::setSpheresOnLattice() { std::vector<int> excludeType; @@ -88,7 +88,7 @@ void LiggghtsCouplingCoProcessor::setSpheresOnLattice() } } -void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r, +void LiggghtsCouplingSimulationObserver::setSingleSphere3D(double *x, double *v, double *omega, /* double *com,*/ double r, int id /*, bool initVelFlag*/) { int level = 0; @@ -172,7 +172,7 @@ void LiggghtsCouplingCoProcessor::setSingleSphere3D(double *x, double *v, double } -double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double const dy_, double const dz_, +double LiggghtsCouplingSimulationObserver::calcSolidFraction(double const dx_, double const dy_, double const dz_, double const r_) { static int const slicesPerDim = 5; @@ -219,7 +219,7 @@ double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double c return fraction * ((double)n); } - 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) + void LiggghtsCouplingSimulationObserver::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[0] = v[0]; p.uPart[1] = v[1]; @@ -235,7 +235,7 @@ double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double c } -void LiggghtsCouplingCoProcessor::setToZero(IBdynamicsParticleData &p) +void LiggghtsCouplingSimulationObserver::setToZero(IBdynamicsParticleData &p) { p.uPart[0] = 0; p.uPart[1] = 0; @@ -244,7 +244,7 @@ void LiggghtsCouplingCoProcessor::setToZero(IBdynamicsParticleData &p) p.partId = 0; } -void LiggghtsCouplingCoProcessor::getForcesFromLattice() +void LiggghtsCouplingSimulationObserver::getForcesFromLattice() { static std::vector<double> force, torque; static typename ParticleData::ParticleDataArrayVector x_lb; @@ -319,7 +319,7 @@ void LiggghtsCouplingCoProcessor::getForcesFromLattice() couplingFix->comm_force_torque(); } -void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArrayVector &x, double *force, double *torque) +void LiggghtsCouplingSimulationObserver::SumForceTorque3D(ParticleData::ParticleDataArrayVector &x, double *force, double *torque) { int nx = grid->getNX1(), ny = grid->getNX2(), nz = grid->getNX3(); @@ -402,12 +402,12 @@ void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArr } } -void LiggghtsCouplingCoProcessor::addForce(int const partId, int const coord, double const value, double *force) +void LiggghtsCouplingSimulationObserver::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) +void LiggghtsCouplingSimulationObserver::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/SimulationObserver/LiggghtsCouplingSimulationObserver.h similarity index 88% rename from src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h rename to src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h index 3e87c89d2b92e2d34465cc41ddeab98eee85c5ed..0ae1786dd72346456621f3f4cf584679fca64f42 100644 --- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.h +++ b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h @@ -26,15 +26,15 @@ // 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 +//! \file LiggghtsCouplingSimulationObserver.h //! \ingroup LiggghtsCoupling //! \author Konstantin Kutscher //======================================================================================= -#ifndef LiggghtsCouplingCoProcessor_h -#define LiggghtsCouplingCoProcessor_h +#ifndef LiggghtsCouplingSimulationObserver_h +#define LiggghtsCouplingSimulationObserver_h -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "lammps.h" #include "input.h" @@ -45,7 +45,7 @@ #include <vector> -class CoProcessor; +class SimulationObserver; namespace vf::mpi {class Communicator;} class LiggghtsCouplingWrapper; class Grid3D; @@ -58,14 +58,14 @@ struct ParticleData { typedef typename std::vector<double> ParticleDataScalarVector; }; -class LiggghtsCouplingCoProcessor : public CoProcessor +class LiggghtsCouplingSimulationObserver : public SimulationObserver { public: - LiggghtsCouplingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::mpi::Communicator> comm, + LiggghtsCouplingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::mpi::Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units); - virtual ~LiggghtsCouplingCoProcessor(); + virtual ~LiggghtsCouplingSimulationObserver(); - void process(double actualTimeStep) override; + void update(double actualTimeStep) override; protected: diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.cpp similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.cpp index 73e399fb6ab3df0ea06620da4b5c0f6fedc8428e..d438f80f53fcefd553813b0c9517e0fe545af96f 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.cpp @@ -26,43 +26,43 @@ // 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 MultiphaseNoSlipBCAlgorithm.cpp +//! \file MultiphaseNoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseNoSlipBCAlgorithm.h" +#include "MultiphaseNoSlipBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -MultiphaseNoSlipBCAlgorithm::MultiphaseNoSlipBCAlgorithm() +MultiphaseNoSlipBCStrategy::MultiphaseNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::MultiphaseNoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::MultiphaseNoSlipBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -MultiphaseNoSlipBCAlgorithm::~MultiphaseNoSlipBCAlgorithm() +MultiphaseNoSlipBCStrategy::~MultiphaseNoSlipBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> MultiphaseNoSlipBCAlgorithm::clone() +SPtr<BCStrategy> MultiphaseNoSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new MultiphaseNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new MultiphaseNoSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseNoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNoSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseNoSlipBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNoSlipBCAlgorithm::applyBC() +void MultiphaseNoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF+1]; real h[D3Q27System::ENDF+1]; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.h similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.h index dc6e5bc6a558b18e2b70bfea8ab1ed4bf1853a82..390c2952e43398e7437ea61d1bc11890d454b9bc 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.h @@ -26,25 +26,25 @@ // 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 MultiphaseNoSlipBCAlgorithm.h +//! \file MultiphaseNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef MultiphaseNoSlipBCAlgorithm_h__ -#define MultiphaseNoSlipBCAlgorithm_h__ +#ifndef MultiphaseNoSlipBCStrategy_h__ +#define MultiphaseNoSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" //! A class implements no-slip boundary condition for multiphase simulations -class MultiphaseNoSlipBCAlgorithm : public BCAlgorithm +class MultiphaseNoSlipBCStrategy : public BCStrategy { public: - MultiphaseNoSlipBCAlgorithm(); - virtual ~MultiphaseNoSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + MultiphaseNoSlipBCStrategy(); + virtual ~MultiphaseNoSlipBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; void applyBC() override; }; -#endif // MultiphaseNoSlipBCAlgorithm_h__ +#endif // MultiphaseNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.cpp similarity index 80% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.cpp index 918f564b64667223d12169aba21dd659bc3308b6..aae7dec82bde0bd3477558fd937f4058a26eddd0 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.cpp @@ -26,48 +26,48 @@ // 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 MultiphaseNonReflectingOutflowBCAlgorithm.cpp +//! \file MultiphaseNonReflectingOutflowBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseNonReflectingOutflowBCAlgorithm.h" +#include "MultiphaseNonReflectingOutflowBCStrategy.h" #include "BoundaryConditions.h" #include "D3Q27System.h" #include "DistributionArray3D.h" -MultiphaseNonReflectingOutflowBCAlgorithm::MultiphaseNonReflectingOutflowBCAlgorithm() +MultiphaseNonReflectingOutflowBCStrategy::MultiphaseNonReflectingOutflowBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::NonReflectingOutflowBCStrategy; + BCStrategy::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -MultiphaseNonReflectingOutflowBCAlgorithm::~MultiphaseNonReflectingOutflowBCAlgorithm() +MultiphaseNonReflectingOutflowBCStrategy::~MultiphaseNonReflectingOutflowBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> MultiphaseNonReflectingOutflowBCAlgorithm::clone() +SPtr<BCStrategy> MultiphaseNonReflectingOutflowBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new MultiphaseNonReflectingOutflowBCAlgorithm()); + SPtr<BCStrategy> bc(new MultiphaseNonReflectingOutflowBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseNonReflectingOutflowBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseNonReflectingOutflowBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributionsH2(SPtr<DistributionArray3D> distributionsH2) +void MultiphaseNonReflectingOutflowBCStrategy::addDistributionsH2(SPtr<DistributionArray3D> distributionsH2) { this->distributionsH2 = distributionsH2; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() +void MultiphaseNonReflectingOutflowBCStrategy::applyBC() { using namespace D3Q27System; // using namespace UbMath; @@ -123,15 +123,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() 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]; + f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P00]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PP0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PM0]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0P]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0M]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -143,15 +143,15 @@ 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_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) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P00]; + h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PP0]; + h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PM0]; + h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P0P]; + h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P0M]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PPP]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PMP]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PPM]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -163,15 +163,15 @@ 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_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP); - h2[DIR_P00] = c1o2 * (h2temp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P00]); - h2[DIR_PP0] = c1o2 * (h2temp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PP0]); - h2[DIR_PM0] = c1o2 * (h2temp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PM0]); - h2[DIR_P0P] = c1o2 * (h2temp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P0P]); - h2[DIR_P0M] = c1o2 * (h2temp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_P0M]); - h2[DIR_PPP] = c1o2 * (h2temp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PPP]); - h2[DIR_PMP] = c1o2 * (h2temp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PMP]); - h2[DIR_PPM] = c1o2 * (h2temp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PPM]); - h2[DIR_PMM] = c1o2 * (h2temp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * h2[DIR_PMM]); + h2[DIR_P00] = c1o2 * (h2temp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_P00]); + h2[DIR_PP0] = c1o2 * (h2temp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_PP0]); + h2[DIR_PM0] = c1o2 * (h2temp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_PM0]); + h2[DIR_P0P] = c1o2 * (h2temp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_P0P]); + h2[DIR_P0M] = c1o2 * (h2temp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_P0M]); + h2[DIR_PPP] = c1o2 * (h2temp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_PPP]); + h2[DIR_PMP] = c1o2 * (h2temp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_PMP]); + h2[DIR_PPM] = c1o2 * (h2temp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h2[DIR_PPM]); + h2[DIR_PMM] = c1o2 * (h2temp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -185,15 +185,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() 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]; + f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M00]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MP0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MM0]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0P]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0M]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMP]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -205,15 +205,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::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); - 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]; + h[DIR_M00] = htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M00]; + h[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MP0]; + h[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MM0]; + h[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M0P]; + h[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M0M]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MPP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MMP]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MPM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -225,15 +225,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::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); - h2[DIR_M00] = c1o2 * (htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M00]); - h2[DIR_MP0] = c1o2 * (htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MP0]); - h2[DIR_MM0] = c1o2 * (htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MM0]); - h2[DIR_M0P] = c1o2 * (htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M0P]); - h2[DIR_M0M] = c1o2 * (htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_M0M]); - h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPP]); - h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMP]); - h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MPM]); - h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * h2[DIR_MMM]); + h2[DIR_M00] = c1o2 * (htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_M00]); + h2[DIR_MP0] = c1o2 * (htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_MP0]); + h2[DIR_MM0] = c1o2 * (htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_MM0]); + h2[DIR_M0P] = c1o2 * (htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_M0P]); + h2[DIR_M0M] = c1o2 * (htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_M0M]); + h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_MPP]); + h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_MMP]); + h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h2[DIR_MPM]); + h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -246,15 +246,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() 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]; - 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]; + f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0P0]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PP0]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MP0]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PP]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PM]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPM]; 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); @@ -266,15 +266,15 @@ 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[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]; - 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]; + h[DIR_0P0] = htemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0P0]; + h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PP0]; + h[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MP0]; + h[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0PP]; + h[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0PM]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PPP]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MPP]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PPM]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MPM]; 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); @@ -286,15 +286,15 @@ 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] = c1o2 * (htemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0P0]); - h2[DIR_PP0] = c1o2 * (htemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PP0]); - h2[DIR_MP0] = c1o2 * (htemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MP0]); - h2[DIR_0PP] = c1o2 * (htemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0PP]); - h2[DIR_0PM] = c1o2 * (htemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_0PM]); - h2[DIR_PPP] = c1o2 * (htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PPP]); - h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MPP]); - h2[DIR_PPM] = c1o2 * (htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_PPM]); - h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * h2[DIR_MPM]); + h2[DIR_0P0] = c1o2 * (htemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_0P0]); + h2[DIR_PP0] = c1o2 * (htemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_PP0]); + h2[DIR_MP0] = c1o2 * (htemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_MP0]); + h2[DIR_0PP] = c1o2 * (htemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_0PP]); + h2[DIR_0PM] = c1o2 * (htemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_0PM]); + h2[DIR_PPP] = c1o2 * (htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_PPP]); + h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_MPP]); + h2[DIR_PPM] = c1o2 * (htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h2[DIR_PPM]); + h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - 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); @@ -308,15 +308,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() break; 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]; + f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0M0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PM0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MM0]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MP]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MM]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMP]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -328,15 +328,15 @@ 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[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]; + h[DIR_0M0] = htemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0M0]; + h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PM0]; + h[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_MM0]; + h[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0MP]; + h[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0MM]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PMP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_MMP]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PMM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -348,15 +348,15 @@ 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] = c1o2 * (htemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0M0]); - h2[DIR_PM0] = c1o2 * (htemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PM0]); - h2[DIR_MM0] = c1o2 * (htemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MM0]); - h2[DIR_0MP] = c1o2 * (htemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0MP]); - h2[DIR_0MM] = c1o2 * (htemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_0MM]); - h2[DIR_PMP] = c1o2 * (htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PMP]); - h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MMP]); - h2[DIR_PMM] = c1o2 * (htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_PMM]); - h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * h2[DIR_MMM]); + h2[DIR_0M0] = c1o2 * (htemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_0M0]); + h2[DIR_PM0] = c1o2 * (htemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_PM0]); + h2[DIR_MM0] = c1o2 * (htemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_MM0]); + h2[DIR_0MP] = c1o2 * (htemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_0MP]); + h2[DIR_0MM] = c1o2 * (htemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_0MM]); + h2[DIR_PMP] = c1o2 * (htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_PMP]); + h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_MMP]); + h2[DIR_PMM] = c1o2 * (htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h2[DIR_PMM]); + h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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); @@ -370,15 +370,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() break; 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]; + f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_00P]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_P0P]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_M0P]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0PP]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0MP]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -390,15 +390,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::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); - 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]; + h[DIR_00P] = htemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_00P]; + h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_P0P]; + h[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_M0P]; + h[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_0PP]; + h[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_0MP]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_PPP]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_MPP]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_PMP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -410,15 +410,15 @@ 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] = c1o2 * (htemp[DIR_00P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_00P]); - h2[DIR_P0P] = c1o2 * (htemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_P0P]); - h2[DIR_M0P] = c1o2 * (htemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_M0P]); - h2[DIR_0PP] = c1o2 * (htemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_0PP]); - h2[DIR_0MP] = c1o2 * (htemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_0MP]); - h2[DIR_PPP] = c1o2 * (htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_PPP]); - h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_MPP]); - h2[DIR_PMP] = c1o2 * (htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_PMP]); - h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * h2[DIR_MMP]); + h2[DIR_00P] = c1o2 * (htemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_00P]); + h2[DIR_P0P] = c1o2 * (htemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_P0P]); + h2[DIR_M0P] = c1o2 * (htemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_M0P]); + h2[DIR_0PP] = c1o2 * (htemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_0PP]); + h2[DIR_0MP] = c1o2 * (htemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_0MP]); + h2[DIR_PPP] = c1o2 * (htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_PPP]); + h2[DIR_MPP] = c1o2 * (htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_MPP]); + h2[DIR_PMP] = c1o2 * (htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h2[DIR_PMP]); + h2[DIR_MMP] = c1o2 * (htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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); @@ -432,15 +432,15 @@ void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() break; 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]; - 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]; + f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_00M]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_P0M]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_M0M]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0PM]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0MM]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MMM]; 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); @@ -452,15 +452,15 @@ 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[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]; - 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]; + h[DIR_00M] = htemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_00M]; + h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_P0M]; + h[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_M0M]; + h[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_0PM]; + h[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_0MM]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_PPM]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_MPM]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_PMM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_MMM]; 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); @@ -472,15 +472,15 @@ 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] = c1o2 * (htemp[DIR_00M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_00M]); - h2[DIR_P0M] = c1o2 * (htemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_P0M]); - h2[DIR_M0M] = c1o2 * (htemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_M0M]); - h2[DIR_0PM] = c1o2 * (htemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_0PM]); - h2[DIR_0MM] = c1o2 * (htemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_0MM]); - h2[DIR_PPM] = c1o2 * (htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_PPM]); - h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_MPM]); - h2[DIR_PMM] = c1o2 * (htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_PMM]); - h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * h2[DIR_MMM]); + h2[DIR_00M] = c1o2 * (htemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_00M]); + h2[DIR_P0M] = c1o2 * (htemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_P0M]); + h2[DIR_M0M] = c1o2 * (htemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_M0M]); + h2[DIR_0PM] = c1o2 * (htemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_0PM]); + h2[DIR_0MM] = c1o2 * (htemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_0MM]); + h2[DIR_PPM] = c1o2 * (htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_PPM]); + h2[DIR_MPM] = c1o2 * (htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_MPM]); + h2[DIR_PMM] = c1o2 * (htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h2[DIR_PMM]); + h2[DIR_MMM] = c1o2 * (htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - 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); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.h similarity index 84% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.h index 3fa67b2763eb5a3d6d456f72b2fdada5a6040782..3aae2ce0384e67cd0024106fb7de3d9b1b1dd7a8 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.h @@ -26,25 +26,25 @@ // 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 MultiphaseNonReflectingOutflowBCAlgorithm.h +//! \file MultiphaseNonReflectingOutflowBCStrategy.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef MultiphaseNonReflectingOutflowBCAlgorithm_h__ -#define MultiphaseNonReflectingOutflowBCAlgorithm_h__ +#ifndef MultiphaseNonReflectingOutflowBCStrategy_h__ +#define MultiphaseNonReflectingOutflowBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" //! A class implements non reflecting outflow boundary condition for multiphase simulations -class MultiphaseNonReflectingOutflowBCAlgorithm : public BCAlgorithm +class MultiphaseNonReflectingOutflowBCStrategy : public BCStrategy { public: - MultiphaseNonReflectingOutflowBCAlgorithm(); - ~MultiphaseNonReflectingOutflowBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + MultiphaseNonReflectingOutflowBCStrategy(); + ~MultiphaseNonReflectingOutflowBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributionsH); void addDistributionsH2(SPtr<DistributionArray3D> distributionsH2); void applyBC(); }; -#endif // MultiphaseNonReflectingOutflowBCAlgorithm_h__ +#endif // MultiphaseNonReflectingOutflowBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp similarity index 50% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp index 7c21b30c8931e6f321abc3c9822eadb678f842f3..d2bb9f083fd433d60e0d1f5054b2238e963d9efc 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp.new +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp @@ -26,53 +26,55 @@ // 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 +//! \file MultiphasePressureBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseVelocityBCAlgorithm.h" +#include "MultiphasePressureBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -MultiphaseVelocityBCAlgorithm::MultiphaseVelocityBCAlgorithm() +MultiphasePressureBCStrategy::MultiphasePressureBCStrategy() { - BCAlgorithm::type = BCAlgorithm::MultiphaseVelocityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::MultiphasePressureBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -MultiphaseVelocityBCAlgorithm::~MultiphaseVelocityBCAlgorithm() +MultiphasePressureBCStrategy::~MultiphasePressureBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> MultiphaseVelocityBCAlgorithm::clone() +SPtr<BCStrategy> MultiphasePressureBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new MultiphaseVelocityBCAlgorithm()); + SPtr<BCStrategy> bc(new MultiphasePressureBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphasePressureBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphasePressureBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributionsH2(SPtr<DistributionArray3D> distributionsH) +void MultiphasePressureBCStrategy::addDistributionsH2(SPtr<DistributionArray3D> distributionsH) { this->distributionsH2 = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::applyBC() +void MultiphasePressureBCStrategy::applyBC() { + using namespace vf::lbm::dir; + 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 heq[D3Q27System::ENDF+1]; LBMReal htemp[D3Q27System::ENDF+1]; distributions->getDistributionInv(f, x1, x2, x3); @@ -84,68 +86,35 @@ 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); - - ///// 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; } + if (bcPtr->hasVelocityBoundaryFlag(DIR_P00)) { nx1 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(DIR_M00)) { nx1 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(DIR_0P0)) { nx2 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(DIR_0M0)) { nx2 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(DIR_00P)) { nx3 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(DIR_00M)) { nx3 += 1; } //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); phiBC = bcPtr->getBoundaryPhaseField(); - + LBMReal rhoBC = bcPtr->getBoundaryDensity(); + D3Q27System::calcIncompFeq(feq, rhoBC, vx1, vx2, vx3); + 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 - } + for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) { + if (bcPtr->hasDensityBoundaryFlag(fdir)) { + LBMReal ftemp = -f[D3Q27System::INVDIR[fdir]] + feq[fdir] + feq[D3Q27System::INVDIR[fdir]]; + distributions->setDistributionForDirection(ftemp, x1, x2, x3, D3Q27System::INVDIR[fdir]); - } + LBMReal hReturn = -h[D3Q27System::INVDIR[fdir]] + htemp[fdir] + htemp[D3Q27System::INVDIR[fdir]]; + distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, D3Q27System::INVDIR[fdir]); + } } - } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.h index 0cfd9a3baa2a13780f39f3dbce024f982907f916..cb6c6cf5e8570b40800a7d2bf1c076307d441738 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.h @@ -26,27 +26,27 @@ // 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.h +//! \file MultiphasePressureBCStrategy.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef MultiphaseVelocityBCAlgorithm_h__ -#define MultiphaseVelocityBCAlgorithm_h__ +#ifndef MultiphasePressureBCStrategy_h__ +#define MultiphasePressureBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" //! A class implements velocity boundary condition for multiphase simulations -class MultiphaseVelocityBCAlgorithm : public BCAlgorithm +class MultiphasePressureBCStrategy : public BCStrategy { public: - MultiphaseVelocityBCAlgorithm(); - ~MultiphaseVelocityBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + MultiphasePressureBCStrategy(); + ~MultiphasePressureBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; void addDistributionsH2(SPtr<DistributionArray3D> distributionsH2) override; void applyBC() override; }; -#endif // MultiphaseVelocityBCAlgorithm_h__ +#endif // MultiphasePressureBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.cpp similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.cpp index c15204f7b9e8c02714d55adf2d40aea0acba8d35..b394d2d5d249004225b533c63fdbd596224e4b33 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.cpp @@ -26,43 +26,43 @@ // 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 MultiphaseSlipBCAlgorithm.cpp +//! \file MultiphaseSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseSlipBCAlgorithm.h" +#include "MultiphaseSlipBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -MultiphaseSlipBCAlgorithm::MultiphaseSlipBCAlgorithm() +MultiphaseSlipBCStrategy::MultiphaseSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::SlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::SlipBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -MultiphaseSlipBCAlgorithm::~MultiphaseSlipBCAlgorithm() +MultiphaseSlipBCStrategy::~MultiphaseSlipBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> MultiphaseSlipBCAlgorithm::clone() +SPtr<BCStrategy> MultiphaseSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new MultiphaseSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new MultiphaseSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseSlipBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseSlipBCAlgorithm::applyBC() +void MultiphaseSlipBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -101,7 +101,7 @@ void MultiphaseSlipBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir);// m+m q=0 stabiler //vx3=0; - real velocity = 0.0; + real velocity = vf::basics::constant::c0o1; switch (invDir) { case DIR_P00: velocity = (vf::basics::constant::c4o9*(+vx1)); break; //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3) @@ -132,7 +132,7 @@ void MultiphaseSlipBCAlgorithm::applyBC() case DIR_MPP: velocity = (vf::basics::constant::c1o36*(-vx1+vx2+vx3)); break; default: throw UbException(UB_EXARGS, "unknown error"); } - real 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)); + real fReturn = ((vf::basics::constant::c1o1-q)/(vf::basics::constant::c1o1+q))*((f[invDir]-feq[invDir])/(vf::basics::constant::c1o1-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(vf::basics::constant::c1o1+q)); distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); //real hReturn = ((1.0-q)/(1.0+q))*((h[invDir]-heq[invDir])/(1.0-collFactorPh)+heq[invDir])+((q/(1.0+q))*(h[invDir]+h[fdir])); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.h rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.h index 53d41d33ca333b7a7bf5515883eef697a20fb04a..1eb25a958505eb2fca2509763acf2f14bdf93414 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.h @@ -26,26 +26,26 @@ // 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 MultiphaseSlipBCAlgorithm.h +//! \file MultiphaseSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef MultiphaseSlipBCAlgorithm_h__ -#define MultiphaseSlipBCAlgorithm_h__ +#ifndef MultiphaseSlipBCStrategy_h__ +#define MultiphaseSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" //! A class implements slip boundary condition for multiphase simulation -class MultiphaseSlipBCAlgorithm : public BCAlgorithm +class MultiphaseSlipBCStrategy : public BCStrategy { public: - MultiphaseSlipBCAlgorithm(); - virtual ~MultiphaseSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + MultiphaseSlipBCStrategy(); + virtual ~MultiphaseSlipBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; void applyBC() override; }; -#endif // SlipBCAlgorithm_h__ +#endif // SlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp similarity index 82% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp index ee8761f98fe151282cedd24b07b4a608f8ad3873..26bb0eed80516751da97810b07c6b9caf249f743 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.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 MultiphaseVelocityBCAdapter.cpp +//! \file MultiphaseVelocityBC.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseVelocityBCAdapter.h" +#include "MultiphaseVelocityBC.h" #include "basics/utilities/UbLogger.h" #include "basics/utilities/UbMath.h" #include "basics/utilities/UbTuple.h" @@ -39,7 +39,7 @@ using namespace std; -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC) +MultiphaseVelocityBC::MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC) { if(vx1) this->vx1BCs.push_back(velVxBC); if(vx2) this->vx2BCs.push_back(velVxBC); @@ -47,7 +47,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const real& phiBC, const real& startTime, const real& endTime ) +MultiphaseVelocityBC::MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const real& phiBC, const real& startTime, const real& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(function,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(function,startTime,endTime)); @@ -58,7 +58,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const real& phiBC, const real& startTime, const real& endTime ) +MultiphaseVelocityBC::MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const real& phiBC, const real& startTime, const real& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(function1,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(function2,startTime,endTime)); @@ -67,7 +67,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const real& startTime, const real& endTime ) +MultiphaseVelocityBC::MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const real& startTime, const real& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(functionstring,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(functionstring,startTime,endTime)); @@ -75,7 +75,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir) +MultiphaseVelocityBC::MultiphaseVelocityBC(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir) { if(x1Dir) this->vx1BCs.push_back(velBC); if(x2Dir) this->vx2BCs.push_back(velBC); @@ -83,7 +83,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velBC this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC) +MultiphaseVelocityBC::MultiphaseVelocityBC(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC) { if( velVx1BC.getEndTime()!=-Ub::inf ) this->vx1BCs.push_back(velVx1BC); if( velVx2BC.getEndTime()!=-Ub::inf ) this->vx2BCs.push_back(velVx2BC); @@ -91,7 +91,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velVx this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs) +MultiphaseVelocityBC::MultiphaseVelocityBC(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs) { this->vx1BCs = velVx1BCs; this->vx2BCs = velVx2BCs; @@ -99,7 +99,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const vector< BCFunctio this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, +MultiphaseVelocityBC::MultiphaseVelocityBC(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, const real& vx2, const real& vx2StartTime, const real& vx2EndTime, const real& vx3, const real& vx3StartTime, const real& vx3EndTime ) { @@ -109,7 +109,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const real& vx1, const this->init(); } /*==========================================================*/ -MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const string& vx1Function, const real& vx1StartTime, const real& vx1EndTime, +MultiphaseVelocityBC::MultiphaseVelocityBC(const string& vx1Function, const real& vx1StartTime, const real& vx1EndTime, const string& vx2Function, const real& vx2StartTime, const real& vx2EndTime, const string& vx3Function, const real& vx3StartTime, const real& vx3EndTime ) { @@ -119,7 +119,7 @@ MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const string& vx1Functi this->init(); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::setNewVelocities(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, +void MultiphaseVelocityBC::setNewVelocities(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, const real& vx2, const real& vx2StartTime, const real& vx2EndTime, const real& vx3, const real& vx3StartTime, const real& vx3EndTime ) { @@ -130,7 +130,7 @@ void MultiphaseVelocityBCAdapter::setNewVelocities(const real& vx1, const real& this->init(); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::init() +void MultiphaseVelocityBC::init() { this->unsetTimeDependent(); @@ -155,7 +155,7 @@ void MultiphaseVelocityBCAdapter::init() catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::init(std::vector<BCFunction>& vxBCs) +void MultiphaseVelocityBC::init(std::vector<BCFunction>& vxBCs) { for(size_t pos=0; pos<vxBCs.size(); ++pos) { @@ -174,7 +174,7 @@ void MultiphaseVelocityBCAdapter::init(std::vector<BCFunction>& vxBCs) } } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const real& time) +void MultiphaseVelocityBC::init(const D3Q27Interactor* const& interactor, const real& time) { this->timeStep = time; this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL; @@ -259,31 +259,31 @@ void MultiphaseVelocityBCAdapter::init(const D3Q27Interactor* const& interactor, } } - UBLOG(logDEBUG4,"D3Q27VelocityBCAdapter::init(time="<<time<<") " + UBLOG(logDEBUG4,"D3Q27VelocityBC::init(time="<<time<<") " <<", vx1= \""<<(tmpVx1Function ? tmpVx1Function->GetExpr() : "-")<<"\"" <<", vx2= \""<<(tmpVx2Function ? tmpVx2Function->GetExpr() : "-")<<"\"" <<", vx3= \""<<(tmpVx3Function ? tmpVx3Function->GetExpr() : "-")<<"\"" <<", timedependent="<<boolalpha<<this->isTimeDependent() ); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::update( const D3Q27Interactor* const& interactor, const real& time ) +void MultiphaseVelocityBC::update( const D3Q27Interactor* const& interactor, const real& time ) { this->init(interactor,time); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& q, const int& fdirection, const real& time ) +void MultiphaseVelocityBC::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& q, const int& fdirection, const real& time ) { bc->setVelocityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption); bc->setQ((real)q,fdirection); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& time ) +void MultiphaseVelocityBC::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& time ) { this->setNodeVelocity(interactor,bc,worldX1,worldX2,worldX3,time); - bc->setBcAlgorithmType(algorithmType); + bc->setBCStrategyType(algorithmType); } /*==========================================================*/ -void MultiphaseVelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& timestep) +void MultiphaseVelocityBC::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const real& worldX1, const real& worldX2, const real& worldX3, const real& timestep) { //Geschwindigkeiten setzen try @@ -304,11 +304,11 @@ void MultiphaseVelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& intera catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } } /*==========================================================*/ -UbTupleDouble3 MultiphaseVelocityBCAdapter::getVelocity(const real& x1, const real& x2, const real& x3, const real& timeStep) const +UbTupleDouble3 MultiphaseVelocityBC::getVelocity(const real& x1, const real& x2, const real& x3, const real& timeStep) const { - real vx1 = 0.0; - real vx2 = 0.0; - real vx3 = 0.0; + real vx1 = vf::basics::constant::c0o1; + real vx2 = vf::basics::constant::c0o1; + real vx3 = vf::basics::constant::c0o1; this->x1 = x1; this->x2 = x2; this->x3 = x3; @@ -321,10 +321,10 @@ UbTupleDouble3 MultiphaseVelocityBCAdapter::getVelocity(const real& x1, const re return UbTupleDouble3(vx1,vx2,vx3); } /*==========================================================*/ -string MultiphaseVelocityBCAdapter::toString() +string MultiphaseVelocityBC::toString() { stringstream info; - info<<"D3Q27VelocityBCAdapter:\n"; + info<<"D3Q27VelocityBC:\n"; info<<" #vx1-functions = "<<(int)vx1BCs.size()<<endl; info<<" #vx2-functions = "<<(int)vx2BCs.size()<<endl; info<<" #vx3-functions = "<<(int)vx3BCs.size()<<endl; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h similarity index 80% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h index 60d93cdecd141834b9800c08fc9b6d1e4fab3c92..e01237cf96e14bffbbfeac43469d32c907d56dd7 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h @@ -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 MultiphaseVelocityBCAdapter.h +//! \file MultiphaseVelocityBC.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef MultiphaseVelocityBCAdapter_H -#define MultiphaseVelocityBCAdapter_H +#ifndef MultiphaseVelocityBC_H +#define MultiphaseVelocityBC_H #include <iostream> #include <string> @@ -45,7 +45,7 @@ class UbFileOutput; class UbFileInput; -#include <BCAdapter.h> +#include <BC.h> #include <BCFunction.h> //! \brief A class provides an interface for velocity boundary condition for multiphase simulation in grid generator. @@ -61,8 +61,8 @@ class UbFileInput; //! vx2BCs.push_back(BCFunction(0.002, 200, 300) ); //t=[200..300[ -> vx2 = 0.002 //! vx2BCs.push_back(BCFunction(0.043, 300, 600) ); //t=[300..600] -> vx2 = 0.043 //! -//! VelocityBCAdapter bcAdapter(vx1BCs,vx2BCs,vx3BCs); -//! bcAdapter.setTimePeriodic(); //-> t=[0 ..100[ -> vx1 = 0.01 +//! VelocityBC BC(vx1BCs,vx2BCs,vx3BCs); +//! BC.setTimePeriodic(); //-> t=[0 ..100[ -> vx1 = 0.01 //! // t=[100..200[ -> vx1 = 0.004 //! // t=[200..400[ -> vx1 = 0.03 //! // t=[400..500[ -> vx1 = 0.01 @@ -81,34 +81,34 @@ class UbFileInput; //! fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (with vmax for //! (0/x2_vmax/x3_vmax) fct.DefineConst("x2Vmax", 0.0 ); //x2-Pos für vmax fct.DefineConst("x3Vmax", 0.0 //! ); //x3-Pos für vmax fct.DefineConst("H" , diameterOfPipe); fct.DefineConst("vmax" , vmax ); -//! VelocityBCAdapter velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); +//! VelocityBC velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); //! \endcode -class MultiphaseVelocityBCAdapter : public BCAdapter +class MultiphaseVelocityBC : public BC { public: //constructors - MultiphaseVelocityBCAdapter() { this->init(); } + MultiphaseVelocityBC() { this->init(); } - MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC ); + MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC ); - MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const real& phiBC, const real& startTime, const real& endTime ); + MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const real& phiBC, const real& startTime, const real& endTime ); - MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const real& phiBC, const real& startTime, const real& endTime ); + MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const real& phiBC, const real& startTime, const real& endTime ); - MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const real& startTime, const real& endTime ); + MultiphaseVelocityBC(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const real& startTime, const real& endTime ); - MultiphaseVelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir); + MultiphaseVelocityBC(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir); - MultiphaseVelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC); + MultiphaseVelocityBC(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC); - MultiphaseVelocityBCAdapter(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs); + MultiphaseVelocityBC(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs); - MultiphaseVelocityBCAdapter(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, + MultiphaseVelocityBC(const real& vx1, const real& vx1StartTime, const real& vx1EndTime, const real& vx2, const real& vx2StartTime, const real& vx2EndTime, const real& vx3, const real& vx3StartTime, const real& vx3EndTime); - MultiphaseVelocityBCAdapter(const std::string& vx1Function, const real& vx1StartTime, const real& vx1EndTime, + MultiphaseVelocityBC(const std::string& vx1Function, const real& vx1StartTime, const real& vx1EndTime, const std::string& vx2Function, const real& vx2StartTime, const real& vx2EndTime, const std::string& vx3Function, const real& vx3StartTime, const real& vx3EndTime ); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp rename to src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp index b6ddf4b46925e770cfcdcc5390d41ed816b992bc..a9b8391a8296fbbaf2709bb36863880985790a45 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp @@ -26,47 +26,47 @@ // 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 +//! \file MultiphaseVelocityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "MultiphaseVelocityBCAlgorithm.h" +#include "MultiphaseVelocityBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -MultiphaseVelocityBCAlgorithm::MultiphaseVelocityBCAlgorithm() +MultiphaseVelocityBCStrategy::MultiphaseVelocityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::MultiphaseVelocityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::MultiphaseVelocityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -MultiphaseVelocityBCAlgorithm::~MultiphaseVelocityBCAlgorithm() +MultiphaseVelocityBCStrategy::~MultiphaseVelocityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> MultiphaseVelocityBCAlgorithm::clone() +SPtr<BCStrategy> MultiphaseVelocityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new MultiphaseVelocityBCAlgorithm()); + SPtr<BCStrategy> bc(new MultiphaseVelocityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseVelocityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseVelocityBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::addDistributionsH2(SPtr<DistributionArray3D> distributionsH) +void MultiphaseVelocityBCStrategy::addDistributionsH2(SPtr<DistributionArray3D> distributionsH) { this->distributionsH2 = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void MultiphaseVelocityBCAlgorithm::applyBC() +void MultiphaseVelocityBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -89,7 +89,7 @@ void MultiphaseVelocityBCAlgorithm::applyBC() vx1=bcPtr->getBoundaryVelocityX1(); vx2 = bcPtr->getBoundaryVelocityX2(); vx3 = bcPtr->getBoundaryVelocityX3(); - p1 = 0.0; + p1 = vf::basics::constant::c0o1; D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3); D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3); diff --git a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..4e99c876aca206eae0cae3bcf8c643d9ce930b87 --- /dev/null +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.h @@ -0,0 +1,52 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 MultiphaseVelocityBCStrategy.h +//! \ingroup BoundarConditions +//! \author Hesameddin Safari +//======================================================================================= + +#ifndef MultiphaseVelocityBCStrategy_h__ +#define MultiphaseVelocityBCStrategy_h__ + +#include "BCStrategy.h" +//! A class implements velocity boundary condition for multiphase simulations +class MultiphaseVelocityBCStrategy : public BCStrategy +{ +public: + MultiphaseVelocityBCStrategy(); + ~MultiphaseVelocityBCStrategy(); + SPtr<BCStrategy> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; + void addDistributionsH2(SPtr<DistributionArray3D> distributionsH2) override; + void applyBC() override; +}; + +#endif // MultiphaseVelocityBCStrategy_h__ + diff --git a/src/cpu/MultiphaseFlow/CMakeLists.txt b/src/cpu/MultiphaseFlow/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..35765164bce5ce208f1c43fcc7345cbd77f4e999 --- /dev/null +++ b/src/cpu/MultiphaseFlow/CMakeLists.txt @@ -0,0 +1 @@ +vf_add_library(PUBLIC_LINK VirtualFluidsCore) \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.cpp index 5561a04cc18d91b554d094ce43ee0e11f32af2ad..2655e916025b1d2b085348c06cb95c425813d83d 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.cpp @@ -69,7 +69,7 @@ SPtr<LBMKernel> MultiphaseCumulantLBMKernel::clone() kernel->setPhaseFieldRelaxation(this->tauH); kernel->setMobility(this->mob); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -100,7 +100,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step) nonLocalDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); zeroDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -1290,7 +1290,7 @@ void MultiphaseCumulantLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X2X1>:: using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.h index 1402e35f0626399c30875d3f58bbcd256367d965..a42f6d5eaf907cd3706546c7afcd67d93e9985f2 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseCumulantLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp index 551d9d21188cbb865c55bec156469be6c88d8b95..6dc3b454e1874382bb539d716147867f03514c38 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.cpp @@ -79,7 +79,7 @@ SPtr<LBMKernel> MultiphasePressureFilterCompressibleAirLBMKernel::clone() kernel->setMobility(this->mob); kernel->setInterfaceWidth(this->interfaceWidth); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -168,7 +168,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::calculate(int step) CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -1630,7 +1630,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors(CbArray3D<r using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); @@ -1651,7 +1651,7 @@ void MultiphasePressureFilterCompressibleAirLBMKernel::findNeighbors2(CbArray3D< using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi2[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h index 65be707f90d1327cad559cc7f9361e74508bcd30..56d31b53c8ed42358e898869e8193bcf7779743a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphasePressureFilterCompressibleAirLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.cpp index 547ad83259d205f8da99184c3cf6c5a761e7f7b2..1d0d66a1803968f98cdff629d0578ecb197ddc31 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.cpp @@ -79,7 +79,7 @@ SPtr<LBMKernel> MultiphasePressureFilterLBMKernel::clone() kernel->setMobility(this->mob); kernel->setInterfaceWidth(this->interfaceWidth); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -168,7 +168,7 @@ void MultiphasePressureFilterLBMKernel::calculate(int step) CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -1748,7 +1748,7 @@ void MultiphasePressureFilterLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.h index d13a5aeffa95cc3ee4980edf5cc93650ecc617a3..fc2783b4f844a0acb00386c64ff034bfa900928b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphasePressureFilterLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphasePressureFilterLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f898f2543a0bf3fec74b84d7cf62dbf76195a0c2 --- /dev/null +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp @@ -0,0 +1,4876 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 MultiphaseScaleDistributionLBMKernel.cpp +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#include "MultiphaseScaleDistributionLBMKernel.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> + +using namespace vf::lbm::dir; +using namespace vf::basics::constant; + +#define PROOF_CORRECTNESS + +////////////////////////////////////////////////////////////////////////// +MultiphaseScaleDistributionLBMKernel::MultiphaseScaleDistributionLBMKernel() { this->compressible = false; } +////////////////////////////////////////////////////////////////////////// +void MultiphaseScaleDistributionLBMKernel::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<real, IndexerX3X2X1>::CbArray3DPtr pressure(new CbArray3D<real, IndexerX3X2X1>( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + pressureOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + p1Old = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + + rhoNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vxNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vyNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vzNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, 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<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0)); + phaseFieldOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 999.0)); + + divU = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); +} +////////////////////////////////////////////////////////////////////////// +SPtr<LBMKernel> MultiphaseScaleDistributionLBMKernel::clone() +{ + SPtr<LBMKernel> kernel(new MultiphaseScaleDistributionLBMKernel()); + kernel->setNX(nx); + dynamicPointerCast<MultiphaseScaleDistributionLBMKernel>(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->setBCSet(bcSet->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<MultiphaseScaleDistributionLBMKernel>(kernel)->initForcing(); + + return kernel; +} +////////////////////////////////////////////////////////////////////////// +void MultiphaseScaleDistributionLBMKernel::forwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) { + //using namespace UbMath; + real m2 = mfa + mfc; + real m1 = mfc - mfa; + real m0 = m2 + mfb; + mfa = m0; + m0 *= Kinverse; + m0 += oneMinusRho; + mfb = (m1 * Kinverse - m0 * vv) * K; + mfc = ((m2 - c2o1 * m1 * vv) * Kinverse + v2 * m0) * K; +} + +//////////////////////////////////////////////////////////////////////////////// +void MultiphaseScaleDistributionLBMKernel::backwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) { + //using namespace UbMath; + real m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K; + real m1 = (((mfa - mfc) - c2o1 * 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 MultiphaseScaleDistributionLBMKernel::forwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2) { + //using namespace UbMath; + real m1 = (mfa + mfc) + mfb; + real m2 = mfc - mfa; + mfc = (mfc + mfa) + (v2 * m1 - c2o1 * vv * m2); + mfb = m2 - vv * m1; + mfa = m1; +} + + +void MultiphaseScaleDistributionLBMKernel::backwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2) { + //using namespace UbMath; + real ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2); + real mb = ((mfa - mfc) - mfa * v2) - c2o1 * mfb * vv; + mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2); + mfb = mb; + mfa = ma; +} + + +void MultiphaseScaleDistributionLBMKernel::calculate(int step) +{ + using namespace D3Q27System; + //using namespace UbMath; + + forcingX1 = 0.0; + forcingX2 = 0.0; + forcingX3 = 0.0; + + real oneOverInterfaceScale = c4o1 / 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<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); + + SPtr<BCArray3D> bcArray = this->getBCSet()->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; + //real 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; + + + + real mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + real mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3); + + //omegaDRho = 2.0;// 1.5; + //real phiOld = (*phaseField)(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) = c1o1; + } + + if ((*phaseField)(x1, x2, x3) < 0) { + (*phaseField)(x1, x2, x3) = 0; + + + } + } + } + } + } + + this->swapDistributions(); + for (int x3 = minX3 - ghostLayerWidth+1; x3 < maxX3 + ghostLayerWidth-1; x3++) { + for (int x2 = minX2 - ghostLayerWidth+1; x2 < maxX2 + ghostLayerWidth-1; x2++) { + for (int x1 = minX1 - ghostLayerWidth+1; x1 < maxX1 + ghostLayerWidth-1; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + //int x1p = x1 + 1; + //int x2p = x2 + 1; + //int x3p = x3 + 1; + + //real mfabb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);//* rho * c1o3; + // real mfbab = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);//* rho * c1o3; + // real mfbba = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3);//* rho * c1o3; + // real mfaab = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3);//* rho * c1o3; + // real mfcab = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3);//* rho * c1o3; + // real mfaba = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3);//* rho * c1o3; + // real mfcba = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3);//* rho * c1o3; + // real mfbaa = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3);//* rho * c1o3; + // real mfbca = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3);//* rho * c1o3; + // real mfaaa = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3);//* rho * c1o3; + // real mfcaa = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3);//* rho * c1o3; + // real mfaca = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3);//* rho * c1o3; + // real mfcca = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3);//* rho * c1o3; + // real mfcbb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3);//* rho * c1o3; + // real mfbcb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3);//* rho * c1o3; + // real mfbbc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p);//* rho * c1o3; + // real mfccb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3);//* rho * c1o3; + // real mfacb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3);//* rho * c1o3; + // real mfcbc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p);//* rho * c1o3; + // real mfabc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p);//* rho * c1o3; + // real mfbcc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p);//* rho * c1o3; + // real mfbac = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p);//* rho * c1o3; + // real mfccc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p);//* rho * c1o3; + // real mfacc = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p);//* rho * c1o3; + // real mfcac = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p);//* rho * c1o3; + // real mfaac = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p);//* rho * c1o3; + // real mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3); + + SPtr<DistributionArray3D> distributionH = this->getDataSet()->getHdistributions(); + real hh[27]; + distributionH->getDistributionInv(hh, x1, x2, x3); + real phiD, vxP, vyP, vzP; + + D3Q27System::calcIncompMacroscopicValues(hh, phiD, vxP, vyP, vzP); + (*phaseFieldOld)(x1, x2, x3) = phiD; + + //real mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + //real mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + //real mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + //real mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + //real mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + //real mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + //real mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + //real mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + //real mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + //real mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + //real mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + //real mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + //real mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + //real mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + //real mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + //real mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + //real mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + //real mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + //real mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + //real mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + //real mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + //real mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + //real mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + //real mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + //real mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + //real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + + //real 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) = c1o1; + //} + + //if ((*phaseField)(x1, x2, x3) < 0) { + // (*phaseField)(x1, x2, x3) = 0; + //} + ////// read F-distributions for velocity formalism + //mfabb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);//* rho * c1o3; + //mfbab = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);//* rho * c1o3; + //mfbba = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);//* rho * c1o3; + //mfaab = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);//* rho * c1o3; + //mfcab = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);//* rho * c1o3; + //mfaba = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);//* rho * c1o3; + //mfcba = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);//* rho * c1o3; + //mfbaa = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);//* rho * c1o3; + //mfbca = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);//* rho * c1o3; + //mfaaa = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);//* rho * c1o3; + //mfcaa = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);//* rho * c1o3; + //mfaca = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);//* rho * c1o3; + //mfcca = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);//* rho * c1o3; + //mfcbb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);//* rho * c1o3; + //mfbcb = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);//* rho * c1o3; + //mfbbc = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);//* rho * c1o3; + //mfccb = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);//* rho * c1o3; + //mfacb = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);//* rho * c1o3; + //mfcbc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);//* rho * c1o3; + //mfabc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);//* rho * c1o3; + //mfbcc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);//* rho * c1o3; + //mfbac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);//* rho * c1o3; + //mfccc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);//* rho * c1o3; + //mfacc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);//* rho * c1o3; + //mfcac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);//* rho * c1o3; + //mfaac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);//* rho * c1o3; + //mfbbb = (*this->zeroDistributionsF)(x1, x2, x3); + + //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); + + + //real 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; + + //(*rhoNode)(x1, x2, x3) = drho; + //(*vxNode)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + // (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + // (mfcbb - mfabb)); + //(*vyNode)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + // (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + // (mfbcb - mfbab)); + //(*vzNode)(x1, x2, x3) = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + // (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + + // (mfbbc - mfbba)); + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG,vx,vy,vz; + //real rhoGG = (((((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; + + + //vx= ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + // (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + // (mfcbb - mfabb)); + //vy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + // (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + // (mfbcb - mfbab)); + //vz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + // (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + + // (mfbbc - mfbba)); + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + //if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { } + //else { rhoG = 0.0; vx = 0.0; vy = 0.0; vz = 0.0; } + //// very bad save the world procedure!!!! + //vx = (vx > 1 || vx < -1) ? 0 : vx; + //vy = (vy > 1 || vy < -1) ? 0 : vy; + //vz = (vz > 1 || vz < -1) ? 0 : vz; + //rhoG = (rhoG > 10 || rhoG < -10) ? 0 : rhoG; + (*rhoNode)(x1, x2, x3) = rhoG;// *((*phaseField)(x1, x2, x3) > c1o2 ? densityRatio : c1o1); + (*vxNode)(x1, x2, x3) = vx; + (*vyNode)(x1, x2, x3) = vy; + (*vzNode)(x1, x2, x3) = vz; + //if (fabsf(vx) > 0 && fabsf(vx) < 0.01) { + // int test = 0; + //} + + + + //if ((*vzNode)(x1, x2, x3) != 0) { + // real vvvv = (*vzNode)(x1, x2, x3); + // real pppp = vvvv / (*phaseField)(x1, x2, x3); + // int ii = 1; + //} + + } + } + } + } + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + 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; + //int x3p = x3 + 1; + findNeighbors(phaseFieldOld, x1, x2, x3); + ////////////////////////////////Momentum conservation experiment 06.03.2023 + //surfacetension + + if ((((*phaseField)(x1, x2, x3) <= c1o2) || phi[DIR_000]<=c1o2)&& ( + (phi[DIR_P00] > c1o2) || + (phi[DIR_M00] > c1o2) || + (phi[DIR_00P] > c1o2) || + (phi[DIR_00M] > c1o2) || + (phi[DIR_0M0] > c1o2) || + (phi[DIR_0P0] > c1o2) || + (phi[DIR_PP0] > c1o2) || + (phi[DIR_PM0] > c1o2) || + (phi[DIR_P0P] > c1o2) || + (phi[DIR_P0M] > c1o2) || + (phi[DIR_MP0] > c1o2) || + (phi[DIR_MM0] > c1o2) || + (phi[DIR_M0P] > c1o2) || + (phi[DIR_M0M] > c1o2) || + (phi[DIR_0PM] > c1o2) || + (phi[DIR_0MM] > c1o2) || + (phi[DIR_0PP] > c1o2) || + (phi[DIR_0MP] > c1o2) || + (phi[DIR_PPP] > c1o2) || + (phi[DIR_PMP] > c1o2) || + (phi[DIR_MPP] > c1o2) || + (phi[DIR_MMP] > c1o2) || + (phi[DIR_PPM] > c1o2) || + (phi[DIR_PMM] > c1o2) || + (phi[DIR_MPM] > c1o2) || + (phi[DIR_MMM] > c1o2) + )) { + real vx = (*vxNode)(x1, x2, x3); + real vy = (*vyNode)(x1, x2, x3); + real vz = (*vzNode)(x1, x2, x3); + findNeighbors(phaseField, x1, x2, x3); + real curv = computeCurvature_phi(); + findNeighbors(phaseFieldOld, x1, x2, x3); + real sigma = c3o1*c2o1*1e-1; + +//16.03.23 c: BB gas side with updated boundary velocity + + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG; + if (phi[DIR_000] > c1o2) { //initialization necessary + real sumRho = 0; + real sumWeight = 1.e-100; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] <= c1o2)) { + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumWeight += WEIGTH[fdir]; + } + + } + rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neighbor? + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2) ) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + if ((phi[D3Q27System::INVDIR[fdir]] > c1o2)) { + ///here we need reconstruction from scrach + real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fGEQOld = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1, x2, x3), vx, vy, vz); + //real fGEQNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew;// fL -feqOLD + feqNew; + //real fBC = fGG - c6o1 * WEIGTH[fdir] * (vBC); + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + ///// other possibility is tor replace the node itself instead of the neighbor (only c1o1 of them is allowed!) + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1 , x2 , x3 ), (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1 , x2 , x3 )); + //real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1, x2, x3 )); + //real fBC = fG - feqOLD + feqNew; + //distribution->setDistributionForDirection(fBC, x1, x2, x3, fdir); + + + } + } + } + //distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + { + real fL = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx,vy,vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoG,vx,vy,vz); + distribution->setDistributionForDirection(fL-feqOLD+feqNew, x1, x2, x3, DIR_000); + } + + } + else {//no refill of gas required + rhoG = (*rhoNode)(x1, x2, x3); + if ((*phaseField)(x1, x2, x3) <= c1o2) {//no refill liquid + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //real fGInv = distribution->getDistributionInvForDirection(x1, x2, x3, D3Q27System::INVDIR[fdir]); + //real fGInvEQ = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) )- c6o1 * WEIGTH[fdir] * (vBC); + real fBC = ( fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + //if (fabsf(-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) - fGEQ) >1000* (fabsf(fG - fGEQ))) fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //if (fGEQ > 1.0e-8&& step>30&& vyBC!=0) { + // std::cout << D3Q27System::DX1[fdir] <<","<< D3Q27System::DX2[fdir] << "," << D3Q27System::DX3[fdir] <<" " << -fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) - fGEQ << " fg:" << fG - fGEQ << " ratio=" << (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) - fGEQ) / (fG - fGEQ) << " feq" << fGEQ << " vy =" << vy << "vyBC=" << vyBC << "\n"; + //} + + //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + //if ((*phaseField)(x1, x2, x3) <= c1o2) + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + //real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL-2*fL+2*feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC; + //real flWW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC; + //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + //real number = 666; + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC, x1, x2, x3, fdir); + //real eqBC= D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + //real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + //real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real curvBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + curvBC = computeCurvature_phi(); + findNeighbors(phaseFieldOld, x1, x2, x3); + } + else curvBC = curv;//reset to the above + real LaplacePressure = curv *(c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + curvBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //16.04.23 + real eqLL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + fL = fL*0.99 +0.01*(eqLL - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)); + LaplacePressure *= sigma; + //eqBCN = eqBC; + //distribution->setDistributionForDirection(LaplacePressure * WEIGTH[fdir] +(fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1-c1o1 / densityRatio*0 ) - fL -0* (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + distribution->setDistributionForDirection(LaplacePressure* WEIGTH[fdir] + (fBC + fG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio ) - fL, x1, x2, x3, fdir); + //if (vxBC != 0) { + // int set = 0; + //} + + } + + } + + + } + } + else {//refill liquid + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //alternative way to bounce back by recovering fG from the opiste direction + //real fGInv= distribution->getDistributionInvForDirection(x1, x2, x3, D3Q27System::INVDIR[fdir]); + //real fGInvEQ = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + //if (fabsf(-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) - fGEQ) > 1000*(fabsf(fG - fGEQ))) fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + ff[D3Q27System::INVDIR[fdir]] = fBC; + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL- (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vBC), x1, x2, x3, fdir); + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //distribution->setDistributionForDirection(0, x1, x2, x3, fdir); + //real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; + //real flWW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; + //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real flNew = (fBC + fG - eqBC - eqG) / densityRatio + eqBC + eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real curvBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + curvBC = computeCurvature_phi(); + findNeighbors(phaseFieldOld, x1, x2, x3); + } + else curvBC = curv;//reset to the above + //16.04.23 + real eqLL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + fL = fL * 0.99 + 0.01 * (eqLL - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)); + real LaplacePressure = curv *(c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + curvBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + LaplacePressure *= sigma; + //eqBCN = eqBC; + distribution->setDistributionForDirection(LaplacePressure* WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio*0) - fL - 0*(feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + distribution->setDistributionForDirection(LaplacePressure* WEIGTH[fdir] + (fBC + fG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio) - fL , x1, x2, x3, fdir); + // real number = 666; + + + + } + + } + else { + ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]);; + } + + + } + + real sum2 = 1e-100; + real sumRho = 0; + real sumVx = 0; + real sumVy = 0; + real sumVz = 0; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; + sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sum2 += WEIGTH[fdir]; + } + } + real rhoL; + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + rhoL = sumRho / sum2; + //vx = sumVx / sum2; + //vy = sumVy / sum2; + //vz = sumVz / sum2; + //rhoL = (*rhoNode)(x1, x2, x3)/densityRatio; + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + } + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + //if (!((phi[fdir] > c1o2) && (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2))) { + if (!((phi[fdir] > c1o2))) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + + + + + //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); + ff[D3Q27System::INVDIR[fdir]]=(feqNew - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)); + //ff[D3Q27System::INVDIR[fdir]] = (ff[D3Q27System::INVDIR[fdir]] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + } + } + //03.04.2023 alternative initialization of liquid nodes based on FD + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // //if (!((phi[fdir] > c1o2) && (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2))) { + // if (!((phi[fdir] > c1o2))) { + // real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vBC = (-D3Q27System::DX1[fdir] * vxBC - D3Q27System::DX2[fdir] * vyBC - D3Q27System::DX3[fdir] * vzBC); + // real vDir = (-D3Q27System::DX1[fdir] * vx - D3Q27System::DX2[fdir] * vy - D3Q27System::DX3[fdir] * vz); + // real dvDir = vBC - vDir; + + // //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); + // ff[D3Q27System::INVDIR[fdir]] = feqNew - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1); + // distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // } + //} + + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] > c1o2)) { + // //real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vBC = -(D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX2[fdir] * vzBC); + // real vDir = -(D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX2[fdir] * vz); + // //vBC = (vBC + vDir) / (c2o1 -( vBC - vDir)); + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) - c6o1 * WEIGTH[fdir] * vDir; + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * D3Q27System::DX3[fdir]); + // real fL= D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(fL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // ff[fdir] = fL; + // } + // if (!(phi[fdir] > c1o2)) { + // //std::cout << "Eq at dir=" << fdir << "\n"; + // real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real feqL = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // ff[fdir] = feqL; + // } + //} + //real sumRho2= 0; + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // sumRho2 += ff[fdir];// -D3Q27System::getIncompFeqForDirection(fdir, 0, sumVx, sumVy, sumVz); + //} + //ff[DIR_000] = rhoL - sumRho2; + //rhoL = 27.0 / 18.0 * sumRho2; + //std::cout << "rhoL=" << rhoL <<" sumRho="<< 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "\n"; + D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + //std::cout << "RecalCrhoL=" << rhoL << " sumRho=" << 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "ffRest="<<ff[DIR_000]<<"\n"; +// distribution->setDistributionForDirection(ff[DIR_000], x1, x2, x3, DIR_000); + { + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + distribution->setDistributionForDirection(fG - feqOLD + feqNew, x1, x2, x3, DIR_000); + } + +//for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // ff[D3Q27System::INVDIR[fdir]]=distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + //} + //D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + //std::cout << "AfterRead rhoL=" << rhoL << " rhoGToL=" << rhoG/densityRatio << " vx=" << vx << " vy=" << vy << "ffRest=" << ff[DIR_000] <<" x="<<x1<<" y="<<x2<<" z="<<x3<< "\n"; + + //real feqL = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + //distribution->setDistributionForDirection(feqL, x1, x2, x3, DIR_000); + + + + } + + + + } + + + //if ((*phaseField)(x1, x2, x3) <= c1o2) { + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, 0, 0.0001, 0); + // ff[D3Q27System::INVDIR[fdir]] = feqNew; + // distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // } + //} + //16.03.23 B: Bounce Back gas side + //distribution->getDistributionInv(ff, x1, x2, x3); + //real rhoG; + //if (phi[DIR_000] > c1o2) { //initialization necessary + // real sumRho = 0; + // real sumWeight = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] <= c1o2)) { + // sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumWeight += WEIGTH[fdir]; + // } + + // } + // rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neigbor? + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = fG - c6o1 * WEIGTH[fdir] * (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX2[fdir] * vzBC); + + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + // } + // } + // distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + + + + //} + //else {//no refill of gas required + // rhoG = (*rhoNode)(x1, x2, x3); + // if ((*phaseField)(x1, x2, x3) <= c1o2) {//no refill liquid + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = fG - c6o1 * WEIGTH[fdir] * (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX2[fdir] * vzBC); + + // //if ((*phaseField)(x1, x2, x3) <= c1o2) + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // //real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + + // } + + + // } + // } + // else {//refill liquid + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = fG-c6o1*WEIGTH[fdir]*(D3Q27System::DX1[fdir]*vxBC+ D3Q27System::DX2[fdir] * vyBC+ D3Q27System::DX2[fdir] * vzBC); + + // ff[D3Q27System::INVDIR[fdir]] = fBC; + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + + // } + // else { + // ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]);; + // } + + + // } + + // real sum2 = 1e-100; + // real sumRho = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + + // sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; + // sum2 += WEIGTH[fdir]; + // } + // } + // real rhoL; + // D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + // rhoL = sumRho / sum2; + + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * D3Q27System::DX3[fdir]);; + // distribution->setDistributionForDirection(fL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // } + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] <= c1o2)) { + // real feqL = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // } + // } + + // real feqL = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1, x2, x3, DIR_000); + + + + // } + + + + //} + + + + + //16.03.23 A: scaled pressure + //distribution->getDistributionInv(ff, x1, x2, x3); + //real rhoG; + //if (phi[DIR_000] > c1o2) { //initialization necessary + // real sumRho = 0; + // real sumWeight = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] <= c1o2)) { + // sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumWeight += WEIGTH[fdir]; + // } + + // } + // rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neigbor? + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + // } + // } + // distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + + + + //} + //else {//no refill of gas required + // rhoG = (*rhoNode)(x1, x2, x3); + // if ((*phaseField)(x1, x2, x3) <= c1o2) {//no refill liquid + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // //if ((*phaseField)(x1, x2, x3) <= c1o2) + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + + // } + + + // } + // } + // else {//refill liquid + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // ff[D3Q27System::INVDIR[fdir]] = fBC; + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + + // } + // else { + // ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]);; + // } + + + // } + + // real sum2 = 1e-100; + // real sumRho = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // + // sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; + // sum2 += WEIGTH[fdir]; + // } + // } + // real rhoL; + // D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + // rhoL=sumRho/sum2; + + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * D3Q27System::DX3[fdir]);; + // distribution->setDistributionForDirection(fL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // } + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] <= c1o2)) { + // real feqL = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // } + // } + + // real feqL = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 , x2, x3 , DIR_000); + + + + // } + + + + //} + + + + + + + + + + + +}//end Loop + + + + + + //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; + // int x3p = x3 + 1; + // findNeighbors(phaseFieldOld, x1, x2, x3); + // ////////////////////////////////Momentum conservation experiment 06.03.2023 + // //surfacetension + // real kapkap = 0*1.0e-5; + // //real scalRefill = 0.0; + // real slowerFactor = 1.0e6; + // if (((*phaseField)(x1, x2, x3) <= c1o2) && ( + // (phi[DIR_P00] > c1o2) || + // (phi[DIR_M00] > c1o2) || + // (phi[DIR_00P] > c1o2) || + // (phi[DIR_00M] > c1o2) || + // (phi[DIR_0M0] > c1o2) || + // (phi[DIR_0P0] > c1o2) || + // (phi[DIR_PP0] > c1o2) || + // (phi[DIR_PM0] > c1o2) || + // (phi[DIR_P0P] > c1o2) || + // (phi[DIR_P0M] > c1o2) || + // (phi[DIR_MP0] > c1o2) || + // (phi[DIR_MM0] > c1o2) || + // (phi[DIR_M0P] > c1o2) || + // (phi[DIR_M0M] > c1o2) || + // (phi[DIR_0PM] > c1o2) || + // (phi[DIR_0MM] > c1o2) || + // (phi[DIR_0PP] > c1o2) || + // (phi[DIR_0MP] > c1o2) || + // (phi[DIR_PPP] > c1o2) || + // (phi[DIR_PMP] > c1o2) || + // (phi[DIR_MPP] > c1o2) || + // (phi[DIR_MMP] > c1o2) || + // (phi[DIR_PPM] > c1o2) || + // (phi[DIR_PMM] > c1o2) || + // (phi[DIR_MPM] > c1o2) || + // (phi[DIR_MMM] > c1o2) + // )) { + // real vx = (*vxNode)(x1, x2, x3); + // real vy = (*vyNode)(x1, x2, x3); + // real vz = (*vzNode)(x1, x2, x3); + + + // distribution->getDistributionInv(ff, x1, x2, x3); + // real rhoG; + // if (phi[DIR_000] > c1o2) { //initialization necessary + // real sumRho = 0; + // real sumWeight = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] <= c1o2)) { + // sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumWeight += WEIGTH[fdir]; + // } + + // } + // rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neigbor? + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + // } + // } + // distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + + + + // } + // else {//no refill required + + // rhoG = (*rhoNode)(x1, x2, x3); + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[fdir] > c1o2)) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real vxBC =c1o2*(vx+ (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC =c1o2*(vy+ (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC =c1o2*(vz+ (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])*(D3Q27System::DX1[fdir])* (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC+fG) / densityRatio-fL+kapkap* WEIGTH[fdir]* computeCurvature_phi() -(feqG-feqL)*(c1o1/densityRatio-c1o1)*(vxBC* D3Q27System::DX1[fdir]+vyBC* D3Q27System::DX2[fdir]+vzBC* D3Q27System::DX3[fdir]), x1 , x2 , x3 , fdir); + // } + + // } + // else { + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy,vz); + // real slower = c1o1/(c1o1+slowerFactor * (vx * vx + vy * vy + vz * vz)); + // real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG / densityRatio, slower * vx, slower * vy, slower * vz); + // real fBC = (fG - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + + // distribution->setDistributionForDirection(fBC, x1, x2 , x3 , fdir); + + // ////inverse refill from here + // //int xn1 = x1 + D3Q27System::DX1[fdir]; + // //int xn2 = x2 + D3Q27System::DX2[fdir]; + // //int xn3 = x3 + D3Q27System::DX3[fdir]; + // //real sumRho = 0; + // //real sumWeight = 0; + // //for (int nfdir = D3Q27System::STARTF; nfdir < D3Q27System::ENDF; nfdir++) { + // // if ((phi[nfdir] > c1o2)) { + // // sumRho += WEIGTH[nfdir] * (*rhoNode)(xn1 + D3Q27System::DX1[nfdir], xn2 + D3Q27System::DX2[nfdir], xn3 + D3Q27System::DX3[nfdir]); + // // sumWeight += WEIGTH[nfdir]; + // // } + // //} + // ////real rhoL = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neigbor? + // //real rhoL = c1o2*(sumRho / sumWeight * scalRefill + (c1o1 - scalRefill) * rhoG / densityRatio);// + + // //// what comes next is the inversion of BC for the gas phase which is only used to derive the liquid BC + // //real fBC = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // ////real feqOld = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////Dirty + // //real feqOld = D3Q27System::getIncompFeqForDirection(fdir, rhoL, -(*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), -(*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), -(*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real fL = (fBC - feqNew) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqOld; + + + // //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // //real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // ////real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL + kapkap * WEIGTH[fdir] * computeCurvature_phi() - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // ////distribution->setDistributionForDirection(( fG) / densityRatio - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // + // + // } + // } + // + // } + + // } + + + + + + + // + + // + // + // } + // if (((*phaseField)(x1, x2, x3) > c1o2) && ((*phaseFieldOld)(x1, x2, x3) <= c1o2)) { + // real vx = (*vxNode)(x1, x2, x3); + // real vy = (*vyNode)(x1, x2, x3); + // real vz = (*vzNode)(x1, x2, x3); + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // if (((*phaseFieldOld)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) <= c1o2) { + // real rhoG = (*rhoNode)(x1, x2, x3); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real slower = c1o1 / (c1o1 + slowerFactor * (vx * vx + vy * vy + vz * vz)); + // real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG / densityRatio, slower*vx, slower*vy, slower*vz); + // real fBC = (fG - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + + // distribution->setDistributionForDirection(fBC, x1, x2, x3, fdir); + + // /////reverse liquid + // //int xn1 = x1 + D3Q27System::DX1[fdir]; + // //int xn2 = x2 + D3Q27System::DX2[fdir]; + // //int xn3 = x3 + D3Q27System::DX3[fdir]; + // //real sumRho = 0; + // //real sumWeight = 0; + // //for (int nfdir = D3Q27System::STARTF; nfdir < D3Q27System::ENDF; nfdir++) { + // // if ((phi[nfdir] > c1o2)) { + // // sumRho += WEIGTH[nfdir] * (*rhoNode)(xn1 + D3Q27System::DX1[nfdir], xn2 + D3Q27System::DX2[nfdir], xn3 + D3Q27System::DX3[nfdir]); + // // sumWeight += WEIGTH[nfdir]; + // // } + // //} + // ////real rhoL = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neigbor? + // //real rhoL = (sumRho / sumWeight*scalRefill+(c1o1-scalRefill)*(*rhoNode)(x1, x2, x3) / densityRatio);// + // //// what comes next is the inversion of BC for the gas phase which is only used to derive the liquid BC + // //real fBC = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // ////real feqOld = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////Dirty + // //real feqOld = D3Q27System::getIncompFeqForDirection(fdir, rhoL, -(*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), -(*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), -(*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1, x2, x3), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real fL = (fBC - feqNew) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqOld; + + + // //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // //real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // ////real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + // ////real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // //distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL + kapkap * WEIGTH[fdir] * computeCurvature_phi() - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + + // /////!reverse liquid + // // + // ////distribution->setDistributionForDirection((fG) / densityRatio - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + // else { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1, x2, x3), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + // distribution->setDistributionForDirection((fBC + fG) / densityRatio - fL + kapkap * WEIGTH[fdir] * computeCurvature_phi() - (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + // } + // + // } + + + + // } + + + + + + ////////////////////////////////////// + +// //if ((phi[DIR_000] > c1o2) && ( +// // (phi[DIR_P00] <= c1o2) || +// // (phi[DIR_M00] <= c1o2) || +// // (phi[DIR_00P] <= c1o2) || +// // (phi[DIR_00M] <= c1o2) || +// // (phi[DIR_0M0] <= c1o2) || +// // (phi[DIR_0P0] <= c1o2) || +// // (phi[DIR_PP0] <= c1o2) || +// // (phi[DIR_PM0] <= c1o2) || +// // (phi[DIR_P0P] <= c1o2) || +// // (phi[DIR_P0M] <= c1o2) || +// // (phi[DIR_MP0] <= c1o2) || +// // (phi[DIR_MM0] <= c1o2) || +// // (phi[DIR_M0P] <= c1o2) || +// // (phi[DIR_M0M] <= c1o2) || +// // (phi[DIR_0PM] <= c1o2) || +// // (phi[DIR_0MM] <= c1o2) || +// // (phi[DIR_0PP] <= c1o2) || +// // (phi[DIR_0MP] <= c1o2) || +// // (phi[DIR_PPP] <= c1o2) || +// // (phi[DIR_PMP] <= c1o2) || +// // (phi[DIR_MPP] <= c1o2) || +// // (phi[DIR_MMP] <= c1o2) || +// // (phi[DIR_PPM] <= c1o2) || +// // (phi[DIR_PMM] <= c1o2) || +// // (phi[DIR_MPM] <= c1o2) || +// // (phi[DIR_MMM] <= c1o2) +// // )) { +// +// // real vx = (*vxNode)(x1, x2, x3); +// // real vy = (*vyNode)(x1, x2, x3); +// // real vz = (*vzNode)(x1, x2, x3); +// +// +// // distribution->getDistributionInv(ff, x1, x2, x3); +// // real rhoG; +// // //D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// // real sumRhoG = 0.0; +// // int countRhoG = 0; +// // for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) { +// // if ((phi[fdir] <= c1o2)) { +// // //BC version +// // // rhoG = (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // //real ftemp = D3Q27System::getCompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz) + D3Q27System::getCompFeqForDirection(fdir, rhoG, vx, vy, vz); +// // // +// // //real fBB; +// // //fBB = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// // //distribution->setDistributionForDirection((ftemp - ff[fdir]), x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// // //distribution->setDistributionForDirection(fBB - c6o1 * D3Q27System::WEIGTH[fdir] * (-vx * D3Q27System::DX1[fdir] - vy * D3Q27System::DX2[fdir] - vz * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); +// // //scaled Version +// +// // real fG; +// // fG = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// +// // //Liquid +// // real ssrho = 1; +// // real rhoLL = (*rhoNode)(x1, x2, x3); +// +// // //real rhoFilter = (*rhoNode)(x1, x2, x3)*c8o27 +// // // + c2o27*(((*rhoNode)(x1 + 1, x2, x3) + (*rhoNode)(x1 - 1, x2, x3)) + ((*rhoNode)(x1, x2 + 1, x3) + (*rhoNode)(x1, x2 - 1, x3)) + ((*rhoNode)(x1, x2, x3 + 1) + (*rhoNode)(x1, x2, x3 - 1))) +// // // + c1o54*((((*rhoNode)(x1 + 1, x2 + 1, x3) + (*rhoNode)(x1 - 1, x2 - 1, x3)) + ((*rhoNode)(x1 - 1, x2 + 1, x3) + (*rhoNode)(x1 + 1, x2 - 1, x3))) +// // // + (((*rhoNode)(x1 + 1, x2, x3 + 1) + (*rhoNode)(x1 - 1, x2, x3 - 1)) + ((*rhoNode)(x1 - 1, x2, x3 + 1) + (*rhoNode)(x1 + 1, x2, x3 - 1))) +// // // + (((*rhoNode)(x1, x2 + 1, x3 + 1) + (*rhoNode)(x1, x2 - 1, x3 - 1)) + ((*rhoNode)(x1, x2 - 1, x3 + 1) + (*rhoNode)(x1, x2 + 1, x3 - 1))) +// // // ) +// // // + c1o216*( +// // // (((*rhoNode)(x1 + 1, x2 + 1, x3 + 1) + (*rhoNode)(x1 - 1, x2 - 1, x3 - 1)) + ((*rhoNode)(x1 + 1, x2 - 1, x3 + 1) + (*rhoNode)(x1 - 1, x2 + 1, x3 - 1))) +// // // + (((*rhoNode)(x1 + 1, x2 + 1, x3 - 1) + (*rhoNode)(x1 - 1, x2 - 1, x3 + 1)) + ((*rhoNode)(x1 + 1, x2 - 1, x3 - 1) + (*rhoNode)(x1 - 1, x2 + 1, x3 + 1))) +// // // ); +// // real rhoGG = (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // real feqOLD = (D3Q27System::getIncompFeqForDirection(fdir, rhoLL/densityRatio, vx, vy, vz)); +// // real feqNew = (D3Q27System::getIncompFeqForDirection(fdir, rhoLL*(c1o1-ssrho)+ssrho*rhoGG, vx, vy, vz)); +// // //real feqNew = (D3Q27System::getIncompFeqForDirection(fdir, rhoFilter, vx, vy, vz)); +// // distribution->setDistributionForDirection( (ff[fdir] - feqOLD)*(c1o1/collFactorG-c1o1)/(c1o1/collFactorL-c1o1) + feqNew, x1, x2, x3, fdir); +// +// // feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// // feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) / densityRatio, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// // distribution->setDistributionForDirection((fG - feqOLD)* (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// // sumRhoG += (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // countRhoG++; +// +// +// // } +// // } +// // (*rhoNode)(x1, x2, x3) = sumRhoG / countRhoG; +// +// if ((phi[DIR_000] > c1o2) && ( +// (phi[DIR_P00] <= c1o2) || +// (phi[DIR_M00] <= c1o2) || +// (phi[DIR_00P] <= c1o2) || +// (phi[DIR_00M] <= c1o2) || +// (phi[DIR_0M0] <= c1o2) || +// (phi[DIR_0P0] <= c1o2) || +// (phi[DIR_PP0] <= c1o2) || +// (phi[DIR_PM0] <= c1o2) || +// (phi[DIR_P0P] <= c1o2) || +// (phi[DIR_P0M] <= c1o2) || +// (phi[DIR_MP0] <= c1o2) || +// (phi[DIR_MM0] <= c1o2) || +// (phi[DIR_M0P] <= c1o2) || +// (phi[DIR_M0M] <= c1o2) || +// (phi[DIR_0PM] <= c1o2) || +// (phi[DIR_0MM] <= c1o2) || +// (phi[DIR_0PP] <= c1o2) || +// (phi[DIR_0MP] <= c1o2) || +// (phi[DIR_PPP] <= c1o2) || +// (phi[DIR_PMP] <= c1o2) || +// (phi[DIR_MPP] <= c1o2) || +// (phi[DIR_MMP] <= c1o2) || +// (phi[DIR_PPM] <= c1o2) || +// (phi[DIR_PMM] <= c1o2) || +// (phi[DIR_MPM] <= c1o2) || +// (phi[DIR_MMM] <= c1o2) +// )) { +// real vx = (*vxNode)(x1, x2, x3); +// real vy = (*vyNode)(x1, x2, x3); +// real vz = (*vzNode)(x1, x2, x3); +// +// +// //distribution->getDistributionInv(ff, x1, x2, x3); +// +// if ((*phaseField)(x1, x2, x3) > c1o2) { +// +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) {// populations without DIR_000 +// if ((phi[fdir] <= c1o2)) { +// real fG = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) / densityRatio, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// distribution->setDistributionForDirection((fG - feqOLD)* (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// +// } +// } +// +// +// } +// else { +// //refill necessary +// real sumRho = 0; +// real sumWeight = 0; +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if ((phi[fdir] > c1o2)) { +// sumRho += WEIGTH[fdir]*(*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// sumWeight += WEIGTH[fdir]; +// } +// } +// sumRho /= sumWeight; +// +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if ((phi[fdir] > c1o2)) { +// real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], sumRho, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// ff[D3Q27System::INVDIR[fdir]] = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; +// } +// else { ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// } +// } +// +// real rhoG; +// D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// sumRho = 0; +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// sumRho = ff[fdir] - D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); +// } +// rhoG = 27.0 / 19.0 * sumRho; +// distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1 , x2 , x3 , DIR_000); +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// //if ((phi[fdir] > c1o2)) { +// distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// //} +// } +// +// +// } +// +// +// } +// else if ((phi[DIR_000] <= c1o2) && ( +// (phi[DIR_P00] > c1o2) || +// (phi[DIR_M00] > c1o2) || +// (phi[DIR_00P] > c1o2) || +// (phi[DIR_00M] > c1o2) || +// (phi[DIR_0M0] > c1o2) || +// (phi[DIR_0P0] > c1o2) || +// (phi[DIR_PP0] > c1o2) || +// (phi[DIR_PM0] > c1o2) || +// (phi[DIR_P0P] > c1o2) || +// (phi[DIR_P0M] > c1o2) || +// (phi[DIR_MP0] > c1o2) || +// (phi[DIR_MM0] > c1o2) || +// (phi[DIR_M0P] > c1o2) || +// (phi[DIR_M0M] > c1o2) || +// (phi[DIR_0PM] > c1o2) || +// (phi[DIR_0MM] > c1o2) || +// (phi[DIR_0PP] > c1o2) || +// (phi[DIR_0MP] > c1o2) || +// (phi[DIR_PPP] > c1o2) || +// (phi[DIR_PMP] > c1o2) || +// (phi[DIR_MPP] > c1o2) || +// (phi[DIR_MMP] > c1o2) || +// (phi[DIR_PPM] > c1o2) || +// (phi[DIR_PMM] > c1o2) || +// (phi[DIR_MPM] > c1o2) || +// (phi[DIR_MMM] > c1o2) +// )) { +// real vx = (*vxNode)(x1, x2, x3); +// real vy = (*vyNode)(x1, x2, x3); +// real vz = (*vzNode)(x1, x2, x3); +// +// +// //distribution->getDistributionInv(ff, x1, x2, x3); +// if ((*phaseField)(x1, x2, x3) <= c1o2) { +// ////explicit way: +// ////real ppph = (*phaseField)(x1, x2, x3); +// // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// // if ((phi[fdir] > c1o2)) { +// // //vx = (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // //vy = (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // //vz = (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // //real rhorho = (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // //int xx1 = x1 + D3Q27System::DX1[fdir]; +// // //int xx2 = x2 + D3Q27System::DX2[fdir]; +// // //int xx3 = x3 + D3Q27System::DX3[fdir]; +// +// // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 , x2 , x3 ), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// // distribution->setDistributionForDirection((fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// // } +// // } +///////iterative way: +// real rhoG = (*rhoNode)(x1, x2, x3); +// //real sumWeight=0; +// //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// // if ((phi[fdir] > c1o2)) { +// // rhoG += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// // sumWeight += WEIGTH[fdir]; +// // } +// //} +// //rhoG = rhoG/sumWeight*densityRatio; +// +// for (int itter = 0; itter < 5; itter++) { +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if ((phi[fdir] > c1o2)) { +// real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// ff[D3Q27System::INVDIR[fdir]] = ((fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew); +// } +// else { ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); } +// } +// ff[DIR_000]= distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); +// D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// //real sumRho = 0; +// //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// // sumRho = ff[fdir] - D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); +// //} +// //rhoG = 27.0 / 19.0 * sumRho; +// } +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// +// distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// +// } +// //distribution->setDistributionForDirection(ff[DIR_000], x1, x2, x3, DIR_000); +// +// +// +// +// } +// else { +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if ((phi[fdir] <= c1o2)) { +// real fG = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) / densityRatio, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); +// ff[D3Q27System::INVDIR[fdir]] = (fG - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; +// distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); +// } +// else { ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]);} +// } +// real rhoG; +// D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// real sumRho = 0; +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// sumRho = ff[fdir] - D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); +// } +// rhoG = 27.0 / 19.0 * sumRho; +// distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); +// +// +// +// } +// +// } +// +// + } + } + } + } + + + + this->swapDistributions(); + + for (int x3 = minX3; x3 < maxX3; x3++) { + for (int x2 = minX2; x2 < maxX2; x2++) { + for (int x1 = minX1; x1 < maxX1; x1++) { + + //int x1p = x1 + 1; + //int x2p = x2 + 1; + //int x3p = x3 + 1; + findNeighbors(phaseFieldOld, x1, x2, x3); + + //if (((*phaseField)(x1, x2, x3) > c1o2) && (((*phaseFieldOld)(x1, x2, x3) <= c1o2))) + {//Refill liquid + real vx; + real vy; + real vz; + + + distribution->getDistribution(ff, x1, x2, x3); + real rhoL; + D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + //if (vz != 0) { + + // std::cout << "precol: rhoL=" << rhoL << " vx=" << vx << " vy=" << vy << " vz=" << vz << "ffRest=" << ff[DIR_000] << " x=" << x1 << " y=" << x2 << " z=" << x3 << "\n"; + //} + } + + } + } +} + + + + ////////momentum balance 06.03.2023 + //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; + // if (((*phaseField)(x1, x2, x3) > c1o2) && (((*phaseFieldOld)(x1, x2, x3) <= c1o2))) + // {//Refill liquid + // real vx; + // real vy; + // real vz; + + + // distribution->getDistribution(ff, x1, x2, x3); + // real rhoL; + // D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + // std::cout << "precol: rhoL=" << rhoL << " vx=" << vx << " vy=" << vy << "ffRest=" << ff[DIR_000] << " x=" << x1 << " y=" << x2 << " z=" << x3 << "\n"; + // } + // } + // } + // } + //} + + + // real sumRho = 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // sumRho = ff[fdir] - D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // } + // rhoL = 27.0 / 19.0 * sumRho; + // distribution->setDistributionInvForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz), x1, x2, x3, DIR_000); + + + // } + // } + // } + // } + //} + + + //////rescaling new liquid nodes 10.03.2023 +// 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; +// if (((*phaseField)(x1, x2, x3) > c1o2) && (((*phaseFieldOld)(x1, x2, x3) <= c1o2))) +// {//Refill liquid +// real vx; +// real vy; +// real vz; +// +// findNeighbors(phaseFieldOld, x1, x2, x3); +// +// //real rhoG; +// //D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// +// //vx = (*vxNode)(x1, x2, x3); +// //vy = (*vyNode)(x1, x2, x3); +// //vz = (*vzNode)(x1, x2, x3); +// +// +// //for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) {// loop includes DIR_000 position, different from all the others +// // real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, rhoG,vx,vy,vz); +// // real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG/densityRatio,vx,vy,vz); +// // real fBC = (ff[fdir] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; +// +// // distribution->setDistributionInvForDirection(fBC, x1 , x2 , x3 ,fdir); +// +// +// +// //} +////15.03.2023 +// real sumVx=0, sumVy=0, sumVz=0; +// real tempRho, tempVx, tempVy, tempVz; +// real sumRho = 0; +// real sum = 1e-100; +// real sum2 = 1e-100; +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if (!(((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) > c1o2) && (((*phaseFieldOld)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) <= c1o2)))&& !bcArray->isSolid(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) && !bcArray->isUndefined(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) { +// //distribution->getDistribution(ff, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); +// //D3Q27System::calcIncompMacroscopicValues(ff, tempRho, tempVx, tempVy, tempVz); +// sum += WEIGTH[fdir]; +// sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);//*tempVx; +// sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);//*tempVy; +// sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);//*tempVz; +// if ((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) > c1o2) { +// sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; +// sum2 += WEIGTH[fdir]; +// } +// if (tempVz != 0) { +// std::cout << "vz=" << tempVz << " " << "x=" << x1 << " " << "y=" << x2 << " " << "z=" << x3 << " fdir=" << fdir << " " << "xn=" << x1 + D3Q27System::DX1[fdir] << " " << "yn=" << x2 + D3Q27System::DX2[fdir] << " " << "zn=" << x3 + D3Q27System::DX3[fdir]<<"vzold="<< (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) << "\n"; +// } +// } +// } +// sumRho/=sum2 ; +// sumVx /= sum; +// sumVy /= sum; +// sumVz /= sum; +// distribution->setDistributionInvForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, sumRho, sumVx, sumVy, sumVz), x1, x2, x3, DIR_000); +// +// std::cout << "x=" << x1 << " " << "y=" << x2 << " " << "z=" << x3 <<" sumVx="<<sumVx<< " sumVy=" << sumVy << " sumVz=" << sumVz << " sumRho=" << sumRho << "\n"; +// +////14.03.2023 +// distribution->getDistribution(ff, x1, x2, x3); +// real rhoG= (*rhoNode)(x1, x2, x3); +// +// vx = (*vxNode)(x1, x2, x3); +// vy = (*vyNode)(x1, x2, x3); +// vz = (*vzNode)(x1, x2, x3); +// std::cout << " Vx=" << vx << " Vy=" << vy << " Vz=" << vz << " rhoL=" << (*rhoNode)(x1, x2, x3) / densityRatio << "\n"; +// +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// if (phi[D3Q27System::INVDIR[fdir]] <= c1o2 && phi[fdir] > c1o2) { +// //ff[fdir] = ff[D3Q27System::INVDIR[fdir]] + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * D3Q27System::DX3[fdir]); +// ff[fdir] = ff[D3Q27System::INVDIR[fdir]] + c6o1 * WEIGTH[fdir] * (sumVx * D3Q27System::DX1[fdir] + sumVy * D3Q27System::DX2[fdir] + sumVz * D3Q27System::DX3[fdir]); +// //ff[fdir] = D3Q27System::getIncompFeqForDirection(fdir, sumRho, sumVx, sumVy, sumVz); +// distribution->setDistributionInvForDirection(ff[fdir], x1, x2, x3, fdir); +// } +// if (phi[fdir] <= c1o2 && phi[D3Q27System::INVDIR[fdir]] <= c1o2) { +// //ff[fdir] = D3Q27System::getIncompFeqForDirection(fdir, rhoG / densityRatio, vx, vy, vz); +// ff[fdir]= D3Q27System::getIncompFeqForDirection(fdir, sumRho, sumVx, sumVy, sumVz); +// distribution->setDistributionInvForDirection(ff[fdir], x1, x2, x3, fdir); +// } +// } +// real rhoL; +// //D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); +// +// +// //real sumRho; +// real sumRho2= 0; +// for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { +// sumRho2 += ff[fdir];// -D3Q27System::getIncompFeqForDirection(fdir, 0, sumVx, sumVy, sumVz); +// } +// rhoL = 27.0 / 19.0 * sumRho; +// //distribution->setDistributionInvForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz), x1, x2, x3, DIR_000); +// //distribution->setDistributionInvForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, sumVx, sumVy, sumVz), x1, x2, x3, DIR_000); +// ff[DIR_000] = sumRho - sumRho2; +// distribution->setDistributionInvForDirection(ff[DIR_000], x1, x2, x3, DIR_000); +// D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); +// std::cout << " calcVx=" << vx << " calcVy=" << vy << " calcVz=" << vz << " rhoG=" << rhoG << "\n"; +// +// +// +// } +// } +// } +// } +// } + + + //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; + + + + // real mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + // real mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + // real mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + // real mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + // real mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + // real mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + // real mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + // real mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + // real mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + // real mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + // real mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + // real mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + // real mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + // real mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + // real mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + // real mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + // real mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + // real mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + // real mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + // real mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + // real mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + // real mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + // real mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + // real mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + // real mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + // real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + // real mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3); + + // omegaDRho = 2.0;// 1.5; + // real phiOld = (*phaseField)(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 (phiOld > 0.49 && phiOld < 0.501) { + // // real ppppppppp = (*phaseField)(x1, x2, x3); + // // int ist = 1; + // //} + // //if (phiOld > 0.5 && (*phaseField)(x1, x2, x3) <= 0.5) { + // // real ppppppppp = (*phaseField)(x1, x2, x3); + // // int ist = 1; + // //} + + + // if ((*phaseField)(x1, x2, x3) > 1 ) { + // (*phaseField)(x1, x2, x3) = c1o1; + // } + + // if ((*phaseField)(x1, x2, x3) < 0) { + // (*phaseField)(x1, x2, x3) = 0; + // } + // ////// read F-distributions for velocity formalism + // if (((phiOld <= 0.5) && ((*phaseField)(x1, x2, x3) <= 0.5)) || ((phiOld > 0.5) && ((*phaseField)(x1, x2, x3) > 0.5))) {} + // else { + // real scaleDistribution = densityRatio;// gas turn liquid + // real scaleStress = (c1o1/collFactorG)/(c1o1/collFactorL); + // if ((phiOld > 0.5) && ((*phaseField)(x1, x2, x3) <= 0.5)) { + // scaleDistribution = 1.0 / densityRatio; + // scaleStress = (c1o1 / collFactorL) / (c1o1 / collFactorG); + // //liquid turned gas + // } + + // 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); + + // distribution->getDistribution(ff, x1, x2, x3); + // real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + // (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + // (mfcbb - mfabb)); + // real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + // (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + // (mfbcb - mfbab)) ; + // real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + // (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + + // (mfbbc - mfbba)) ; + // real drho = (((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; + // //real mp= c3o1*(((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) + + // // c2o1*(((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) + + // // ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) + + // // (mfbab + mfbcb) + (mfbba + mfbbc)); + // //mp -= vvx * vvx - vvy * vvy - vvz * vvz; + // real drhoScaled = drho / scaleDistribution; + // if (((*phaseField)(x1, x2, x3) <= 0.5)) { drhoScaled = (*rhoNode)(x1, x2, x3); } + + // //mp = 2 * drho - mp; + // for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) { + // real feqOLD = (D3Q27System::getIncompFeqForDirection(fdir, drho, vvx, vvy, vvz)); + // real feqNew = (D3Q27System::getIncompFeqForDirection(fdir, drhoScaled, vvx, vvy, vvz)); + // distribution->setDistributionInvForDirection((ff[fdir]-feqOLD)* scaleStress +feqNew,x1,x2,x3,fdir); + // } + + + + + + // } + // } + // } + // } + //} + + real collFactorM; + + + + + + + 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; + + + +// real mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); +// real mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); +// real mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); +// real mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); +// real mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); +// real mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); +// real mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); +// real mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); +// real mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); +// real mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); +// real mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); +// real mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); +// real mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); +// +// real mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); +// real mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); +// real mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); +// real mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); +// real mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); +// real mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); +// real mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); +// real mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); +// real mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); +// real mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); +// real mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); +// real mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); +// real mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); +// +// real mfbbb = (*this->zeroDistributionsF)(x1, x2, x3); +// +// real m0, m1, m2; +// +// real rho = (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; +// +// real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + +// (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + +// (mfcbb - mfabb)); +// real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + +// (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + +// (mfbcb - mfbab)); +// real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + +// (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + +// (mfbbc - mfbba)); +// +// //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 +// } +// /////////////////////////////////////////////////////////////////////////////////////////// +// real 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 = 1. - (oMdrho + m0); +// +// real vx2; +// real vy2; +// real vz2; +// vx2 = vvx * vvx; +// vy2 = vvy * vvy; +// vz2 = vvz * vvz; +// //////////////////////////////////////////////////////////////////////////////////// +// real wadjust; +// real 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 +// //////////////////////////////////////////////////////////////////////////////////// +// real OxxPyyPzz = 1.; //omega2 or bulk viscosity +// real OxyyPxzz = 1.;//-s9;//2+s9;// +// //real OxyyMxzz = 1.;//2+s9;// +// real O4 = 1.; +// real O5 = 1.; +// real O6 = 1.; +// real OxyyMxzz = 1.; +// //real OxyyPxzz = 1.; +// +// //Cum 4. +// //real CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 +// //real CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 +// //real CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 +// +// real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); +// real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); +// real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); +// +// real CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - 1.) * oMdrho); +// real CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - 1.) * oMdrho); +// real CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - 1.) * oMdrho); +// +// //Cum 5. +// real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; +// real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; +// real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; +// +// //Cum 6. +// real 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 +// real mxxPyyPzz = mfcaa + mfaca + mfaac; +// real mxxMyy = mfcaa - mfaca; +// real mxxMzz = mfcaa - mfaac; +// +// real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz); +// real dyuy = dxux + collFactorM * c3o2 * mxxMyy; +// real dzuz = dxux + collFactorM * c3o2 * mxxMzz; +// +// //relax +// mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); +// mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); +// mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vz2 * 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 +// real mxxyPyzz = mfcba + mfabc; +// real mxxyMyzz = mfcba - mfabc; +// +// real mxxzPyyz = mfcab + mfacb; +// real mxxzMyyz = mfcab - mfacb; +// +// real mxyyPxzz = mfbca + mfbac; +// real 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 * 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 - 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 * (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 +// real 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; +// //real dif = fabs(rho - rho_post); +// real dif = rho - 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) +// + " in " + block.lock()->toString() + " step = " + UbSystem::toString(step))); +// } +//#endif +// ////////////////////////////////////////////////////////////////////////// +// //write distribution +// ////////////////////////////////////////////////////////////////////////// +// (*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; +// +// findNeighbors(phaseField, x1, x2, x3); +// real dX1_phi = gradX1_phi(); +// real dX2_phi = gradX2_phi(); +// real dX3_phi = gradX3_phi(); +// +// real denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi)+ 1.0e-20;//+ 1e-9+1e-3; +// +// real normX1 = dX1_phi / denom; +// real normX2 = dX2_phi / denom; +// real normX3 = dX3_phi / denom; + ////////////////////////////////////////////////////////////////////////// + +// ////////////////old kernel +// ////////////////////////////////////////////////////////////////////////// +// // 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); + + real mfcbb ;//= (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb ;//= (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc ;//= (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); + real mfccb ;//= (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb ;//= (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc ;//= (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc ;//= (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc ;//= (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac ;//= (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc ;//= (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc ;//= (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac ;//= (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac ;//= (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca ;//= (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb ;//= (*this->zeroDistributionsF)(x1, x2, x3); + + + //real mfhcbb ;//= (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3); + //real mfhbcb ;//= (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3); + //real mfhbbc ;//= (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3); + //real mfhccb ;//= (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3); + //real mfhacb ;//= (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3); + //real mfhcbc ;//= (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3); + //real mfhabc ;//= (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3); + //real mfhbcc ;//= (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3); + //real mfhbac ;//= (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3); + //real mfhccc ;//= (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3); + //real mfhacc ;//= (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3); + //real mfhcac ;//= (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3); + //real mfhaac ;//= (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3); + //real mfhabb ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3); + //real mfhbab ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3); + //real mfhbba ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p); + //real mfhaab ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3); + //real mfhcab ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3); + //real mfhaba ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p); + //real mfhcba ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p); + //real mfhbaa ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p); + //real mfhbca ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p); + //real mfhaaa ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p); + //real mfhcaa ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p); + //real mfhaca ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p); + //real mfhcca ;//= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p); + //real mfhbbb ;//= (*this->zeroDistributionsH2)(x1, x2, x3); + + + //if (phi[DIR_000] < c1o2) + //{ + 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); + + + // mfhcbb= (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3); + // mfhbcb= (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3); + // mfhbbc= (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3); + // mfhccb= (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3); + // mfhacb= (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3); + // mfhcbc= (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3); + // mfhabc= (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3); + // mfhbcc= (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3); + // mfhbac= (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3); + // mfhccc= (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3); + // mfhacc= (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3); + // mfhcac= (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3); + // mfhaac= (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3); + // mfhabb= (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3); + // mfhbab= (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3); + // mfhbba= (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p); + // mfhaab= (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3); + // mfhcab= (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3); + // mfhaba= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p); + // mfhcba= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p); + // mfhbaa= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p); + // mfhbca= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p); + // mfhaaa= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p); + // mfhcaa= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p); + // mfhaca= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p); + // mfhcca= (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p); + // mfhbbb= (*this->zeroDistributionsH2)(x1, x2, x3); + + //} + //else + //{ + // mfhcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); + // mfhbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); + // mfhbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); + // mfhccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); + // mfhacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); + // mfhcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); + // mfhabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); + // mfhbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); + // mfhbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); + // mfhccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); + // mfhacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); + // mfhcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); + // mfhaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); + // mfhabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); + // mfhbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); + // mfhbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); + // mfhaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); + // mfhcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); + // mfhaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); + // mfhcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); + // mfhbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); + // mfhbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); + // mfhaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); + // mfhcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); + // mfhaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); + // mfhcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); + // mfhbbb = (*this->zeroDistributionsF)(x1, x2, x3); + + + // 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); + + //} + + //real rhoH = 1.0; + //real rhoL = 1.0 / densityRatio; + + real rhoH = 1.0; + real rhoL = 1.0/ densityRatio; + + //real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); + + real dX1_phi = gradX1_phi(); + real dX2_phi = gradX2_phi(); + real dX3_phi = gradX3_phi(); + + real denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi)+ 1.0e-20;//+ 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? + real normX1 = dX1_phi / denom; + real normX2 = dX2_phi / denom; + real normX3 = dX3_phi / denom; + + + //real pushInterface = 2.0; + //collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[DIR_000] - phiH) / (phiH - phiL); + //collFactorM = collFactorL + (collFactorL - collFactorG) * (tanh(pushInterface * (c2o1 * phi[DIR_000] - c1o1)) / tanh(pushInterface) * c1o2 + c1o2 - phiH) / (phiH - phiL); + collFactorM = phi[DIR_000] > c1o2 ? collFactorL : collFactorG; + //collFactorM=(((*phaseField)(x1, x2, x3) > c1o2) && ((*phaseFieldOld)(x1, x2, x3) <= c1o2)) ? 1.8 : collFactorM; + real collFactorMInv = phi[DIR_000] > c1o2 ? collFactorG : collFactorL; + + //real mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(); + + //----------- Calculating Macroscopic Values ------------- + real rho = phi[DIR_000] > c1o2 ? rhoH : rhoL;//rhoH + rhoToPhi * (phi[DIR_000] - phiH); //Incompressible + + //real rho = rhoH + rhoToPhi * (tanh(pushInterface*(c2o1*phi[DIR_000]-c1o1))/tanh(pushInterface)*c1o2 +c1o2 - phiH); //Incompressible + ///scaled phase field + //real rho = rhoH + rhoToPhi * ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) / ((*phaseField)(x1, x2, x3) * (*phaseField)(x1, x2, x3) + (c1o1 - (*phaseField)(x1, x2, x3)) * (c1o1 - (*phaseField)(x1, x2, x3))) - phiH); + ///!scaled phase field + + //real rho = rhoH + rhoToPhi * (phi[DIR_000] - phiH)+(c1o1-phi[DIR_000])* (*pressure)(x1, x2, x3)*c3o1; //compressible + //real rho = rhoL + (rhoH - rhoL) * phi[DIR_000] + (c1o1 - phi[DIR_000]) * (*pressure)(x1, x2, x3) * c3o1; //compressible + + real m0, m1, m2; + real rhoRef=c1o1; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + (mfcbb - mfabb))/rhoRef; + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + (mfbcb - mfbab))/rhoRef; + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + + (mfbbc - mfbba))/rhoRef; + ////Filter&Gradient merged + //real pressureHere = (*pressureOld)(x1, x2, x3); + //real pressureHere = (*pressure)(x1, x2, x3); + + //real 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}} }; + //real 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; + + //real 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 * (c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2)) * (c1o1 + c3o1 * 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; + //real gradPx = 0.0; + //real gradPy = 0.0; + //real 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 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // gradPx += arrayP[2][dir1+1][dir2+1] * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + + + + // gradPy -= arrayP[dir1+1][0][dir2+1] * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // gradPy += arrayP[dir1+1][2][dir2+1] * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // + + // gradPz -= arrayP[dir1+1][dir2+1][0] * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // gradPz += arrayP[dir1+1][dir2+1][2] * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + //} + + //real 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; + //real 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; + //real 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 *=c1o1 - (*pressure)(x1, x2, x3)+pressureHere; + //gradPy *=c1o1 - (*pressure)(x1, x2, x3) + pressureHere; + //gradPz *=c1o1 - (*pressure)(x1, x2, x3) + pressureHere; + + ////!Filter&Gradient merged + //real gradPx = 0.0; + //real gradPy = 0.0; + //real 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 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPx -= (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // if (!bcArray->isSolid(x1 + 1, yyy, zzz) && !bcArray->isUndefined(x1 + 1, yyy, zzz)) { + // gradPx += (*pressure)(x1 + 1, yyy, zzz) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPx += (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * 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 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPy -= (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // if (!bcArray->isSolid(xxx, x2+1, zzz) && !bcArray->isUndefined(xxx, x2+1, zzz)) { + // gradPy += (*pressure)(xxx, x2+1, zzz) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPy += (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * 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 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPz -= (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // if (!bcArray->isSolid(xxx, yyy, x3+1) && !bcArray->isUndefined(xxx, yyy, x3+1)) { + // gradPz += (*pressure)(xxx, yyy, x3+1) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + // else { + // gradPz += (*pressure)(x1, x2, x3) * c2o9 / ((c1o1 + c3o1 * abs(dir1)) * (c1o1 + c3o1 * abs(dir2))); + // } + + // } + //} + + //Viscosity increase by phase field residuum + //real errPhi = (((1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale)- denom); + //real limVis = 0.01;// 0.0000001 * 10;//0.01; + // collFactorM =collFactorM/(c1o1+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])); + + + + ////external pressure + //forcingX1 =/* muForcingX1.Eval()/rho */- gradPx/rho; + //forcingX2 =/* muForcingX2.Eval()/rho */- gradPy/rho; + //forcingX3 =/* muForcingX3.Eval()/rho */- gradPz/rho; + + /////////////////////////////////////////////// + + //real 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; + //} + + /////////////////////////////////////////////// + + //real 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; + + //rho = rhoH + rhoToPhi * ((phi[DIR_000] - phiH)+fabs(pStarStart)*0); //Incompressible + + muRho = rho; + + + ///////////////////// + + 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; + + + //real dRhoInvX = -(((((mfhccc - mfhaaa) + (mfhcac - mfhaca)) + ((mfhcaa - mfhacc) + (mfhcca - mfhaac))) + + // (((mfhcba - mfhabc) + (mfhcbc - mfhaba)) + ((mfhcab - mfhacb) + (mfhccb - mfhaab))) + + // (mfhcbb - mfhabb))); + //real dRhoInvY = -(((((mfhccc - mfhaaa) + (mfhaca - mfhcac)) + ((mfhacc - mfhcaa) + (mfhcca - mfhaac))) + + // (((mfhbca - mfhbac) + (mfhbcc - mfhbaa)) + ((mfhacb - mfhcab) + (mfhccb - mfhaab))) + + // (mfhbcb - mfhbab))); + //real 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 + //real dX1_rhoInv = gradX1_rhoInv(rhoL, rhoH - rhoL); + //real dX2_rhoInv = gradX2_rhoInv(rhoL, rhoH - rhoL); + //real 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; + //real FdX1_phi = normX1 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale; + //real FdX2_phi = normX2 * (1.0 - phi[DIR_000]) * (phi[DIR_000]) * oneOverInterfaceScale; + //real 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 *c3o1) ; + //forcingX2 = (pStar * dRhoInvY* rho *c3o1) ; + //forcingX3 = (pStar * dRhoInvZ* rho *c3o1) ; + //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; + //real forcingX1ALTERNAT = ( pStar * dX1_rhoInv * rho) ; + //real forcingX2ALTERNAT = ( pStar * dX2_rhoInv * rho) ; + //real 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 *(c1o1- phi[DIR_000]) + pStar * dX1_rhoInv * rho*(phi[DIR_000])); + //forcingX2 = (-pStar * dX2_phi * rhoToPhi / rho *(c1o1- phi[DIR_000]) + pStar * dX2_rhoInv * rho*(phi[DIR_000])); + //forcingX3 = (-pStar * dX3_phi * rhoToPhi / rho *(c1o1- 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; + //} + + + + //real scaleGrad = c2o1 * 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 + + //real 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; + + //real forcingBIAS = 0.5; + forcingX1 += muForcingX1.Eval() / rho;//*phi[DIR_000]; + forcingX2 += -5.0e-7 * phi[DIR_000];// muForcingX2.Eval() / rho - 5.0e-7 * phi[DIR_000] * 0;// * 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 + + + + + real vx2; + real vy2; + real vz2; + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + //pStar =ppStar- (vx2 + vy2 + vz2)*pStar; + // pStar = (pStar + ppStar)*c1o2; + /////////////////////////////////////////////////////////////////////////////////////////// + real 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!!!! + + //////////////////////////////////////////////////////////////////////////////////// + real wadjust; + //real qudricLimit = 0.01 / (c1o1 + 1.0e5 * phi[DIR_000] * (c1o1 - phi[DIR_000])); //real qudricLimit = 0.01; + //real qudricLimit = (((*phaseField)(x1, x2, x3) > c1o2) && (normX1 * vvx + normX2 * vvy + normX3 * vvz < 0)) ? 0.01 / (c1o1 + 1.0e5 * phi[DIR_000] * (c1o1 - phi[DIR_000])) : 0.01; + real qudricLimit = (((*phaseField)(x1, x2, x3) > c1o2)&& (normX1*vvx+normX2*vvy+normX3*vvz<0) ) ? 0.01 / (c1o1 + 1.0e5 * phi[DIR_000] * (c1o1 - phi[DIR_000])) : 0.01 ; + //real qudricLimit = 0.01 / (c1o1 + 1.0e5 * phi[DIR_000] * (c1o1 - phi[DIR_000])) ; + //real qudricLimit = (((*phaseField)(x1, x2, x3) > c1o2) ) ? 0.01 / (c1o1 + 1.0e5 * phi[DIR_000] * (c1o1 - phi[DIR_000])) : 0.01 ; + //qudricLimit = (((*phaseField)(x1, x2, x3)-c1o2 ) * (normX1 * vvx + normX2 * vvy + normX3 * vvz) < 0) ? 0.01 / (c1o1 + 1.0e8 * phi[DIR_000] * (c1o1 - phi[DIR_000])) : 0.01; + // if (phi[DIR_000] > c1o2 && (*phaseFieldOld)(x1, x2, x3) <= c1o2) collFactorM = 1.8; + + //////////////////////////////////////////////////////////////////////////////////// + //! - 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, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + forwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c3o1, c1o9, oMdrho); + + + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + // Cumulants + //////////////////////////////////////////////////////////////////////////////////// + + // mfaaa = 0.0; + real OxxPyyPzz = 1.0; //omega2 or bulk viscosity + // real OxyyPxzz = 1.;//-s9;//2+s9;// + // real OxyyMxzz = 1.;//2+s9;// + real O4 = 1.; + real O5 = 1.; + real O6 = 1.; + + //collFactorM+= (1.7 - collFactorM) * fabs(mfaaa) / (fabs(mfaaa) + 0.001f); + ////// + //M110 -= vvx * vvy - mfbba; + //M101 -= vvx * vvz - mfbab; + //M011 -= vvy * vvz - mfabb; + + + + //M200 -= vx2; + //M020 -= vy2; + //M002 -= vz2; + //real Mp = (M200 + M020 + M002); + + + + //M200 -= c1o3 * Mp; + //M020 -= c1o3 * Mp; + //M002 -= c1o3 * Mp; + + //M200 -= -mfcaa + (mfcaa + mfaca + mfaac) * c1o3; + //M020 -= -mfaca + (mfcaa + mfaca + mfaac) * c1o3; + //M002 -= -mfaac + (mfcaa + mfaca + mfaac) * c1o3; + + ///// + + /////fourth order parameters; here only for test. Move out of loop! + + real 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))); + real 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); + real 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)); + real 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' ) + real 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)); + //real stress = 1.0;// stress / (stress + 1.0e-10); + //stress = 1.0; + //OxyyPxzz += stress*(1.0-OxyyPxzz); + //OxyyPxzz = c3o1 * (collFactorM - c2o1) / (collFactorM - c3o1); + //OxyyMxzz += stress*(1.0-OxyyMxzz); + //Oxyz += stress*(1.0-Oxyz); + //A *= 1.0-stress; + //BB *= 1.0-stress; + + //Cum 4. + //real CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 + //real CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 + //real CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 + + real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); + real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); + real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); + + real CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + + //Cum 5. + real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; + real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; + real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; + + //Cum 6. + real 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 + real 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; + // real 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 + //dirty (04.04.2023) + //if (phi[DIR_000] > c1o2 &&(dX1_phi*vvx+dX2_phi*vvy+dX3_phi*vvz)<0) { + // //collFactorM = c1o1 / (c1o1 / collFactorM +1e10* fabsf(mxxPyyPzz)*(c1o1-fabsf(phi[DIR_000]))); + // collFactorM = c1o1 / (c1o1 / collFactorM - 1e15*(dX1_phi * vvx + dX2_phi * vvy + dX3_phi * vvz)* fabsf(mxxPyyPzz) ); + // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; + // 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))); + // 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); + // 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)); + // 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)); + // 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)); + + //} + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + + /// + real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + real mmfabb = mfabb; + real mmfbab = mfbab; + real mmfbba = mfbba; + /// + + real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);// *0; + //real dxux = -c1o2 * (mxxMyy + mxxMzz) * collFactorM - mfaaa * c1o3* omegaDRho; + real dyuy = dxux + collFactorM * c3o2 * mxxMyy; + real dzuz = dxux + collFactorM * c3o2 * mxxMzz; + real Dxy = -c3o1 * collFactorM * mfbba; + real Dxz = -c3o1 * collFactorM * mfbab; + real Dyz = -c3o1 * collFactorM * mfabb; + //if ((phi[DIR_000] > c1o2)&& (normX1 * vvx + normX2 * vvy + normX3 * vvz < 0)){//&& ((*phaseFieldOld)(x1, x2, x3) <= c1o2)) { + // //std::cout << "new node\n"; + // ///QR eddyviscosity: + // real eddyR = -(Dxy * Dxy + Dxz * Dxz + c1o3 * dxux * dxux) * (dxux)-(Dxy * Dxy + Dyz * Dyz + c1o3 * dyuy * dyuy) * dyuy - (Dxz * Dxz + Dyz * Dyz + c1o3 * dzuz * dzuz) * dzuz - c2o1 * Dxy * Dxz * Dyz; + // real eddyQ = Dxy * Dxz + Dxy * Dyz + Dxz * Dyz + c1o2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz); + // real nuEddy = 10.0e1*(eddyR / (eddyQ + 1e-100)) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); + // nuEddy=10.0e4*fabsf(dxux+dyuy+dzuz) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); + // //if (nuEddy > c1o1 / collFactorM) std::cout << nuEddy <<" "<< fabsf(dxux + dyuy + dzuz)<< "\n"; + // nuEddy = (nuEddy < c1o1 / collFactorM) ? c1o1 / collFactorM : nuEddy; + // collFactorM = c1o1 / nuEddy; + // //collFactorM = 1.8; + // //collFactorM = c1o1 / (c1o1 / collFactorM +1.e2*nuEddy*(dX1_phi*dX1_phi+dX2_phi*dX2_phi+dX3_phi*dX3_phi)); + // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; + // 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))); + // 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); + // 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)); + // 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)); + // 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)); + + //} + /////// + real mxxMyyh = -c2o1 * (dxux - dyuy) / collFactorMInv * c1o3; + real mxxMzzh = -c2o1 * (dxux - dzuz) / collFactorMInv * c1o3; +// mfhbba = -Dxy / collFactorMInv*c1o3; +// mfhbab = -Dxz / collFactorMInv * c1o3; +// mfhabb = -Dyz / collFactorMInv * c1o3; + +// // attempt to improve implicit stress computation by fixed iteration +// real dX2_rho = (rhoToPhi)*dX2_phi; +// real dX1_rho = (rhoToPhi)*dX1_phi; +// real dX3_rho = (rhoToPhi)*dX3_phi; +// +// real dfx= c1o3 * (c1o1 / collFactorM - c1o2) *(2 * dxux * dX1_rho + Dxy * dX2_rho + Dxz * dX3_rho) / (rho); +// real dfy = c1o3 * (c1o1 / collFactorM - c1o2) *(Dxy * dX1_rho + 2 * dyuy * dX2_rho + Dyz * dX3_rho) / (rho); +// real dfz = c1o3 * (c1o1 / 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); + +// mfhaaa = (phi[DIR_000] < c1o2) ? mfaaa * rhoL / rhoH : mfaaa * rhoL / rhoH; + mxxMyyh += collFactorMInv * (-mxxMyyh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vy2 * dyuy); + mxxMzzh += collFactorMInv * (-mxxMzzh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vz2 * dzuz); + + //mfhabb += collFactorMInv * (-mfhabb); + //mfhbab += collFactorMInv * (-mfhbab); + //mfhbba += collFactorMInv * (-mfhbba); + + //mfhcaa = c1o3 * (mxxMyyh + mxxMzzh + mfhaaa); + //mfhaca = c1o3 * (-2. * mxxMyyh + mxxMzzh + mfhaaa); + //mfhaac = c1o3 * (mxxMyyh - 2. * mxxMzzh + mfhaaa); + + + //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 *= (c1o1-omegaDRho);// (mfaaa + (dxux + dyuy + dzuz)) * .5; // Pressure elimination as in standard velocity model + // mfaaa += (rho - c1o1) * (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 + real mxxyPyzz = mfcba + mfabc; + real mxxyMyzz = mfcba - mfabc; + + real mxxzPyyz = mfcab + mfacb; + real mxxzMyyz = mfcab - mfacb; + + real mxyyPxzz = mfbca + mfbac; + real 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 * (c1o1 / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / collFactorM - c1o2) * Dxy * c1o3 * BB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / collFactorM - c1o2) * Dxz * c1o3 * BB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / collFactorM - c1o2) * Dyz * c1o3 * BB + (c1o1 - 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 - c1o1) * oMdrho; + mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho; + mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * 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; + + + ////////save central moments for the phase field + //real MMxx = mfcaa - c1o3 * mfaaa; + //real MMyy = mfaca - c1o3 * mfaaa; + //real MMzz = mfaac - c1o3 * mfaaa; + //real MMxy = mfbba; + //real MMxz = mfbab; + //real MMyz = mfabb; + + + //////////////////////////////////////////////////////////////////////////////////// + //forcing + mfbaa = -mfbaa;// *(c1o1 - forcingBIAS) / forcingBIAS; + mfaba = -mfaba;// *(c1o1 - forcingBIAS) / forcingBIAS; + mfaab = -mfaab;// *(c1o1 - forcingBIAS) / forcingBIAS; + + + //mfhbaa = mfbaa; + //mfhaba = mfaba; + //mfhaab = mfaab; + + //mfhcba = 0.; + //mfhabc = 0.; + //mfhcab = 0.; + //mfhacb = 0.; + //mfhbca = 0.; + //mfhbac = 0.; + //mfhbbb = 0.; + + //real oMdrhoInv = (rhoRef - (mfhaaa )) / rhoRef; + //mfhcbb =/* CUMcbb + */((mfhcaa + c1o3) * mfhabb + 2. * mfhbba * mfhbab); + //mfhbcb =/* CUMbcb + */((mfhaca + c1o3) * mfhbab + 2. * mfhbba * mfhabb); + //mfhbbc =/* CUMbbc + */((mfhaac + c1o3) * mfhbba + 2. * mfhbab * mfhabb); + + //mfhcca = /*CUMcca + */(mfhcaa * mfhaca + 2. * mfhbba * mfhbba) + c1o3 * (mfhcaa + mfhaca) * oMdrhoInv + c1o9 * (oMdrhoInv - c1o1) * oMdrhoInv; + //mfhcac = /*CUMcac + */(mfhcaa * mfhaac + 2. * mfhbab * mfhbab) + c1o3 * (mfhcaa + mfhaac) * oMdrhoInv + c1o9 * (oMdrhoInv - c1o1) * oMdrhoInv; + //mfhacc = /*CUMacc + */(mfhaac * mfhaca + 2. * mfhabb * mfhabb) + c1o3 * (mfhaac + mfhaca) * oMdrhoInv + c1o9 * (oMdrhoInv - c1o1) * oMdrhoInv; + + ////5. + //mfhbcc = /*CUMbcc +*/ (mfhaac * mfhbca + mfhaca * mfhbac + 4. * mfhabb * mfhbbb + 2. * (mfhbab * mfhacb + mfhbba * mfhabc)) + c1o3 * (mfhbca + mfhbac) * oMdrhoInv; + //mfhcbc = /*CUMcbc +*/ (mfhaac * mfhcba + mfhcaa * mfhabc + 4. * mfhbab * mfhbbb + 2. * (mfhabb * mfhcab + mfhbba * mfhbac)) + c1o3 * (mfhcba + mfhabc) * oMdrhoInv; + //mfhccb = /*CUMccb +*/ (mfhcaa * mfhacb + mfhaca * mfhcab + 4. * mfhbba * mfhbbb + 2. * (mfhbab * mfhbca + mfhabb * mfhcba)) + c1o3 * (mfhacb + mfhcab) * oMdrhoInv; + + ////6. + //mfhccc = /*CUMccc */- ((-4. * mfhbbb * mfhbbb + // - (mfhcaa * mfhacc + mfhaca * mfhcac + mfhaac * mfhcca) + // - 4. * (mfhabb * mfhcbb + mfhbac * mfhbca + mfhbba * mfhbbc) + // - 2. * (mfhbca * mfhbac + mfhcba * mfhabc + mfhcab * mfhacb)) + // + (4. * (mfhbab * mfhbab * mfhaca + mfhabb * mfhabb * mfhcaa + mfhbba * mfhbba * mfhaac) + // + 2. * (mfhcaa * mfhaca * mfhaac) + // + 16. * mfhbba * mfhbab * mfhabb) + // - c1o3 * (mfhacc + mfhcac + mfhcca) * oMdrhoInv - c1o9 * oMdrhoInv * oMdrhoInv + // - c1o9 * (mfhcaa + mfhaca + mfhaac) * oMdrhoInv * (1. - 2. * oMdrhoInv) - c1o27 * oMdrhoInv * oMdrhoInv * (-2. * oMdrhoInv) + // + (2. * (mfhbab * mfhbab + mfhabb * mfhabb + mfhbba * mfhbba) + // + (mfhaac * mfhaca + mfhaac * mfhcaa + mfhaca * mfhcaa)) * c2o3 * oMdrhoInv) - c1o27 * oMdrhoInv; + + + + + + backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + backwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c9o1, c1o9, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + + + + + + //backwardInverseChimeraWithKincompressible(mfhaaa, mfhbaa, mfhcaa, vvx, vx2, c1o1, c1o1, oMdrhoInv); + //backwardChimera(mfhaba, mfhbba, mfhcba, vvx, vx2); + //backwardInverseChimeraWithKincompressible(mfhaca, mfhbca, mfhcca, vvx, vx2, c3o1, c1o3, oMdrhoInv); + //backwardChimera(mfhaab, mfhbab, mfhcab, vvx, vx2); + //backwardChimera(mfhabb, mfhbbb, mfhcbb, vvx, vx2); + //backwardChimera(mfhacb, mfhbcb, mfhccb, vvx, vx2); + //backwardInverseChimeraWithKincompressible(mfhaac, mfhbac, mfhcac, vvx, vx2, c3o1, c1o3, oMdrhoInv); + //backwardChimera(mfhabc, mfhbbc, mfhcbc, vvx, vx2); + //backwardInverseChimeraWithKincompressible(mfhacc, mfhbcc, mfhccc, vvx, vx2, c9o1, c1o9, oMdrhoInv); + + ////////////////////////////////////////////////////////////////////////////////////// + //// Y - Dir + //backwardInverseChimeraWithKincompressible(mfhaaa, mfhaba, mfhaca, vvy, vy2, c6o1, c1o6, oMdrhoInv); + //backwardChimera(mfhaab, mfhabb, mfhacb, vvy, vy2); + //backwardInverseChimeraWithKincompressible(mfhaac, mfhabc, mfhacc, vvy, vy2, c18o1, c1o18, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhbaa, mfhbba, mfhbca, vvy, vy2, c3o2, c2o3, oMdrhoInv); + //backwardChimera(mfhbab, mfhbbb, mfhbcb, vvy, vy2); + //backwardInverseChimeraWithKincompressible(mfhbac, mfhbbc, mfhbcc, vvy, vy2, c9o2, c2o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhcaa, mfhcba, mfhcca, vvy, vy2, c6o1, c1o6, oMdrhoInv); + //backwardChimera(mfhcab, mfhcbb, mfhccb, vvy, vy2); + //backwardInverseChimeraWithKincompressible(mfhcac, mfhcbc, mfhccc, vvy, vy2, c18o1, c1o18, oMdrhoInv); + + ////////////////////////////////////////////////////////////////////////////////////// + //// Z - Dir + //backwardInverseChimeraWithKincompressible(mfhaaa, mfhaab, mfhaac, vvz, vz2, c36o1, c1o36, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhaba, mfhabb, mfhabc, vvz, vz2, c9o1, c1o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhaca, mfhacb, mfhacc, vvz, vz2, c36o1, c1o36, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhbaa, mfhbab, mfhbac, vvz, vz2, c9o1, c1o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhbba, mfhbbb, mfhbbc, vvz, vz2, c9o4, c4o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhbca, mfhbcb, mfhbcc, vvz, vz2, c9o1, c1o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhcaa, mfhcab, mfhcac, vvz, vz2, c36o1, c1o36, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhcba, mfhcbb, mfhcbc, vvz, vz2, c9o1, c1o9, oMdrhoInv); + //backwardInverseChimeraWithKincompressible(mfhcca, mfhccb, mfhccc, vvz, vz2, c36o1, c1o36, oMdrhoInv); + + ///////////////////// + + ////////////////////////////////////////////////////////////////////////// + //proof correctness + ////////////////////////////////////////////////////////////////////////// + //#ifdef PROOF_CORRECTNESS + real 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; + // //real dif = fabs(drho - rho_post); + // real 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 + ////////////////////////////////////////////////////////////////////////// + // if (phi[DIR_000] < c1o2) { + (*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; + // } + + + // else { + // (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfhabb;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfhbab;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfhbba;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfhaab;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfhcab;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfhaba;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfhcba;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfhbaa;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfhbca;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfhaaa;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfhcaa;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfhaca;//* rho * c1o3; + // (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfhcca;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfhcbb;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfhbcb;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfhbbc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfhccb;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfhacb;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfhcbc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfhabc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfhbcc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfhbac;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfhccc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfhacc;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfhcac;//* rho * c1o3; + // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfhaac;//* rho * c1o3; + + // (*this->zeroDistributionsF)(x1, x2, x3) = mfhbbb;// *rho* c1o3; + + + // (*this->localDistributionsH2)(D3Q27System::ET_E, x1, x2, x3) = mfabb;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_N, x1, x2, x3) = mfbab;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_T, x1, x2, x3) = mfbba;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_NE, x1, x2, x3) = mfaab;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TE, x1, x2, x3) = mfaba;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca;//* rho * c1o3; + // (*this->localDistributionsH2)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac;//* rho * c1o3; + // (*this->nonLocalDistributionsH2)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac;//* rho * c1o3; + + // (*this->zeroDistributionsH2)(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 + real 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 + real 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; + //////////////////////////////////////////////////////////////////////////////////// + real oneMinusRho = c1o1- concentration; + + real cx = + ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + (mfcbb - mfabb)); + real cy = + ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + (mfbcb - mfbab)); + real 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 + real cx2 = cx * cx; + real cy2 = cy * cy; + real 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, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, c1o36, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + forwardChimera(mfaab, mfabb, mfacb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, 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, c6o1, c1o6, oneMinusRho); + forwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1o1, c1o1, oneMinusRho); + forwardChimera(mfaba, mfbba, mfcba, cx, cx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, 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, c3o1, c1o3, oneMinusRho); + forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + //! - experimental Cumulant ... to be published ... hopefully + //! + + // linearized orthogonalization of 3rd order central moments + real Mabc = mfabc - mfaba * c1o3; + real Mbca = mfbca - mfbaa * c1o3; + real Macb = mfacb - mfaab * c1o3; + real Mcba = mfcba - mfaba * c1o3; + real Mcab = mfcab - mfaab * c1o3; + real Mbac = mfbac - mfbaa * c1o3; + // linearized orthogonalization of 5th order central moments + real Mcbc = mfcbc - mfaba * c1o9; + real Mbcc = mfbcc - mfbaa * c1o9; + real Mccb = mfccb - mfaab * c1o9; + + //25.03.2023 mixed normals + real MomX1 = vvx * concentration - cx; + real MomX2 = vvy * concentration - cy; + real MomX3 = vvz * concentration - cz; + real mixNormal = 0.5; + + real MomXDenom = sqrt(MomX1 * MomX1 + MomX2 * MomX2 + MomX3 * MomX3)+1.0e-100; + real scaleNorm = (normX1 * MomX1 + normX2 * MomX2 + normX3 * MomX3) / MomXDenom; + scaleNorm = scaleNorm * scaleNorm;// *scaleNorm* scaleNorm; + + normX1 = (normX1 * (c1o1 - mixNormal) + mixNormal * MomX1 / MomXDenom )* scaleNorm; + normX2 = (normX2 * (c1o1 - mixNormal) + mixNormal * MomX2 / MomXDenom )* scaleNorm; + normX3 = (normX3 * (c1o1 - mixNormal) + mixNormal * MomX3 / MomXDenom )* scaleNorm; + + //31.05.2022 addaptive mobility + //omegaD = c1o1 + (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 = c2o1 * (concentration * (concentration - c1o1)) / (-c6o1 * (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) + (concentration * (concentration - c1o1))+1.0e-200); + // collision of 1st order moments + cx = cx * (c1o1 - omegaD) + omegaD * vvx * concentration + + normX1 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + cy = cy * (c1o1 - omegaD) + omegaD * vvy * concentration + + normX2 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + cz = cz * (c1o1 - omegaD) + omegaD * vvz * concentration + + normX3 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + + cx2 = cx * cx; + cy2 = cy * cy; + cz2 = cz * cz; + + //// equilibration of 2nd order moments + mfbba = c0o1; + mfbab = c0o1; + mfabb = c0o1; + + mfcaa = c1o3 * concentration; + mfaca = c1o3 * concentration; + mfaac = c1o3 * concentration; + + //take second moment from fluid + //mfbba = concentration*MMxy; + //mfbab = concentration*MMxz; + //mfabb = concentration*MMyz; + + //mfcaa = (c1o3+MMxx) * concentration; + //mfaca = (c1o3+MMyy) * concentration; + //mfaac = (c1o3+MMzz) * concentration; + + + + // equilibration of 3rd order moments + Mabc = c0o1; + Mbca = c0o1; + Macb = c0o1; + Mcba = c0o1; + Mcab = c0o1; + Mbac = c0o1; + mfbbb = c0o1; + + // 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 = c0o1; + mfbcb = c0o1; + mfbbc = c0o1; + + // equilibration of 5th order moments + Mcbc = c0o1; + Mbcc = c0o1; + Mccb = c0o1; + + // 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, c1o1, c1o1, oneMinusRho); + backwardChimera(mfaba, mfbba, mfcba, cx, cx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, 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, c3o1, c1o3, oneMinusRho); + backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + backwardChimera(mfaab, mfabb, mfacb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, 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, c6o1, c1o6, oneMinusRho); + backwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, 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; + + + + + } + } + } + } + } + //Set multiphase BCs + //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; + // findNeighbors(phaseField, x1, x2, x3); + // if ((phi[DIR_000] > c1o2) && ( + // (phi[DIR_P00] <= c1o2) || + // (phi[DIR_M00] <= c1o2) || + // (phi[DIR_00P] <= c1o2) || + // (phi[DIR_00M] <= c1o2) || + // (phi[DIR_0M0] <= c1o2) || + // (phi[DIR_0P0] <= c1o2) || + // (phi[DIR_PP0] <= c1o2) || + // (phi[DIR_PM0] <= c1o2) || + // (phi[DIR_P0P] <= c1o2) || + // (phi[DIR_P0M] <= c1o2) || + // (phi[DIR_MP0] <= c1o2) || + // (phi[DIR_MM0] <= c1o2) || + // (phi[DIR_M0P] <= c1o2) || + // (phi[DIR_M0M] <= c1o2) || + // (phi[DIR_0PM] <= c1o2) || + // (phi[DIR_0MM] <= c1o2) || + // (phi[DIR_0PP] <= c1o2) || + // (phi[DIR_0MP] <= c1o2) || + // (phi[DIR_PPP] <= c1o2) || + // (phi[DIR_PMP] <= c1o2) || + // (phi[DIR_MPP] <= c1o2) || + // (phi[DIR_MMP] <= c1o2) || + // (phi[DIR_PPM] <= c1o2) || + // (phi[DIR_PMM] <= c1o2) || + // (phi[DIR_MPM] <= c1o2) || + // (phi[DIR_MMM] <= c1o2) + // )) { + // //real mfabb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3);//* rho * c1o3; + // //real mfbab = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3);//* rho * c1o3; + // //real mfbba = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3);//* rho * c1o3; + // //real mfaab = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3);//* rho * c1o3; + // //real mfcab = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3);//* rho * c1o3; + // //real mfaba = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3);//* rho * c1o3; + // //real mfcba = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3);//* rho * c1o3; + // //real mfbaa = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3);//* rho * c1o3; + // //real mfbca = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3);//* rho * c1o3; + // //real mfaaa = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3);//* rho * c1o3; + // //real mfcaa = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3);//* rho * c1o3; + // //real mfaca = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3);//* rho * c1o3; + // //real mfcca = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3);//* rho * c1o3; + // //real mfcbb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3);//* rho * c1o3; + // //real mfbcb = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3);//* rho * c1o3; + // //real mfbbc = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p);//* rho * c1o3; + // //real mfccb = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3);//* rho * c1o3; + // //real mfacb = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3);//* rho * c1o3; + // //real mfcbc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p);//* rho * c1o3; + // //real mfabc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p);//* rho * c1o3; + // //real mfbcc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p);//* rho * c1o3; + // //real mfbac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p);//* rho * c1o3; + // //real mfccc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p);//* rho * c1o3; + // //real mfacc = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p);//* rho * c1o3; + // //real mfcac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p);//* rho * c1o3; + // //real mfaac = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p);//* rho * c1o3; + // //real mfbbb = (*this->zeroDistributionsF)(x1, x2, x3); + // + // real vx = (*vxNode)(x1, x2, x3); + // real vy = (*vyNode)(x1, x2, x3); + // real vz = (*vzNode)(x1, x2, x3); + // SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + // real ff[27]; + // distribution->getDistributionInv(ff, x1, x2 , x3 ); + + // for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) { + // if ((phi[fdir] <= c1o2)) { + // real rhoG = (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // real ftemp= D3Q27System::getCompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz) + D3Q27System::getCompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real fBB; + // fBB=distribution->getDistributionInvForDirection( x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir],fdir); + // distribution->setDistributionInvForDirection(ftemp - ff[fdir], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + // distribution->setDistributionForDirection(fBB-c6o1*D3Q27System::WEIGTH[fdir] * (-vx * D3Q27System::DX1[fdir] - vy * D3Q27System::DX2[fdir] - vz * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // } + // } + + // //if ((phi[DIR_P00] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(W, rhoG, vx,vy,vz )+ D3Q27System::getCompFeqForDirection(E, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_E, x1 + 1, x2, x3); + // // (*this->localDistributionsF)(D3Q27System::ET_E, x1+1, x2, x3)=ftemp-mfcbb; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3)=fBB-c6o1*c2o27*(-vx); + // //} + // //if ((phi[DIR_M00] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(E, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(W, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p-1, x2, x3); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p - 1, x2, x3) = ftemp - mfabb; + // // (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = fBB - c6o1 * c2o27 * ( vx); + // //} + // //if ((phi[DIR_0P0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2+1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(S, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(N, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2+1, x3); + // // (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2+1, x3) = ftemp - mfbcb; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = fBB - c6o1 * c2o27 * (-vy); + // //} + // //if ((phi[DIR_0M0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2 - 1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(N, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(S, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p-1, x3); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p - 1, x3) = ftemp - mfbab; + // // (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = fBB - c6o1 * c2o27 * ( vy); + // //} + // //if ((phi[DIR_00P] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2 , x3+1); + // // real ftemp = D3Q27System::getCompFeqForDirection(B, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(T, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3+1) = ftemp - mfbbc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = fBB - c6o1 * c2o27 * (-vz); + // //} + // //if ((phi[DIR_00M] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(T, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(B, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p-1) = ftemp - mfbba; + // // (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = fBB - c6o1 * c2o27 * ( vz); + // //} + // // + // //if ((phi[DIR_PP0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2+1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(SW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(NE, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_NE, x1+1, x2+1, x3); + // // (*this->localDistributionsF)(D3Q27System::ET_NE, x1 + 1, x2 + 1, x3) = ftemp - mfccb; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = fBB - c6o1 * c1o54 * (-vx-vy); + // //} + // //if ((phi[DIR_MM0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 - 1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(NE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(SW, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p-1, x2p-1, x3); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p - 1, x2p - 1, x3) = ftemp - mfaab; + // // (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = fBB - c6o1 * c1o54 * ( vx + vy); + // //} + // //if ((phi[DIR_MP0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 + 1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(SE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(NW, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p-1, x2+1, x3); + // // (*this->localDistributionsF)(D3Q27System::ET_NW, x1p - 1, x2 + 1, x3) = ftemp - mfacb; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = fBB - c6o1 * c1o54 * ( vx - vy); + // //} + // //if ((phi[DIR_PM0] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2 - 1, x3); + // // real ftemp = D3Q27System::getCompFeqForDirection(NW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(SE, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1+1, x2p-1, x3); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1 + 1, x2p - 1, x3) = ftemp - mfcab; + // // (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = fBB - c6o1 * c1o54 * (-vx + vy); + // //} + // //if ((phi[DIR_P0P] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2 , x3+1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TE, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TE, x1+1, x2, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TE, x1 + 1, x2, x3 + 1) = ftemp - mfcbc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = fBB - c6o1 * c1o54 * (-vx - vz); + // //} + // //if ((phi[DIR_M0P] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TW, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p-1, x2, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TW, x1p - 1, x2, x3 + 1) = ftemp - mfabc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = fBB - c6o1 * c1o54 * ( vx - vz); + // //} + // //if ((phi[DIR_P0M] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BE, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1+1, x2, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1 + 1, x2, x3p - 1) = ftemp - mfcba; + // // (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = fBB - c6o1 * c1o54 * (-vx + vz); + // //} + // //if ((phi[DIR_M0M] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BW, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p-1, x2, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p - 1, x2, x3p - 1) = ftemp - mfaba; + // // (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = fBB - c6o1 * c1o54 * ( vx + vz); + // //} + // //if ((phi[DIR_0PP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2+1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BS, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TN, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2+1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2 + 1, x3 + 1) = ftemp - mfbcc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = fBB - c6o1 * c1o54 * (-vy - vz); + // //} + // //if ((phi[DIR_0MP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2 - 1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BN, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TS, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p-1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p - 1, x3 + 1) = ftemp - mfbac; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = fBB - c6o1 * c1o54 * ( vy - vz); + // //} + // //if ((phi[DIR_0PM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2 + 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TS, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BN, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2+1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2 + 1, x3p - 1) = ftemp - mfbca; + // // (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = fBB - c6o1 * c1o54 * (-vy + vz); + // //} + // //if ((phi[DIR_0MM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1, x2 - 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TN, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BS, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p-1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p - 1, x3p - 1) = ftemp - mfbaa; + // // (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = fBB - c6o1 * c1o54 * (-vy - vz); + // //} + + // //if ((phi[DIR_PPP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1+1, x2 + 1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BSW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TNE, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1+1, x2+1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TNE, x1 + 1, x2 + 1, x3 + 1) = ftemp - mfccc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = fBB - c6o1 * c1o216 * (-vx -vy - vz); + // //} + // //if ((phi[DIR_MPP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 + 1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BSE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TNW, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p-1, x2+1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p - 1, x2 + 1, x3 + 1) = ftemp - mfacc; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = fBB - c6o1 * c1o216 * ( vx - vy - vz); + // //} + // //if ((phi[DIR_MMP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 - 1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BNE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TSW, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p-1, x2p-1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p - 1, x2p - 1, x3 + 1) = ftemp - mfaac; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = fBB - c6o1 * c1o216 * (vx + vy - vz); + // //} + // //if ((phi[DIR_PMP] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2 - 1, x3 + 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(BNW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(TSE, rhoG, vx, vy, vz); + // // real fBB = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1+1, x2p-1, x3+1); + // // (*this->localDistributionsF)(D3Q27System::ET_TSE, x1 + 1, x2p - 1, x3 + 1) = ftemp - mfcac; + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = fBB - c6o1 * c1o216 * (-vx + vy - vz); + // //} + // //if ((phi[DIR_PMM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2 - 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TNW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BSE, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1+1, x2p-1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1+1, x2p-1, x3p-1) = ftemp - mfcaa; + // // (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = fBB - c6o1 * c1o216 * (-vx + vy + vz); + // //} + // //if ((phi[DIR_MMM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 - 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TNE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BSW, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p-1, x2p-1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p - 1, x2p - 1, x3p - 1) = ftemp - mfaaa; + // // (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = fBB - c6o1 * c1o216 * ( vx + vy + vz); + // //} + // //if ((phi[DIR_MPM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 - 1, x2 + 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TSE, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BNW, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p-1, x2+1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p - 1, x2 + 1, x3p - 1) = ftemp - mfaca; + // // (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = fBB - c6o1 * c1o216 * (vx - vy + vz); + // //} + // //if ((phi[DIR_PPM] <= c1o2)) { + // // real rhoG = (*rhoNode)(x1 + 1, x2 + 1, x3 - 1); + // // real ftemp = D3Q27System::getCompFeqForDirection(TSW, rhoG, vx, vy, vz)+ D3Q27System::getCompFeqForDirection(BNE, rhoG, vx, vy, vz); + // // real fBB = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1+1, x2+1, x3p-1); + // // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1 + 1, x2 + 1, x3p - 1) = ftemp - mfcca; + // // (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = fBB - c6o1 * c1o216 * (-vx - vy + vz); + // //} + + + + + // } + // } + // } + // } + //} +} + + + + + + + +////////////////////////////////////////////////////////////////////////// + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::gradX1_rhoInv(real rhoL,real 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]))); +} + +real MultiphaseScaleDistributionLBMKernel::gradX2_rhoInv(real rhoL,real 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]))); +} + +real MultiphaseScaleDistributionLBMKernel::gradX3_rhoInv(real rhoL, real 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]))); +} + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::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])); +} + +real MultiphaseScaleDistributionLBMKernel::nabla2_phi() +{ + using namespace D3Q27System; + real 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; +} + +real MultiphaseScaleDistributionLBMKernel::computeCurvature_phi() +{ + using namespace D3Q27System; + //using namespace UbMath; + + real phiX = gradX1_phi(); + real phiY = gradX2_phi(); + real phiZ = gradX3_phi(); + real phiXX = c4o9*(phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]) + +(c1o9*(((phi[DIR_PP0] - c2o1 * phi[DIR_0P0] + phi[DIR_MP0])+ (phi[DIR_PM0] - c2o1 * phi[DIR_0M0] + phi[DIR_MM0]))+ ((phi[DIR_P0P] - c2o1 * phi[DIR_00P] + phi[DIR_M0P]) + (phi[DIR_P0M] - c2o1 * phi[DIR_00M] + phi[DIR_M0M]))) + +c1o36* (((phi[DIR_PPP] - c2o1 * phi[DIR_0PP] + phi[DIR_MPP]) + (phi[DIR_PMP] - c2o1 * phi[DIR_0MP] + phi[DIR_MMP])) + ((phi[DIR_PPM] - c2o1 * phi[DIR_0PM] + phi[DIR_MPM]) + (phi[DIR_PMM] - c2o1 * phi[DIR_0MM] + phi[DIR_MMM])))); + real phiYY = c4o9*(phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]) + +(c1o9*(((phi[DIR_PP0] - c2o1 * phi[DIR_P00] + phi[DIR_PM0])+ (phi[DIR_MP0] - c2o1 * phi[DIR_M00] + phi[DIR_MM0]))+ ((phi[DIR_0PP] - c2o1 * phi[DIR_00P] + phi[DIR_0MP]) + (phi[DIR_0PM] - c2o1 * phi[DIR_00M] + phi[DIR_0MM]))) + +c1o36* (((phi[DIR_PPP] - c2o1 * phi[DIR_P0P] + phi[DIR_PMP]) + (phi[DIR_MPM] - c2o1 * phi[DIR_M0M] + phi[DIR_MMM])) + ((phi[DIR_MPP] - c2o1 * phi[DIR_M0P] + phi[DIR_MMP]) + (phi[DIR_PPM] - c2o1 * phi[DIR_P0M] + phi[DIR_PMM])))); + real phiZZ = c4o9*(phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]) + +(c1o9*(((phi[DIR_M0P] - c2o1 * phi[DIR_M00] + phi[DIR_M0M])+ (phi[DIR_P0P] - c2o1 * phi[DIR_P00] + phi[DIR_P0M]))+ ((phi[DIR_0MP] - c2o1 * phi[DIR_0M0] + phi[DIR_0MM]) + (phi[DIR_0PP] - c2o1 * phi[DIR_0P0] + phi[DIR_0PM]))) + +c1o36* (((phi[DIR_MPP] - c2o1 * phi[DIR_MP0] + phi[DIR_MPM]) + (phi[DIR_PMP] - c2o1 * phi[DIR_PM0] + phi[DIR_PMM])) + ((phi[DIR_MMP] - c2o1 * phi[DIR_MM0] + phi[DIR_MMM]) + (phi[DIR_PPP] - c2o1 * phi[DIR_PP0] + phi[DIR_PPM])))); + real phiXY = c1o4 *(c2o3* (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0])+c1o6*((phi[DIR_MMP] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_MPP])+ (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PPM] - phi[DIR_MPM]))); + real phiXZ = c1o4 *(c2o3* (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P])+c1o6*((phi[DIR_MPM] - phi[DIR_PPM] + phi[DIR_PPP] - phi[DIR_MPP])+ (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PMP] - phi[DIR_MMP]))); + real phiYZ = c1o4 *(c2o3* (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM])+c1o6*((phi[DIR_MMM] - phi[DIR_MMP] + phi[DIR_MPP] - phi[DIR_MPM])+ (phi[DIR_PMM] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_PPM]))); + + //non isotropic FD (to be improved): + //real phiX = (phi[DIR_P00] - phi[DIR_M00]) * c1o2; //gradX1_phi(); + //real phiY = (phi[DIR_0P0] - phi[DIR_0M0]) * c1o2; //gradX2_phi(); + //real phiZ = (phi[DIR_00P] - phi[DIR_00M]) * c1o2; //gradX3_phi(); + + //real phiXX = phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]; + //real phiYY = phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]; + //real phiZZ =( phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]); + //real phiXY = c1o4 * (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0]); + //real phiXZ = c1o4 * (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P]); + //real phiYZ = c1o4 * (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM]); + //real back= (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - phiXX * (phiY * phiY + phiZ * phiZ) - phiYY * (phiX * phiX + phiZ * phiZ) - phiZZ * (phiX * phiX + phiY * phiY)) / (c2o1 * pow(phiX * phiX + phiY * phiY + phiZ * phiZ, c3o2)); + return (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - (phiXX * (phiY * phiY + phiZ * phiZ) + phiYY * (phiX * phiX + phiZ * phiZ) + phiZZ * (phiX * phiX + phiY * phiY))) / (c2o1*pow(phiX*phiX+phiY*phiY+phiZ*phiZ,c3o2)); + //return (phiX * phiX * phiXX + phiY * phiY * phiYY + phiZ * phiZ * phiZZ + c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ)) / ((phiX * phiX + phiY * phiY + phiZ * phiZ) * (phiX * phiX + phiY * phiY + phiZ * phiZ)); +} + +void MultiphaseScaleDistributionLBMKernel::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 MultiphaseScaleDistributionLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, + int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->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 MultiphaseScaleDistributionLBMKernel::findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, + int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->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 MultiphaseScaleDistributionLBMKernel::swapDistributions() +{ + LBMKernel::swapDistributions(); + dataSet->getHdistributions()->swap(); + dataSet->getH2distributions()->swap(); +} + +void MultiphaseScaleDistributionLBMKernel::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/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..67a6680bb7d11980e357c0f797c185899618b324 --- /dev/null +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h @@ -0,0 +1,132 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 MultiphaseScaleDistributionLBMKernel.h +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#ifndef MultiphaseScaleDistributionLBMKernel_H +#define MultiphaseScaleDistributionLBMKernel_H + +#include "LBMKernel.h" +#include "BCSet.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 MultiphaseScaleDistributionLBMKernel : public LBMKernel +{ +public: + MultiphaseScaleDistributionLBMKernel(); + virtual ~MultiphaseScaleDistributionLBMKernel(void) = default; + void calculate(int step) override; + SPtr<LBMKernel> clone() override; + + + ///refactor + //CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure; + + + double getCalculationTime() override { return .0; } +protected: + virtual void initDataSet(); + void swapDistributions() override; + + void initForcing(); + + void forwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void backwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void forwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2); + void backwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2); + + real f1[D3Q27System::ENDF+1]; + + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF; + + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1; + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1; + CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH1; + + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH2; + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH2; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH2; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressureOld; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr p1Old; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseField; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr divU; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr rhoNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vxNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vyNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vzNode; + + real h [D3Q27System::ENDF+1]; + real h2[D3Q27System::ENDF + 1]; + real g [D3Q27System::ENDF+1]; + real phi[D3Q27System::ENDF+1]; + real phi2[D3Q27System::ENDF + 1]; + real pr1[D3Q27System::ENDF+1]; + real phi_cutoff[D3Q27System::ENDF+1]; + + real gradX1_phi(); + real gradX2_phi(); + real gradX3_phi(); + real gradX1_rhoInv(real rhoL, real rhoDIV); + real gradX2_rhoInv(real rhoL, real rhoDIV); + real gradX3_rhoInv(real rhoL, real rhoDIV); + real gradX1_phi2(); + real gradX2_phi2(); + real gradX3_phi2(); + void computePhasefield(); + void findNeighbors(CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3); + void findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3); + + real nabla2_phi(); + + real computeCurvature_phi(); + + mu::value_type muX1,muX2,muX3; + mu::value_type muDeltaT; + mu::value_type muNu; + mu::value_type muRho; + real forcingX1; + real forcingX2; + real forcingX3; +}; + +#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.cpp index eb9606e49591c9ec550c65fe15eca025c31e5ab0..85d6dcadcd3f8ebf661d7f32f18dcbc54c4eb5c4 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.cpp @@ -70,7 +70,7 @@ SPtr<LBMKernel> MultiphaseScratchCumulantLBMKernel::clone() kernel->setPhaseFieldRelaxation(this->tauH); kernel->setMobility(this->mob); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -155,7 +155,7 @@ void MultiphaseScratchCumulantLBMKernel::calculate(int step) nonLocalDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); zeroDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -3062,7 +3062,7 @@ void MultiphaseScratchCumulantLBMKernel::findNeighbors(CbArray3D<real, IndexerX3 using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.h index 6f10c9b5db0e2272d734de02a55dab1452f79d1a..db4e547a2054f1a37468bb726f4f3fc20c33bd53 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseScratchCumulantLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseScratchCumulantLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af5ba7d63edbf3a8a1866a70d6edc30920664cb1 --- /dev/null +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp @@ -0,0 +1,1674 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 MultiphaseSharpInterfaceLBMKernel.cpp +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#include "MultiphaseSharpInterfaceLBMKernel.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> +#include "NonNewtonianFluids/LBM/Rheology.h" + +#define PROOF_CORRECTNESS + +using namespace vf::lbm::dir; +using namespace vf::basics::constant; + +////////////////////////////////////////////////////////////////////////// +MultiphaseSharpInterfaceLBMKernel::MultiphaseSharpInterfaceLBMKernel() { this->compressible = false; } +////////////////////////////////////////////////////////////////////////// +void MultiphaseSharpInterfaceLBMKernel::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<real, IndexerX3X2X1>::CbArray3DPtr pressure(new CbArray3D<real, IndexerX3X2X1>( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + //pressureOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + //p1Old = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + + rhoNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vxNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vyNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vzNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, 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<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0)); + phaseFieldOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 999.0)); + + //divU = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); +} +////////////////////////////////////////////////////////////////////////// +SPtr<LBMKernel> MultiphaseSharpInterfaceLBMKernel::clone() +{ + SPtr<LBMKernel> kernel(new MultiphaseSharpInterfaceLBMKernel()); + kernel->setNX(nx); + dynamicPointerCast<MultiphaseSharpInterfaceLBMKernel>(kernel)->initDataSet(); + kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG); + kernel->setDensityRatio(this->densityRatio); + //kernel->setMultiphaseModelParameters(this->beta, this->kappa); + kernel->setSigma(this->sigma); + 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->setBCSet(bcSet->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<MultiphaseSharpInterfaceLBMKernel>(kernel)->initForcing(); + + return kernel; +} +////////////////////////////////////////////////////////////////////////// +void MultiphaseSharpInterfaceLBMKernel::forwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) { + //using namespace UbMath; + real m2 = mfa + mfc; + real m1 = mfc - mfa; + real m0 = m2 + mfb; + mfa = m0; + m0 *= Kinverse; + m0 += oneMinusRho; + mfb = (m1 * Kinverse - m0 * vv) * K; + mfc = ((m2 - c2o1 * m1 * vv) * Kinverse + v2 * m0) * K; +} + +//////////////////////////////////////////////////////////////////////////////// +void MultiphaseSharpInterfaceLBMKernel::backwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) { + //using namespace UbMath; + real m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K; + real m1 = (((mfa - mfc) - c2o1 * 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 MultiphaseSharpInterfaceLBMKernel::forwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2) { + //using namespace UbMath; + real m1 = (mfa + mfc) + mfb; + real m2 = mfc - mfa; + mfc = (mfc + mfa) + (v2 * m1 - c2o1 * vv * m2); + mfb = m2 - vv * m1; + mfa = m1; +} + + +void MultiphaseSharpInterfaceLBMKernel::backwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2) { + //using namespace UbMath; + real ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2); + real mb = ((mfa - mfc) - mfa * v2) - c2o1 * mfb * vv; + mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2); + mfb = mb; + mfa = ma; +} + + +void MultiphaseSharpInterfaceLBMKernel::calculate(int step) +{ + using namespace D3Q27System; + //using namespace UbMath; + + forcingX1 = 0.0; + forcingX2 = 0.0; + forcingX3 = 0.0; + + real oneOverInterfaceScale = c4o1 / 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<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); + + SPtr<BCArray3D> bcArray = this->getBCSet()->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; + //real 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; + + + + real mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + real mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3); + + //omegaDRho = 2.0;// 1.5; + //real phiOld = (*phaseField)(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) = c1o1; + } + + if ((*phaseField)(x1, x2, x3) < 0) { + (*phaseField)(x1, x2, x3) = 0; + + + } + } + } + } + } + + this->swapDistributions(); + for (int x3 = minX3 - ghostLayerWidth+1; x3 < maxX3 + ghostLayerWidth-1; x3++) { + for (int x2 = minX2 - ghostLayerWidth+1; x2 < maxX2 + ghostLayerWidth-1; x2++) { + for (int x1 = minX1 - ghostLayerWidth+1; x1 < maxX1 + ghostLayerWidth-1; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + //int x1p = x1 + 1; + //int x2p = x2 + 1; + //int x3p = x3 + 1; + + + SPtr<DistributionArray3D> distributionH = this->getDataSet()->getHdistributions(); + real hh[27]; + distributionH->getDistributionInv(hh, x1, x2, x3); + real phiD, vxP, vyP, vzP; + + D3Q27System::calcIncompMacroscopicValues(hh, phiD, vxP, vyP, vzP); + (*phaseFieldOld)(x1, x2, x3) = phiD; + + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG,vx,vy,vz; + + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + + (*rhoNode)(x1, x2, x3) = rhoG;// *((*phaseField)(x1, x2, x3) > c1o2 ? densityRatio : c1o1); + (*vxNode)(x1, x2, x3) = vx; + (*vyNode)(x1, x2, x3) = vy; + (*vzNode)(x1, x2, x3) = vz; + + + } + } + } + } + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + 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; + //int x3p = x3 + 1; + findNeighbors(phaseFieldOld, x1, x2, x3); + ////////////////////////////////Momentum conservation experiment 06.03.2023 + //surfacetension + + if ((((*phaseField)(x1, x2, x3) <= c1o2) || phi[DIR_000]<=c1o2)&& ( + (phi[DIR_P00] > c1o2) || + (phi[DIR_M00] > c1o2) || + (phi[DIR_00P] > c1o2) || + (phi[DIR_00M] > c1o2) || + (phi[DIR_0M0] > c1o2) || + (phi[DIR_0P0] > c1o2) || + (phi[DIR_PP0] > c1o2) || + (phi[DIR_PM0] > c1o2) || + (phi[DIR_P0P] > c1o2) || + (phi[DIR_P0M] > c1o2) || + (phi[DIR_MP0] > c1o2) || + (phi[DIR_MM0] > c1o2) || + (phi[DIR_M0P] > c1o2) || + (phi[DIR_M0M] > c1o2) || + (phi[DIR_0PM] > c1o2) || + (phi[DIR_0MM] > c1o2) || + (phi[DIR_0PP] > c1o2) || + (phi[DIR_0MP] > c1o2) || + (phi[DIR_PPP] > c1o2) || + (phi[DIR_PMP] > c1o2) || + (phi[DIR_MPP] > c1o2) || + (phi[DIR_MMP] > c1o2) || + (phi[DIR_PPM] > c1o2) || + (phi[DIR_PMM] > c1o2) || + (phi[DIR_MPM] > c1o2) || + (phi[DIR_MMM] > c1o2) + )) { + real vx = (*vxNode)(x1, x2, x3); + real vy = (*vyNode)(x1, x2, x3); + real vz = (*vzNode)(x1, x2, x3); + findNeighbors(phaseField, x1, x2, x3); + real laplacePressure = c12o1 * sigma * computeCurvature_phi(); + // if (step > 5000) + // UBLOG(logINFO, x1 << ","<< x2 << ","<< x3 << " "<< "3*dP=" << laplacePressure << " dP=" << laplacePressure / 3.0<< " phi=" << phi[DIR_000]<< "\n"); + findNeighbors(phaseFieldOld, x1, x2, x3); + +//16.03.23 c: BB gas side with updated boundary velocity + + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG; + if (phi[DIR_000] > c1o2) { //initialization necessary + real sumRho = 0; + real sumWeight = 1.e-100; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] <= c1o2)) { + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumWeight += WEIGTH[fdir]; + } + + } + rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neighbor? + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2) ) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + if ((phi[D3Q27System::INVDIR[fdir]] > c1o2)) { + ///here we need reconstruction from scrach + real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fGEQOld = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1, x2, x3), vx, vy, vz); + //real fGEQNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew;// fL -feqOLD + feqNew; + //real fBC = fGG - c6o1 * WEIGTH[fdir] * (vBC); + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + ///// other possibility is tor replace the node itself instead of the neighbor (only c1o1 of them is allowed!) + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1 , x2 , x3 ), (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1 , x2 , x3 )); + //real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1, x2, x3 )); + //real fBC = fG - feqOLD + feqNew; + //distribution->setDistributionForDirection(fBC, x1, x2, x3, fdir); + + + } + } + } + //distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + { + real fL = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx,vy,vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoG,vx,vy,vz); + distribution->setDistributionForDirection(fL-feqOLD+feqNew, x1, x2, x3, DIR_000); + } + + } + else {//no refill of gas required + rhoG = (*rhoNode)(x1, x2, x3); + if ((*phaseField)(x1, x2, x3) <= c1o2) {//no refill liquid + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + //real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + //real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + + //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + //if ((*phaseField)(x1, x2, x3) <= c1o2) + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + //real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL-2*fL+2*feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC; + //real flWW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC; + //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + //real number = 666; + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC, x1, x2, x3, fdir); + //// real eqBC= D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + //// real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + ////real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + // distribution->setDistributionForDirection(c2o1*laplacePressure * WEIGTH[fdir] +(fBC + fG - eqBC - eqG) / densityRatio + (eqBC + eqG) - fL, x1, x2, x3, fdir);// -0* (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // //if (vxBC != 0) { + // // int set = 0; + // //} + + + real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real laplacePressureBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + laplacePressureBC =c6o1*c2o1* computeCurvature_phi() * sigma; + findNeighbors(phaseFieldOld, x1, x2, x3); + } else + laplacePressureBC = laplacePressure; // curv; // reset to the above + laplacePressureBC = laplacePressure * (c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + laplacePressureBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //laplacePressureBC *= sigma; + distribution->setDistributionForDirection(laplacePressureBC * WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio * 0) - fL - 0 * (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir); + + } + + } + + + } + } + else {//refill liquid + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + //real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + //real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + + //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + ff[D3Q27System::INVDIR[fdir]] = fBC; + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL- (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vBC), x1, x2, x3, fdir); + //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + //distribution->setDistributionForDirection(0, x1, x2, x3, fdir); + //real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; + //real flWW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; + //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + // real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real flNew = (fBC + fG - eqBC - eqG) / densityRatio + eqBC + eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + // distribution->setDistributionForDirection(c2o1*laplacePressure* WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBC + eqG) - fL, x1, x2, x3, fdir);// - 0*(feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + + //// real number = 666; + + real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real laplacePressureBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + laplacePressureBC = c12o1 * computeCurvature_phi() * sigma; + findNeighbors(phaseFieldOld, x1, x2, x3); + } else + laplacePressureBC = laplacePressure; // curv; // reset to the above + laplacePressureBC = laplacePressure * (c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + laplacePressureBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // laplacePressureBC *= sigma; + distribution->setDistributionForDirection(laplacePressureBC * WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio * 0) - fL - 0 * (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir); + + } + + } + else { + ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]);; + } + + + } + + real sum2 = 1e-100; + real sumRho = 0; + real sumVx = 0; + real sumVy = 0; + real sumVz = 0; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; + sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sum2 += WEIGTH[fdir]; + } + } + real rhoL; + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + rhoL = sumRho / sum2; + //vx = sumVx / sum2; + //vy = sumVy / sum2; + //vz = sumVz / sum2; + //rhoL = (*rhoNode)(x1, x2, x3)/densityRatio; + + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + //} + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if (((phi[fdir] <= c1o2) ))//&& (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2))) + { + real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); + ff[D3Q27System::INVDIR[fdir]] = (ff[D3Q27System::INVDIR[fdir]] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + } + } + + + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] > c1o2)) { + // //real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vBC = -(D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX2[fdir] * vzBC); + // real vDir = -(D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX2[fdir] * vz); + // //vBC = (vBC + vDir) / (c2o1 -( vBC - vDir)); + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) - c6o1 * WEIGTH[fdir] * vDir; + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * D3Q27System::DX3[fdir]); + // real fL= D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(fL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // ff[fdir] = fL; + // } + // if (!(phi[fdir] > c1o2)) { + // //std::cout << "Eq at dir=" << fdir << "\n"; + // real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real feqL = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // ff[fdir] = feqL; + // } + //} + //real sumRho2= 0; + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // sumRho2 += ff[fdir];// -D3Q27System::getIncompFeqForDirection(fdir, 0, sumVx, sumVy, sumVz); + //} + //ff[DIR_000] = rhoL - sumRho2; + //rhoL = 27.0 / 18.0 * sumRho2; + //std::cout << "rhoL=" << rhoL <<" sumRho="<< 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "\n"; + D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + //std::cout << "RecalCrhoL=" << rhoL << " sumRho=" << 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "ffRest="<<ff[DIR_000]<<"\n"; + //distribution->setDistributionForDirection(ff[DIR_000], x1, x2, x3, DIR_000); + { + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + distribution->setDistributionForDirection(fG - feqOLD + feqNew, x1, x2, x3, DIR_000); + } + //for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // ff[D3Q27System::INVDIR[fdir]]=distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + //} + //D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + //std::cout << "AfterRead rhoL=" << rhoL << " rhoGToL=" << rhoG/densityRatio << " vx=" << vx << " vy=" << vy << "ffRest=" << ff[DIR_000] <<" x="<<x1<<" y="<<x2<<" z="<<x3<< "\n"; + + //real feqL = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + //distribution->setDistributionForDirection(feqL, x1, x2, x3, DIR_000); + + + + } + + + + } + +}//end Loop + + + + + + } + } + } + } + + + + this->swapDistributions(); + + real collFactorM; + + 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; + + findNeighbors(phaseField, x1, x2, x3); + + + + real mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); + real mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb = (*this->zeroDistributionsF)(x1, x2, x3); + + + + + real rhoH = 1.0; + real rhoL = 1.0/ densityRatio; + + //real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); + + real dX1_phi = gradX1_phi(); + real dX2_phi = gradX2_phi(); + real dX3_phi = gradX3_phi(); + + real denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi)+ 1.0e-20;//+ 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? + real normX1 = dX1_phi / denom; + real normX2 = dX2_phi / denom; + real normX3 = dX3_phi / denom; + + + + collFactorM = phi[DIR_000] > c1o2 ? collFactorL : collFactorG; + //real collFactorMInv = phi[DIR_000] > c1o2 ? collFactorG : collFactorL; + + //real mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(); + + //----------- Calculating Macroscopic Values ------------- + real rho = phi[DIR_000] > c1o2 ? rhoH : rhoL; + + + + real m0, m1, m2; + real rhoRef=c1o1; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + (mfcbb - mfabb))/rhoRef; + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + (mfbcb - mfbab))/rhoRef; + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + + (mfbbc - mfbba))/rhoRef; + ///////////////////// + + forcingX1 = 0.0; + forcingX2 = 0.0; + forcingX3 = 0.0; + + if (withForcing) { + muRho = rho; + muPhi = phi[DIR_000]; + forcingX1 += muForcingX1.Eval(); + forcingX2 += muForcingX2.Eval(); + forcingX3 += muForcingX3.Eval(); + + vvx += (forcingX1)*deltaT * c1o2; + vvy += (forcingX2)*deltaT * c1o2; + vvz += (forcingX3)*deltaT * c1o2; + } + real vx2; + real vy2; + real vz2; + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + /////////////////////////////////////////////////////////////////////////////////////////// + real 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!!!! + + //////////////////////////////////////////////////////////////////////////////////// + real wadjust; +// real qudricLimit = 0.01 / (c1o1 + 1.0e4 * phi[DIR_000] * (c1o1 - phi[DIR_000])); + //real qudricLimit = 0.01 / (c1o1 + (((*phaseField)(x1, x2, x3) > c1o2) ? 1.0e6 * phi[DIR_000] * (c1o1 - phi[DIR_000]):c0o1)); + real qudricLimit = 0.01; + + //////////////////////////////////////////////////////////////////////////////////// + //! - 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, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + forwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c3o1, c1o9, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + // Cumulants + //////////////////////////////////////////////////////////////////////////////////// + + // mfaaa = 0.0; + real OxxPyyPzz = 1.0; //omega2 or bulk viscosity + // real OxyyPxzz = 1.;//-s9;//2+s9;// + // real OxyyMxzz = 1.;//2+s9;// + real O4 = 1.; + real O5 = 1.; + real O6 = 1.; + ///// + + /////fourth order parameters; here only for test. Move out of loop! + + real 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))); + real 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); + real 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)); + real 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' ) + real 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. + real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); + real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); + real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); + + real CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + + //Cum 5. + real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; + real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; + real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; + + //Cum 6. + real 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 + real mxxPyyPzz = mfcaa + mfaca + mfaac; + mxxPyyPzz -= mfaaa ;//12.03.21 shifted by mfaaa + //mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + + /// + real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + real mmfabb = mfabb; + real mmfbab = mfbab; + real mmfbba = mfbba; + /// + + real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz)*0; + //real dxux = -c1o2 * (mxxMyy + mxxMzz) * collFactorM - mfaaa * c1o3* omegaDRho; + real dyuy = dxux + collFactorM * c3o2 * mxxMyy; + real dzuz = dxux + collFactorM * c3o2 * mxxMzz; + real Dxy = -c3o1 * collFactorM * mfbba; + real Dxz = -c3o1 * collFactorM * mfbab; + real Dyz = -c3o1 * collFactorM * mfabb; + + if (phi[DIR_000] > c1o2) { + /// QR eddyviscosity: + real eddyR = -(Dxy * Dxy + Dxz * Dxz + c1o3 * dxux * dxux) * (dxux) - (Dxy * Dxy + Dyz * Dyz + c1o3 * dyuy * dyuy) * dyuy - (Dxz * Dxz + Dyz * Dyz + c1o3 * dzuz * dzuz) * dzuz - c2o1 * Dxy * Dxz * Dyz; + real eddyQ = Dxy * Dxz + Dxy * Dyz + Dxz * Dyz + c1o2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz); + real nuEddy = 5.0e1 * (eddyR / (eddyQ + 1e-100)) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); + nuEddy = (nuEddy < c1o1 / collFactorM) ? c1o1 / collFactorM : nuEddy; + collFactorM = c1o1 / nuEddy; + // collFactorM = c1o1 / (c1o1 / collFactorM +1.e2*nuEddy*(dX1_phi*dX1_phi+dX2_phi*dX2_phi+dX3_phi*dX3_phi)); + collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; + 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))); + 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); + 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)); + 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)); + 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)); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // non Newtonian fluid collision factor + if (phi[DIR_000] > c1o2) + { + real shearRate = sqrt(c2o1 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); + collFactorM = Rheology::getBinghamCollFactor(collFactorM, shearRate, c1o1); + collFactorM = (collFactorM < c1o1) ? c1o1 : collFactorM; + } + // omega = Rheology::getHerschelBulkleyCollFactor(omega, shearRate, drho); + // omega = Rheology::getBinghamCollFactor(omega, shearRate, drho); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + ///////// + //real mxxMyyh = -c2o1 * (dxux - dyuy) / collFactorMInv * c1o3; + //real mxxMzzh = -c2o1 * (dxux - dzuz) / collFactorMInv * c1o3; + + //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); + + //mxxMyyh += collFactorMInv * (-mxxMyyh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vy2 * dyuy); + //mxxMzzh += collFactorMInv * (-mxxMzzh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vz2 * 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 + real mxxyPyzz = mfcba + mfabc; + real mxxyMyzz = mfcba - mfabc; + + real mxxzPyyz = mfcab + mfacb; + real mxxzMyyz = mfcab - mfacb; + + real mxyyPxzz = mfbca + mfbac; + real 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 * (c1o1 / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / collFactorM - c1o2) * Dxy * c1o3 * BB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / collFactorM - c1o2) * Dxz * c1o3 * BB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / collFactorM - c1o2) * Dyz * c1o3 * BB + (c1o1 - 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 - c1o1) * oMdrho; + mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho; + mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * 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; + + backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + backwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c9o1, c1o9, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + ////////////////////////////////////////////////////////////////////////// + //proof correctness + ////////////////////////////////////////////////////////////////////////// + //#ifdef PROOF_CORRECTNESS + real 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; + + 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 + ////////////////////////////////////////////////////////////////////////// + // if (phi[DIR_000] < c1o2) { + (*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; +///////////////////// P H A S E - F I E L D S O L V E R +//////////////////////////////////////////// +/////CUMULANT PHASE-FIELD + real 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 + real 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; + //////////////////////////////////////////////////////////////////////////////////// + real oneMinusRho = c1o1- concentration; + + real cx = + ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + + (mfcbb - mfabb)); + real cy = + ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + + (mfbcb - mfbab)); + real 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 + real cx2 = cx * cx; + real cy2 = cy * cy; + real 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, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, c1o36, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + forwardChimera(mfaab, mfabb, mfacb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, 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, c6o1, c1o6, oneMinusRho); + forwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1o1, c1o1, oneMinusRho); + forwardChimera(mfaba, mfbba, mfcba, cx, cx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, 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, c3o1, c1o3, oneMinusRho); + forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + //! - experimental Cumulant ... to be published ... hopefully + //! + + // linearized orthogonalization of 3rd order central moments + real Mabc = mfabc - mfaba * c1o3; + real Mbca = mfbca - mfbaa * c1o3; + real Macb = mfacb - mfaab * c1o3; + real Mcba = mfcba - mfaba * c1o3; + real Mcab = mfcab - mfaab * c1o3; + real Mbac = mfbac - mfbaa * c1o3; + // linearized orthogonalization of 5th order central moments + real Mcbc = mfcbc - mfaba * c1o9; + real Mbcc = mfbcc - mfbaa * c1o9; + real Mccb = mfccb - mfaab * c1o9; + + //31.05.2022 addaptive mobility + //omegaD = c1o1 + (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 = c2o1 * (concentration * (concentration - c1o1)) / (-c6o1 * (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) + (concentration * (concentration - c1o1))+1.0e-200); + // collision of 1st order moments + cx = cx * (c1o1 - omegaD) + omegaD * vvx * concentration + + normX1 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + cy = cy * (c1o1 - omegaD) + omegaD * vvy * concentration + + normX2 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + cz = cz * (c1o1 - omegaD) + omegaD * vvz * concentration + + normX3 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration) * c1o3 * oneOverInterfaceScale; + + cx2 = cx * cx; + cy2 = cy * cy; + cz2 = cz * cz; + + // equilibration of 2nd order moments + mfbba = c0o1; + mfbab = c0o1; + mfabb = c0o1; + + mfcaa = c1o3 * concentration; + mfaca = c1o3 * concentration; + mfaac = c1o3 * concentration; + + // equilibration of 3rd order moments + Mabc = c0o1; + Mbca = c0o1; + Macb = c0o1; + Mcba = c0o1; + Mcab = c0o1; + Mbac = c0o1; + mfbbb = c0o1; + + // 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 = c0o1; + mfbcb = c0o1; + mfbbc = c0o1; + + // equilibration of 5th order moments + Mcbc = c0o1; + Mbcc = c0o1; + Mccb = c0o1; + + // 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, c1o1, c1o1, oneMinusRho); + backwardChimera(mfaba, mfbba, mfcba, cx, cx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, 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, c3o1, c1o3, oneMinusRho); + backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + backwardChimera(mfaab, mfabb, mfacb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, 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, c6o1, c1o6, oneMinusRho); + backwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, 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; + + + + + } + } + } + } + } +} +////////////////////////////////////////////////////////////////////////// + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::gradX1_rhoInv(real rhoL,real 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]))); +} + +real MultiphaseSharpInterfaceLBMKernel::gradX2_rhoInv(real rhoL,real 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]))); +} + +real MultiphaseSharpInterfaceLBMKernel::gradX3_rhoInv(real rhoL, real 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]))); +} + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::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])); +} + +real MultiphaseSharpInterfaceLBMKernel::nabla2_phi() +{ + using namespace D3Q27System; + real 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; +} + +real MultiphaseSharpInterfaceLBMKernel::computeCurvature_phi() +{ + using namespace D3Q27System; + using namespace UbMath; + + real phiX = gradX1_phi(); + real phiY = gradX2_phi(); + real phiZ = gradX3_phi(); + real phiXX = c4o9*(phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]) + +(c1o9*(((phi[DIR_PP0] - c2o1 * phi[DIR_0P0] + phi[DIR_MP0])+ (phi[DIR_PM0] - c2o1 * phi[DIR_0M0] + phi[DIR_MM0]))+ ((phi[DIR_P0P] - c2o1 * phi[DIR_00P] + phi[DIR_M0P]) + (phi[DIR_P0M] - c2o1 * phi[DIR_00M] + phi[DIR_M0M]))) + +c1o36* (((phi[DIR_PPP] - c2o1 * phi[DIR_0PP] + phi[DIR_MPP]) + (phi[DIR_PMP] - c2o1 * phi[DIR_0MP] + phi[DIR_MMP])) + ((phi[DIR_PPM] - c2o1 * phi[DIR_0PM] + phi[DIR_MPM]) + (phi[DIR_PMM] - c2o1 * phi[DIR_0MM] + phi[DIR_MMM])))); + real phiYY = c4o9*(phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]) + +(c1o9*(((phi[DIR_PP0] - c2o1 * phi[DIR_P00] + phi[DIR_PM0])+ (phi[DIR_MP0] - c2o1 * phi[DIR_M00] + phi[DIR_MM0]))+ ((phi[DIR_0PP] - c2o1 * phi[DIR_00P] + phi[DIR_0MP]) + (phi[DIR_0PM] - c2o1 * phi[DIR_00M] + phi[DIR_0MM]))) + +c1o36* (((phi[DIR_PPP] - c2o1 * phi[DIR_P0P] + phi[DIR_PMP]) + (phi[DIR_MPM] - c2o1 * phi[DIR_M0M] + phi[DIR_MMM])) + ((phi[DIR_MPP] - c2o1 * phi[DIR_M0P] + phi[DIR_MMP]) + (phi[DIR_PPM] - c2o1 * phi[DIR_P0M] + phi[DIR_PMM])))); + real phiZZ = c4o9*(phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]) + +(c1o9*(((phi[DIR_M0P] - c2o1 * phi[DIR_M00] + phi[DIR_M0M])+ (phi[DIR_P0P] - c2o1 * phi[DIR_P00] + phi[DIR_P0M]))+ ((phi[DIR_0MP] - c2o1 * phi[DIR_0M0] + phi[DIR_0MM]) + (phi[DIR_0PP] - c2o1 * phi[DIR_0P0] + phi[DIR_0PM]))) + +c1o36* (((phi[DIR_MPP] - c2o1 * phi[DIR_MP0] + phi[DIR_MPM]) + (phi[DIR_PMP] - c2o1 * phi[DIR_PM0] + phi[DIR_PMM])) + ((phi[DIR_MMP] - c2o1 * phi[DIR_MM0] + phi[DIR_MMM]) + (phi[DIR_PPP] - c2o1 * phi[DIR_PP0] + phi[DIR_PPM])))); + real phiXY = c1o4 *(c2o3* (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0])+c1o6*((phi[DIR_MMP] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_MPP])+ (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PPM] - phi[DIR_MPM]))); + real phiXZ = c1o4 *(c2o3* (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P])+c1o6*((phi[DIR_MPM] - phi[DIR_PPM] + phi[DIR_PPP] - phi[DIR_MPP])+ (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PMP] - phi[DIR_MMP]))); + real phiYZ = c1o4 *(c2o3* (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM])+c1o6*((phi[DIR_MMM] - phi[DIR_MMP] + phi[DIR_MPP] - phi[DIR_MPM])+ (phi[DIR_PMM] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_PPM]))); + + //non isotropic FD (to be improved): + //real phiX = (phi[DIR_P00] - phi[DIR_M00]) * c1o2; //gradX1_phi(); + //real phiY = (phi[DIR_0P0] - phi[DIR_0M0]) * c1o2; //gradX2_phi(); + //real phiZ = (phi[DIR_00P] - phi[DIR_00M]) * c1o2; //gradX3_phi(); + + //real phiXX = phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]; + //real phiYY = phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]; + //real phiZZ =( phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]); + //real phiXY = c1o4 * (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0]); + //real phiXZ = c1o4 * (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P]); + //real phiYZ = c1o4 * (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM]); + //real back= (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - phiXX * (phiY * phiY + phiZ * phiZ) - phiYY * (phiX * phiX + phiZ * phiZ) - phiZZ * (phiX * phiX + phiY * phiY)) / (c2o1 * pow(phiX * phiX + phiY * phiY + phiZ * phiZ, c3o2)); + return (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - phiXX * (phiY * phiY + phiZ * phiZ) - phiYY * (phiX * phiX + phiZ * phiZ) - phiZZ * (phiX * phiX + phiY * phiY)) / (c2o1*pow(phiX*phiX+phiY*phiY+phiZ*phiZ,c3o2)); + +} + +void MultiphaseSharpInterfaceLBMKernel::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 MultiphaseSharpInterfaceLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, + int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->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 MultiphaseSharpInterfaceLBMKernel::findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, + int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->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 MultiphaseSharpInterfaceLBMKernel::swapDistributions() +{ + LBMKernel::swapDistributions(); + dataSet->getHdistributions()->swap(); +} + +void MultiphaseSharpInterfaceLBMKernel::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/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..fd4b2d88ad4f195683fa2cf17990380a581221dd --- /dev/null +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.h @@ -0,0 +1,129 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 MultiphaseSharpInterfaceLBMKernel.h +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#ifndef MultiphaseSharpInterfaceLBMKernel_H +#define MultiphaseSharpInterfaceLBMKernel_H + +#include "LBMKernel.h" +#include "BCSet.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 MultiphaseSharpInterfaceLBMKernel : public LBMKernel +{ +public: + MultiphaseSharpInterfaceLBMKernel(); + virtual ~MultiphaseSharpInterfaceLBMKernel(void) = default; + void calculate(int step) override; + SPtr<LBMKernel> clone() override; + + + ///refactor + //CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure; + + + double getCalculationTime() override { return .0; } +protected: + virtual void initDataSet(); + void swapDistributions() override; + + void initForcing(); + + void forwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void backwardInverseChimeraWithKincompressible(real& mfa, real& mfb, real& mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void forwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2); + void backwardChimera(real& mfa, real& mfb, real& mfc, real vv, real v2); + + real f1[D3Q27System::ENDF+1]; + + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF; + + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1; + CbArray4D<real,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1; + CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr zeroDistributionsH1; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressureOld; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr p1Old; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseField; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld; + //CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr divU; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr rhoNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vxNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vyNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vzNode; + + real h [D3Q27System::ENDF+1]; + //real h2[D3Q27System::ENDF + 1]; + //real g [D3Q27System::ENDF+1]; + real phi[D3Q27System::ENDF+1]; + real phi2[D3Q27System::ENDF + 1]; + //real pr1[D3Q27System::ENDF+1]; + real phi_cutoff[D3Q27System::ENDF+1]; + + real gradX1_phi(); + real gradX2_phi(); + real gradX3_phi(); + real gradX1_rhoInv(real rhoL, real rhoDIV); + real gradX2_rhoInv(real rhoL, real rhoDIV); + real gradX3_rhoInv(real rhoL, real rhoDIV); + real gradX1_phi2(); + real gradX2_phi2(); + real gradX3_phi2(); + void computePhasefield(); + void findNeighbors(CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3); + void findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3); + + real nabla2_phi(); + + real computeCurvature_phi(); + + mu::value_type muX1,muX2,muX3; + mu::value_type muDeltaT; + mu::value_type muNu; + mu::value_type muRho; + mu::value_type muPhi; + real forcingX1; + real forcingX2; + real forcingX3; +}; + +#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp index 54b2f412a530be065ad9931a77e38511a68b3aa9..047da3666e9f77cd5624f5a3479b3cb79a43990b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp @@ -85,7 +85,7 @@ SPtr<LBMKernel> MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::clone() kernel->setMobility(this->mob); kernel->setInterfaceWidth(this->interfaceWidth); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -170,7 +170,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::calculate(int step) CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -2982,7 +2982,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors(CbArra using namespace vf::lbm::dir; using namespace vf::basics::constant; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); if (phi[DIR_000] < 0) { @@ -3007,7 +3007,7 @@ void MultiphaseSimpleVelocityBaseExternalPressureLBMKernel::findNeighbors2(CbArr using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi2[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h index e2dc6d86abf7525231510df4f052cfc0768df457..98ca6108dca8f0835bc5e4e9479f696791cc354c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseSimpleVelocityBaseExternalPressureLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp index 7ca468f57b58610619b4d641290bae360fc92891..8abd71133dd7088199066b1de0975b8efb16ebc8 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.cpp @@ -71,7 +71,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsCumulantLBMKernel::clone() kernel->setPhaseFieldRelaxation(this->tauH); kernel->setMobility(this->mob); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -160,7 +160,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::calculate(int step) nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions(); zeroDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -3174,7 +3174,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors(CbArray3D<real, In using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); @@ -3195,7 +3195,7 @@ void MultiphaseTwoPhaseFieldsCumulantLBMKernel::findNeighbors2(CbArray3D<real, I using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi2[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h index dbc94d613c4683fb19cb92a7ab7d075da41ab231..34730f454faf81a126eb1431fb623f0447f52fa1 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseTwoPhaseFieldsCumulantLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp index 090abea7ab2158faf9bdf807be64e35ff49d25d1..8a6c2bde6d5031a1b379bdd391aaa1051ca6217f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.cpp @@ -83,7 +83,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::clone() kernel->setMobility(this->mob); kernel->setInterfaceWidth(this->interfaceWidth); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -176,7 +176,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::calculate(int step) CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -3540,7 +3540,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors(CbArray3D<re using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); @@ -3561,7 +3561,7 @@ void MultiphaseTwoPhaseFieldsPressureFilterLBMKernel::findNeighbors2(CbArray3D<r using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi2[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h index 138b24410b10b4631b1411fba3e803bde504531a..c486caf0c0fb64c3a9a7366b55bb3150c139468a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseTwoPhaseFieldsPressureFilterLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp index eb5bd4201e5aa29c66be74440ac619caf3992f86..ef0d033bc0c255d02e51a08fa1a0a85d1b20f0b4 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.cpp @@ -73,7 +73,7 @@ SPtr<LBMKernel> MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::clone() kernel->setPhaseFieldRelaxation(this->tauH); kernel->setMobility(this->mob); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -162,7 +162,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::calculate(int step) nonLocalDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getNonLocalDistributions(); zeroDistributionsH2 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getH2distributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -3471,7 +3471,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors(CbArray3D< using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi[DIR_000] = (*ph)(x1, x2, x3); @@ -3492,7 +3492,7 @@ void MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel::findNeighbors2(CbArray3D using namespace D3Q27System; using namespace vf::lbm::dir; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); phi2[DIR_000] = (*ph)(x1, x2, x3); diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h rename to src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h index a34858ae47c0cb5b10755b21df14290fa242115a..34c0f5b8db234c27a2f55f7c8dee4a7c33bdc949 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h @@ -35,7 +35,7 @@ #define MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/MultiphaseFlow/MultiphaseFlow.h b/src/cpu/MultiphaseFlow/MultiphaseFlow.h new file mode 100644 index 0000000000000000000000000000000000000000..469a819060f7a06ce6e914ace68cb44f6b83dca1 --- /dev/null +++ b/src/cpu/MultiphaseFlow/MultiphaseFlow.h @@ -0,0 +1,28 @@ +#pragma once + +#include "MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.h" +#include "MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.h" +#include "MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h" +#include "MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.h" +#include "MultiphaseFlow/BoundaryConditions/MultiphaseSlipBCStrategy.h" +#include "MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.h" + +#include "MultiphaseFlow/LBM/MultiphaseCumulantLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphasePressureFilterLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseScratchCumulantLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h" +#include "MultiphaseFlow/LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h" + +#include "MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h" +#include "MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h" + +#include "MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h" +#include "MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h" +#include "MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.h" +#include "MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h" + diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp rename to src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp index 74fced98d39116ebbb9ebc9a762398f2cba7c579..adc6a4f81f77cc57a4030643517cc583b61b3c7d 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.cpp +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp @@ -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 WriteMultiphaseQuantitiesCoProcessor.cpp -//! \ingroup CoProcessors +//! \file WriteMultiphaseQuantitiesSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "WriteMultiphaseQuantitiesCoProcessor.h" -#include "BCProcessor.h" +#include "WriteMultiphaseQuantitiesSimulationObserver.h" +#include "BCSet.h" #include "LBMKernel.h" #include <string> #include <vector> @@ -47,14 +47,14 @@ #include "basics/writer/WbWriterVtkXmlASCII.h" #include <logger/Logger.h> -WriteMultiphaseQuantitiesCoProcessor::WriteMultiphaseQuantitiesCoProcessor() = default; +WriteMultiphaseQuantitiesSimulationObserver::WriteMultiphaseQuantitiesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteMultiphaseQuantitiesCoProcessor::WriteMultiphaseQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +WriteMultiphaseQuantitiesSimulationObserver::WriteMultiphaseQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -69,21 +69,21 @@ WriteMultiphaseQuantitiesCoProcessor::WriteMultiphaseQuantitiesCoProcessor(SPtr< } ////////////////////////////////////////////////////////////////////////// -void WriteMultiphaseQuantitiesCoProcessor::init() +void WriteMultiphaseQuantitiesSimulationObserver::init() {} ////////////////////////////////////////////////////////////////////////// -void WriteMultiphaseQuantitiesCoProcessor::process(real step) +void WriteMultiphaseQuantitiesSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - //UBLOG(logDEBUG3, "WriteMultiphaseQuantitiesCoProcessor::update:" << step); - VF_LOG_DEBUG("WriteMultiphaseQuantitiesCoProcessor::update:: {}", step); + //UBLOG(logDEBUG3, "WriteMultiphaseQuantitiesSimulationObserver::update:" << step); + VF_LOG_DEBUG("WriteMultiphaseQuantitiesSimulationObserver::update:: {}", step); } ////////////////////////////////////////////////////////////////////////// -void WriteMultiphaseQuantitiesCoProcessor::collectData(real step) +void WriteMultiphaseQuantitiesSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -120,22 +120,22 @@ void WriteMultiphaseQuantitiesCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - //UBLOG(logINFO, "WriteMultiphaseQuantitiesCoProcessor step: " << istep); - VF_LOG_INFO("WriteMultiphaseQuantitiesCoProcessor step: {}", istep); + //UBLOG(logINFO, "WriteMultiphaseQuantitiesSimulationObserver step: " << istep); + VF_LOG_INFO("WriteMultiphaseQuantitiesSimulationObserver step: {}", istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteMultiphaseQuantitiesCoProcessor::clearData() +void WriteMultiphaseQuantitiesSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -144,7 +144,7 @@ void WriteMultiphaseQuantitiesCoProcessor::clearData() } ////////////////////////////////////////////////////////////////////////// -void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) +void WriteMultiphaseQuantitiesSimulationObserver::addDataMQ(SPtr<Block3D> block) { using namespace D3Q27System; // using namespace UbMath; @@ -167,7 +167,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) data.resize(datanames.size()); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributionsF = kernel->getDataSet()->getFdistributions(); SPtr<DistributionArray3D> distributionsH = kernel->getDataSet()->getHdistributions(); SPtr<DistributionArray3D> distributionsH2 = kernel->getDataSet()->getH2distributions(); @@ -474,7 +474,7 @@ void WriteMultiphaseQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) } } -real WriteMultiphaseQuantitiesCoProcessor::gradX1_phi(const real *const &h) +real WriteMultiphaseQuantitiesSimulationObserver::gradX1_phi(const real *const &h) { using namespace D3Q27System; real sum = 0.0; @@ -483,7 +483,7 @@ real WriteMultiphaseQuantitiesCoProcessor::gradX1_phi(const real *const &h) } return 3.0 * sum; } -real WriteMultiphaseQuantitiesCoProcessor::gradX2_phi(const real *const &h) +real WriteMultiphaseQuantitiesSimulationObserver::gradX2_phi(const real *const &h) { using namespace D3Q27System; real sum = 0.0; @@ -493,7 +493,7 @@ real WriteMultiphaseQuantitiesCoProcessor::gradX2_phi(const real *const &h) return 3.0 * sum; } -real WriteMultiphaseQuantitiesCoProcessor::gradX3_phi(const real *const &h) +real WriteMultiphaseQuantitiesSimulationObserver::gradX3_phi(const real *const &h) { using namespace D3Q27System; real sum = 0.0; @@ -503,7 +503,7 @@ real WriteMultiphaseQuantitiesCoProcessor::gradX3_phi(const real *const &h) return 3.0 * sum; } -real WriteMultiphaseQuantitiesCoProcessor::nabla2_phi(const real *const &h) +real WriteMultiphaseQuantitiesSimulationObserver::nabla2_phi(const real *const &h) { using namespace vf::lbm::dir; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.h b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h similarity index 85% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.h rename to src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h index de09654bb01b8bd851df3afcea1fb3445386fff0..452a06d3bbb23943995f42ce84d712aa3c01b6a4 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMultiphaseQuantitiesCoProcessor.h +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h @@ -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 WriteMultiphaseQuantitiesCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteMultiphaseQuantitiesSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteMultiphaseQuantitiesCoProcessor_H -#define WriteMultiphaseQuantitiesCoProcessor_H +#ifndef WriteMultiphaseQuantitiesSimulationObserver_H +#define WriteMultiphaseQuantitiesSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -50,11 +50,11 @@ class WbWriter; class Block3D; //! \brief A class writes macroscopic quantities information to a VTK-file -class WriteMultiphaseQuantitiesCoProcessor : public CoProcessor +class WriteMultiphaseQuantitiesSimulationObserver : public SimulationObserver { public: - WriteMultiphaseQuantitiesCoProcessor(); - //! \brief Construct WriteMultiphaseQuantitiesCoProcessor object + WriteMultiphaseQuantitiesSimulationObserver(); + //! \brief Construct WriteMultiphaseQuantitiesSimulationObserver object //! \pre The Grid3D and UbScheduler objects must exist //! \param grid is observable Grid3D object //! \param s is UbScheduler object for scheduling of observer @@ -62,11 +62,11 @@ public: //! \param writer is WbWriter object //! \param conv is LBMUnitConverter object //! \param comm is Communicator object - WriteMultiphaseQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + WriteMultiphaseQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteMultiphaseQuantitiesCoProcessor() override = default; + ~WriteMultiphaseQuantitiesSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; protected: //! Collect data for VTK-file diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64ef23bcffb2d9b5478b1f57590d7d297ab08f52 --- /dev/null +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp @@ -0,0 +1,416 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 WriteSharpInterfaceQuantitiesSimulationObserver.cpp +//! \ingroup SimulationObservers +//! \author Konstantin Kutscher +//======================================================================================= + +#include "WriteSharpInterfaceQuantitiesSimulationObserver.h" +#include "BCSet.h" +#include "LBMKernel.h" +#include <string> +#include <vector> + +#include "BCArray3D.h" +#include "Block3D.h" +#include <mpi/Communicator.h> +#include "DataSet3D.h" +#include "Grid3D.h" +#include "LBMUnitConverter.h" +#include "UbScheduler.h" +#include "basics/writer/WbWriterVtkXmlASCII.h" + +WriteSharpInterfaceQuantitiesSimulationObserver::WriteSharpInterfaceQuantitiesSimulationObserver() = default; +////////////////////////////////////////////////////////////////////////// +WriteSharpInterfaceQuantitiesSimulationObserver::WriteSharpInterfaceQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, + const std::string &path, + WbWriter *const writer, + SPtr<LBMUnitConverter> conv, + std::shared_ptr<vf::mpi::Communicator> comm) + : SimulationObserver(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 WriteSharpInterfaceQuantitiesSimulationObserver::init() +{} + +////////////////////////////////////////////////////////////////////////// +void WriteSharpInterfaceQuantitiesSimulationObserver::update(double step) +{ + if (scheduler->isDue(step)) + collectData(step); + + UBLOG(logDEBUG3, "WriteSharpInterfaceQuantitiesSimulationObserver::update:" << step); +} + +////////////////////////////////////////////////////////////////////////// +void WriteSharpInterfaceQuantitiesSimulationObserver::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 == SimulationObserver::scheduler->getMinBegin()) + { + WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); + } else + { + WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); + } + UBLOG(logINFO, "WriteSharpInterfaceQuantitiesSimulationObserver step: " << istep); + } + + clearData(); +} + +////////////////////////////////////////////////////////////////////////// +void WriteSharpInterfaceQuantitiesSimulationObserver::clearData() +{ + nodes.clear(); + cells.clear(); + datanames.clear(); + data.clear(); +} + +////////////////////////////////////////////////////////////////////////// +void WriteSharpInterfaceQuantitiesSimulationObserver::addDataMQ(SPtr<Block3D> block) +{ + using namespace D3Q27System; + //using namespace UbMath; + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel()); + //double level = (double)block->getLevel(); + kernel->swapDistributions(); + // Diese Daten werden geschrieben: + datanames.resize(0); + datanames.push_back("Phi"); + datanames.push_back("Vx"); + datanames.push_back("Vy"); + datanames.push_back("Vz"); + datanames.push_back("Pressure"); + + data.resize(datanames.size()); + + + SPtr<BCArray3D> bcArray = kernel->getBCSet()->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(); + + real pressure; + + real f[D3Q27System::ENDF + 1]; + real phi; + real vx1, vx2, vx3, rho; + real densityRatio = kernel->getDensityRatio(); + //real phiL = kernel->getPhiL(); + //real phiH = kernel->getPhiH(); + + // 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)(distributionsF->getNX1()); + int maxX2 = (int)(distributionsF->getNX2()); + int maxX3 = (int)(distributionsF->getNX3()); + + 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()); + // int maxX3 = (int)(distributions->getNX3()); + + // nummern vergeben und node vector erstellen + daten sammeln + CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1); + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseField( + new CbArray3D<real, IndexerX3X2X1>(maxX1, maxX2, maxX3, -999.0)); + + + 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)) { + distributionsH->getDistributionInv(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[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]; + } + } + } + } + + if (kernel->getGhostLayerWidth() == 1) + { + maxX1 -= 2; + maxX2 -= 2; + maxX3 -= 2; + } + else if (kernel->getGhostLayerWidth() == 2) + { + maxX1 -= 3; + maxX2 -= 3; + maxX3 -= 3; + } + + int nr = (int)nodes.size(); + //real dX1_phi; + //real dX2_phi; + //real dX3_phi; + //real mu; + + 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]))); + + phi = (*phaseField)(ix1, ix2, ix3); + + + distributionsF->getDistributionInv(f, ix1, ix2, ix3); + //real dU = (*divU)(ix1, ix2, ix3); + + real rhoH = 1.0; + real rhoL = 1.0 / densityRatio; + // real rhoToPhi = (1.0 - 1.0/densityRatio); + //real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); + + // rho = phi[ZERO] + (1.0 - phi[ZERO])*1.0/densityRatio; + + + rho = (phi>c1o2) ? rhoH : rhoL; // rhoH + rhoToPhi * (phi - phiH); + + 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])) ; + + 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])) ; + + 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])); + + + + pressure = (((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])*c1o3*rho; + + 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))); + + if (UbMath::isNaN(phi) || UbMath::isInfinity(phi)) + 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) + "," + + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3))); + + if (UbMath::isNaN(pressure) || UbMath::isInfinity(pressure)) + UB_THROW( UbException(UB_EXARGS,"pressure 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))); + + //if (UbMath::isNaN(p1) || UbMath::isInfinity(p1)) + // 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))); + + //if (UbMath::isNaN(mp) || UbMath::isInfinity(mp)) + // UB_THROW(UbException(UB_EXARGS, "mp 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))); + + //if (UbMath::isNaN(delmp) || UbMath::isInfinity(delmp)) + // UB_THROW(UbException(UB_EXARGS, "delmp 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); + 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[DIR_000]); + //data[index++].push_back(mp); + //data[index++].push_back(delmp); + data[index++].push_back(pressure); + } + } + } + } + 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)); + } + } + } + } + kernel->swapDistributions(); +} + +real WriteSharpInterfaceQuantitiesSimulationObserver::gradX1_phi(const real *const &h) +{ + using namespace D3Q27System; + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + real sum = c0o1; + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + sum += WEIGTH[k] * DX1[k] * h[k]; + } + return 3.0 * sum; +} +real WriteSharpInterfaceQuantitiesSimulationObserver::gradX2_phi(const real *const &h) +{ + using namespace D3Q27System; + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + real sum = c0o1; + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + sum += WEIGTH[k] * DX2[k] * h[k]; + } + return 3.0 * sum; +} + +real WriteSharpInterfaceQuantitiesSimulationObserver::gradX3_phi(const real *const &h) +{ + using namespace D3Q27System; + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + real sum = c0o1; + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + sum += WEIGTH[k] * DX3[k] * h[k]; + } + return 3.0 * sum; +} + +real WriteSharpInterfaceQuantitiesSimulationObserver::nabla2_phi(const real *const &h) +{ + using namespace D3Q27System; + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + real sum = c0o1; + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + sum += WEIGTH[k] * (h[k] - h[DIR_000]); + } + return 6.0 * sum; +} \ No newline at end of file diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..8c1e6347862a80cf25ab26a99b1304c731e2e2ee --- /dev/null +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h @@ -0,0 +1,104 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 WriteSharpInterfaceQuantitiesSimulationObserver.h +//! \ingroup SimulationObservers +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef WriteSharpInterfaceQuantitiesSimulationObserver_H +#define WriteSharpInterfaceQuantitiesSimulationObserver_H + +#include <PointerDefinitions.h> +#include <string> +#include <vector> + +#include "SimulationObserver.h" +#include "LBMSystem.h" +#include "UbTuple.h" + +namespace vf::mpi {class Communicator;} +class Grid3D; +class UbScheduler; +class LBMUnitConverter; +class WbWriter; +class Block3D; + +//! \brief A class writes macroscopic quantities information to a VTK-file +class WriteSharpInterfaceQuantitiesSimulationObserver : public SimulationObserver +{ +public: + WriteSharpInterfaceQuantitiesSimulationObserver(); + //! \brief Construct WriteSharpInterfaceQuantitiesSimulationObserver 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 + WriteSharpInterfaceQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + ~WriteSharpInterfaceQuantitiesSimulationObserver() override = default; + + void update(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; + std::shared_ptr<vf::mpi::Communicator> comm; + + real gradX1_phi(const real *const &); + real gradX2_phi(const real *const &); + real gradX3_phi(const real *const &); + real nabla2_phi(const real *const &); + + using CalcMacrosFct = void (*)(const real *const &, real &, real &, real &, real &); + CalcMacrosFct calcMacros; +}; + +#endif diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp b/src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp similarity index 90% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp index b4eee2dfbd952d27835dbaab24da84c041999a21..1b8dc581c37fea66b6f5725330d5d693917adf7d 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp @@ -32,15 +32,15 @@ //======================================================================================= #include "MultiphaseBoundaryConditionsBlockVisitor.h" -#include "BCAdapter.h" +#include "BC.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" #include "Grid3D.h" #include "D3Q27System.h" -#include "BCAdapter.h" +#include "BC.h" #include "Block3D.h" #include "BCArray3D.h" #include "LBMKernel.h" @@ -67,14 +67,14 @@ void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Blo throw UbException(UB_EXARGS, "LBMKernel in " + block->toString() + "is not exist!"); } - SPtr<BCProcessor> bcProcessor = kernel->getBCProcessor(); + SPtr<BCSet> bcSet = kernel->getBCSet(); - if (!bcProcessor) + if (!bcSet) { throw UbException(UB_EXARGS,"Boundary Conditions Processor is not exist!" ); } - SPtr<BCArray3D> bcArray = bcProcessor->getBCArray(); + SPtr<BCArray3D> bcArray = bcSet->getBCArray(); bool compressible = kernel->getCompressible(); real collFactorL = kernel->getCollisionFactorL(); @@ -93,7 +93,7 @@ void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Blo int maxX3 = (int)bcArray->getNX3(); SPtr<BoundaryConditions> bcPtr; - bcProcessor->clearBC(); + bcSet->clearBC(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<DistributionArray3D> distributionsH = kernel->getDataSet()->getHdistributions(); @@ -109,8 +109,8 @@ void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Blo { if ((bcPtr = bcArray->getBC(x1, x2, x3)) != NULL) { - char alg = bcPtr->getBcAlgorithmType(); - SPtr<BCAlgorithm> bca = bcMap[alg]; + char alg = bcPtr->getBCStrategyType(); + SPtr<BCStrategy> bca = bcMap[alg]; if (bca) { @@ -129,7 +129,7 @@ void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Blo bca->setPhiBound(phiL, phiH); bca->setCompressible(compressible); bca->setBcArray(bcArray); - bcProcessor->addBC(bca); + bcSet->addBC(bca); } } } @@ -139,9 +139,9 @@ void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Blo } } ////////////////////////////////////////////////////////////////////////// -void MultiphaseBoundaryConditionsBlockVisitor::addBC(SPtr<BCAdapter> bc) +void MultiphaseBoundaryConditionsBlockVisitor::addBC(SPtr<BC> bc) { - bcMap.insert(std::make_pair(bc->getBcAlgorithmType(), bc->getAlgorithm())); + bcMap.insert(std::make_pair(bc->getBCStrategyType(), bc->getAlgorithm())); } diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h b/src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h similarity index 95% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h index e6cbc69c8bb2431e552d01210c73e450661961c3..cc04246d411dfc91f225598c269c1a10893817f5 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h @@ -37,8 +37,8 @@ #include "Block3DVisitor.h" #include <map> -class BCAdapter; -class BCAlgorithm; +class BC; +class BCStrategy; class MultiphaseBoundaryConditionsBlockVisitor : public Block3DVisitor { @@ -47,9 +47,9 @@ public: virtual ~MultiphaseBoundaryConditionsBlockVisitor(); void visit(SPtr<Grid3D> grid, SPtr<Block3D> block); - void addBC(SPtr<BCAdapter> bc); + void addBC(SPtr<BC> bc); protected: private: - std::map<char, SPtr<BCAlgorithm>> bcMap; + std::map<char, SPtr<BCStrategy>> bcMap; }; #endif // MultiphaseBoundaryConditionsBlockVisitor_h__ diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp b/src/cpu/MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp index 4bc8a1862535ad4f7129577b864de6fe6dfc9ae8..ded01d95428ce53dc09f1371961d68ee1b005c00 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp @@ -33,7 +33,7 @@ #include "MultiphaseInitDistributionsBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "EsoTwist3D.h" @@ -174,7 +174,7 @@ void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPt if (!kernel) throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString()); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->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()); diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h b/src/cpu/MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.h similarity index 100% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.h diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp similarity index 89% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp index 8885b09ea0e19d56bce205334263a7b5c1f16313..04590a0d9e6700720bd3addc824ec4eb04fd94a3 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp @@ -58,24 +58,24 @@ void MultiphaseSetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo newKernel->setDataSet(dataSet); - SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); + SPtr<BCSet> bcProc = block->getKernel()->getBCSet(); if (!bcProc) { - UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); + UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCSet in kernel! Old BCSet is not exist!")); } - newKernel->setBCProcessor(bcProc); + newKernel->setBCSet(bcProc); block->setKernel(newKernel); } break; case MultiphaseSetKernelBlockVisitor::ChangeKernelWithData: { - SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); + SPtr<BCSet> bcProc = block->getKernel()->getBCSet(); if (!bcProc) { - UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); + UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCSet in kernel! Old BCSet is not exist!")); } - newKernel->setBCProcessor(bcProc); + newKernel->setBCSet(bcProc); block->setKernel(newKernel); } break; diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h similarity index 100% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp b/src/cpu/MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp similarity index 83% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp index 1338ab8822f254cc00fc795aa07bdb1b9a525ac2..0aca152c1d9d326e73216a86540130dae3dd4ad0 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.cpp @@ -33,7 +33,7 @@ #include "MultiphaseVelocityFormInitDistributionsBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "EsoTwist3D.h" @@ -48,6 +48,7 @@ MultiphaseVelocityFormInitDistributionsBlockVisitor::MultiphaseVelocityFormInitD this->setVx2(0.0); this->setVx3(0.0); this->setRho(0.0); + this->setPhi(0.0); this->setPressure(0.0); } ////////////////////////////////////////////////////////////////////////// @@ -178,7 +179,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3 if (!kernel) throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString()); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->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()); @@ -207,7 +208,8 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3 vx3 = muVx3.Eval(); phi = muPhi.Eval(); pres = muPressure.Eval(); - (*pressure)(ix1, ix2, ix3) = pres; + if (pressure) + (*pressure)(ix1, ix2, ix3) = pres; //rho = phi*1.0 + (1.0-phi)/densityRatio; @@ -223,7 +225,7 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3 real vx1Sq = vx1*vx1; real vx2Sq = vx2*vx2; real vx3Sq = vx3*vx3; - for (int dir = STARTF; dir < (ENDF+1); dir++) + for (int dir = STARTF; dir <= ENDF; dir++) { real velProd = DX1[dir]*vx1 + DX2[dir]*vx2 + DX3[dir]*vx3; real velSq1 = velProd*velProd; @@ -236,65 +238,65 @@ void MultiphaseVelocityFormInitDistributionsBlockVisitor::visit(const SPtr<Grid3 geq[dir] = p1 * WEIGTH[dir] / (vf::basics::constant::c1o3) + gamma ; } - - f[DIR_P00] = geq[DIR_P00] ; - 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] ; - 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] ; + f[DIR_000] = geq[DIR_000]; + f[DIR_P00] = geq[DIR_P00]; + 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]; + 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]; + distributionsF->setDistribution(f, ix1, ix2, ix3); distributionsF->setDistributionInv(f, ix1, ix2, ix3); - 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; + 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); diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h b/src/cpu/MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h similarity index 100% rename from src/cpu/VirtualFluidsCore/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h rename to src/cpu/MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelNoSlipBCStrategy.h similarity index 77% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelNoSlipBCStrategy.h index 45c9c0c21dba308862c8d4a8c1c1827a4a07e7c7..24c96da39c87a156574327fb92ad758d2025e639 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelNoSlipBCStrategy.h @@ -26,29 +26,29 @@ // 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 RheologyBinghamModelNoSlipBCAlgorithm.h +//! \file RheologyBinghamModelNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyBinghamModelNoSlipBCAlgorithm_h__ -#define RheologyBinghamModelNoSlipBCAlgorithm_h__ +#ifndef RheologyBinghamModelNoSlipBCStrategy_h__ +#define RheologyBinghamModelNoSlipBCStrategy_h__ -#include "RheologyNoSlipBCAlgorithm.h" -#include "Rheology.h" +#include "RheologyNoSlipBCStrategy.h" +#include "cpu/NonNewtonianFluids/LBM/Rheology.h" -class RheologyBinghamModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm +class RheologyBinghamModelNoSlipBCStrategy : public RheologyNoSlipBCStrategy { public: - RheologyBinghamModelNoSlipBCAlgorithm() + RheologyBinghamModelNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::RheologyBinghamModelNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::RheologyBinghamModelNoSlipBCStrategy; + BCStrategy::preCollision = true; } - ~RheologyBinghamModelNoSlipBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override + ~RheologyBinghamModelNoSlipBCStrategy() {} + SPtr<BCStrategy> clone() override { - SPtr<BCAlgorithm> bc(new RheologyBinghamModelNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new RheologyBinghamModelNoSlipBCStrategy()); return bc; } protected: @@ -57,4 +57,4 @@ protected: return Rheology::getBinghamCollFactor(omegaInf, shearRate, drho); } }; -#endif // BinghamModelNoSlipBCAlgorithm_h__ +#endif // BinghamModelNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelVelocityBCStrategy.h similarity index 77% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelVelocityBCStrategy.h index 2837238c40ec02bffe7a8eccb4fedb5100846d55..bbff469c0ebef26eaf57859d56e4bd27c39b358a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelVelocityBCStrategy.h @@ -26,29 +26,29 @@ // 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 RheologyBinghamModelVelocityBCAlgorithm.h +//! \file RheologyBinghamModelVelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef BinghamModelVelocityBCAlgorithm_h__ -#define BinghamModelVelocityBCAlgorithm_h__ +#ifndef BinghamModelVelocityBCStrategy_h__ +#define BinghamModelVelocityBCStrategy_h__ -#include "RheologyVelocityBCAlgorithm.h" -#include "Rheology.h" +#include "RheologyVelocityBCStrategy.h" +#include "cpu/NonNewtonianFluids/LBM/Rheology.h" -class RheologyBinghamModelVelocityBCAlgorithm : public RheologyVelocityBCAlgorithm +class RheologyBinghamModelVelocityBCStrategy : public RheologyVelocityBCStrategy { public: - RheologyBinghamModelVelocityBCAlgorithm() + RheologyBinghamModelVelocityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::RheologyBinghamModelVelocityBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::RheologyBinghamModelVelocityBCStrategy; + BCStrategy::preCollision = true; } - ~RheologyBinghamModelVelocityBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override + ~RheologyBinghamModelVelocityBCStrategy() {} + SPtr<BCStrategy> clone() override { - SPtr<BCAlgorithm> bc(new RheologyBinghamModelVelocityBCAlgorithm()); + SPtr<BCStrategy> bc(new RheologyBinghamModelVelocityBCStrategy()); return bc; } protected: @@ -57,4 +57,4 @@ protected: return Rheology::getBinghamCollFactor(omegaInf, shearRate, drho); } }; -#endif // BinghamModelVelocityBCAlgorithm_h__ +#endif // BinghamModelVelocityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCStrategy.h similarity index 76% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCStrategy.h index c9b76b563dd16044ee109acbdc8eff73cde95959..c29c6e9cebc3092358369bc16c5bfe5b65215ea9 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCStrategy.h @@ -26,28 +26,28 @@ // 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 RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h +//! \file RheologyHerschelBulkleyModelNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ -#define RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ +#ifndef RheologyHerschelBulkleyModelNoSlipBCStrategy_h__ +#define RheologyHerschelBulkleyModelNoSlipBCStrategy_h__ -#include "RheologyNoSlipBCAlgorithm.h" -#include "Rheology.h" +#include "RheologyNoSlipBCStrategy.h" +#include "cpu/NonNewtonianFluids/LBM/Rheology.h" -class RheologyHerschelBulkleyModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm +class RheologyHerschelBulkleyModelNoSlipBCStrategy : public RheologyNoSlipBCStrategy { public: - RheologyHerschelBulkleyModelNoSlipBCAlgorithm() + RheologyHerschelBulkleyModelNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::RheologyHerschelBulkleyModelNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::RheologyHerschelBulkleyModelNoSlipBCStrategy; + BCStrategy::preCollision = true; } - ~RheologyHerschelBulkleyModelNoSlipBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override + ~RheologyHerschelBulkleyModelNoSlipBCStrategy() {} + SPtr<BCStrategy> clone() override { - SPtr<BCAlgorithm> bc(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new RheologyHerschelBulkleyModelNoSlipBCStrategy()); return bc; } protected: @@ -56,4 +56,4 @@ protected: return Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); } }; -#endif // RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ \ No newline at end of file +#endif // RheologyHerschelBulkleyModelNoSlipBCStrategy_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.cpp similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.cpp index 73bf54ad7eccbd42deb2454fa5d0a060cf6b5c15..4227b3af8af343de69b15944a5ebb96f5bd5c9d8 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.cpp @@ -26,21 +26,21 @@ // 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 RheologyNoSlipBCAlgorithm.cpp +//! \file RheologyNoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "RheologyNoSlipBCAlgorithm.h" +#include "RheologyNoSlipBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" ////////////////////////////////////////////////////////////////////////// -void RheologyNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void RheologyNoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void RheologyNoSlipBCAlgorithm::applyBC() +void RheologyNoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -59,7 +59,7 @@ void RheologyNoSlipBCAlgorithm::applyBC() //quadratic bounce back const int invDir = D3Q27System::INVDIR[fDir]; real q = bcPtr->getQ(invDir); - real fReturn =(f[invDir] + q * f[fDir] + q * collFactorF * (feq[invDir] - f[invDir] + feq[fDir] - f[fDir])) / (1.0 + q); + real fReturn =(f[invDir] + q * f[fDir] + q * collFactorF * (feq[invDir] - f[invDir] + feq[fDir] - f[fDir])) / (vf::basics::constant::c1o1 + q); distributions->setDistributionInvForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], invDir); } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.h similarity index 85% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.h index c8c38ad7fcf3e35378b1e5dd14938cdad230f185..611d87bcd3b6e275869b6ec430b7a1f349c0aa3e 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.h @@ -26,27 +26,27 @@ // 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 RheologyNoSlipBCAlgorithm.h +//! \file RheologyNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyNoSlipBCAlgorithm_h__ -#define RheologyNoSlipBCAlgorithm_h__ +#ifndef RheologyNoSlipBCStrategy_h__ +#define RheologyNoSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class RheologyNoSlipBCAlgorithm : public BCAlgorithm +class RheologyNoSlipBCStrategy : public BCStrategy { public: - RheologyNoSlipBCAlgorithm() = default; - ~RheologyNoSlipBCAlgorithm() = default; - virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("real clone() - belongs in the derived class")); } + RheologyNoSlipBCStrategy() = default; + ~RheologyNoSlipBCStrategy() = default; + virtual SPtr<BCStrategy> clone() override { UB_THROW(UbException("real clone() - belongs in the derived class")); } void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; protected: virtual real getRheologyCollFactor(real omegaInf, real shearRate, real drho) const = 0; // { UB_THROW(UbException("real getRheologyCollFactor() - belongs in the derived class")); } }; -#endif // RheologyNoSlipBCAlgorithm_h__ +#endif // RheologyNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyPowellEyringModelNoSlipBCStrategy.h similarity index 76% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyPowellEyringModelNoSlipBCStrategy.h index a6a3a5a745f193d66f2d87303ab5df1fd62826eb..f867ab1dc2df84bb8498728295a1f6d7cf734d83 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyPowellEyringModelNoSlipBCStrategy.h @@ -26,28 +26,28 @@ // 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 RheologyPowellEyringModelNoSlipBCAlgorithm.h +//! \file RheologyPowellEyringModelNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyPowellEyringModelNoSlipBCAlgorithm_h__ -#define RheologyPowellEyringModelNoSlipBCAlgorithm_h__ +#ifndef RheologyPowellEyringModelNoSlipBCStrategy_h__ +#define RheologyPowellEyringModelNoSlipBCStrategy_h__ -#include "RheologyNoSlipBCAlgorithm.h" -#include "Rheology.h" +#include "RheologyNoSlipBCStrategy.h" +#include "cpu/NonNewtonianFluids/LBM/Rheology.h" -class RheologyPowellEyringModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm +class RheologyPowellEyringModelNoSlipBCStrategy : public RheologyNoSlipBCStrategy { public: - RheologyPowellEyringModelNoSlipBCAlgorithm() + RheologyPowellEyringModelNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::RheologyPowellEyringModelNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::RheologyPowellEyringModelNoSlipBCStrategy; + BCStrategy::preCollision = true; } - ~RheologyPowellEyringModelNoSlipBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override + ~RheologyPowellEyringModelNoSlipBCStrategy() {} + SPtr<BCStrategy> clone() override { - SPtr<BCAlgorithm> bc(new RheologyPowellEyringModelNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new RheologyPowellEyringModelNoSlipBCStrategy()); return bc; } protected: @@ -56,4 +56,4 @@ protected: return Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); } }; -#endif // RheologyPowellEyringModelNoSlipBCAlgorithm_h__ \ No newline at end of file +#endif // RheologyPowellEyringModelNoSlipBCStrategy_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.cpp similarity index 63% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.cpp index 9f7881af1705fca4ef24402f0fed4dbcb701127b..706edc7a2efe6ab23dde750b26d2905f16fe4220 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.cpp @@ -26,54 +26,58 @@ // 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 RheologyVelocityBCAlgorithm.cpp +//! \file RheologyVelocityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "RheologyVelocityBCAlgorithm.h" +#include "RheologyVelocityBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -RheologyVelocityBCAlgorithm::RheologyVelocityBCAlgorithm() +RheologyVelocityBCStrategy::RheologyVelocityBCStrategy() { - //BCAlgorithm::type = BCAlgorithm::RheologyVelocityBCAlgorithm; - //BCAlgorithm::preCollision = false; + //BCStrategy::type = BCStrategy::RheologyVelocityBCStrategy; + //BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -RheologyVelocityBCAlgorithm::~RheologyVelocityBCAlgorithm() +RheologyVelocityBCStrategy::~RheologyVelocityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -void RheologyVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void RheologyVelocityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void RheologyVelocityBCAlgorithm::applyBC() +void RheologyVelocityBCStrategy::applyBC() { - real f[D3Q27System::ENDF+1]; - real feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - real rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - calcFeqFct(feq, drho, vx1, vx2, vx3); + using namespace vf::basics::constant; + + real f[D3Q27System::ENDF+1]; + real feq[D3Q27System::ENDF+1]; + distributions->getDistribution(f, x1, x2, x3); + real rho, vx1, vx2, vx3, drho; + calcMacrosFct(f, drho, vx1, vx2, vx3); + calcFeqFct(feq, drho, vx1, vx2, vx3); real shearRate = D3Q27System::getShearRate(f, collFactor); + // getShearRate(f, collFactor) takes pre collision state but is given post collision state. Requires rescaling real collFactorF = getRheologyCollFactor(collFactor, shearRate, drho); + rho = 1.0+drho*compressibleFactor; - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) - { - if (bcPtr->hasVelocityBoundaryFlag(fdir)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - real q = bcPtr->getQ(invDir);// m+m q=0 stabiler - real velocity = bcPtr->getBoundaryVelocity(invDir); - real fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactorF)+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); - } - } + for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) + { + if (bcPtr->hasVelocityBoundaryFlag(fdir)) + { + const int invDir = D3Q27System::INVDIR[fdir]; + real q = bcPtr->getQ(invDir); + real velocity = bcPtr->getBoundaryVelocity(invDir); + real fReturn = ((c1o1 - q) / (c1o1 + q)) * ((f[invDir])) + ((q * (f[invDir] + f[fdir] - collFactorF * (f[invDir] - feq[invDir] + f[fdir] - feq[fdir])) - velocity * rho) / (c1o1 + q)); + distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); + } + } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.h similarity index 85% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.h index 91ac9ec574b9252c4d2842b9134d4190878d9daf..00c08230cf19fd73bfa56b7949239e62be72fbd4 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/RheologyVelocityBCStrategy.h @@ -26,29 +26,29 @@ // 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 RheologyVelocityBCAlgorithm.h +//! \file RheologyVelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyVelocityBCAlgorithm_h__ -#define RheologyVelocityBCAlgorithm_h__ +#ifndef RheologyVelocityBCStrategy_h__ +#define RheologyVelocityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class RheologyVelocityBCAlgorithm : public BCAlgorithm +class RheologyVelocityBCStrategy : public BCStrategy { public: - RheologyVelocityBCAlgorithm(); - ~RheologyVelocityBCAlgorithm(); - virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("real clone() - belongs in the derived class")); } + RheologyVelocityBCStrategy(); + ~RheologyVelocityBCStrategy(); + virtual SPtr<BCStrategy> clone() override { UB_THROW(UbException("real clone() - belongs in the derived class")); } void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; protected: virtual real getRheologyCollFactor(real omegaInf, real shearRate, real drho) const = 0; // { UB_THROW(UbException("real getRheologyCollFactor() - belongs in the derived class")); } }; -#endif // RheologyVelocityBCAlgorithm_h__ +#endif // RheologyVelocityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.cpp similarity index 84% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.cpp index ebdf07f25ba489a87b637646271171bdc6de6d58..70981c5d0e4178eb0b58ac807305635be5a7fdfd 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.cpp @@ -26,51 +26,51 @@ // 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 ThixotropyDensityBCAlgorithm.cpp +//! \file ThixotropyDensityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyDensityBCAlgorithm.h" +#include "ThixotropyDensityBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -ThixotropyDensityBCAlgorithm::ThixotropyDensityBCAlgorithm() +ThixotropyDensityBCStrategy::ThixotropyDensityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThixotropyDensityBCAlgorithm; - BCAlgorithm::preCollision = false; - BCAlgorithm::thixotropy = true; + BCStrategy::type = BCStrategy::ThixotropyDensityBCStrategy; + BCStrategy::preCollision = false; + BCStrategy::thixotropy = true; lambdaBC = 0.0; } ////////////////////////////////////////////////////////////////////////// -ThixotropyDensityBCAlgorithm::~ThixotropyDensityBCAlgorithm() +ThixotropyDensityBCStrategy::~ThixotropyDensityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThixotropyDensityBCAlgorithm::clone() +SPtr<BCStrategy> ThixotropyDensityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThixotropyDensityBCAlgorithm()); - dynamicPointerCast<ThixotropyDensityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + SPtr<BCStrategy> bc(new ThixotropyDensityBCStrategy()); + dynamicPointerCast<ThixotropyDensityBCStrategy>(bc)->setLambdaBC(lambdaBC); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void ThixotropyDensityBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyDensityBCStrategy::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void ThixotropyDensityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyDensityBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyDensityBCAlgorithm::applyBC() +void ThixotropyDensityBCStrategy::applyBC() { using namespace vf::lbm::dir; using namespace D3Q27System; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h index 2b83eed0ef9720b247751011e4d49d70df4b5e71..a40500fe5b9e5ca2136bba71e3723e75db33bd50 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h @@ -26,23 +26,23 @@ // 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 ThixotropyDensityBCAlgorithm.h +//! \file ThixotropyDensityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyDensityBCAlgorithm_h__ -#define ThixotropyDensityBCAlgorithm_h__ +#ifndef ThixotropyDensityBCStrategy_h__ +#define ThixotropyDensityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" -class ThixotropyDensityBCAlgorithm : public BCAlgorithm +class ThixotropyDensityBCStrategy : public BCStrategy { public: - ThixotropyDensityBCAlgorithm(); - virtual ~ThixotropyDensityBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + ThixotropyDensityBCStrategy(); + virtual ~ThixotropyDensityBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); //void addDistributionsF(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributions); @@ -54,5 +54,5 @@ protected: private: real lambdaBC; }; -#endif // ThixotropyDensityBCAlgorithm_h__ +#endif // ThixotropyDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.cpp similarity index 76% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.cpp index e973a0091ea12db88e21052c3addc8fa4db8e995..da1f2deaa8c18fb74f9d5b60212f05dbb94173fe 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.cpp @@ -26,49 +26,49 @@ // 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 ThixotropyNoSlipBCAlgorithm.cpp +//! \file ThixotropyNoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyNoSlipBCAlgorithm.h" +#include "ThixotropyNoSlipBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -ThixotropyNoSlipBCAlgorithm::ThixotropyNoSlipBCAlgorithm() +ThixotropyNoSlipBCStrategy::ThixotropyNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThixotropyNoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; - BCAlgorithm::thixotropy = true; + BCStrategy::type = BCStrategy::ThixotropyNoSlipBCStrategy; + BCStrategy::preCollision = false; + BCStrategy::thixotropy = true; } ////////////////////////////////////////////////////////////////////////// -ThixotropyNoSlipBCAlgorithm::~ThixotropyNoSlipBCAlgorithm() +ThixotropyNoSlipBCStrategy::~ThixotropyNoSlipBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThixotropyNoSlipBCAlgorithm::clone() +SPtr<BCStrategy> ThixotropyNoSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThixotropyNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new ThixotropyNoSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyNoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void ThixotropyNoSlipBCAlgorithm::addDistributionsF(SPtr<DistributionArray3D> distributions) +//void ThixotropyNoSlipBCStrategy::addDistributionsF(SPtr<DistributionArray3D> distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void ThixotropyNoSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyNoSlipBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyNoSlipBCAlgorithm::applyBC() +void ThixotropyNoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -91,8 +91,8 @@ void ThixotropyNoSlipBCAlgorithm::applyBC() //quadratic bounce back const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir); - real fReturnf = ((1.0 - q) / (1.0 + q))*((f[invDir] - feq[invDir]) / (1.0 - collFactor) + feq[invDir]) + ((q / (1.0 + q))*(f[invDir] + f[fdir])); - real fReturnh = ((1.0 - q) / (1.0 + q))*((h[invDir] - heq[invDir]) / (1.0 - collFactor) + heq[invDir]) + ((q / (1.0 + q))*(h[invDir] + h[fdir])); + real fReturnf = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q))*((f[invDir] - feq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + feq[invDir]) + ((q / (vf::basics::constant::c1o1 + q))*(f[invDir] + f[fdir])); + real fReturnh = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q))*((h[invDir] - heq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + heq[invDir]) + ((q / (vf::basics::constant::c1o1 + q))*(h[invDir] + h[fdir])); distributions->setDistributionForDirection(fReturnf, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); distributionsH->setDistributionForDirection(fReturnh, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h index e3e0ebc348909bd7152cdcbb9d1ede2253c80497..edd8952333f9607429e78ea917edf360768743c7 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h @@ -26,21 +26,21 @@ // 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 ThixotropyNoSlipBCAlgorithm.h +//! \file ThixotropyNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyNoSlipBCAlgorithm_h__ -#define ThixotropyNoSlipBCAlgorithm_h__ +#ifndef ThixotropyNoSlipBCStrategy_h__ +#define ThixotropyNoSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" -class ThixotropyNoSlipBCAlgorithm : public BCAlgorithm +class ThixotropyNoSlipBCStrategy : public BCStrategy { public: - ThixotropyNoSlipBCAlgorithm(); - virtual ~ThixotropyNoSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + ThixotropyNoSlipBCStrategy(); + virtual ~ThixotropyNoSlipBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); //void addDistributionsF(DistributionArray3DPtr distributions); void addDistributionsH(SPtr<DistributionArray3D> distributions); @@ -50,5 +50,5 @@ protected: private: }; -#endif // ThixotropyNoSlipBCAlgorithm_h__ +#endif // ThixotropyNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.cpp similarity index 52% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.cpp index 257b2b6f227a71f2b22312aad20bb49d93dbf4e9..3ee059eec142c2c0ef14d36d52cdf097a68efa18 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.cpp @@ -26,51 +26,52 @@ // 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 ThixotropyNonReflectingOutflowBCAlgorithm.cpp +//! \file ThixotropyNonReflectingOutflowBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyNonReflectingOutflowBCAlgorithm.h" +#include "ThixotropyNonReflectingOutflowBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -ThixotropyNonReflectingOutflowBCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm() +ThixotropyNonReflectingOutflowBCStrategy::ThixotropyNonReflectingOutflowBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm; - BCAlgorithm::preCollision = true; - BCAlgorithm::thixotropy = true; + BCStrategy::type = BCStrategy::ThixotropyNonReflectingOutflowBCStrategy; + BCStrategy::preCollision = true; + BCStrategy::thixotropy = true; } ////////////////////////////////////////////////////////////////////////// -ThixotropyNonReflectingOutflowBCAlgorithm::~ThixotropyNonReflectingOutflowBCAlgorithm() +ThixotropyNonReflectingOutflowBCStrategy::~ThixotropyNonReflectingOutflowBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThixotropyNonReflectingOutflowBCAlgorithm::clone() +SPtr<BCStrategy> ThixotropyNonReflectingOutflowBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThixotropyNonReflectingOutflowBCAlgorithm()); + SPtr<BCStrategy> bc(new ThixotropyNonReflectingOutflowBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyNonReflectingOutflowBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyNonReflectingOutflowBCStrategy::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyNonReflectingOutflowBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() +void ThixotropyNonReflectingOutflowBCStrategy::applyBC() { using namespace vf::lbm::dir; using namespace D3Q27System; + using namespace vf::basics::constant; real f[ENDF + 1]; real ftemp[ENDF + 1]; @@ -97,16 +98,16 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() switch (direction) { - case DIR_P00: - f[DIR_P00] = ftemp[DIR_P00] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P00]; - f[DIR_PP0] = ftemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PP0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PM0]; - f[DIR_P0P] = ftemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P0P]; - f[DIR_P0M] = ftemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P0M]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PMP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PMM]; + case DIR_P00: + f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P00]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PP0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PM0]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0P]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0M]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -119,15 +120,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M00]; - f[DIR_MP0] = ftemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MP0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MM0]; - f[DIR_M0P] = ftemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M0P]; - f[DIR_M0M] = ftemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M0M]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MPP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MMP]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MPM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MMM]; + f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M00]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MP0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MM0]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0P]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0M]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMP]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -140,15 +141,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0P0]; - f[DIR_PP0] = ftemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PP0]; - f[DIR_MP0] = ftemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MP0]; - f[DIR_0PP] = ftemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0PP]; - f[DIR_0PM] = ftemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0PM]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MPP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MPM]; + f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0P0]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PP0]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MP0]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PP]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PM]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPM]; 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); @@ -161,15 +162,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0M0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PM0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MM0]; - f[DIR_0MP] = ftemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0MP]; - f[DIR_0MM] = ftemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0MM]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MMP]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MMM]; + f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0M0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PM0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MM0]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MP]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MM]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMP]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -182,15 +183,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_00P]; - f[DIR_P0P] = ftemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_P0P]; - f[DIR_M0P] = ftemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_M0P]; - f[DIR_0PP] = ftemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_0PP]; - f[DIR_0MP] = ftemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_0MP]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_MPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_MMP]; + f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_00P]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_P0P]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_M0P]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0PP]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0MP]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -203,15 +204,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_00M]; - f[DIR_P0M] = ftemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_P0M]; - f[DIR_M0M] = ftemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_M0M]; - f[DIR_0PM] = ftemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_0PM]; - f[DIR_0MM] = ftemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_0MM]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_MPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_MMM]; + f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_00M]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_P0M]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_M0M]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0PM]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0MM]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MMM]; 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); @@ -242,15 +243,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() switch (direction) { case DIR_P00: - h[DIR_P00] = htemp[DIR_P00] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_P00]; - h[DIR_PP0] = htemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PP0]; - h[DIR_PM0] = htemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PM0]; - h[DIR_P0P] = htemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_P0P]; - h[DIR_P0M] = htemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_P0M]; - h[DIR_PPP] = htemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PPP]; - h[DIR_PMP] = htemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PMP]; - h[DIR_PPM] = htemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PPM]; - h[DIR_PMM] = htemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * h[DIR_PMM]; + h[DIR_P00] = htemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P00]; + h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PP0]; + h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PM0]; + h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P0P]; + h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_P0M]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PPP]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PMP]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * h[DIR_PPM]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -263,15 +264,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributionsH->setDistributionInvForDirection(h[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP); break; case DIR_M00: - h[DIR_M00] = htemp[DIR_M00] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_M00]; - h[DIR_MP0] = htemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MP0]; - h[DIR_MM0] = htemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MM0]; - h[DIR_M0P] = htemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_M0P]; - h[DIR_M0M] = htemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_M0M]; - h[DIR_MPP] = htemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MPP]; - h[DIR_MMP] = htemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MMP]; - h[DIR_MPM] = htemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MPM]; - h[DIR_MMM] = htemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * h[DIR_MMM]; + h[DIR_M00] = htemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M00]; + h[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MP0]; + h[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MM0]; + h[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M0P]; + h[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_M0M]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MPP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MMP]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * h[DIR_MPM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -284,15 +285,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP); break; case DIR_0P0: - h[DIR_0P0] = htemp[DIR_0P0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_0P0]; - h[DIR_PP0] = htemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_PP0]; - h[DIR_MP0] = htemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_MP0]; - h[DIR_0PP] = htemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_0PP]; - h[DIR_0PM] = htemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_0PM]; - h[DIR_PPP] = htemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_PPP]; - h[DIR_MPP] = htemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_MPP]; - h[DIR_PPM] = htemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_PPM]; - h[DIR_MPM] = htemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * h[DIR_MPM]; + h[DIR_0P0] = htemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0P0]; + h[DIR_PP0] = htemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PP0]; + h[DIR_MP0] = htemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MP0]; + h[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0PP]; + h[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_0PM]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PPP]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MPP]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_PPM]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * h[DIR_MPM]; 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); @@ -305,15 +306,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributionsH->setDistributionInvForDirection(h[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP); break; case DIR_0M0: - h[DIR_0M0] = htemp[DIR_0M0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_0M0]; - h[DIR_PM0] = htemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_PM0]; - h[DIR_MM0] = htemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_MM0]; - h[DIR_0MP] = htemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_0MP]; - h[DIR_0MM] = htemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_0MM]; - h[DIR_PMP] = htemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_PMP]; - h[DIR_MMP] = htemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_MMP]; - h[DIR_PMM] = htemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_PMM]; - h[DIR_MMM] = htemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * h[DIR_MMM]; + h[DIR_0M0] = htemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0M0]; + h[DIR_PM0] = htemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PM0]; + h[DIR_MM0] = htemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_MM0]; + h[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0MP]; + h[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_0MM]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PMP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_MMP]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * h[DIR_PMM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -326,15 +327,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributionsH->setDistributionInvForDirection(h[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP); break; case DIR_00P: - h[DIR_00P] = htemp[DIR_00P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_00P]; - h[DIR_P0P] = htemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_P0P]; - h[DIR_M0P] = htemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_M0P]; - h[DIR_0PP] = htemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_0PP]; - h[DIR_0MP] = htemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_0MP]; - h[DIR_PPP] = htemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_PPP]; - h[DIR_MPP] = htemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_MPP]; - h[DIR_PMP] = htemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_PMP]; - h[DIR_MMP] = htemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * h[DIR_MMP]; + h[DIR_00P] = htemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_00P]; + h[DIR_P0P] = htemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_P0P]; + h[DIR_M0P] = htemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_M0P]; + h[DIR_0PP] = htemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_0PP]; + h[DIR_0MP] = htemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_0MP]; + h[DIR_PPP] = htemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_PPP]; + h[DIR_MPP] = htemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_MPP]; + h[DIR_PMP] = htemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * h[DIR_PMP]; + h[DIR_MMP] = htemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -347,15 +348,15 @@ void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() distributionsH->setDistributionInvForDirection(h[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM); break; case DIR_00M: - h[DIR_00M] = htemp[DIR_00M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_00M]; - h[DIR_P0M] = htemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_P0M]; - h[DIR_M0M] = htemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_M0M]; - h[DIR_0PM] = htemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_0PM]; - h[DIR_0MM] = htemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_0MM]; - h[DIR_PPM] = htemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_PPM]; - h[DIR_MPM] = htemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_MPM]; - h[DIR_PMM] = htemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_PMM]; - h[DIR_MMM] = htemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * h[DIR_MMM]; + h[DIR_00M] = htemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_00M]; + h[DIR_P0M] = htemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_P0M]; + h[DIR_M0M] = htemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_M0M]; + h[DIR_0PM] = htemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_0PM]; + h[DIR_0MM] = htemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_0MM]; + h[DIR_PPM] = htemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_PPM]; + h[DIR_MPM] = htemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_MPM]; + h[DIR_PMM] = htemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_PMM]; + h[DIR_MMM] = htemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * h[DIR_MMM]; 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); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.h similarity index 85% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.h index cabc67bd67111b873c9c62db748d1f04eb006c56..7ae90994a13ab1a0842a0abbad596d1762bd4927 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.h @@ -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 ThixotropyNonReflectingOutflowBCAlgorithm.h +//! \file ThixotropyNonReflectingOutflowBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyNonReflectingOutflowBCAlgorithm_h__ -#define ThixotropyNonReflectingOutflowBCAlgorithm_h__ +#ifndef ThixotropyNonReflectingOutflowBCStrategy_h__ +#define ThixotropyNonReflectingOutflowBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" -class ThixotropyNonReflectingOutflowBCAlgorithm : public BCAlgorithm +class ThixotropyNonReflectingOutflowBCStrategy : public BCStrategy { public: - ThixotropyNonReflectingOutflowBCAlgorithm(); - virtual ~ThixotropyNonReflectingOutflowBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + ThixotropyNonReflectingOutflowBCStrategy(); + virtual ~ThixotropyNonReflectingOutflowBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); //void addDistributionsF(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributions); @@ -53,5 +53,5 @@ protected: private: //LBMReal lambdaBC; }; -#endif // ThixotropyNonReflectingOutflowBCAlgorithm_h__ +#endif // ThixotropyNonReflectingOutflowBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.cpp similarity index 81% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.cpp index 189f52fd3088392be0db5b144158ed97623beafe..2b2dd1714eb7a9decceeb92a28a5dbfae6944e9c 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.cpp @@ -26,50 +26,50 @@ // 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 ThixotropyVelocityBCAlgorithm.cpp +//! \file ThixotropyVelocityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyVelocityBCAlgorithm.h" +#include "ThixotropyVelocityBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -ThixotropyVelocityBCAlgorithm::ThixotropyVelocityBCAlgorithm() +ThixotropyVelocityBCStrategy::ThixotropyVelocityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThixotropyVelocityBCAlgorithm; - BCAlgorithm::preCollision = false; - BCAlgorithm::thixotropy = true; - lambdaBC = 0.0; + BCStrategy::type = BCStrategy::ThixotropyVelocityBCStrategy; + BCStrategy::preCollision = false; + BCStrategy::thixotropy = true; + lambdaBC = vf::basics::constant::c0o1; } ////////////////////////////////////////////////////////////////////////// -ThixotropyVelocityBCAlgorithm::~ThixotropyVelocityBCAlgorithm() +ThixotropyVelocityBCStrategy::~ThixotropyVelocityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThixotropyVelocityBCAlgorithm::clone() +SPtr<BCStrategy> ThixotropyVelocityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThixotropyVelocityBCAlgorithm()); - dynamicPointerCast<ThixotropyVelocityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + SPtr<BCStrategy> bc(new ThixotropyVelocityBCStrategy()); + dynamicPointerCast<ThixotropyVelocityBCStrategy>(bc)->setLambdaBC(lambdaBC); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void ThixotropyVelocityBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyVelocityBCStrategy::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityBCAlgorithm::applyBC() +void ThixotropyVelocityBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -84,7 +84,7 @@ void ThixotropyVelocityBCAlgorithm::applyBC() calcMacrosFct(f, drho, vx1, vx2, vx3); calcFeqFct(feq, drho, vx1, vx2, vx3); - rho = 1.0 + drho * compressibleFactor; + rho = vf::basics::constant::c1o1 + drho * compressibleFactor; //calcDiffusionMacrosFctPost(h, concentration, fl1, fl2, fl3, m100, collFactor); real lambda = D3Q27System::getDensity(h); @@ -127,7 +127,7 @@ void ThixotropyVelocityBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir);// m+m q=0 stabiler real velocity = bcPtr->getBoundaryVelocity(invDir); - real 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)); + real fReturn = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q)) * ((f[invDir] - feq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + feq[invDir]) + ((q * (f[invDir] + f[fdir]) - velocity * rho) / (vf::basics::constant::c1o1 + q)); distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); real htemp = D3Q27System::getCompFeqForDirection(fdir, lambda, vx1, vx2, vx3); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.h index bea3b0a374a128f1de88b1ef3d6e75c0ad34190a..93cf6d2206efe942c57024e979ef9a4f970c2807 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.h @@ -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 ThixotropyVelocityBCAlgorithm.h +//! \file ThixotropyVelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyVelocityBCAlgorithm_h__ -#define ThixotropyVelocityBCAlgorithm_h__ +#ifndef ThixotropyVelocityBCStrategy_h__ +#define ThixotropyVelocityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" -class ThixotropyVelocityBCAlgorithm : public BCAlgorithm +class ThixotropyVelocityBCStrategy : public BCStrategy { public: - ThixotropyVelocityBCAlgorithm(); - virtual ~ThixotropyVelocityBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + ThixotropyVelocityBCStrategy(); + virtual ~ThixotropyVelocityBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributions); void applyBC(); @@ -52,5 +52,5 @@ protected: private: real lambdaBC; }; -#endif // ThixotropyVelocityBCAlgorithm_h__ +#endif // ThixotropyVelocityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.cpp similarity index 83% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.cpp index 6c2622fc7838381de8fa94b12a97d35146b78b43..5d91a1e7a38ea5fc3d20e8aef5f78c9fad6a468d 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.cpp @@ -26,43 +26,43 @@ // 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 ThixotropyVelocityWithDensityBCAlgorithm.cpp +//! \file ThixotropyVelocityWithDensityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyVelocityWithDensityBCAlgorithm.h" +#include "ThixotropyVelocityWithDensityBCStrategy.h" #include "DistributionArray3D.h" #include "BCArray3D.h" -ThixotropyVelocityWithDensityBCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm() +ThixotropyVelocityWithDensityBCStrategy::ThixotropyVelocityWithDensityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::ThixotropyVelocityWithDensityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -ThixotropyVelocityWithDensityBCAlgorithm::~ThixotropyVelocityWithDensityBCAlgorithm() +ThixotropyVelocityWithDensityBCStrategy::~ThixotropyVelocityWithDensityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThixotropyVelocityWithDensityBCAlgorithm::clone() +SPtr<BCStrategy> ThixotropyVelocityWithDensityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThixotropyVelocityWithDensityBCAlgorithm()); - dynamicPointerCast<ThixotropyVelocityWithDensityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + SPtr<BCStrategy> bc(new ThixotropyVelocityWithDensityBCStrategy()); + dynamicPointerCast<ThixotropyVelocityWithDensityBCStrategy>(bc)->setLambdaBC(lambdaBC); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityWithDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityWithDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityWithDensityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityWithDensityBCStrategy::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyVelocityWithDensityBCAlgorithm::applyBC() +void ThixotropyVelocityWithDensityBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -76,7 +76,7 @@ void ThixotropyVelocityWithDensityBCAlgorithm::applyBC() real rho, vx1, vx2, vx3, drho; calcMacrosFct(f, drho, vx1, vx2, vx3); - rho = 1.0+drho*compressibleFactor; + rho = vf::basics::constant::c1o1+drho*compressibleFactor; /////////////////////////////////////////////////////////////////// // Rheology @@ -116,7 +116,7 @@ void ThixotropyVelocityWithDensityBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; real velocity = bcPtr->getBoundaryVelocity(fdir); - real fReturn = (f[fdir] + f[invDir] - velocity*rho) / 2.0 - drho*D3Q27System::WEIGTH[invDir]; + real fReturn = (f[fdir] + f[invDir] - velocity*rho) / vf::basics::constant::c2o1 - drho*D3Q27System::WEIGTH[invDir]; distributions->setDistributionForDirection(fReturn, nX1, nX2, nX3, invDir); } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.h similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h rename to src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.h index d69e79a223e3db56cb6a37014bbf030183adf606..74d33efc0a1dbb693280665d0d27e541081b2fd3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h +++ b/src/cpu/NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.h @@ -26,27 +26,27 @@ // 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 ThixotropyVelocityWithDensityBCAlgorithm.h +//! \file ThixotropyVelocityWithDensityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyVelocityWithDensityBCAlgorithm_h__ -#define ThixotropyVelocityWithDensityBCAlgorithm_h__ +#ifndef ThixotropyVelocityWithDensityBCStrategy_h__ +#define ThixotropyVelocityWithDensityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; //! \brief Class implements Dirichlet boundary condition for velocity. Set density in system. It is used together with non reflecting outflow. -class ThixotropyVelocityWithDensityBCAlgorithm : public BCAlgorithm +class ThixotropyVelocityWithDensityBCStrategy : public BCStrategy { public: - ThixotropyVelocityWithDensityBCAlgorithm(); - ~ThixotropyVelocityWithDensityBCAlgorithm(); - SPtr<BCAlgorithm> clone(); + ThixotropyVelocityWithDensityBCStrategy(); + ~ThixotropyVelocityWithDensityBCStrategy(); + SPtr<BCStrategy> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributions); void applyBC(); @@ -57,4 +57,4 @@ protected: private: real lambdaBC; }; -#endif // ThixotropyVelocityWithDensityBCAlgorithm_h__ +#endif // ThixotropyVelocityWithDensityBCStrategy_h__ diff --git a/src/cpu/NonNewtonianFluids/CMakeLists.txt b/src/cpu/NonNewtonianFluids/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..35765164bce5ce208f1c43fcc7345cbd77f4e999 --- /dev/null +++ b/src/cpu/NonNewtonianFluids/CMakeLists.txt @@ -0,0 +1 @@ +vf_add_library(PUBLIC_LINK VirtualFluidsCore) \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/Rheology.cpp b/src/cpu/NonNewtonianFluids/LBM/Rheology.cpp similarity index 100% rename from src/cpu/VirtualFluidsCore/LBM/Rheology.cpp rename to src/cpu/NonNewtonianFluids/LBM/Rheology.cpp diff --git a/src/cpu/VirtualFluidsCore/LBM/Rheology.h b/src/cpu/NonNewtonianFluids/LBM/Rheology.h similarity index 100% rename from src/cpu/VirtualFluidsCore/LBM/Rheology.h rename to src/cpu/NonNewtonianFluids/LBM/Rheology.h diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/RheologyBinghamModelLBMKernel.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyBinghamModelLBMKernel.h index da51e6c4e11f67ff48efe7a34c7eeaf900e9e730..61ff8c86d65db9d36b0a6919927704ffc2618716 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyBinghamModelLBMKernel.h @@ -50,7 +50,7 @@ public: kernel->setNX(nx); kernel->setCollisionFactor(collFactor); dynamicPointerCast<RheologyBinghamModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/RheologyHerschelBulkleyModelLBMKernel.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyHerschelBulkleyModelLBMKernel.h index 2422efefd52cdbfac183a9fdd19b9b2f5a5fee70..55435e1b4c1243aaefd5f7f141ec2da84c594116 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyHerschelBulkleyModelLBMKernel.h @@ -49,7 +49,7 @@ public: kernel->setNX(nx); kernel->setCollisionFactor(collFactor); dynamicPointerCast<RheologyHerschelBulkleyModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.cpp similarity index 100% rename from src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp rename to src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.cpp diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.h b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h similarity index 100% rename from src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp rename to src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp index 9cb096cd1df43332e41b09c5229b2cdeb0b2936b..a9c7a05da6eefb4f44834d1c91f5e5b43d4f5eb4 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp @@ -71,7 +71,7 @@ SPtr<LBMKernel> RheologyK17LBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<RheologyK17LBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -126,7 +126,7 @@ void RheologyK17LBMKernel::calculate(int step) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.h index 80bf7dcb346f500d75a31eca68fefdd092f2e9e8..1244bb031c1dffda3ea369739a5e9436238e1e0a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.h @@ -35,7 +35,7 @@ #define RheologyK17LBMKernel_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp rename to src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.cpp index 8fe8a78a41609e4acb4bcd6fcd09a7285912b6a7..7f1c8c884d4cf3b4a174f7d2c58e2f070c459b6b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.cpp @@ -83,7 +83,7 @@ void RheologyModelLBMKernel::calculate(int step) nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -903,7 +903,7 @@ void RheologyModelLBMKernel::calculate(int step) // kernel->setCollisionFactor(collFactor); // collFactorF = collFactor; // dynamicPointerCast<RheologyModelLBMKernel>(kernel)->initDataSet(); -// kernel->setBCProcessor(bcProcessor->clone(kernel)); +// kernel->setBCSet(bcSet->clone(kernel)); // kernel->setWithForcing(withForcing); // kernel->setForcingX1(muForcingX1); // kernel->setForcingX2(muForcingX2); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.h similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.h index 8b4ce82984d12ef33b1011fe020fe7d3f0c638e4..4ff3bb9f7b679c4f97b2a685b2d1bbe64912d892 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel.h @@ -34,7 +34,7 @@ #define RheologyModelLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp rename to src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.cpp index b7d7f2c916c8ec1c76fc4fe6175d05fd9312b8c4..380bb9861343803b3ec2165af96c684ac4722c47 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.cpp @@ -53,7 +53,7 @@ void RheologyModelLBMKernel2::calculate(int step) nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -902,7 +902,7 @@ void RheologyModelLBMKernel2::calculate(int step) // kernel->setCollisionFactor(collFactor); // collFactorF = collFactor; // dynamicPointerCast<RheologyModelLBMKernel2>(kernel)->initDataSet(); -// kernel->setBCProcessor(bcProcessor->clone(kernel)); +// kernel->setBCSet(bcSet->clone(kernel)); // kernel->setWithForcing(withForcing); // kernel->setForcingX1(muForcingX1); // kernel->setForcingX2(muForcingX2); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.h index ca058f1e4e67cd8cf51e971999f9a2a359aa197d..ca97551c849d2b3315ff1813ecb0b3936a451a5b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyModelLBMKernel2.h @@ -2,7 +2,7 @@ #define RheologyModelLBMKernel2_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/RheologyPowellEyringModelLBMKernel.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyPowellEyringModelLBMKernel.h index acd02101fed8793175a6aae62394ce14e2847832..5cf0533f96b1c1df10ea8843196e15064044cbb9 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyPowellEyringModelLBMKernel.h @@ -49,7 +49,7 @@ public: kernel->setNX(nx); kernel->setCollisionFactor(collFactor); dynamicPointerCast<RheologyPowellEyringModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.cpp rename to src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp index 70bfdfdadc0d3ebb50befbc022798dc91717276d..cbfa924405109fa03dfef6532c538fb2917d2d43 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp @@ -45,7 +45,7 @@ SPtr<LBMKernel> ThixotropyExpLBMKernel::clone() dynamicPointerCast<ThixotropyExpLBMKernel>(kernel)->setCollisionFactorH(this->collFactorH); dynamicPointerCast<ThixotropyExpLBMKernel>(kernel)->setAlpha(this->alpha); dynamicPointerCast<ThixotropyExpLBMKernel>(kernel)->setTheta(this->theta); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -98,7 +98,7 @@ void ThixotropyExpLBMKernel::calculate(int step) nonLocalDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); zeroDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.h index 1316493c81c56a849cdcc39a9adfb064aa684205..754dd0ae09129455331c5a55b3b4d640350f33db 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyExpLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.h @@ -2,7 +2,7 @@ #define ThixotropyExpLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp similarity index 99% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.cpp rename to src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp index f866381d42538f01e7194d67415e134d9106ab16..368436088dc72bb10677f046aa9e954f9120be42 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp @@ -45,7 +45,7 @@ SPtr<LBMKernel> ThixotropyLBMKernel::clone() dynamicPointerCast<ThixotropyLBMKernel>(kernel)->setCollisionFactorH(this->collFactorH); dynamicPointerCast<ThixotropyLBMKernel>(kernel)->setAlpha(this->alpha); dynamicPointerCast<ThixotropyLBMKernel>(kernel)->setTheta(this->theta); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -98,7 +98,7 @@ void ThixotropyLBMKernel::calculate(int step) nonLocalDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); zeroDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.h b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.h similarity index 98% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.h rename to src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.h index c638105425c20dfa64a221a02004ee1ece8879fd..00b374ed133f58878ed8e1cf541c3fad79ea7c5e 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyLBMKernel.h +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.h @@ -2,7 +2,7 @@ #define ThixotropyLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h b/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h new file mode 100644 index 0000000000000000000000000000000000000000..169082259b203b195b7fc636d84cdd4029ce6ccf --- /dev/null +++ b/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h @@ -0,0 +1,24 @@ +#pragma once + +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/RheologyNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/RheologyPowellEyringModelNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/RheologyBinghamModelVelocityBCStrategy.h" + +#include "NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h" +#include "NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h" + +#include "NonNewtonianFluids/LBM/ThixotropyLBMKernel.h" +#include "NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.h" +#include "NonNewtonianFluids/LBM/RheologyBinghamModelLBMKernel.h" +#include "NonNewtonianFluids/LBM/RheologyHerschelBulkleyModelLBMKernel.h" +#include "NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h" +#include "NonNewtonianFluids/LBM/Rheology.h" +#include "NonNewtonianFluids/LBM/RheologyK17LBMKernel.h" +#include "NonNewtonianFluids/LBM/RheologyPowellEyringModelLBMKernel.h" diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp similarity index 53% rename from src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp rename to src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp index 93b3854070c0b9f1f589e6d32f1872cc8521ca86..82adf2f0e2e59a36e4585d42d9baadb4e793f55f 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.cpp +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "CalculateTorqueCoProcessor.h" -#include "BCProcessor.h" +#include "CalculateTorqueSimulationObserver.h" +#include "BCSet.h" #include <mpi/Communicator.h> #include "D3Q27Interactor.h" @@ -12,8 +12,9 @@ #include "BCArray3D.h" #include "EsoTwist3D.h" #include "DistributionArray3D.h" +#include "NonNewtonianFluids/LBM/Rheology.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), torqueX1global(0), torqueX2global(0), torqueX3global(0) +CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) { if (comm->getProcessID() == comm->getRoot()) { @@ -36,20 +37,20 @@ CalculateTorqueCoProcessor::CalculateTorqueCoProcessor( SPtr<Grid3D> grid, SPtr< } } ////////////////////////////////////////////////////////////////////////// -CalculateTorqueCoProcessor::~CalculateTorqueCoProcessor() +CalculateTorqueSimulationObserver::~CalculateTorqueSimulationObserver() { } ////////////////////////////////////////////////////////////////////////// -void CalculateTorqueCoProcessor::process( real step ) +void CalculateTorqueSimulationObserver::update( real step ) { if(scheduler->isDue(step) ) collectData(step); - UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "D3Q27ForcesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void CalculateTorqueCoProcessor::collectData( real step ) +void CalculateTorqueSimulationObserver::collectData( real step ) { calculateForces(); @@ -70,13 +71,16 @@ void CalculateTorqueCoProcessor::collectData( real step ) ostr << istep << ";"; ostr << torqueX1global << ";"; ostr << torqueX2global << ";"; - ostr << torqueX3global; + ostr << torqueX3global << ";"; + ostr << Fx << ";"; + ostr << Fy << ";"; + ostr << Fz; ostr << std::endl; ostr.close(); } } ////////////////////////////////////////////////////////////////////////// -void CalculateTorqueCoProcessor::calculateForces() +void CalculateTorqueSimulationObserver::calculateForces() { torqueX1global = 0.0; torqueX2global = 0.0; @@ -101,9 +105,8 @@ void CalculateTorqueCoProcessor::calculateForces() SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); - distributions->swap(); int ghostLayerWidth = kernel->getGhostLayerWidth(); int minX1 = ghostLayerWidth; @@ -125,15 +128,24 @@ void CalculateTorqueCoProcessor::calculateForces() if(bcArray->isFluid(x1,x2,x3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!! { SPtr<BoundaryConditions> bc = bcArray->getBC(x1,x2,x3); - UbTupleDouble3 forceVec = getForces(x1,x2,x3,distributions,bc); - real Fx = val<1>(forceVec); - real Fy = val<2>(forceVec); - real Fz = val<3>(forceVec); - + Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3); - real rx = (worldCoordinates[0] - x1Centre) / deltaX; - real ry = (worldCoordinates[1] - x2Centre) / deltaX; - real rz = (worldCoordinates[2] - x3Centre) / deltaX; + real rx = (worldCoordinates[0] - x1Centre) / deltaX; + real ry = (worldCoordinates[1] - x2Centre) / deltaX; + real rz = (worldCoordinates[2] - x3Centre) / deltaX; + + // real nx = rx / sqrt(rx * rx + ry * ry + rz * rz); + // real ny = ry / sqrt(rx * rx + ry * ry + rz * rz); + // real nz = rz / sqrt(rx * rx + ry * ry + rz * rz); + + UbTupleDouble3 forceVec = getForces(x1, x2, x3, distributions, bc); + //UbTupleDouble3 forceVec = getForcesFromMoments(x1, x2, x3, kernel, distributions, bc, nx, ny, nz); + //UbTupleDouble3 forceVec = getForcesFromStressTensor(x1, x2, x3, kernel, distributions, bc, nx, ny, nz); + /*real*/ Fx = val<1>(forceVec); + /*real*/ Fy = val<2>(forceVec); + /*real*/ Fz = val<3>(forceVec); + + torqueX1 += ry * Fz - rz * Fy; torqueX2 += rz * Fx - rx * Fz; @@ -141,8 +153,6 @@ void CalculateTorqueCoProcessor::calculateForces() } } - distributions->swap(); - torqueX1global += torqueX1; torqueX2global += torqueX2; torqueX3global += torqueX3; @@ -170,13 +180,10 @@ void CalculateTorqueCoProcessor::calculateForces() } } ////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) +UbTupleDouble3 CalculateTorqueSimulationObserver::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) { UbTupleDouble3 force(0.0,0.0,0.0); - real fs[D3Q27System::ENDF + 1]; - distributions->getDistributionInv(fs, x1, x2, x3); - if(bc) { //references to tuple "force" @@ -185,6 +192,8 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3, SP real& forceX3 = val<3>(force); real f, fnbr; + dynamicPointerCast<EsoTwist3D>(distributions)->swap(); + for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { if(bc->hasNoSlipBoundaryFlag(fdir) || bc->hasVelocityBoundaryFlag(fdir)) @@ -198,12 +207,85 @@ UbTupleDouble3 CalculateTorqueCoProcessor::getForces(int x1, int x2, int x3, SP forceX3 += (f + fnbr) * D3Q27System::DX3[invDir]; } } + + dynamicPointerCast<EsoTwist3D>(distributions)->swap(); + } + + return force; +} +////////////////////////////////////////////////////////////////////////// +UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromMoments(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) +{ + using namespace vf::basics::constant; + UbTupleDouble3 force(0.0, 0.0, 0.0); + + + if (bc) { + real f[D3Q27System::ENDF + 1]; + distributions->getDistribution(f, x1, x2, x3); + real collFactor = kernel->getCollisionFactor(); + real shearRate = D3Q27System::getShearRate(f, collFactor); + real rho = D3Q27System::getDensity(f); + real omega = Rheology::getBinghamCollFactor(collFactor, shearRate, rho); + std::array<real, 6> moments = D3Q27System::getSecondMoments(f, omega); + + // references to tuple "force" + real &forceX1 = val<1>(force); + real &forceX2 = val<2>(force); + real &forceX3 = val<3>(force); + + real mxx = (moments[0] + moments[1] + moments[2])*c1o3; + real myy = (-c2o1 * moments[1] + moments[2] + moments[0]) * c1o3; + real mzz = (-c2o1 * moments[2] + moments[1] + moments[0]) * c1o3; + real mxy = moments[3]; + real mxz = moments[4]; + real myz = moments[5]; + + forceX1 = mxx *nx + mxy*ny + mxz*nz; + forceX2 = mxy *nx + myy*ny + myz*nz; + forceX3 = mxz *nx + myz*ny + mzz*nz; } - + + return force; +} +////////////////////////////////////////////////////////////////////////// +UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromStressTensor(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) +{ + using namespace vf::basics::constant; + UbTupleDouble3 force(0.0, 0.0, 0.0); + + if (bc) { + real f[D3Q27System::ENDF + 1]; + distributions->getDistribution(f, x1, x2, x3); + real collFactor = kernel->getCollisionFactor(); + real shearRate = D3Q27System::getShearRate(f, collFactor); + real rho = D3Q27System::getDensity(f); + real omega = Rheology::getBinghamCollFactor(collFactor, shearRate, rho); + std::array<real, 6> stress = D3Q27System::getStressTensor(f, omega); + + // references to tuple "force" + real &forceX1 = val<1>(force); + real &forceX2 = val<2>(force); + real &forceX3 = val<3>(force); + + real &tauXX = stress[0]; + real &tauYY = stress[1]; + real &tauZZ = stress[2]; + real &tauXY = stress[3]; + real &tauXZ = stress[4]; + real &tauYZ = stress[5]; + + //https: // journals.aps.org/pre/pdf/10.1103/PhysRevE.88.013303 + + forceX1 = tauXX * nx + tauXY * ny + tauXZ * nz; + forceX2 = tauXY * nx + tauYY * ny + tauYZ * nz; + forceX3 = tauXZ * nx + tauYZ * ny + tauZZ * nz; + } + return force; } ////////////////////////////////////////////////////////////////////////// -void CalculateTorqueCoProcessor::addInteractor( SPtr<D3Q27Interactor> interactor ) +void CalculateTorqueSimulationObserver::addInteractor( SPtr<D3Q27Interactor> interactor ) { interactors.push_back(interactor); } diff --git a/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..d0cd9c41d5afc4e127f9be74e106960c86097f96 --- /dev/null +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h @@ -0,0 +1,55 @@ +/* + * D3Q27ForcesSimulationObserver.h + * + * Created on: 29.09.2012 + * Author: K. Kucher + */ + +#ifndef CalculateTorqueSimulationObserver_H +#define CalculateTorqueSimulationObserver_H + +#include <PointerDefinitions.h> +#include <string> +#include <vector> + +#include "SimulationObserver.h" +#include "UbTuple.h" +#include "D3Q27System.h" + +class ForceCalculator; +namespace vf::mpi {class Communicator;} +class Grid3D; +class UbScheduler; +class D3Q27Interactor; +class DistributionArray3D; +class BoundaryConditions; +class ILBMKernel; + +class CalculateTorqueSimulationObserver: public SimulationObserver +{ +public: + //! Constructor + CalculateTorqueSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + virtual ~CalculateTorqueSimulationObserver(); + void update(real step); + void addInteractor(SPtr<D3Q27Interactor> interactor); +protected: + void collectData(real step); + void calculateForces(); + UbTupleDouble3 getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc); + UbTupleDouble3 getForcesFromMoments(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz); + UbTupleDouble3 getForcesFromStressTensor(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz); + +private: + std::string path; + std::shared_ptr<vf::mpi::Communicator> comm; + std::vector<SPtr<D3Q27Interactor> > interactors; + real torqueX1global; + real torqueX2global; + real torqueX3global; + + real Fx, Fy, Fz; +}; + + +#endif /* D3Q27ForcesSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp similarity index 88% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp rename to src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp index 9ff3fe0982d43ed119e7cfb3fba497a61e2c201b..61f13299d914bb3fd15a8d0a69712c722c91ca6f 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp @@ -30,9 +30,9 @@ //! \ingroup CoProcessors //! \author Konstantin Kutscher //======================================================================================= -#include "WriteThixotropyQuantitiesCoProcessor.h" +#include "WriteThixotropyQuantitiesSimulationObserver.h" #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "UbScheduler.h" #include "DataSet3D.h" #include "D3Q27System.h" @@ -42,17 +42,14 @@ #include <algorithm> #include <numeric> #include "basics/writer/WbWriterVtkXmlASCII.h" -#include "ThixotropyExpLBMKernel.h" -#include "Rheology.h" +#include "LBM/ThixotropyExpLBMKernel.h" +#include "LBM/Rheology.h" using namespace std; -WriteThixotropyQuantitiesCoProcessor::WriteThixotropyQuantitiesCoProcessor() -{ - -} +WriteThixotropyQuantitiesSimulationObserver::WriteThixotropyQuantitiesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteThixotropyQuantitiesCoProcessor::WriteThixotropyQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm) +WriteThixotropyQuantitiesSimulationObserver::WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -66,20 +63,20 @@ WriteThixotropyQuantitiesCoProcessor::WriteThixotropyQuantitiesCoProcessor(SPtr< } } ////////////////////////////////////////////////////////////////////////// -void WriteThixotropyQuantitiesCoProcessor::init() +void WriteThixotropyQuantitiesSimulationObserver::init() { } ////////////////////////////////////////////////////////////////////////// -void WriteThixotropyQuantitiesCoProcessor::process(real step) +void WriteThixotropyQuantitiesSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "WriteThixotropyQuantitiesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "WriteThixotropyQuantitiesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void WriteThixotropyQuantitiesCoProcessor::collectData(real step) +void WriteThixotropyQuantitiesSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); //ConcentrationSum = 0; @@ -118,7 +115,7 @@ void WriteThixotropyQuantitiesCoProcessor::collectData(real step) vector<string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } @@ -126,13 +123,13 @@ void WriteThixotropyQuantitiesCoProcessor::collectData(real step) { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "WriteThixotropyQuantitiesCoProcessor step: " << istep); + UBLOG(logINFO, "WriteThixotropyQuantitiesSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteThixotropyQuantitiesCoProcessor::clearData() +void WriteThixotropyQuantitiesSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -140,7 +137,7 @@ void WriteThixotropyQuantitiesCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void WriteThixotropyQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) +void WriteThixotropyQuantitiesSimulationObserver::addDataMQ(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);; UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); @@ -170,7 +167,7 @@ void WriteThixotropyQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributionsF = kernel->getDataSet()->getFdistributions(); //SPtr<DistributionArray3D> distributionsH = kernel->getDataSet()->getHdistributions(); //LBMReal collFactorF = staticPointerCast<ThixotropyExpLBMKernel>(kernel)->getCollisionFactorF(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.h b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h similarity index 80% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.h rename to src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h index fbb2b6740c53b1d8a2ed9e37881fff98e4707a69..3ac9664e595adef9b45edaee662849a3ab63616f 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.h +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h @@ -26,29 +26,29 @@ // 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 WriteMultiphaseQuantitiesCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteMultiphaseQuantitiesSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteThixotropyQuantitiesCoProcessor_H -#define WriteThixotropyQuantitiesCoProcessor_H +#ifndef WriteThixotropyQuantitiesSimulationObserver_H +#define WriteThixotropyQuantitiesSimulationObserver_H -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "Grid3D.h" #include "Block3D.h" #include "LBMUnitConverter.h" #include <mpi/Communicator.h> #include "WbWriter.h" -class WriteThixotropyQuantitiesCoProcessor : public CoProcessor +class WriteThixotropyQuantitiesSimulationObserver : public SimulationObserver { public: - WriteThixotropyQuantitiesCoProcessor(); - WriteThixotropyQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteThixotropyQuantitiesCoProcessor() = default; + WriteThixotropyQuantitiesSimulationObserver(); + WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + ~WriteThixotropyQuantitiesSimulationObserver() = default; - void process(real step) override; + void update(real step) override; protected: void collectData(real step); diff --git a/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.cpp b/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..69c65b6ecb26953e45671023af3c3a3407c40640 --- /dev/null +++ b/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.cpp @@ -0,0 +1,140 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 BoundaryConditionsBlockVisitor.cpp +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + +#include "BoundaryConditionsBlockVisitor.h" +#include "BC.h" +#include "BCArray3D.h" +#include "BCSet.h" +#include "Block3D.h" +#include "D3Q27EsoTwist3DSplittedVector.h" +#include "DataSet3D.h" +#include "Grid3D.h" +#include "D3Q27System.h" +#include "BC.h" +#include "Block3D.h" +#include "BCArray3D.h" +#include "ILBMKernel.h" + +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyNonReflectingOutflowBCStrategy.h" +#include "NonNewtonianFluids/BoundaryConditions/ThixotropyVelocityWithDensityBCStrategy.h" + + +BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL) +{ +} +////////////////////////////////////////////////////////////////////////// +BoundaryConditionsBlockVisitor::~BoundaryConditionsBlockVisitor() = default; +////////////////////////////////////////////////////////////////////////// +void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) +{ + if (block->getRank() == grid->getRank()) { + SPtr<ILBMKernel> kernel = block->getKernel(); + + if (!kernel) { + throw UbException(UB_EXARGS, "LBMKernel in " + block->toString() + "is not exist!"); + } + + SPtr<BCSet> bcSet = kernel->getBCSet(); + + if (!bcSet) { + throw UbException(UB_EXARGS, "Boundary Conditions Processor is not exist!"); + } + + SPtr<BCArray3D> bcArray = bcSet->getBCArray(); + + bool compressible = kernel->getCompressible(); + real collFactor = kernel->getCollisionFactor(); + + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; + int maxX1 = (int)bcArray->getNX1(); + int maxX2 = (int)bcArray->getNX2(); + int maxX3 = (int)bcArray->getNX3(); + SPtr<BoundaryConditions> bcPtr; + + bcSet->clearBC(); + + SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); + + 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 ((bcPtr = bcArray->getBC(x1, x2, x3)) != NULL) { + char alg = bcPtr->getBCStrategyType(); + SPtr<BCStrategy> bca = bcMap[alg]; + + if (bca) { + bca = bca->clone(); + bca->setBlock(block); + bca->setNodeIndex(x1, x2, x3); + bca->setBcPointer(bcPtr); + bca->addDistributions(distributions); + + if (alg == BCStrategy::ThixotropyVelocityBCStrategy) + std::static_pointer_cast<ThixotropyVelocityBCStrategy>(bca)->addDistributionsH( + kernel->getDataSet()->getHdistributions()); + if (alg == BCStrategy::ThixotropyDensityBCStrategy) + std::static_pointer_cast<ThixotropyDensityBCStrategy>(bca)->addDistributionsH( + kernel->getDataSet()->getHdistributions()); + if (alg == BCStrategy::ThixotropyNoSlipBCStrategy) + std::static_pointer_cast<ThixotropyNoSlipBCStrategy>(bca)->addDistributionsH( + kernel->getDataSet()->getHdistributions()); + if (alg == BCStrategy::ThixotropyNonReflectingOutflowBCStrategy) + std::static_pointer_cast<ThixotropyNonReflectingOutflowBCStrategy>(bca) + ->addDistributionsH(kernel->getDataSet()->getHdistributions()); + if (alg == BCStrategy::ThixotropyVelocityWithDensityBCStrategy) + std::static_pointer_cast<ThixotropyVelocityWithDensityBCStrategy>(bca) + ->addDistributionsH(kernel->getDataSet()->getHdistributions()); + + bca->setCollFactor(collFactor); + bca->setCompressible(compressible); + bca->setBcArray(bcArray); + bcSet->addBC(bca); + } + } + } + } + } + } + } +} +////////////////////////////////////////////////////////////////////////// +void BoundaryConditionsBlockVisitor::addBC(SPtr<BC> bc) +{ + bcMap.insert(std::make_pair(bc->getBCStrategyType(), bc->getAlgorithm())); +} diff --git a/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.h b/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.h new file mode 100644 index 0000000000000000000000000000000000000000..8954bf73a6a459a795e916f24192f5db698b1426 --- /dev/null +++ b/src/cpu/NonNewtonianFluids/Visitors/RheologyBoundaryConditionsBlockVisitor.h @@ -0,0 +1,61 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 BoundaryConditionsBlockVisitor.h +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef BoundaryConditionBlockVisitor_h__ +#define BoundaryConditionBlockVisitor_h__ + +#include <PointerDefinitions.h> +#include <map> + +#include "Block3DVisitor.h" + +class Grid3D; +class Block3D; +class BCStrategy; +class BC; + +//! \brief set boundary conditions +class BoundaryConditionsBlockVisitor : public Block3DVisitor +{ +public: + BoundaryConditionsBlockVisitor(); + ~BoundaryConditionsBlockVisitor() override; + + void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; + void addBC(SPtr<BC> bc); + +protected: +private: + std::map<char, SPtr<BCStrategy>> bcMap; +}; +#endif // BoundaryConditionBlockVisitor_h__ diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index 1ee4c7e78aded0e11ea723769d4515f0f1ec846d..6fa9b30bfc0e650f289d00a2970bdff545c71359 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -108,45 +108,34 @@ #include <muParserToken.h> #include <muParserTokenReader.h> -#include <BoundaryConditions/BCAdapter.h> -#include <BoundaryConditions/BCAlgorithm.h> +#include <BoundaryConditions/BC.h> +#include <BoundaryConditions/BCStrategy.h> #include <BoundaryConditions/BCArray3D.h> #include <BoundaryConditions/BCFunction.h> -#include <BoundaryConditions/BCProcessor.h> +#include <BoundaryConditions/BCSet.h> #include <BoundaryConditions/BoundaryConditions.h> -#include <BoundaryConditions/DensityBCAdapter.h> -#include <BoundaryConditions/EqDensityBCAlgorithm.h> -#include <BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h> -#include <BoundaryConditions/NoSlipBCAdapter.h> -#include <BoundaryConditions/NoSlipBCAlgorithm.h> -#include <BoundaryConditions/NonEqDensityBCAlgorithm.h> -#include <BoundaryConditions/NonReflectingOutflowBCAlgorithm.h> -#include <BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.h> -#include <BoundaryConditions/NonReflectingInflowBCAlgorithm.h> -#include <BoundaryConditions/SlipBCAdapter.h> -#include <BoundaryConditions/SlipBCAlgorithm.h> -#include <BoundaryConditions/ThinWallBCProcessor.h> -#include <BoundaryConditions/ThinWallNoSlipBCAlgorithm.h> -#include <BoundaryConditions/VelocityBCAdapter.h> -#include <BoundaryConditions/VelocityBCAlgorithm.h> -#include <BoundaryConditions/VelocityWithDensityBCAlgorithm.h> -#include <BoundaryConditions/ThixotropyDensityBCAlgorithm.h> -#include <BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h> -#include <BoundaryConditions/ThixotropyVelocityBCAlgorithm.h> -#include <BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h> -#include <BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h> -#include <BoundaryConditions/SimpleVelocityBCAlgorithm.h> -#include <BoundaryConditions/RheologyNoSlipBCAlgorithm.h> -#include <BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h> -#include <BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h> -#include <BoundaryConditions/SimpleSlipBCAlgorithm.h> -#include <BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h> -#include <BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseVelocityBCAdapter.h> -#include <BoundaryConditions/MultiphaseVelocityBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseSlipBCAlgorithm.h> +#include <BoundaryConditions/DensityBC.h> +#include <BoundaryConditions/EqDensityBCStrategy.h> +#include <BoundaryConditions/HighViscosityNoSlipBCStrategy.h> +#include <BoundaryConditions/NoSlipBC.h> +#include <BoundaryConditions/NoSlipBCStrategy.h> +#include <BoundaryConditions/NonEqDensityBCStrategy.h> +#include <BoundaryConditions/NonReflectingOutflowBCStrategy.h> +#include <BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.h> +#include <BoundaryConditions/NonReflectingInflowBCStrategy.h> +#include <BoundaryConditions/SlipBC.h> +#include <BoundaryConditions/SlipBCStrategy.h> +#include <BoundaryConditions/ThinWallBCSet.h> +#include <BoundaryConditions/ThinWallNoSlipBCStrategy.h> +#include <BoundaryConditions/VelocityBC.h> +#include <BoundaryConditions/VelocityBCStrategy.h> +#include <BoundaryConditions/VelocityWithDensityBCStrategy.h> +#include <BoundaryConditions/SimpleVelocityBCStrategy.h> +#include <BoundaryConditions/SimpleSlipBCStrategy.h> + + + + #include <Connectors/Block3DConnector.h> //#include <Connectors/Block3DConnectorFactory.h> @@ -173,51 +162,50 @@ #include <Data/EsoTwistD3Q27System.h> #include <Data/VoidData3D.h> -#include <Grid/BasicCalculator.h> -#include <Grid/Block3D.h> -#include <Grid/Calculator.h> -#include <Grid/Grid3D.h> +#include <Simulation/Block3D.h> +#include <Simulation/Simulation.h> +#include <Simulation/Grid3D.h> #include <Interactors/D3Q27Interactor.h> #include <Interactors/D3Q27TriFaceMeshInteractor.h> #include <Interactors/Interactor3D.h> #include <Interactors/InteractorsHelper.h> -#include <CoProcessors/AdjustForcingCoProcessor.h> -#include <CoProcessors/CalculateForcesCoProcessor.h> -#include <CoProcessors/CalculateTorqueCoProcessor.h> -#include <CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h> -#include <CoProcessors/WriteMQFromSelectionCoProcessor.h> -#include <CoProcessors/WriteBoundaryConditionsCoProcessor.h> -#include <CoProcessors/WriteMQFromSelectionCoProcessor.h> -#include <CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h> -#include <WriteBlocksCoProcessor.h> -//#include <CoProcessors/PathLineCoProcessor.h> -//#include <CoProcessors/PathLineCoProcessorMcpart.h> -#include <CoProcessors/EmergencyExitCoProcessor.h> -#include <CoProcessors/NUPSCounterCoProcessor.h> -#include <CoProcessors/PressureDifferenceCoProcessor.h> -//#include <CoProcessors/Particles.h> -#include <CoProcessors/AverageValuesCoProcessor.h> -#include <CoProcessors/CoProcessor.h> -#include <CoProcessors/DecreaseViscosityCoProcessor.h> -#include <CoProcessors/InSituVTKCoProcessor.h> -#include <CoProcessors/QCriterionCoProcessor.h> -#include <CoProcessors/ShearStressCoProcessor.h> -#include <CoProcessors/TimeseriesCoProcessor.h> -#include <CoProcessors/TurbulenceIntensityCoProcessor.h> -#include <CoProcessors/TimeAveragedValuesCoProcessor.h> - -//#include <CoProcessors/MeanValuesCoProcessor.h> -#include <CoProcessors/InSituCatalystCoProcessor.h> -#include <CoProcessors/LineTimeSeriesCoProcessor.h> -#include <CoProcessors/MPIIOMigrationBECoProcessor.h> -#include <CoProcessors/MPIIOMigrationCoProcessor.h> -#include <CoProcessors/MPIIORestartCoProcessor.h> -#include <CoProcessors/MicrophoneArrayCoProcessor.h> -#include <WriteThixotropyQuantitiesCoProcessor.h> -#include <WriteMultiphaseQuantitiesCoProcessor.h> -#include <TimeDependentBCCoProcessor.h> +#include <SimulationObservers/AdjustForcingSimulationObserver.h> +#include <SimulationObservers/CalculateForcesSimulationObserver.h> + +#include <SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h> +#include <SimulationObservers/WriteMQFromSelectionSimulationObserver.h> +#include <SimulationObservers/WriteBoundaryConditionsSimulationObserver.h> +#include <SimulationObservers/WriteMQFromSelectionSimulationObserver.h> +#include <SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h> +#include <WriteBlocksSimulationObserver.h> +//#include <SimulationObservers/PathLineSimulationObserver.h> +//#include <SimulationObservers/PathLineSimulationObserverMcpart.h> +#include <SimulationObservers/EmergencyExitSimulationObserver.h> +#include <SimulationObservers/NUPSCounterSimulationObserver.h> +#include <SimulationObservers/PressureDifferenceSimulationObserver.h> +//#include <SimulationObservers/Particles.h> +#include <SimulationObservers/AverageValuesSimulationObserver.h> +#include <SimulationObservers/SimulationObserver.h> +#include <SimulationObservers/DecreaseViscositySimulationObserver.h> +#include <SimulationObservers/InSituVTKSimulationObserver.h> +#include <SimulationObservers/QCriterionSimulationObserver.h> +#include <SimulationObservers/ShearStressSimulationObserver.h> +#include <SimulationObservers/TimeseriesSimulationObserver.h> +#include <SimulationObservers/TurbulenceIntensitySimulationObserver.h> +#include <SimulationObservers/TimeAveragedValuesSimulationObserver.h> + +//#include <SimulationObservers/MeanValuesSimulationObserver.h> +#include <SimulationObservers/InSituCatalystSimulationObserver.h> +#include <SimulationObservers/LineTimeSeriesSimulationObserver.h> +#include <SimulationObservers/MPIIOMigrationBESimulationObserver.h> +#include <SimulationObservers/MPIIOMigrationSimulationObserver.h> +#include <SimulationObservers/MPIIORestartSimulationObserver.h> +#include <SimulationObservers/MicrophoneArraySimulationObserver.h> + + +#include <TimeDependentBCSimulationObserver.h> #include <IntegrateValuesHelper.h> //#include <LBM/D3Q27CompactInterpolationProcessor.h> @@ -241,26 +229,13 @@ #include <LBM/LBMSystem.h> #include <LBM/LBMUnitConverter.h> #include <LBM/BGKLBMKernel.h> -#include <LBM/ThixotropyLBMKernel.h> -#include <LBM/ThixotropyExpLBMKernel.h> + #include <LBM/CumulantLBMKernel.h> #include <LBM/CumulantK17LBMKernel.h> //#include <LBM/RheologyModelLBMKernel.h> //#include <LBM/RheologyModelLBMKernel2.h> -#include <LBM/RheologyBinghamModelLBMKernel.h> -#include <LBM/RheologyHerschelBulkleyModelLBMKernel.h> -#include <LBM/RheologyInterpolationProcessor.h> -#include <LBM/Rheology.h> -#include <LBM/RheologyK17LBMKernel.h> -#include <LBM/RheologyPowellEyringModelLBMKernel.h> -#include <LBM/MultiphaseCumulantLBMKernel.h> -#include <LBM/MultiphaseScratchCumulantLBMKernel.h> -#include <LBM/MultiphaseTwoPhaseFieldsCumulantLBMKernel.h> -#include <LBM/MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel.h> -#include <LBM/MultiphaseTwoPhaseFieldsPressureFilterLBMKernel.h> -#include <LBM/MultiphasePressureFilterLBMKernel.h> -#include <LBM/MultiphasePressureFilterCompressibleAirLBMKernel.h> -#include <MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.h> + + @@ -349,10 +324,7 @@ #include <CheckRatioBlockVisitor.h> #include <SpongeLayerBlockVisitor.h> #include <ZoltanPartitioningGridVisitor.h> -#include <Visitors/MultiphaseSetKernelBlockVisitor.h> -#include <Visitors/MultiphaseBoundaryConditionsBlockVisitor.h> -#include <Visitors/MultiphaseInitDistributionsBlockVisitor.h> -#include <Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h> + #include <Visitors/SetInterpolationConnectorsBlockVisitor.h> #include <RefineAroundGbObjectHelper.h> diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BC.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/BC.h index 625fb92149df067639b05435d9b8597b6f96e775..7dc4e4d4146231db144717bdc16b70b01bf59a8b 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BC.h @@ -26,30 +26,30 @@ // 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 BCAdapter.h +//! \file BC.h //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#ifndef BCAdapter_H -#define BCAdapter_H +#ifndef BC_H +#define BC_H #include <PointerDefinitions.h> -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include "BoundaryConditions.h" class D3Q27Interactor; //! \brief Abstract class of baundary conditions adapter -//! \details BCAdapter supports the definition of boundary conditions in grid generation -class BCAdapter +//! \details BC supports the definition of boundary conditions in grid generation +class BC { public: - BCAdapter() = default; + BC() = default; //! \param secondaryBcOption additional option of boundary conditions - BCAdapter(const short &secondaryBcOption) : secondaryBcOption(secondaryBcOption) {} - virtual ~BCAdapter() = default; + BC(const short &secondaryBcOption) : secondaryBcOption(secondaryBcOption) {} + virtual ~BC() = default; // methods bool isTimeDependent() { return ((this->type & TIMEDEPENDENT) == TIMEDEPENDENT); } @@ -66,20 +66,20 @@ public: const real &worldX1, const real &worldX2, const real &worldX3, const real &q, const int &fdirection, const real &time = 0) = 0; - void setBcAlgorithm(SPtr<BCAlgorithm> alg) + void setBCStrategy(SPtr<BCStrategy> alg) { algorithmType = alg->getType(); algorithm = alg; } - SPtr<BCAlgorithm> getAlgorithm() { return algorithm; } - char getBcAlgorithmType() { return algorithmType; } + SPtr<BCStrategy> getAlgorithm() { return algorithm; } + char getBCStrategyType() { return algorithmType; } protected: short secondaryBcOption{ 0 }; char type{ 0 }; - SPtr<BCAlgorithm> algorithm; + SPtr<BCStrategy> algorithm; char algorithmType{ -1 }; static const char TIMEDEPENDENT = 1 << 0; //'1'; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.h index b9d08f7117d9dc41c008c9d92a5780aceedad21c..13d8fbad837d32982e466b8daa05afba9293b69d 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.h @@ -130,9 +130,9 @@ private: ////////////////////////////////////////////////////////////////////////// void deleteBC(std::size_t x1, std::size_t x2, std::size_t x3); - friend class MPIIORestartCoProcessor; - friend class MPIIOMigrationCoProcessor; - friend class MPIIOMigrationBECoProcessor; + friend class MPIIORestartSimulationObserver; + friend class MPIIOMigrationSimulationObserver; + friend class MPIIOMigrationBESimulationObserver; protected: ////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp index 286c9a9f7b9ecd131f90a8c6853ed8e250e1f262..79ab89f0bfbbe8c797aacc8a35c8043a47156b20 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp @@ -32,6 +32,7 @@ //======================================================================================= #include "BCFunction.h" +#include "basics/constants/NumericConstants.h" -const real BCFunction::INFTIMEDEPENDENT = -1.0; -const real BCFunction::INFCONST = -10.0; +const real BCFunction::INFTIMEDEPENDENT = -vf::basics::constant::c1o1; +const real BCFunction::INFCONST = -vf::basics::constant::c10o1; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.cpp similarity index 82% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.cpp index de647a842d1ffcdb08d39988befe1ed19ebc5842..ca8bcadd14040219ced9e519e04a947bd3b8efdc 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.cpp @@ -26,21 +26,21 @@ // 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 BCProcessor.h +//! \file BCSet.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "BCProcessor.h" -#include "BCAlgorithm.h" +#include "BCSet.h" +#include "BCStrategy.h" #include "BCArray3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" #include "ILBMKernel.h" -BCProcessor::BCProcessor() = default; +BCSet::BCSet() = default; ////////////////////////////////////////////////////////////////////////// -BCProcessor::BCProcessor(SPtr<ILBMKernel> kernel) +BCSet::BCSet(SPtr<ILBMKernel> kernel) { SPtr<DistributionArray3D> distributions = std::dynamic_pointer_cast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); @@ -48,19 +48,19 @@ BCProcessor::BCProcessor(SPtr<ILBMKernel> kernel) BCArray3D::FLUID); } ////////////////////////////////////////////////////////////////////////// -BCProcessor::~BCProcessor() = default; +BCSet::~BCSet() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCProcessor> BCProcessor::clone(SPtr<ILBMKernel> kernel) +SPtr<BCSet> BCSet::clone(SPtr<ILBMKernel> kernel) { - SPtr<BCProcessor> bcProcessor(new BCProcessor(kernel)); - return bcProcessor; + SPtr<BCSet> bcSet(new BCSet(kernel)); + return bcSet; } ////////////////////////////////////////////////////////////////////////// -SPtr<BCArray3D> BCProcessor::getBCArray() { return bcArray; } +SPtr<BCArray3D> BCSet::getBCArray() { return bcArray; } ////////////////////////////////////////////////////////////////////////// -void BCProcessor::setBCArray(SPtr<BCArray3D> bcarray) { bcArray = bcarray; } +void BCSet::setBCArray(SPtr<BCArray3D> bcarray) { bcArray = bcarray; } ////////////////////////////////////////////////////////////////////////// -void BCProcessor::addBC(SPtr<BCAlgorithm> bc) +void BCSet::addBC(SPtr<BCStrategy> bc) { if (bc->isPreCollision()) { preBC.push_back(bc); @@ -69,19 +69,19 @@ void BCProcessor::addBC(SPtr<BCAlgorithm> bc) } } ////////////////////////////////////////////////////////////////////////// -void BCProcessor::applyPreCollisionBC() +void BCSet::applyPreCollisionBC() { - for (SPtr<BCAlgorithm> bc : preBC) + for (SPtr<BCStrategy> bc : preBC) bc->applyBC(); } ////////////////////////////////////////////////////////////////////////// -void BCProcessor::applyPostCollisionBC() +void BCSet::applyPostCollisionBC() { - for (SPtr<BCAlgorithm> bc : postBC) + for (SPtr<BCStrategy> bc : postBC) bc->applyBC(); } ////////////////////////////////////////////////////////////////////////// -void BCProcessor::clearBC() +void BCSet::clearBC() { preBC.clear(); postBC.clear(); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.h similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.h index 266307305db6febd885d6e90a8385714947221ff..f3f464093eab5e6ba7945e07dc4f7c929fb1bb34 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCSet.h @@ -26,40 +26,40 @@ // 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 BCProcessor.h +//! \file BCSet.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef BC_PROCESSSOR_H -#define BC_PROCESSSOR_H +#ifndef BCSet_H +#define BCSet_H #include <PointerDefinitions.h> #include <vector> class BCArray3D; -class BCAlgorithm; +class BCStrategy; class ILBMKernel; //! A class provides an interface for boundary conditions in the calculation loop. -class BCProcessor +class BCSet { public: - BCProcessor(); - BCProcessor(SPtr<ILBMKernel> kernel); - virtual ~BCProcessor(); + BCSet(); + BCSet(SPtr<ILBMKernel> kernel); + virtual ~BCSet(); virtual SPtr<BCArray3D> getBCArray(); virtual void setBCArray(SPtr<BCArray3D> bcarray); - virtual SPtr<BCProcessor> clone(SPtr<ILBMKernel> kernel); + virtual SPtr<BCSet> clone(SPtr<ILBMKernel> kernel); - void addBC(SPtr<BCAlgorithm> bc); + void addBC(SPtr<BCStrategy> bc); void applyPreCollisionBC(); void applyPostCollisionBC(); void clearBC(); protected: - std::vector<SPtr<BCAlgorithm>> preBC; - std::vector<SPtr<BCAlgorithm>> postBC; + std::vector<SPtr<BCStrategy>> preBC; + std::vector<SPtr<BCStrategy>> postBC; SPtr<BCArray3D> bcArray; private: diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp similarity index 81% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp index 179007cb6f3f881517c55196420c2cf7135a62f1..3331f24538f421db95d12da0eb6f287ba858765a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp @@ -26,33 +26,33 @@ // 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 BCAlgorithm.cpp +//! \file BCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include "BCArray3D.h" #include "BoundaryConditions.h" #include "EsoTwist3D.h" #include "Block3D.h" -void BCAlgorithm::setBlock(SPtr<Block3D> block) +void BCStrategy::setBlock(SPtr<Block3D> block) { this->block = block; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setNodeIndex(int x1, int x2, int x3) +void BCStrategy::setNodeIndex(int x1, int x2, int x3) { this->x1 = x1; this->x2 = x2; this->x3 = x3; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setBcPointer(SPtr<BoundaryConditions> bcPtr) { this->bcPtr = bcPtr; } +void BCStrategy::setBcPointer(SPtr<BoundaryConditions> bcPtr) { this->bcPtr = bcPtr; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCompressible(bool c) +void BCStrategy::setCompressible(bool c) { compressible = c; @@ -69,26 +69,26 @@ void BCAlgorithm::setCompressible(bool c) } } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCollFactor(real cf) { collFactor = cf; } +void BCStrategy::setCollFactor(real cf) { collFactor = cf; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCollFactorL(real cf) { collFactorL = cf; } +void BCStrategy::setCollFactorL(real cf) { collFactorL = cf; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCollFactorG(real cf) { collFactorG = cf; } +void BCStrategy::setCollFactorG(real cf) { collFactorG = cf; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setCollFactorPh(real cf) { collFactorPh = cf; } +void BCStrategy::setCollFactorPh(real cf) { collFactorPh = cf; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setDensityRatio(real dr) { densityRatio = dr; } +void BCStrategy::setDensityRatio(real dr) { densityRatio = dr; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setPhiBound(real phiL, real phiH) +void BCStrategy::setPhiBound(real phiL, real phiH) { this->phiL = phiL; this->phiH = phiH; } ////////////////////////////////////////////////////////////////////////// -char BCAlgorithm::getType() { return type; } +char BCStrategy::getType() { return type; } ////////////////////////////////////////////////////////////////////////// -bool BCAlgorithm::isPreCollision() { return preCollision; } +bool BCStrategy::isPreCollision() { return preCollision; } ////////////////////////////////////////////////////////////////////////// -SPtr<BCArray3D> BCAlgorithm::getBcArray() { return bcArray; } +SPtr<BCArray3D> BCStrategy::getBcArray() { return bcArray; } ////////////////////////////////////////////////////////////////////////// -void BCAlgorithm::setBcArray(SPtr<BCArray3D> bcarray) { bcArray = bcarray; } +void BCStrategy::setBcArray(SPtr<BCArray3D> bcarray) { bcArray = bcarray; } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.h similarity index 68% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.h index f182546b0740cbff6b66b3849e2c67e42de1a98d..3cc53172a8291961cd5871458efe6869d79f8d00 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.h @@ -26,7 +26,7 @@ // 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 BCAlgorithm.h +//! \file BCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= @@ -44,38 +44,39 @@ class BoundaryConditions; class Block3D; //! \brief Abstract class of baundary conditions algorithm -//! \details BCAlgorithm provides interface for implementation of diferent boundary conditions -class BCAlgorithm +//! \details BCStrategy provides interface for implementation of diferent boundary conditions +class BCStrategy { public: - static const char VelocityBCAlgorithm = 0; - static const char EqDensityBCAlgorithm = 1; - static const char NonEqDensityBCAlgorithm = 2; - static const char NoSlipBCAlgorithm = 3; - static const char SlipBCAlgorithm = 4; - static const char HighViscosityNoSlipBCAlgorithm = 5; - static const char ThinWallNoSlipBCAlgorithm = 6; - static const char VelocityWithDensityBCAlgorithm = 7; - static const char NonReflectingOutflowBCAlgorithm = 8; - static const char ThixotropyVelocityBCAlgorithm = 9; - static const char ThixotropyDensityBCAlgorithm = 10; - static const char ThixotropyNoSlipBCAlgorithm = 11; - static const char ThixotropyNonReflectingOutflowBCAlgorithm = 12; - static const char ThixotropyVelocityWithDensityBCAlgorithm = 13; - static const char RheologyBinghamModelNoSlipBCAlgorithm = 14; - static const char RheologyHerschelBulkleyModelNoSlipBCAlgorithm = 15; - static const char SimpleVelocityBCAlgorithm = 16; - static const char SimpleSlipBCAlgorithm = 17; - static const char RheologyPowellEyringModelNoSlipBCAlgorithm = 18; - static const char RheologyBinghamModelVelocityBCAlgorithm = 19; - static const char MultiphaseNoSlipBCAlgorithm = 20; - static const char MultiphaseVelocityBCAlgorithm = 21; - static const char NonReflectingInflowBCAlgorithm = 22; - static const char NonReflectingOutflowBCAlgorithmWithRelaxation = 23; + static const char VelocityBCStrategy = 0; + static const char EqDensityBCStrategy = 1; + static const char NonEqDensityBCStrategy = 2; + static const char NoSlipBCStrategy = 3; + static const char SlipBCStrategy = 4; + static const char HighViscosityNoSlipBCStrategy = 5; + static const char ThinWallNoSlipBCStrategy = 6; + static const char VelocityWithDensityBCStrategy = 7; + static const char NonReflectingOutflowBCStrategy = 8; + static const char ThixotropyVelocityBCStrategy = 9; + static const char ThixotropyDensityBCStrategy = 10; + static const char ThixotropyNoSlipBCStrategy = 11; + static const char ThixotropyNonReflectingOutflowBCStrategy = 12; + static const char ThixotropyVelocityWithDensityBCStrategy = 13; + static const char RheologyBinghamModelNoSlipBCStrategy = 14; + static const char RheologyHerschelBulkleyModelNoSlipBCStrategy = 15; + static const char SimpleVelocityBCStrategy = 16; + static const char SimpleSlipBCStrategy = 17; + static const char RheologyPowellEyringModelNoSlipBCStrategy = 18; + static const char RheologyBinghamModelVelocityBCStrategy = 19; + static const char MultiphaseNoSlipBCStrategy = 20; + static const char MultiphaseVelocityBCStrategy = 21; + static const char NonReflectingInflowBCStrategy = 22; + static const char NonReflectingOutflowWithRelaxationBCStrategy = 23; + static const char MultiphasePressureBCStrategy = 24; public: - BCAlgorithm() = default; - virtual ~BCAlgorithm() = default; + BCStrategy() = default; + virtual ~BCStrategy() = default; virtual void addDistributions(SPtr<DistributionArray3D> distributions) = 0; virtual void addDistributionsH(SPtr<DistributionArray3D> distributionsH) {} @@ -94,7 +95,7 @@ public: char getType(); bool isPreCollision(); - virtual SPtr<BCAlgorithm> clone() = 0; + virtual SPtr<BCStrategy> clone() = 0; SPtr<BCArray3D> getBcArray(); void setBcArray(SPtr<BCArray3D> bcarray); virtual void applyBC() = 0; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h index 2dcd667bddbd85cb0c07e74ec19d55f93f880157..92cfb6f3cbf347eee7e8fec95c27d7a5646db3b5 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.h @@ -42,6 +42,7 @@ #include "UbTuple.h" #include "Vector3D.h" #include <PointerDefinitions.h> +#include "basics/constants/NumericConstants.h" //! Difenition of baundary conditions in grid generation class BoundaryConditions @@ -310,8 +311,8 @@ public: return (((flag >> (optionDigits * direction)) & maxOptionVal) != 0); } - void setBcAlgorithmType(char alg) { algorithmType = alg; } - char getBcAlgorithmType() { return algorithmType; } + void setBCStrategyType(char alg) { algorithmType = alg; } + char getBCStrategyType() { return algorithmType; } public: static const int optionDigits = 2; //--> 2 bits for secondary Option --> maxOptionVal = 7 @@ -326,20 +327,20 @@ protected: long long densityBoundaryFlags{ 0 }; long long wallModelBoundaryFlags{ 0 }; - float bcVelocityX1{ 0.0f }; - float bcVelocityX2{ 0.0f }; - float bcVelocityX3{ 0.0f }; - float bcDensity{ 0.0f }; - float bcPhaseField{ 0.0f }; + float bcVelocityX1{ vf::basics::constant::c0o1 }; + float bcVelocityX2{ vf::basics::constant::c0o1 }; + float bcVelocityX3{ vf::basics::constant::c0o1 }; + float bcDensity{ vf::basics::constant::c0o1 }; + float bcPhaseField{ vf::basics::constant::c0o1 }; - float nx1{ 0.0f }, nx2{ 0.0f }, nx3{ 0.0f }; + float nx1{ vf::basics::constant::c0o1 }, nx2{ vf::basics::constant::c0o1 }, nx3{ vf::basics::constant::c0o1 }; char algorithmType { -1 }; private: - friend class MPIIORestartCoProcessor; - friend class MPIIOMigrationCoProcessor; - friend class MPIIOMigrationBECoProcessor; + friend class MPIIORestartSimulationObserver; + friend class MPIIOMigrationSimulationObserver; + friend class MPIIOMigrationBESimulationObserver; }; #endif diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.cpp similarity index 85% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.cpp index 86ac7726170c2322e2749f1d4cfaa92033cf7ff9..ecfeff73bf83b94c4b61af8dc5e946bd3de3a81a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.cpp @@ -26,47 +26,48 @@ // 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 DensityBCAdapter.cpp +//! \file DensityBC.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "DensityBCAdapter.h" +#include "DensityBC.h" #include "basics/utilities/UbInfinity.h" #include "basics/utilities/UbLogger.h" +#include "basics/constants/NumericConstants.h" using namespace std; /*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const real &dens, const real &startTime, const real &endTime) +DensityBC::DensityBC(const real &dens, const real &startTime, const real &endTime) { this->densBCs.emplace_back(dens, startTime, endTime); this->init(); } /*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const BCFunction &densBC) +DensityBC::DensityBC(const BCFunction &densBC) { this->densBCs.push_back(densBC); this->init(); } /*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const std::vector<BCFunction> &densBCs) +DensityBC::DensityBC(const std::vector<BCFunction> &densBCs) { this->densBCs = densBCs; this->init(); } /*==========================================================*/ -DensityBCAdapter::DensityBCAdapter(const mu::Parser &function, const real &startTime, const real &endTime) +DensityBC::DensityBC(const mu::Parser &function, const real &startTime, const real &endTime) { this->densBCs.emplace_back(function, startTime, endTime); this->init(); } /*==========================================================*/ -void DensityBCAdapter::init() +void DensityBC::init() { - this->timeStep = 0.0; + this->timeStep = vf::basics::constant::c0o1; - this->x1 = 0.0; - this->x2 = 0.0; - this->x3 = 0.0; + this->x1 = vf::basics::constant::c0o1; + this->x2 = vf::basics::constant::c0o1; + this->x3 = vf::basics::constant::c0o1; this->tmpDensityFunction = NULL; @@ -96,7 +97,7 @@ void DensityBCAdapter::init() } } /*==========================================================*/ -void DensityBCAdapter::init(const D3Q27Interactor *const & /*interactor*/, const real &time) +void DensityBC::init(const D3Q27Interactor *const & /*interactor*/, const real &time) { this->timeStep = time; this->tmpDensityFunction = NULL; @@ -124,18 +125,18 @@ void DensityBCAdapter::init(const D3Q27Interactor *const & /*interactor*/, const if (UbMath::greaterEqual(time, maxEndtime)) this->unsetTimeDependent(); - UBLOG(logDEBUG4, "D3Q27DensityBCAdapter::init(time=" + UBLOG(logDEBUG4, "D3Q27DensityBC::init(time=" << time << ") " << ", rho= \"" << (tmpDensityFunction ? tmpDensityFunction->GetExpr() : "-") << "\", timedependant=" << (this->isTimeDependent() ? "true" : "false")); } /*==========================================================*/ -void DensityBCAdapter::update(const D3Q27Interactor *const &interactor, const real &time) +void DensityBC::update(const D3Q27Interactor *const &interactor, const real &time) { this->init(interactor, time); } /*==========================================================*/ -void DensityBCAdapter::adaptBCForDirection(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, +void DensityBC::adaptBCForDirection(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, const real & /*worldX1*/, const real & /*worldX2*/, const real & /*worldX3*/, const real &q, const int &fdirection, const real & /*time*/) @@ -144,14 +145,14 @@ void DensityBCAdapter::adaptBCForDirection(const D3Q27Interactor & /*interactor* bc->setQ((real)q, fdirection); } /*==========================================================*/ -void DensityBCAdapter::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real &worldX1, +void DensityBC::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real &worldX1, const real &worldX2, const real &worldX3, const real &time) { this->setNodeDensity(interactor, bc, worldX1, worldX2, worldX3, time); - bc->setBcAlgorithmType(algorithmType); + bc->setBCStrategyType(algorithmType); } /*==========================================================*/ -void DensityBCAdapter::setNodeDensity(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, +void DensityBC::setNodeDensity(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, const real &worldX1, const real &worldX2, const real &worldX3, const real ×tep) { @@ -176,7 +177,7 @@ void DensityBCAdapter::setNodeDensity(const D3Q27Interactor & /*interactor*/, SP } } /*==========================================================*/ -real DensityBCAdapter::getDensity(const real &x1, const real &x2, const real &x3, const real &timeStep) +real DensityBC::getDensity(const real &x1, const real &x2, const real &x3, const real &timeStep) { this->x1 = x1; this->x2 = x2; @@ -184,15 +185,15 @@ real DensityBCAdapter::getDensity(const real &x1, const real &x2, const real &x3 this->timeStep = timeStep; if (!tmpDensityFunction) - return 0.0; + return vf::basics::constant::c0o1; return tmpDensityFunction->Eval(); } /*==========================================================*/ -string DensityBCAdapter::toString() +string DensityBC::toString() { stringstream info; - info << "D3Q27DensityBCAdapter:\n"; + info << "D3Q27DensityBC:\n"; info << " #dens-functions = " << (int)densBCs.size() << endl; info << " protected variables: x1, x2, x3, t" << endl; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.h similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.h index 74bfea4dd533ca8bbe81a5941ab302e3ffb06a95..b51fb984a7b5ea1e463e06a43ff4d2691d444341 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBC.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 DensityBCAdapter.h +//! \file DensityBC.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef DensityBCAdapter_H -#define DensityBCAdapter_H +#ifndef DensityBC_H +#define DensityBC_H #include <iostream> #include <sstream> @@ -42,10 +42,10 @@ //#include "basics/utilities/UbMath.h" #include "basics/utilities/UbTuple.h" -#include "BCAdapter.h" +#include "BC.h" #include "BCFunction.h" -//* DensityBCAdapter */ +//* DensityBC */ //* */ //** //<BR><BR> @@ -57,15 +57,15 @@ // usage: ... //*/ -class DensityBCAdapter : public BCAdapter +class DensityBC : public BC { public: // constructors - DensityBCAdapter() { this->init(); } - DensityBCAdapter(const real &dens, const real &startTime = 0.0, const real &endTime = BCFunction::INFCONST); - DensityBCAdapter(const BCFunction &densBC); - DensityBCAdapter(const std::vector<BCFunction> &densBCs); - DensityBCAdapter(const mu::Parser &function, const real &startTime = 0.0, + DensityBC() { this->init(); } + DensityBC(const real &dens, const real &startTime = 0.0, const real &endTime = BCFunction::INFCONST); + DensityBC(const BCFunction &densBC); + DensityBC(const std::vector<BCFunction> &densBCs); + DensityBC(const mu::Parser &function, const real &startTime = 0.0, const real &endTime = BCFunction::INFCONST); //------------- implements D3Q27BoundaryConditionAdapter ----- start diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.cpp similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.cpp index fa5dc1bdeff9112a7a0c1a26b9c52ee5f27012a5..77a4601ea352efe1b25c9c509077f533e44f63dd 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.cpp @@ -26,34 +26,34 @@ // 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 EqDensityBCAlgorithm.cpp +//! \file EqDensityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "EqDensityBCAlgorithm.h" +#include "EqDensityBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" -EqDensityBCAlgorithm::EqDensityBCAlgorithm() +EqDensityBCStrategy::EqDensityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::EqDensityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::EqDensityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -EqDensityBCAlgorithm::~EqDensityBCAlgorithm() = default; +EqDensityBCStrategy::~EqDensityBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> EqDensityBCAlgorithm::clone() +SPtr<BCStrategy> EqDensityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new EqDensityBCAlgorithm()); + SPtr<BCStrategy> bc(new EqDensityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void EqDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void EqDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void EqDensityBCAlgorithm::applyBC() +void EqDensityBCStrategy::applyBC() { using namespace vf::lbm::dir; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.h similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.h index 173b6b12f46fa46d021c17345b203a97862c7949..2de16acdd11665f1535611d3820f8f4909f5fc97 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCStrategy.h @@ -26,25 +26,25 @@ // 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 EqDensityBCAlgorithm.h +//! \file EqDensityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef EqDensityBCAlgorithm_h__ -#define EqDensityBCAlgorithm_h__ +#ifndef EqDensityBCStrategy_h__ +#define EqDensityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class EqDensityBCAlgorithm : public BCAlgorithm +class EqDensityBCStrategy : public BCStrategy { public: - EqDensityBCAlgorithm(); - ~EqDensityBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; + EqDensityBCStrategy(); + ~EqDensityBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // EqDensityBCAlgorithm_h__ +#endif // EqDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h deleted file mode 100644 index bb033d409cd84a2b419aa46599a61ca1e8d29aad..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h +++ /dev/null @@ -1,50 +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 HighViscosityNoSlipBCAlgorithm.h -//! \ingroup BoundarConditions -//! \author Konstantin Kutscher -//======================================================================================= -#ifndef HighViscosityNoSlipBCAlgorithm_h__ -#define HighViscosityNoSlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" -#include <PointerDefinitions.h> - -class DistributionArray3D; - -class HighViscosityNoSlipBCAlgorithm : public BCAlgorithm -{ -public: - HighViscosityNoSlipBCAlgorithm(); - ~HighViscosityNoSlipBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; - void addDistributions(SPtr<DistributionArray3D> distributions) override; - void applyBC() override; -}; -#endif // HighViscosityNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.cpp similarity index 84% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.cpp index 3ed53ee85f2047cedc5cdc6eb71f607ca8792b6f..cb8deaa00b7cf0f38095cef86f72b71656a4cac3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.cpp @@ -26,34 +26,34 @@ // 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 HighViscosityNoSlipBCAlgorithm.cpp +//! \file HighViscosityNoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "HighViscosityNoSlipBCAlgorithm.h" +#include "HighViscosityNoSlipBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" -HighViscosityNoSlipBCAlgorithm::HighViscosityNoSlipBCAlgorithm() +HighViscosityNoSlipBCStrategy::HighViscosityNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::HighViscosityNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::HighViscosityNoSlipBCStrategy; + BCStrategy::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -HighViscosityNoSlipBCAlgorithm::~HighViscosityNoSlipBCAlgorithm() = default; +HighViscosityNoSlipBCStrategy::~HighViscosityNoSlipBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> HighViscosityNoSlipBCAlgorithm::clone() +SPtr<BCStrategy> HighViscosityNoSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new HighViscosityNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new HighViscosityNoSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void HighViscosityNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void HighViscosityNoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void HighViscosityNoSlipBCAlgorithm::applyBC() +void HighViscosityNoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -69,7 +69,7 @@ void HighViscosityNoSlipBCAlgorithm::applyBC() real q = bcPtr->getQ(invDir); real fReturn = (f[invDir] + q * f[fDir] + q * collFactor * (feq[invDir] - f[invDir] + feq[fDir] - f[fDir])) / - (1.0 + q); + (vf::basics::constant::c1o1 + q); distributions->setDistributionInvForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], invDir); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..e153a67e644530f52977f1644c30426acce44843 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCStrategy.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 HighViscosityNoSlipBCStrategy.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef HighViscosityNoSlipBCStrategy_h__ +#define HighViscosityNoSlipBCStrategy_h__ + +#include "BCStrategy.h" +#include <PointerDefinitions.h> + +class DistributionArray3D; + +class HighViscosityNoSlipBCStrategy : public BCStrategy +{ +public: + HighViscosityNoSlipBCStrategy(); + ~HighViscosityNoSlipBCStrategy() override; + SPtr<BCStrategy> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void applyBC() override; +}; +#endif // HighViscosityNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.cpp similarity index 97% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.cpp index 4b272878a4bd30d1031c2894ac9994db6a966a6f..d49cffe64085e9a5d5e865cde0c899bdab543791 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.cpp @@ -26,8 +26,8 @@ // 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 NoSlipBCAdapter.cpp +//! \file NoSlipBC.cpp //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#include "NoSlipBCAdapter.h" +#include "NoSlipBC.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.h similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.h index 52eda33082e8031454b00f578a6f520b738c0d42..fe7eecebb9960107793f7bf034de5dd436d58613 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBC.h @@ -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 NoSlipBCAdapter.cpp +//! \file NoSlipBC.cpp //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#ifndef NoSlipBCAdapter_H -#define NoSlipBCAdapter_H +#ifndef NoSlipBC_H +#define NoSlipBC_H -#include "BCAdapter.h" +#include "BC.h" //! A class provides an interface for no-slip boundary condition in grid generator -class NoSlipBCAdapter : public BCAdapter +class NoSlipBC : public BC { public: - NoSlipBCAdapter() : BCAdapter() {} - NoSlipBCAdapter(const short &secondaryBcOption) : BCAdapter(secondaryBcOption) {} + NoSlipBC() : BC() {} + NoSlipBC(const short &secondaryBcOption) : BC(secondaryBcOption) {} void init(const D3Q27Interactor *const &interactor, const real &time = 0) override {} void update(const D3Q27Interactor *const &interactor, const real &time = 0) override {} @@ -56,9 +56,9 @@ public: void adaptBC(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, const real & /*worldX1*/, const real & /*worldX2*/, const real & /*worldX3*/, const real & /*time*/ = 0) override { - bc->setBcAlgorithmType(algorithmType); + bc->setBCStrategyType(algorithmType); } private: }; -#endif // NoSlipBCAdapter_H +#endif // NoSlipBC_H diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp similarity index 82% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp index f89c74513289ab2787cbef0dbe504d913510afc5..cabd41b30dd31ac8751c60f00f46c899cbfa2334 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp @@ -26,33 +26,33 @@ // 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 NoSlipBCAlgorithm.cpp +//! \file NoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "NoSlipBCAlgorithm.h" +#include "NoSlipBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" -NoSlipBCAlgorithm::NoSlipBCAlgorithm() +NoSlipBCStrategy::NoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::NoSlipBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NoSlipBCAlgorithm::clone() +SPtr<BCStrategy> NoSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new NoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new NoSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void NoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithm::applyBC() +void NoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -66,8 +66,8 @@ void NoSlipBCAlgorithm::applyBC() // quadratic bounce back const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir); - real fReturn = ((1.0 - q) / (1.0 + q)) * ((f[invDir] - feq[invDir]) / (1.0 - collFactor) + feq[invDir]) + - ((q / (1.0 + q)) * (f[invDir] + f[fdir])); + real fReturn = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q)) * ((f[invDir] - feq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + feq[invDir]) + + ((q / (vf::basics::constant::c1o1 + q)) * (f[invDir] + f[fdir])); distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.h similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.h index dcf678b4f05bd2c50403bfd758cd27767f45d33a..d45526f373816f38a85ede287ffe975150bd96af 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.h @@ -26,25 +26,25 @@ // 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 NoSlipBCAlgorithm.h +//! \file NoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef NoSlipBCAlgorithm_h__ -#define NoSlipBCAlgorithm_h__ +#ifndef NoSlipBCStrategy_h__ +#define NoSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; //! A class implements no-slip boundary condition -class NoSlipBCAlgorithm : public BCAlgorithm +class NoSlipBCStrategy : public BCStrategy { public: - NoSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + NoSlipBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.cpp similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.cpp index 2787d685cbd3b71b879c3fabc1c114e0e61eef8d..d3f44c6ff7ce9d8acf913a8cebd3e42800b7a571 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.cpp @@ -26,35 +26,35 @@ // 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 NonEqDensityBCAlgorithm.cpp +//! \file NonEqDensityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "NonEqDensityBCAlgorithm.h" +#include "NonEqDensityBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" -NonEqDensityBCAlgorithm::NonEqDensityBCAlgorithm() +NonEqDensityBCStrategy::NonEqDensityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NonEqDensityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::NonEqDensityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -NonEqDensityBCAlgorithm::~NonEqDensityBCAlgorithm() = default; +NonEqDensityBCStrategy::~NonEqDensityBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonEqDensityBCAlgorithm::clone() +SPtr<BCStrategy> NonEqDensityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new NonEqDensityBCAlgorithm()); + SPtr<BCStrategy> bc(new NonEqDensityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonEqDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void NonEqDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonEqDensityBCAlgorithm::applyBC() +void NonEqDensityBCStrategy::applyBC() { using namespace vf::lbm::dir; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.h index ca7d5b0432b74cf371659fee2c6da49f1ee8a9eb..d919a673e9cb344b51e826addf9b1fafe56b41f4 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCStrategy.h @@ -26,25 +26,25 @@ // 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 NonEqDensityBCAlgorithm.h +//! \file NonEqDensityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef NonEqDensityBCAlgorithm_h__ -#define NonEqDensityBCAlgorithm_h__ +#ifndef NonEqDensityBCStrategy_h__ +#define NonEqDensityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class NonEqDensityBCAlgorithm : public BCAlgorithm +class NonEqDensityBCStrategy : public BCStrategy { public: - NonEqDensityBCAlgorithm(); - ~NonEqDensityBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; + NonEqDensityBCStrategy(); + ~NonEqDensityBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // NonEqDensityBCAlgorithm_h__ +#endif // NonEqDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp similarity index 97% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp index 9fe55f9aa4ab87a8548ca04759fad16e809b682b..7f5eaf840c721f65cc030d5e6fad2995858af1b3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp @@ -26,36 +26,36 @@ // 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 NonReflectingInflowBCAlgorithm.cpp +//! \file NonReflectingInflowBCStrategy.cpp //! \ingroup BoundarConditions //! \author Hussein Alihussein //======================================================================================= -#include "NonReflectingInflowBCAlgorithm.h" +#include "NonReflectingInflowBCStrategy.h" #include "BoundaryConditions.h" #include "D3Q27System.h" #include "DistributionArray3D.h" -NonReflectingInflowBCAlgorithm::NonReflectingInflowBCAlgorithm() +NonReflectingInflowBCStrategy::NonReflectingInflowBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NonReflectingInflowBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::NonReflectingInflowBCStrategy; + BCStrategy::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -NonReflectingInflowBCAlgorithm::~NonReflectingInflowBCAlgorithm() = default; +NonReflectingInflowBCStrategy::~NonReflectingInflowBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonReflectingInflowBCAlgorithm::clone() +SPtr<BCStrategy> NonReflectingInflowBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new NonReflectingInflowBCAlgorithm()); + SPtr<BCStrategy> bc(new NonReflectingInflowBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingInflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void NonReflectingInflowBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingInflowBCAlgorithm::applyBC() +void NonReflectingInflowBCStrategy::applyBC() { using namespace vf::lbm::dir; using namespace D3Q27System; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.h similarity index 85% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.h index 1f3e87ce3fff371fbec30dbbe90721bd5ff975cc..b3c9b6ba833d32d7fe551f561e366f581f518eee 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.h @@ -26,25 +26,25 @@ // 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 NonReflectingInflowBCAlgorithm.h +//! \file NonReflectingInflowBCStrategy.h //! \ingroup BoundarConditions //! \author Hussein Alihussein //======================================================================================= -#ifndef NonReflectingInflowBCAlgorithm_h__ -#define NonReflectingInflowBCAlgorithm_h__ +#ifndef NonReflectingInflowBCStrategy_h__ +#define NonReflectingInflowBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class NonReflectingInflowBCAlgorithm : public BCAlgorithm +class NonReflectingInflowBCStrategy : public BCStrategy { public: - NonReflectingInflowBCAlgorithm(); - ~NonReflectingInflowBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; + NonReflectingInflowBCStrategy(); + ~NonReflectingInflowBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // NonReflectingDensityBCAlgorithm_h__ +#endif // NonReflectingDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h deleted file mode 100644 index d664b67fbf5f2d99258f0567f90b0dbd1e728fb5..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h +++ /dev/null @@ -1,50 +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 NonReflectingOutflowBCAlgorithm.h -//! \ingroup BoundarConditions -//! \author Konstantin Kutscher -//======================================================================================= -#ifndef NonReflectingOutflowBCAlgorithm_h__ -#define NonReflectingOutflowBCAlgorithm_h__ - -#include "BCAlgorithm.h" -#include <PointerDefinitions.h> - -class DistributionArray3D; - -class NonReflectingOutflowBCAlgorithm : public BCAlgorithm -{ -public: - NonReflectingOutflowBCAlgorithm(); - ~NonReflectingOutflowBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; - void addDistributions(SPtr<DistributionArray3D> distributions) override; - void applyBC() override; -}; -#endif // NonReflectingDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.cpp similarity index 56% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.cpp index 09adfefa8d246ff92f43eeeacb57ad3c4bd3ea16..b19b27ec1a5d22f835595020a26a76f194cc7ccb 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.cpp @@ -26,36 +26,36 @@ // 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 NonReflectingOutflowBCAlgorithm.cpp +//! \file NonReflectingOutflowBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "NonReflectingOutflowBCAlgorithm.h" +#include "NonReflectingOutflowBCStrategy.h" #include "BoundaryConditions.h" #include "D3Q27System.h" #include "DistributionArray3D.h" -NonReflectingOutflowBCAlgorithm::NonReflectingOutflowBCAlgorithm() +NonReflectingOutflowBCStrategy::NonReflectingOutflowBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowBCAlgorithm; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::NonReflectingOutflowBCStrategy; + BCStrategy::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -NonReflectingOutflowBCAlgorithm::~NonReflectingOutflowBCAlgorithm() = default; +NonReflectingOutflowBCStrategy::~NonReflectingOutflowBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonReflectingOutflowBCAlgorithm::clone() +SPtr<BCStrategy> NonReflectingOutflowBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new NonReflectingOutflowBCAlgorithm()); + SPtr<BCStrategy> bc(new NonReflectingOutflowBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void NonReflectingOutflowBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithm::applyBC() +void NonReflectingOutflowBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -101,15 +101,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() switch (direction) { case DIR_P00: - f[DIR_P00] = ftemp[DIR_P00] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P00]; - f[DIR_PP0] = ftemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PP0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PM0]; - f[DIR_P0P] = ftemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P0P]; - f[DIR_P0M] = ftemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_P0M]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PMP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 + vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx1) * f[DIR_PMM]; + f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P00]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PP0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PM0]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0P]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0M]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - 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); @@ -122,15 +122,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M00]; - f[DIR_MP0] = ftemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MP0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MM0]; - f[DIR_M0P] = ftemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M0P]; - f[DIR_M0M] = ftemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_M0M]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MPP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MMP]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MPM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx1) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx1) * f[DIR_MMM]; + f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M00]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MP0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MM0]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0P]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0M]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMP]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - 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); @@ -143,15 +143,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0P0]; - f[DIR_PP0] = ftemp[DIR_PP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PP0]; - f[DIR_MP0] = ftemp[DIR_MP0] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MP0]; - f[DIR_0PP] = ftemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0PP]; - f[DIR_0PM] = ftemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_0PM]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MPP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 + vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx2) * f[DIR_MPM]; + f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0P0]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PP0]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MP0]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PP]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PM]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPM]; 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); @@ -164,15 +164,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0M0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PM0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MM0]; - f[DIR_0MP] = ftemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0MP]; - f[DIR_0MM] = ftemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_0MM]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MMP]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx2) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx2) * f[DIR_MMM]; + f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0M0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PM0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MM0]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MP]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MM]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMP]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - 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_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -185,15 +185,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_00P]; - f[DIR_P0P] = ftemp[DIR_P0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_P0P]; - f[DIR_M0P] = ftemp[DIR_M0P] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_M0P]; - f[DIR_0PP] = ftemp[DIR_0PP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_0PP]; - f[DIR_0MP] = ftemp[DIR_0MP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_0MP]; - f[DIR_PPP] = ftemp[DIR_PPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_MPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (vf::basics::constant::one_over_sqrt3 + vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 - vx3) * f[DIR_MMP]; + f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_00P]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_P0P]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_M0P]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0PP]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0MP]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - 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_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -206,15 +206,15 @@ void NonReflectingOutflowBCAlgorithm::applyBC() distributions->setDistributionInvForDirection(f[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] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_00M]; - f[DIR_P0M] = ftemp[DIR_P0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_P0M]; - f[DIR_M0M] = ftemp[DIR_M0M] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_M0M]; - f[DIR_0PM] = ftemp[DIR_0PM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_0PM]; - f[DIR_0MM] = ftemp[DIR_0MM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_0MM]; - f[DIR_PPM] = ftemp[DIR_PPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_MPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (vf::basics::constant::one_over_sqrt3 - vx3) + (1.0 - vf::basics::constant::one_over_sqrt3 + vx3) * f[DIR_MMM]; + f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_00M]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_P0M]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_M0M]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0PM]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0MM]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MMM]; 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); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..7fca99885755f78ca4088dd031511d774bfc4115 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCStrategy.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 NonReflectingOutflowBCStrategy.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef NonReflectingOutflowBCStrategy_h__ +#define NonReflectingOutflowBCStrategy_h__ + +#include "BCStrategy.h" +#include <PointerDefinitions.h> + +class DistributionArray3D; + +class NonReflectingOutflowBCStrategy : public BCStrategy +{ +public: + NonReflectingOutflowBCStrategy(); + ~NonReflectingOutflowBCStrategy() override; + SPtr<BCStrategy> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void applyBC() override; +}; +#endif // NonReflectingDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp similarity index 96% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp index d36e07118248363c0a81bc7d907c70b3d1b4fcea..3e10421e59bac7e260e95ccf491d1f749f28c640 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp @@ -26,36 +26,36 @@ // 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 NonReflectingOutflowBCAlgorithmWithRelaxation.cpp +//! \file NonReflectingOutflowWithRelaxationBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher, Hussein Alihussein //======================================================================================= -#include "NonReflectingOutflowBCAlgorithmWithRelaxation.h" +#include "NonReflectingOutflowWithRelaxationBCStrategy.h" #include "BoundaryConditions.h" #include "D3Q27System.h" #include "DistributionArray3D.h" -NonReflectingOutflowBCAlgorithmWithRelaxation::NonReflectingOutflowBCAlgorithmWithRelaxation() +NonReflectingOutflowWithRelaxationBCStrategy::NonReflectingOutflowWithRelaxationBCStrategy() { - BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowBCAlgorithmWithRelaxation; - BCAlgorithm::preCollision = true; + BCStrategy::type = BCStrategy::NonReflectingOutflowWithRelaxationBCStrategy; + BCStrategy::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -NonReflectingOutflowBCAlgorithmWithRelaxation::~NonReflectingOutflowBCAlgorithmWithRelaxation() = default; +NonReflectingOutflowWithRelaxationBCStrategy::~NonReflectingOutflowWithRelaxationBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonReflectingOutflowBCAlgorithmWithRelaxation::clone() +SPtr<BCStrategy> NonReflectingOutflowWithRelaxationBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new NonReflectingOutflowBCAlgorithmWithRelaxation()); + SPtr<BCStrategy> bc(new NonReflectingOutflowWithRelaxationBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithmWithRelaxation::addDistributions(SPtr<DistributionArray3D> distributions) +void NonReflectingOutflowWithRelaxationBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithmWithRelaxation::applyBC() +void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() { using namespace vf::lbm::dir; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.h similarity index 83% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.h index 97badb60dbe84e0b7a4a3fa82b950649e0a12d93..e8179c706f204494ac383b519fa22ef78de5d5ac 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmWithRelaxation.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.h @@ -26,25 +26,25 @@ // 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 NonReflectingOutflowBCAlgorithmWithRelaxation.h +//! \file NonReflectingOutflowWithRelaxationBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher, Hussein Alihussein //======================================================================================= -#ifndef NonReflectingOutflowBCAlgorithmWithRelaxation_h__ -#define NonReflectingOutflowBCAlgorithmWithRelaxation_h__ +#ifndef NonReflectingOutflowWithRelaxationBCStrategy_h__ +#define NonReflectingOutflowWithRelaxationBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class NonReflectingOutflowBCAlgorithmWithRelaxation : public BCAlgorithm +class NonReflectingOutflowWithRelaxationBCStrategy : public BCStrategy { public: - NonReflectingOutflowBCAlgorithmWithRelaxation(); - ~NonReflectingOutflowBCAlgorithmWithRelaxation() override; - SPtr<BCAlgorithm> clone() override; + NonReflectingOutflowWithRelaxationBCStrategy(); + ~NonReflectingOutflowWithRelaxationBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // NonReflectingDensityBCAlgorithm_h__ +#endif // NonReflectingDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.cpp similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.cpp index e02ee9fb7766217411ac37a104bf8c59a60a741e..7bd97721771d1cd5f2d5121bc3776c6dad9b3900 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.cpp @@ -26,37 +26,37 @@ // 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 SimpleSlipBCAlgorithm.cpp +//! \file SimpleSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "SimpleSlipBCAlgorithm.h" +#include "SimpleSlipBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -SimpleSlipBCAlgorithm::SimpleSlipBCAlgorithm() +SimpleSlipBCStrategy::SimpleSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::SimpleSlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::SimpleSlipBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SimpleSlipBCAlgorithm::~SimpleSlipBCAlgorithm() +SimpleSlipBCStrategy::~SimpleSlipBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> SimpleSlipBCAlgorithm::clone() +SPtr<BCStrategy> SimpleSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new SimpleSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new SimpleSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void SimpleSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void SimpleSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void SimpleSlipBCAlgorithm::applyBC() +void SimpleSlipBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -67,7 +67,7 @@ void SimpleSlipBCAlgorithm::applyBC() calcMacrosFct(f, drho, vx1, vx2, vx3); calcFeqFct(feq, drho, vx1, vx2, vx3); - rho = 1.0 + drho * compressibleFactor; + rho = vf::basics::constant::c1o1 + drho * compressibleFactor; UbTupleFloat3 normale = bcPtr->getNormalVector(); real amp = vx1*val<1>(normale)+vx2*val<2>(normale)+vx3*val<3>(normale); @@ -82,7 +82,7 @@ void SimpleSlipBCAlgorithm::applyBC() { //quadratic bounce back const int invDir = D3Q27System::INVDIR[fdir]; - real velocity = 0.0; + real velocity = vf::basics::constant::c0o1; switch (invDir) { case DIR_P00: velocity = (vf::basics::constant::c4o9*(+vx1)); break; //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3) diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.h similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.h index bfe4a766bc4fe1f05cf55cb679cfb3900f574c39..294c7fdf648603359f14aa1a0bf4f769d6672f05 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCStrategy.h @@ -26,26 +26,26 @@ // 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 SimpleVelocityBCAlgorithm.h +//! \file SimpleVelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef SimpleSlipBCAlgorithm_h__ -#define SimpleSlipBCAlgorithm_h__ +#ifndef SimpleSlipBCStrategy_h__ +#define SimpleSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; //! \brief A class implements slip boundary condition by using simple bounce back -class SimpleSlipBCAlgorithm : public BCAlgorithm +class SimpleSlipBCStrategy : public BCStrategy { public: - SimpleSlipBCAlgorithm(); - virtual ~SimpleSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + SimpleSlipBCStrategy(); + virtual ~SimpleSlipBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // SimpleSlipBCAlgorithm_h__ +#endif // SimpleSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.cpp similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.cpp index 83badd723e2c9bda222abaccdb09fbc352bc46af..2206e71541d6d264fd91146be5641ba75ed5b4d3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.cpp @@ -26,37 +26,37 @@ // 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 SimpleVelocityBCAlgorithm.cpp +//! \file SimpleVelocityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "SimpleVelocityBCAlgorithm.h" +#include "SimpleVelocityBCStrategy.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -SimpleVelocityBCAlgorithm::SimpleVelocityBCAlgorithm() +SimpleVelocityBCStrategy::SimpleVelocityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::SimpleVelocityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::SimpleVelocityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SimpleVelocityBCAlgorithm::~SimpleVelocityBCAlgorithm() +SimpleVelocityBCStrategy::~SimpleVelocityBCStrategy() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> SimpleVelocityBCAlgorithm::clone() +SPtr<BCStrategy> SimpleVelocityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new SimpleVelocityBCAlgorithm()); + SPtr<BCStrategy> bc(new SimpleVelocityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void SimpleVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void SimpleVelocityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void SimpleVelocityBCAlgorithm::applyBC() +void SimpleVelocityBCStrategy::applyBC() { real f[D3Q27System::ENDF+1]; real feq[D3Q27System::ENDF+1]; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.h similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.h index b751d220c0cd15b597969fd9980184c16c5de36c..597e69a386ad03c0eb29ea62a77563b84c72435c 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleVelocityBCStrategy.h @@ -26,26 +26,26 @@ // 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 SimpleVelocityBCAlgorithm.h +//! \file SimpleVelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef SimpleVelocityBCAlgorithm_H -#define SimpleVelocityBCAlgorithm_H +#ifndef SimpleVelocityBCStrategy_H +#define SimpleVelocityBCStrategy_H -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; //! \brief A class implements velocyty boundary condition -class SimpleVelocityBCAlgorithm : public BCAlgorithm +class SimpleVelocityBCStrategy : public BCStrategy { public: - SimpleVelocityBCAlgorithm(); - ~SimpleVelocityBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + SimpleVelocityBCStrategy(); + ~SimpleVelocityBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp similarity index 75% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp index 8f8299850d2299f75903a42a2b59512e093d6172..008adefd8196c6d6689316d29bbc2f3fe50b9f9e 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp @@ -26,27 +26,27 @@ // 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 SlipBCAdapter.cpp +//! \file SlipBC.cpp //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#include "SlipBCAdapter.h" +#include "SlipBC.h" #include "D3Q27Interactor.h" #include "D3Q27System.h" #include "geometry3d/GbCuboid3D.h" //*==========================================================*/ -// ObObject* D3Q27SlipBCAdapterCreator::createObObject() +// ObObject* D3Q27SlipBCCreator::createObObject() //{ -// return new D3Q27SlipBCAdapter; +// return new D3Q27SlipBC; //} //*==========================================================*/ -// ObObjectCreator* D3Q27SlipBCAdapter::getCreator() +// ObObjectCreator* D3Q27SlipBC::getCreator() //{ -// return D3Q27SlipBCAdapterCreator::getInstance(); +// return D3Q27SlipBCCreator::getInstance(); //} //*==========================================================*/ -void SlipBCAdapter::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real & /*worldX1*/, +void SlipBC::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real & /*worldX1*/, const real & /*worldX2*/, const real & /*worldX3*/, const real & /*time*/) { using namespace vf::lbm::dir; @@ -59,17 +59,17 @@ void SlipBCAdapter::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryCond throw UbException(UB_EXARGS, "derzeit nur fuer Cubes valide"); if (bc->hasSlipBoundaryFlag(DIR_P00)) - bc->setNormalVector(1.0, 0.0, 0.0); + bc->setNormalVector(vf::basics::constant::c1o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); else if (bc->hasSlipBoundaryFlag(DIR_M00)) - bc->setNormalVector(-1.0, 0.0, 0.0); + bc->setNormalVector(-vf::basics::constant::c1o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); else if (bc->hasSlipBoundaryFlag(DIR_0P0)) - bc->setNormalVector(0.0, 1.0, 0.0); + bc->setNormalVector(vf::basics::constant::c0o1, vf::basics::constant::c1o1, vf::basics::constant::c0o1); else if (bc->hasSlipBoundaryFlag(DIR_0M0)) - bc->setNormalVector(0.0, -1.0, 0.0); + bc->setNormalVector(vf::basics::constant::c0o1, -vf::basics::constant::c1o1, vf::basics::constant::c0o1); else if (bc->hasSlipBoundaryFlag(DIR_00P)) - bc->setNormalVector(0.0, 0.0, 1.0); + bc->setNormalVector(vf::basics::constant::c0o1, vf::basics::constant::c0o1, vf::basics::constant::c1o1); else if (bc->hasSlipBoundaryFlag(DIR_00M)) - bc->setNormalVector(0.0, 0.0, -1.0); + bc->setNormalVector(vf::basics::constant::c0o1, vf::basics::constant::c0o1, -vf::basics::constant::c1o1); - bc->setBcAlgorithmType(algorithmType); + bc->setBCStrategyType(algorithmType); } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h similarity index 79% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h index 5c2225e0a1212931805207da7bacf1a1a797e290..98205ba32b2d3ccec85346bd89a199e8e9a9049c 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h @@ -26,43 +26,43 @@ // 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 SlipBCAdapter.h +//! \file SlipBC.h //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#ifndef SlipBCAdapter_H -#define SlipBCAdapter_H +#ifndef SlipBC_H +#define SlipBC_H -#include "BCAdapter.h" +#include "BC.h" /*=======================================================*/ -// D3Q27SlipBCAdapterCreator -// class D3Q27SlipBCAdapterCreator : public ObObjectCreator +// D3Q27SlipBCCreator +// class D3Q27SlipBCCreator : public ObObjectCreator //{ // public: -// static D3Q27SlipBCAdapterCreator* getInstance() +// static D3Q27SlipBCCreator* getInstance() // { -// static D3Q27SlipBCAdapterCreator instance; +// static D3Q27SlipBCCreator instance; // return &instance; // } // // ObObject* createObObject(); // -// std::string getTypeID() { return "D3Q27SlipBCAdapter";} -// std::string toString() { return "D3Q27SlipBCAdapterCreator"; } +// std::string getTypeID() { return "D3Q27SlipBC";} +// std::string toString() { return "D3Q27SlipBCCreator"; } // // private: -// D3Q27SlipBCAdapterCreator( const D3Q27SlipBCAdapterCreator& ); //no copy allowed -// const D3Q27SlipBCAdapterCreator& operator=( const D3Q27SlipBCAdapterCreator& ); //no copy allowed -// D3Q27SlipBCAdapterCreator() : ObObjectCreator() {} +// D3Q27SlipBCCreator( const D3Q27SlipBCCreator& ); //no copy allowed +// const D3Q27SlipBCCreator& operator=( const D3Q27SlipBCCreator& ); //no copy allowed +// D3Q27SlipBCCreator() : ObObjectCreator() {} //}; // -class SlipBCAdapter : public BCAdapter +class SlipBC : public BC { public: - SlipBCAdapter() : BCAdapter() {} - SlipBCAdapter(const short &secondaryBcOption) : BCAdapter(secondaryBcOption) {} + SlipBC() : BC() {} + SlipBC(const short &secondaryBcOption) : BC(secondaryBcOption) {} //------------- implements D3Q27BoundaryConditionAdapter ----- start diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.h deleted file mode 100644 index b7a75969f6895f680bf17c08462f4b788fc31c65..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SlipBCAlgorithm_h__ -#define SlipBCAlgorithm_h__ - -#include "BCAlgorithm.h" -#include <PointerDefinitions.h> - -class DistributionArray3D; - -class SlipBCAlgorithm : public BCAlgorithm -{ -public: - SlipBCAlgorithm(); - ~SlipBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; - void addDistributions(SPtr<DistributionArray3D> distributions) override; - void applyBC() override; -}; -#endif // SlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.cpp similarity index 83% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.cpp index 4232ae91a8d4806e1615beacfb57c5eb5deb10ca..34093b6a86833266b7c589ce1ed88252ba608892 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.cpp @@ -1,24 +1,24 @@ -#include "SlipBCAlgorithm.h" +#include "SlipBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" -SlipBCAlgorithm::SlipBCAlgorithm() +SlipBCStrategy::SlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::SlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::SlipBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SlipBCAlgorithm::~SlipBCAlgorithm() = default; +SlipBCStrategy::~SlipBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> SlipBCAlgorithm::clone() +SPtr<BCStrategy> SlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new SlipBCAlgorithm()); + SPtr<BCStrategy> bc(new SlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } +void SlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithm::applyBC() +void SlipBCStrategy::applyBC() { using namespace vf::lbm::dir; @@ -36,7 +36,7 @@ void SlipBCAlgorithm::applyBC() vx2 = vx2 - amp * val<2>(normale); // normale zeigt von struktur weg! vx3 = vx3 - amp * val<3>(normale); // normale zeigt von struktur weg! - rho = 1.0 + drho * compressibleFactor; + rho = vf::basics::constant::c1o1 + drho * compressibleFactor; for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { @@ -46,7 +46,7 @@ void SlipBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir);// m+m q=0 stabiler //vx3=0; - real velocity = 0.0; + real velocity = vf::basics::constant::c0o1; switch (invDir) { case DIR_P00: velocity = (vf::basics::constant::c4o9*(+vx1)); break; //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3) @@ -77,7 +77,7 @@ void SlipBCAlgorithm::applyBC() case DIR_MPP: velocity = (vf::basics::constant::c1o36*(-vx1+vx2+vx3)); break; default: throw UbException(UB_EXARGS, "unknown error"); } - real 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)); + real fReturn = ((vf::basics::constant::c1o1-q)/(vf::basics::constant::c1o1+q))*((f[invDir]-feq[invDir])/(vf::basics::constant::c1o1-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(vf::basics::constant::c1o1+q)); distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..6eeb43a9022737637c1fa8dd7b7a557af067eda8 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCStrategy.h @@ -0,0 +1,18 @@ +#ifndef SlipBCStrategy_h__ +#define SlipBCStrategy_h__ + +#include "BCStrategy.h" +#include <PointerDefinitions.h> + +class DistributionArray3D; + +class SlipBCStrategy : public BCStrategy +{ +public: + SlipBCStrategy(); + ~SlipBCStrategy() override; + SPtr<BCStrategy> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void applyBC() override; +}; +#endif // SlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.cpp similarity index 77% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.cpp index 7d4aa93295aabe45f4dea9d13a9c5b22dfac3b2a..aefbd97f1fc7cae230af6632432b1efce41829cd 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.cpp @@ -26,34 +26,34 @@ // 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 ThinWallBCProcessor.cpp +//! \file ThinWallBCSet.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThinWallBCProcessor.h" +#include "ThinWallBCSet.h" -#include "ThinWallNoSlipBCAlgorithm.h" +#include "ThinWallNoSlipBCStrategy.h" #include "LBMKernel.h" ////////////////////////////////////////////////////////////////////////// -ThinWallBCProcessor::ThinWallBCProcessor(SPtr<ILBMKernel> kernel) : BCProcessor(kernel) {} +ThinWallBCSet::ThinWallBCSet(SPtr<ILBMKernel> kernel) : BCSet(kernel) {} ////////////////////////////////////////////////////////////////////////// -SPtr<BCProcessor> ThinWallBCProcessor::clone(SPtr<ILBMKernel> kernel) +SPtr<BCSet> ThinWallBCSet::clone(SPtr<ILBMKernel> kernel) { - SPtr<BCProcessor> bcProcessor(new ThinWallBCProcessor(kernel)); - return bcProcessor; + SPtr<BCSet> BCSet(new ThinWallBCSet(kernel)); + return BCSet; } ////////////////////////////////////////////////////////////////////////// -void ThinWallBCProcessor::applyPostCollisionBC() +void ThinWallBCSet::applyPostCollisionBC() { - BCProcessor::applyPostCollisionBC(); + BCSet::applyPostCollisionBC(); - for (SPtr<BCAlgorithm> bc : postBC) { - if (bc->getType() == BCAlgorithm::ThinWallNoSlipBCAlgorithm) { - dynamicPointerCast<ThinWallNoSlipBCAlgorithm>(bc)->setPass(2); + for (SPtr<BCStrategy> bc : postBC) { + if (bc->getType() == BCStrategy::ThinWallNoSlipBCStrategy) { + dynamicPointerCast<ThinWallNoSlipBCStrategy>(bc)->setPass(2); bc->applyBC(); - dynamicPointerCast<ThinWallNoSlipBCAlgorithm>(bc)->setPass(1); + dynamicPointerCast<ThinWallNoSlipBCStrategy>(bc)->setPass(1); } } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.h index cb81e6c168748d9d4baf3cce1688f114e7d5faf8..45c76a23f3d1260f8231bce581ec72ba4587794a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCSet.h @@ -26,25 +26,25 @@ // 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 ThinWallBCProcessor.h +//! \file ThinWallBCSet.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThinWallBCProcessor_H -#define ThinWallBCProcessor_H +#ifndef ThinWallBCSet_H +#define ThinWallBCSet_H #include <PointerDefinitions.h> -#include "BCProcessor.h" +#include "BCSet.h" class ILBMKernel; -class ThinWallBCProcessor : public BCProcessor +class ThinWallBCSet : public BCSet { public: - ThinWallBCProcessor() = default; - explicit ThinWallBCProcessor(SPtr<ILBMKernel> kernel); - SPtr<BCProcessor> clone(SPtr<ILBMKernel> kernel) override; + ThinWallBCSet() = default; + explicit ThinWallBCSet(SPtr<ILBMKernel> kernel); + SPtr<BCSet> clone(SPtr<ILBMKernel> kernel) override; void applyPostCollisionBC(); // FIXME: should the base method virtual?? protected: private: diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.cpp similarity index 83% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.cpp index b3c97393af0e21f5732ee2763c09f9fc60017862..2427983a121b4948167b20d2336dbc39a0d81b9a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.cpp @@ -26,31 +26,31 @@ // 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 ThinWallNoSlipBCAlgorithm.cpp +//! \file ThinWallNoSlipBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "ThinWallNoSlipBCAlgorithm.h" +#include "ThinWallNoSlipBCStrategy.h" #include "BoundaryConditions.h" #include "D3Q27EsoTwist3DSplittedVector.h" -ThinWallNoSlipBCAlgorithm::ThinWallNoSlipBCAlgorithm() +ThinWallNoSlipBCStrategy::ThinWallNoSlipBCStrategy() { - BCAlgorithm::type = BCAlgorithm::ThinWallNoSlipBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::ThinWallNoSlipBCStrategy; + BCStrategy::preCollision = false; pass = 1; } ////////////////////////////////////////////////////////////////////////// -ThinWallNoSlipBCAlgorithm::~ThinWallNoSlipBCAlgorithm() = default; +ThinWallNoSlipBCStrategy::~ThinWallNoSlipBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> ThinWallNoSlipBCAlgorithm::clone() +SPtr<BCStrategy> ThinWallNoSlipBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new ThinWallNoSlipBCAlgorithm()); + SPtr<BCStrategy> bc(new ThinWallNoSlipBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::applyBC() +void ThinWallNoSlipBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -66,9 +66,9 @@ void ThinWallNoSlipBCAlgorithm::applyBC() const int invDir = D3Q27System::INVDIR[fdir]; if (pass == 1) { real q = bcPtr->getQ(invDir); - fReturn = ((1.0 - q) / (1.0 + q)) * 0.5 * + fReturn = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q)) * vf::basics::constant::c1o2 * (f[invDir] - f[fdir] + - (f[invDir] + f[fdir] - collFactor * (feq[fdir] + feq[invDir])) / (1.0 - collFactor)); + (f[invDir] + f[fdir] - collFactor * (feq[fdir] + feq[invDir])) / (vf::basics::constant::c1o1 - collFactor)); // distributionsTemp->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + // D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); fTemp[fdir] = fReturn; @@ -85,9 +85,9 @@ void ThinWallNoSlipBCAlgorithm::applyBC() } } ////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThinWallNoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void ThinWallNoSlipBCAlgorithm::setPass(int pass) { this->pass = pass; } +void ThinWallNoSlipBCStrategy::setPass(int pass) { this->pass = pass; } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.h similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.h index f9995d49fae300b44e30df4b8e3f47cd7ac95929..deba685a3b2a4d28f32406c4f5048520a2c46959 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCStrategy.h @@ -26,24 +26,24 @@ // 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 ThinWallNoSlipBCAlgorithm.h +//! \file ThinWallNoSlipBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThinWallNoSlipBCAlgorithm_h__ -#define ThinWallNoSlipBCAlgorithm_h__ +#ifndef ThinWallNoSlipBCStrategy_h__ +#define ThinWallNoSlipBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; -class ThinWallNoSlipBCAlgorithm : public BCAlgorithm +class ThinWallNoSlipBCStrategy : public BCStrategy { public: - ThinWallNoSlipBCAlgorithm(); - ~ThinWallNoSlipBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; + ThinWallNoSlipBCStrategy(); + ~ThinWallNoSlipBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void setPass(int pass); void applyBC() override; @@ -55,4 +55,4 @@ private: int pass; real fTemp[D3Q27System::ENDF + 1]; }; -#endif // ThinWallNoSlipBCAlgorithm_h__ +#endif // ThinWallNoSlipBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.cpp similarity index 87% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.cpp index 6ed8affe2b907764b56ad9f186d7f8adba2b6867..1ffc4470032f6212db1e5f52195235b5b6100cc9 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.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 VelocityBCAdapter.cpp +//! \file VelocityBC.cpp //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#include "VelocityBCAdapter.h" +#include "VelocityBC.h" #include "basics/utilities/UbLogger.h" #include "basics/utilities/UbMath.h" #include "basics/utilities/UbTuple.h" using namespace std; -VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const BCFunction &velVxBC) +VelocityBC::VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const BCFunction &velVxBC) { if (vx1) this->vx1BCs.push_back(velVxBC); @@ -49,7 +49,7 @@ VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const boo this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function, +VelocityBC::VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function, const real &startTime, const real &endTime) { if (vx1) @@ -61,7 +61,7 @@ VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const boo this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function1, +VelocityBC::VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function1, const mu::Parser &function2, const mu::Parser &function3, const real &startTime, const real &endTime) { @@ -74,7 +74,7 @@ VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const boo this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const string &functionstring, +VelocityBC::VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const string &functionstring, const real &startTime, const real &endTime) { if (vx1) @@ -86,7 +86,7 @@ VelocityBCAdapter::VelocityBCAdapter(const bool &vx1, const bool &vx2, const boo this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const BCFunction &velBC, bool x1Dir, bool x2Dir, bool x3Dir) +VelocityBC::VelocityBC(const BCFunction &velBC, bool x1Dir, bool x2Dir, bool x3Dir) { if (x1Dir) this->vx1BCs.push_back(velBC); @@ -97,7 +97,7 @@ VelocityBCAdapter::VelocityBCAdapter(const BCFunction &velBC, bool x1Dir, bool x this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const BCFunction &velVx1BC, const BCFunction &velVx2BC, const BCFunction &velVx3BC) +VelocityBC::VelocityBC(const BCFunction &velVx1BC, const BCFunction &velVx2BC, const BCFunction &velVx3BC) { if (velVx1BC.getEndTime() != -Ub::inf) this->vx1BCs.push_back(velVx1BC); @@ -108,7 +108,7 @@ VelocityBCAdapter::VelocityBCAdapter(const BCFunction &velVx1BC, const BCFunctio this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const vector<BCFunction> &velVx1BCs, const vector<BCFunction> &velVx2BCs, +VelocityBC::VelocityBC(const vector<BCFunction> &velVx1BCs, const vector<BCFunction> &velVx2BCs, const vector<BCFunction> &velVx3BCs) { this->vx1BCs = velVx1BCs; @@ -117,7 +117,7 @@ VelocityBCAdapter::VelocityBCAdapter(const vector<BCFunction> &velVx1BCs, const this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, +VelocityBC::VelocityBC(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, const real &vx2, const real &vx2StartTime, const real &vx2EndTime, const real &vx3, const real &vx3StartTime, const real &vx3EndTime) { @@ -127,7 +127,7 @@ VelocityBCAdapter::VelocityBCAdapter(const real &vx1, const real &vx1StartTime, this->init(); } /*==========================================================*/ -VelocityBCAdapter::VelocityBCAdapter(const string &vx1Function, const real &vx1StartTime, const real &vx1EndTime, +VelocityBC::VelocityBC(const string &vx1Function, const real &vx1StartTime, const real &vx1EndTime, const string &vx2Function, const real &vx2StartTime, const real &vx2EndTime, const string &vx3Function, const real &vx3StartTime, const real &vx3EndTime) { @@ -140,7 +140,7 @@ VelocityBCAdapter::VelocityBCAdapter(const string &vx1Function, const real &vx1S this->init(); } /*==========================================================*/ -void VelocityBCAdapter::setNewVelocities(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, +void VelocityBC::setNewVelocities(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, const real &vx2, const real &vx2StartTime, const real &vx2EndTime, const real &vx3, const real &vx3StartTime, const real &vx3EndTime) { @@ -151,7 +151,7 @@ void VelocityBCAdapter::setNewVelocities(const real &vx1, const real &vx1StartTi this->init(); } /*==========================================================*/ -void VelocityBCAdapter::init() +void VelocityBC::init() { this->unsetTimeDependent(); @@ -181,7 +181,7 @@ void VelocityBCAdapter::init() } } /*==========================================================*/ -void VelocityBCAdapter::init(std::vector<BCFunction> &vxBCs) +void VelocityBC::init(std::vector<BCFunction> &vxBCs) { for (size_t pos = 0; pos < vxBCs.size(); ++pos) { if (!(UbMath::equal(BCFunction::INFCONST, vxBCs[pos].getEndTime()) && @@ -198,7 +198,7 @@ void VelocityBCAdapter::init(std::vector<BCFunction> &vxBCs) } } /*==========================================================*/ -void VelocityBCAdapter::init(const D3Q27Interactor *const &interactor, const real &time) +void VelocityBC::init(const D3Q27Interactor *const &interactor, const real &time) { this->timeStep = time; this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL; @@ -276,7 +276,7 @@ void VelocityBCAdapter::init(const D3Q27Interactor *const &interactor, const rea } } - UBLOG(logDEBUG4, "D3Q27VelocityBCAdapter::init(time=" + UBLOG(logDEBUG4, "D3Q27VelocityBC::init(time=" << time << ") " << ", vx1= \"" << (tmpVx1Function ? tmpVx1Function->GetExpr() : "-") << "\"" << ", vx2= \"" << (tmpVx2Function ? tmpVx2Function->GetExpr() : "-") << "\"" @@ -284,12 +284,12 @@ void VelocityBCAdapter::init(const D3Q27Interactor *const &interactor, const rea << ", timedependent=" << boolalpha << this->isTimeDependent()); } /*==========================================================*/ -void VelocityBCAdapter::update(const D3Q27Interactor *const &interactor, const real &time) +void VelocityBC::update(const D3Q27Interactor *const &interactor, const real &time) { this->init(interactor, time); } /*==========================================================*/ -void VelocityBCAdapter::adaptBCForDirection(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, +void VelocityBC::adaptBCForDirection(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, const real & /*worldX1*/, const real & /*worldX2*/, const real & /*worldX3*/, const real &q, const int &fdirection, const real & /*time*/) @@ -298,14 +298,14 @@ void VelocityBCAdapter::adaptBCForDirection(const D3Q27Interactor & /*interactor bc->setQ((real)q, fdirection); } /*==========================================================*/ -void VelocityBCAdapter::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real &worldX1, +void VelocityBC::adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real &worldX1, const real &worldX2, const real &worldX3, const real &time) { this->setNodeVelocity(interactor, bc, worldX1, worldX2, worldX3, time); - bc->setBcAlgorithmType(algorithmType); + bc->setBCStrategyType(algorithmType); } /*==========================================================*/ -void VelocityBCAdapter::setNodeVelocity(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, +void VelocityBC::setNodeVelocity(const D3Q27Interactor & /*interactor*/, SPtr<BoundaryConditions> bc, const real &worldX1, const real &worldX2, const real &worldX3, const real ×tep) { @@ -334,12 +334,12 @@ void VelocityBCAdapter::setNodeVelocity(const D3Q27Interactor & /*interactor*/, } } /*==========================================================*/ -UbTupleDouble3 VelocityBCAdapter::getVelocity(const real &x1, const real &x2, const real &x3, +UbTupleDouble3 VelocityBC::getVelocity(const real &x1, const real &x2, const real &x3, const real &timeStep) const { - real vx1 = 0.0; - real vx2 = 0.0; - real vx3 = 0.0; + real vx1 = vf::basics::constant::c0o1; + real vx2 = vf::basics::constant::c0o1; + real vx3 = vf::basics::constant::c0o1; this->x1 = x1; this->x2 = x2; this->x3 = x3; @@ -355,10 +355,10 @@ UbTupleDouble3 VelocityBCAdapter::getVelocity(const real &x1, const real &x2, co return { vx1, vx2, vx3 }; } /*==========================================================*/ -string VelocityBCAdapter::toString() +string VelocityBC::toString() { stringstream info; - info << "D3Q27VelocityBCAdapter:\n"; + info << "D3Q27VelocityBC:\n"; info << " #vx1-functions = " << (int)vx1BCs.size() << endl; info << " #vx2-functions = " << (int)vx2BCs.size() << endl; info << " #vx3-functions = " << (int)vx3BCs.size() << endl; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.h similarity index 83% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.h index c0596b8e234f581726243a8a95beb6eb71121be4..64e333ad86e1cc03c9295274c107387bf6583562 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBC.h @@ -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 VelocityBCAdapter.h +//! \file VelocityBC.h //! \ingroup BoundarConditions //! \author Sören Freudiger //======================================================================================= -#ifndef VelocityBCAdapter_H -#define VelocityBCAdapter_H +#ifndef VelocityBC_H +#define VelocityBC_H #include <iostream> #include <sstream> @@ -40,7 +40,7 @@ #include <basics/utilities/UbInfinity.h> -#include <BCAdapter.h> +#include <BC.h> #include <BCFunction.h> //! \brief A class provides an interface for velocity boundary condition in grid generator. @@ -56,8 +56,8 @@ //! vx2BCs.push_back(BCFunction(0.002, 200, 300) ); //t=[200..300[ -> vx2 = 0.002 //! vx2BCs.push_back(BCFunction(0.043, 300, 600) ); //t=[300..600] -> vx2 = 0.043 //! -//! VelocityBCAdapter bcAdapter(vx1BCs,vx2BCs,vx3BCs); -//! bcAdapter.setTimePeriodic(); //-> t=[0 ..100[ -> vx1 = 0.01 +//! VelocityBC BC(vx1BCs,vx2BCs,vx3BCs); +//! BC.setTimePeriodic(); //-> t=[0 ..100[ -> vx1 = 0.01 //! // t=[100..200[ -> vx1 = 0.004 //! // t=[200..400[ -> vx1 = 0.03 //! // t=[400..500[ -> vx1 = 0.01 @@ -76,39 +76,39 @@ //! fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (with vmax for //! (0/x2_vmax/x3_vmax) fct.DefineConst("x2Vmax", 0.0 ); //x2-Pos für vmax fct.DefineConst("x3Vmax", 0.0 //! ); //x3-Pos für vmax fct.DefineConst("H" , diameterOfPipe); fct.DefineConst("vmax" , vmax ); -//! VelocityBCAdapter velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); +//! VelocityBC velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); //! \endcode -class VelocityBCAdapter : public BCAdapter +class VelocityBC : public BC { public: // constructors - VelocityBCAdapter() { this->init(); } + VelocityBC() { this->init(); } - VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const BCFunction &velVxBC); + VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const BCFunction &velVxBC); - VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function, + VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function, const real &startTime, const real &endTime); - VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function1, + VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const mu::Parser &function1, const mu::Parser &function2, const mu::Parser &function3, const real &startTime, const real &endTime); - VelocityBCAdapter(const bool &vx1, const bool &vx2, const bool &vx3, const std::string &functionstring, + VelocityBC(const bool &vx1, const bool &vx2, const bool &vx3, const std::string &functionstring, const real &startTime, const real &endTime); - VelocityBCAdapter(const BCFunction &velBC, bool x1Dir, bool x2Dir, bool x3Dir); + VelocityBC(const BCFunction &velBC, bool x1Dir, bool x2Dir, bool x3Dir); - VelocityBCAdapter(const BCFunction &velVx1BC, const BCFunction &velVx2BC, const BCFunction &velVx3BC); + VelocityBC(const BCFunction &velVx1BC, const BCFunction &velVx2BC, const BCFunction &velVx3BC); - VelocityBCAdapter(const std::vector<BCFunction> &velVx1BCs, const std::vector<BCFunction> &velVx2BCs, + VelocityBC(const std::vector<BCFunction> &velVx1BCs, const std::vector<BCFunction> &velVx2BCs, const std::vector<BCFunction> &velVx3BCs); - VelocityBCAdapter(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, const real &vx2, + VelocityBC(const real &vx1, const real &vx1StartTime, const real &vx1EndTime, const real &vx2, const real &vx2StartTime, const real &vx2EndTime, const real &vx3, const real &vx3StartTime, const real &vx3EndTime); - VelocityBCAdapter(const std::string &vx1Function, const real &vx1StartTime, const real &vx1EndTime, + VelocityBC(const std::string &vx1Function, const real &vx1StartTime, const real &vx1EndTime, const std::string &vx2Function, const real &vx2StartTime, const real &vx2EndTime, const std::string &vx3Function, const real &vx3StartTime, const real &vx3EndTime); @@ -122,7 +122,7 @@ public: const real &vx2StartTime, const real &vx2EndTime, const real &vx3, const real &vx3StartTime, const real &vx3EndTime); - //------------- implements BCAdapter ----- start + //------------- implements BC ----- start std::string toString(); void init(const D3Q27Interactor *const &interactor, const real &time = 0) override; @@ -134,7 +134,7 @@ public: void adaptBC(const D3Q27Interactor &interactor, SPtr<BoundaryConditions> bc, const real &worldX1, const real &worldX2, const real &worldX3, const real &time = 0) override; - //------------- implements BCAdapter ----- end + //------------- implements BC ----- end UbTupleDouble3 getVelocity(const real &x1, const real &x2, const real &x3, const real &timeStep) const; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.cpp similarity index 82% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.cpp index 9f1bf39d8d6d11747a71b04d9cfc7e3b70870802..4f4c1615d0b6386a2e3382959e73f1885c8e9af4 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.cpp @@ -26,34 +26,34 @@ // 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 VelocityBCAlgorithm.cpp +//! \file VelocityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "VelocityBCAlgorithm.h" +#include "VelocityBCStrategy.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" #include "Block3D.h" -VelocityBCAlgorithm::VelocityBCAlgorithm() +VelocityBCStrategy::VelocityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::VelocityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::VelocityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> VelocityBCAlgorithm::clone() +SPtr<BCStrategy> VelocityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new VelocityBCAlgorithm()); + SPtr<BCStrategy> bc(new VelocityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void VelocityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithm::applyBC() +void VelocityBCStrategy::applyBC() { real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; @@ -65,15 +65,15 @@ void VelocityBCAlgorithm::applyBC() //DEBUG //int blockID = block->getGlobalID(); - rho = 1.0 + drho * compressibleFactor; + rho = vf::basics::constant::c1o1 + drho * compressibleFactor; for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if (bcPtr->hasVelocityBoundaryFlag(fdir)) { const int invDir = D3Q27System::INVDIR[fdir]; real q = bcPtr->getQ(invDir); real velocity = bcPtr->getBoundaryVelocity(invDir); - real 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)); + real fReturn = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q)) * ((f[invDir] - feq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + feq[invDir]) + + ((q * (f[invDir] + f[fdir]) - velocity * rho) / (vf::basics::constant::c1o1 + q)); distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.h similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.h index 44bbd2cee69c12a613e638f4173b371d1260964f..bc12cf937471726454c0de7b22d531a227d75696 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCStrategy.h @@ -26,25 +26,25 @@ // 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 VelocityBCAlgorithm.h +//! \file VelocityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef VelocityBCAlgorithm_H -#define VelocityBCAlgorithm_H +#ifndef VelocityBCStrategy_H +#define VelocityBCStrategy_H -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; //! \brief A class implements velocyty boundary condition -class VelocityBCAlgorithm : public BCAlgorithm +class VelocityBCStrategy : public BCStrategy { public: - VelocityBCAlgorithm(); - SPtr<BCAlgorithm> clone() override; + VelocityBCStrategy(); + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp index 09a52798e62013fdc5878678a4c47aec003b68a2..1b579877afa20ac6c3d82cce0ea2b5c6f00aef81 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp @@ -26,34 +26,34 @@ // 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 VelocityWithDensityBCAlgorithm.cpp +//! \file VelocityWithDensityBCStrategy.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "VelocityWithDensityBCAlgorithm.h" +#include "VelocityWithDensityBCStrategy.h" #include "BCArray3D.h" #include "DistributionArray3D.h" -VelocityWithDensityBCAlgorithm::VelocityWithDensityBCAlgorithm() +VelocityWithDensityBCStrategy::VelocityWithDensityBCStrategy() { - BCAlgorithm::type = BCAlgorithm::VelocityWithDensityBCAlgorithm; - BCAlgorithm::preCollision = false; + BCStrategy::type = BCStrategy::VelocityWithDensityBCStrategy; + BCStrategy::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -VelocityWithDensityBCAlgorithm::~VelocityWithDensityBCAlgorithm() = default; +VelocityWithDensityBCStrategy::~VelocityWithDensityBCStrategy() = default; ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> VelocityWithDensityBCAlgorithm::clone() +SPtr<BCStrategy> VelocityWithDensityBCStrategy::clone() { - SPtr<BCAlgorithm> bc(new VelocityWithDensityBCAlgorithm()); + SPtr<BCStrategy> bc(new VelocityWithDensityBCStrategy()); return bc; } ////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void VelocityWithDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityBCAlgorithm::applyBC() +void VelocityWithDensityBCStrategy::applyBC() { //velocity bc for non reflecting pressure bc real f[D3Q27System::ENDF+1]; @@ -92,7 +92,7 @@ void VelocityWithDensityBCAlgorithm::applyBC() // if q=1 // LBMReal fReturn = ((q*(f[fdir] + f[invDir]) - velocity*rho) / (1.0 + // q))-drho*D3Q27System::WEIGTH[invDir]; - real fReturn = (f[fdir] + f[invDir] - velocity * rho) / 2.0 - drho * D3Q27System::WEIGTH[invDir]; + real fReturn = (f[fdir] + f[invDir] - velocity * rho) / vf::basics::constant::c2o1 - drho * D3Q27System::WEIGTH[invDir]; distributions->setDistributionForDirection(fReturn, nX1, nX2, nX3, invDir); } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.h similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.h index 7ab57d2b892af9db0e0e42327b970b381710edf3..6d91f2ced18e647449c7ba732aa09c4f5fe25f8d 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.h @@ -26,15 +26,15 @@ // 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 VelocityWithDensityBCAlgorithm.h +//! \file VelocityWithDensityBCStrategy.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef VelocityWithDensityBCAlgorithm_h__ -#define VelocityWithDensityBCAlgorithm_h__ +#ifndef VelocityWithDensityBCStrategy_h__ +#define VelocityWithDensityBCStrategy_h__ -#include "BCAlgorithm.h" +#include "BCStrategy.h" #include <PointerDefinitions.h> class DistributionArray3D; @@ -42,13 +42,13 @@ class DistributionArray3D; //! \brief Class implements Dirichlet boundary condition for velocity. Set density in system. It is used together with //! non reflecting outflow. -class VelocityWithDensityBCAlgorithm : public BCAlgorithm +class VelocityWithDensityBCStrategy : public BCStrategy { public: - VelocityWithDensityBCAlgorithm(); - ~VelocityWithDensityBCAlgorithm() override; - SPtr<BCAlgorithm> clone() override; + VelocityWithDensityBCStrategy(); + ~VelocityWithDensityBCStrategy() override; + SPtr<BCStrategy> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; -#endif // VelocityWithDensityBCAlgorithm_h__ +#endif // VelocityWithDensityBCStrategy_h__ diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt index 5300e898bd17e45b2a0a5c5e2b0d083c975ad1fb..9f3cd96e889097a32ce737e56e3f1fa31dddaee0 100644 --- a/src/cpu/VirtualFluidsCore/CMakeLists.txt +++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt @@ -1,17 +1,17 @@ set(VF_LIBRARIES) -IF(${USE_METIS} AND METIS_RELEASE_LIBRARY AND METIS_DEBUG_LIBRARY) +IF(${VFCPU_USE_METIS} AND METIS_RELEASE_LIBRARY AND METIS_DEBUG_LIBRARY) list(APPEND VF_LIBRARIES optimized ${METIS_RELEASE_LIBRARY} debug ${METIS_DEBUG_LIBRARY}) ELSE() list(APPEND VF_LIBRARIES metis) ENDIF() -IF(${USE_VTK}) +IF(${VFCPU_USE_VTK}) list(APPEND VF_LIBRARIES optimized ${VTK_LIBRARIES} debug ${VTK_LIBRARIES}) ENDIF() -IF(${USE_CATALYST}) +IF(${VFCPU_USE_CATALYST}) list(APPEND VF_LIBRARIES optimized vtkPVPythonCatalyst debug vtkPVPythonCatalyst) list(APPEND VF_LIBRARIES optimized vtkParallelMPI debug vtkParallelMPI ) ENDIF() @@ -20,10 +20,6 @@ if(BUILD_USE_OPENMP) list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) endif() -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 ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger) vf_add_tests() @@ -36,23 +32,18 @@ target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Da target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Grid) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Simulation) 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}/SimulationObservers) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities) - -IF(${USE_METIS} AND METIS_INCLUDEDIR) +IF(${VFCPU_USE_METIS} AND METIS_INCLUDEDIR) target_include_directories(${library_name} PUBLIC ${METIS_INCLUDEDIR}) ENDIF() target_include_directories(${library_name} PRIVATE ${ZOLTAN_INCLUDEDIR}) -IF(${USE_VTK}) +IF(${VFCPU_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/CalculateTorqueCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h deleted file mode 100644 index 26686239bdca68a047c4f8c8f4c33f5a09f53bb5..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateTorqueCoProcessor.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * D3Q27ForcesCoProcessor.h - * - * Created on: 29.09.2012 - * Author: K. Kucher - */ - -#ifndef CalculateTorqueCoProcessor_H -#define CalculateTorqueCoProcessor_H - -#include <PointerDefinitions.h> -#include <string> -#include <vector> - -#include "CoProcessor.h" -#include "UbTuple.h" -#include "D3Q27System.h" - -class ForceCalculator; -namespace vf::mpi {class Communicator;} -class Grid3D; -class UbScheduler; -class D3Q27Interactor; -class DistributionArray3D; -class BoundaryConditions; - -class CalculateTorqueCoProcessor: public CoProcessor -{ -public: - //! Constructor - CalculateTorqueCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - virtual ~CalculateTorqueCoProcessor(); - void process(real step); - void addInteractor(SPtr<D3Q27Interactor> interactor); -protected: - void collectData(real step); - void calculateForces(); - UbTupleDouble3 getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc); -private: - std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; - std::vector<SPtr<D3Q27Interactor> > interactors; - real torqueX1global; - real torqueX2global; - real torqueX3global; -}; - - -#endif /* D3Q27ForcesCoProcessor_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h deleted file mode 100644 index 13eaa7832cf5815005d30910332a7d382f047186..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * EmergencyExitCoProcessor.h - * - * Created on: 05.10.2012 - * Author: K. Kucher - */ - -#ifndef EmergencyExitCoProcessor_H -#define EmergencyExitCoProcessor_H - -#include <PointerDefinitions.h> -#include <string> - -#include "CoProcessor.h" - -class MPIIORestartCoProcessor; -namespace vf::mpi {class Communicator;} -class Grid3D; -class UbScheduler; - -class EmergencyExitCoProcessor : public CoProcessor -{ -public: - EmergencyExitCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<MPIIORestartCoProcessor> rp, std::shared_ptr<vf::mpi::Communicator> comm); - ~EmergencyExitCoProcessor() override; - - void process(real step) override; - -protected: - void collectData(real step); - void writeMetafile(int status); - bool readMetafile(); - void checkMetafile(); - -private: - std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; - SPtr<MPIIORestartCoProcessor> rp; - std::string metafile; -}; - -#endif /* EmergencyExitCoProcessor_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp deleted file mode 100644 index 22158269d3d622fd4dd0f6c943b7e28b871b5172..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "TimeDependentBCCoProcessor.h" - -#include "Grid3D.h" -#include "Interactor3D.h" -#include "UbScheduler.h" - -TimeDependentBCCoProcessor::TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : CoProcessor(grid, s) {} -////////////////////////////////////////////////////////////////////////// -TimeDependentBCCoProcessor::~TimeDependentBCCoProcessor() = default; -////////////////////////////////////////////////////////////////////////// -void TimeDependentBCCoProcessor::process(real step) -{ - if (scheduler->isDue(step)) { - for (SPtr<Interactor3D> inter : interactors) - inter->updateInteractor(step); - UBLOG(logDEBUG3, "TimeDependentBCCoProcessor::update:" << step); - } -} -////////////////////////////////////////////////////////////////////////// -void TimeDependentBCCoProcessor::addInteractor(SPtr<Interactor3D> interactor) { interactors.push_back(interactor); } - -////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h deleted file mode 100644 index cb41ca9622759f99d701d1d97865d9754d9bf5e6..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef TimeDependentBCCoProcessor_H -#define TimeDependentBCCoProcessor_H - -#include <PointerDefinitions.h> -#include <vector> - -#include "CoProcessor.h" - -class Interactor3D; -class Grid3D; - -//! \brief The class update interactors depend of time step. -//! \details TimeDependentBCCoProcessor update every time step information in BCAdapters throw Interactors -//! \author Sonja Uphoff, Kostyantyn Kucher -class TimeDependentBCCoProcessor : public CoProcessor -{ -public: - TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s); - ~TimeDependentBCCoProcessor() override; - - void process(real step) override; - - //! add interactors to CoProcessor - void addInteractor(SPtr<Interactor3D> interactor); - -private: - std::vector<SPtr<Interactor3D>> interactors; -}; - -#endif /* TimeDependentBCCoProcessor_H */ diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h index c2ba596a7bdb20c24fa373064e09854c4f6d95eb..d7f9f72c4f86f5d849fa4f2c0cd703333007091a 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h @@ -48,7 +48,7 @@ #include "basics/transmitter/TbTransmitterLocal.h" #include <PointerDefinitions.h> -#include "BCProcessor.h" +#include "BCSet.h" #include "FineToCoarseVectorConnector.h" class Block3D; @@ -833,7 +833,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectorExt(SPtr<Dist return; int ix1, ix2, ix3; real xoff, yoff, zoff; - SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCSet()->getBCArray(); for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) { for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) { @@ -1979,7 +1979,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::findCFnodes(SPtr<Distributi return; int ix1, ix2, ix3; real xoff, yoff, zoff; - SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCSet()->getBCArray(); for (ix3 = lMinX3; ix3 < lMaxX3; ix3++) { for (ix2 = lMinX2; ix2 < lMaxX2; ix2++) { diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h index f4f4080215869cdd4ae1c75e750daa2419af9240..ffab5008241e7f8f4457c7385c83872a296ee748 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h @@ -46,7 +46,7 @@ #include "basics/transmitter/TbTransmitter.h" #include <PointerDefinitions.h> -#include "BCProcessor.h" +#include "BCSet.h" #include "DataSet3D.h" class Block3D; @@ -795,7 +795,7 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVector(SPtr<Distrib { int ix1, ix2, ix3; real xoff, yoff, zoff; - SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCSet()->getBCArray(); for (ix3 = lMinX3; ix3 < lMaxX3; ix3 += 2) { for (ix2 = lMinX2; ix2 < lMaxX2; ix2 += 2) { diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h index bbd1c5a346ac50b08c78794ea3b00457ba4836b7..40f119cd61a80126cf80853ab9f7511d38132215 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullDirectConnector.h @@ -162,6 +162,7 @@ inline void TwoDistributionsDoubleGhostLayerFullDirectConnector::exchangeData(in (*this->zeroDistributionsToh)(x1To, x2To, x3To) = (*this->zeroDistributionsFromh)(x1From, x2From, x3From); - (*this->pressureTo)(x1To, x2To, x3To) = (*this->pressureFrom)(x1From, x2From, x3From); + if (this->pressureTo) + (*this->pressureTo)(x1To, x2To, x3To) = (*this->pressureFrom)(x1From, x2From, x3From); } #endif \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h index 060e2cb3ad367d31d6b30577f370cd1b692daecd..21f1610641706dac82e1314b1a01be5959c8b0b2 100644 --- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h +++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h @@ -103,8 +103,8 @@ protected: CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr zeroDistributions; size_t NX1, NX2, NX3; - friend class MPIIORestartCoProcessor; - friend class MPIIOMigrationCoProcessor; + friend class MPIIORestartSimulationObserver; + friend class MPIIOMigrationSimulationObserver; }; #endif diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.h b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.h deleted file mode 100644 index 3ef1f4c712e552ea5d5b5e82306e2bd94d74d7ab..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.h +++ /dev/null @@ -1,69 +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 BasicCalculator.h -//! \ingroup Grid -//! \author Konstantin Kutscher -//======================================================================================= - -#ifndef BasicCalculator_h__ -#define BasicCalculator_h__ - -#include "Calculator.h" - -class Block3DConnector; - -//! \class BasicCalculator -//! \brief Class implements basic functionality with MPI + OpenMP parallelization for main calculation loop -//! \author Konstantin Kutscher - -class BasicCalculator : public Calculator -{ -public: - BasicCalculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps); - ~BasicCalculator() override = default; - void calculate() override; - -protected: - void calculateBlocks(int startLevel, int maxInitLevel, int calcStep); - void swapDistributions(int startLevel, int maxInitLevel); - void exchangeBlockData(int startLevel, int maxInitLevel); - void connectorsPrepareLocal(std::vector<SPtr<Block3DConnector>> &connectors); - void connectorsSendLocal(std::vector<SPtr<Block3DConnector>> &connectors); - void connectorsReceiveLocal(std::vector<SPtr<Block3DConnector>> &connectors); - void connectorsPrepareRemote(std::vector<SPtr<Block3DConnector>> &connectors); - void connectorsSendRemote(std::vector<SPtr<Block3DConnector>> &connectors); - void connectorsReceiveRemote(std::vector<SPtr<Block3DConnector>> &connectors); - void interpolation(int startLevel, int maxInitLevel); - void applyPreCollisionBC(int startLevel, int maxInitLevel); - void applyPostCollisionBC(int startLevel, int maxInitLevel); - -private: -}; - -#endif // BasicCalculator_h__ diff --git a/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp b/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp deleted file mode 100644 index 85235867a3352c8277e6e279b7dbb6058d03020a..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp +++ /dev/null @@ -1,231 +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 Calculator.cpp -//! \ingroup Grid -//! \author Konstantin Kutscher -//======================================================================================= - -#include "Calculator.h" - -#include "Block3D.h" -#include "Block3DConnector.h" -#include "CoProcessor.h" -#include "Grid3D.h" -#include "UbScheduler.h" - -#include <basics/utilities/UbException.h> - -Calculator::Calculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps) - : grid(grid), additionalGhostLayerUpdateScheduler(additionalGhostLayerUpdateScheduler), - numberOfTimeSteps(numberOfTimeSteps) -{ - this->grid = grid; - startTimeStep = int(grid->getTimeStep()) + 1; - minLevel = grid->getCoarsestInitializedLevel(); - maxLevel = grid->getFinestInitializedLevel(); - if (maxLevel > 0) - refinement = true; - else - refinement = false; - blocks.resize(maxLevel + 1); - localConns.resize(maxLevel + 1); - remoteConns.resize(maxLevel + 1); - localInterConns.resize(maxLevel); - remoteInterConns.resize(maxLevel); - - int gridRank = grid->getRank(); - - for (int level = minLevel; level <= maxLevel; level++) { - std::vector<SPtr<Block3D>> blockVector; - grid->getBlocks(level, gridRank, true, blockVector); - for (const auto &block : blockVector) - if (block) - blocks[block->getLevel()].push_back(block); - } - - initLocalConnectors(); - initRemoteConnectors(); -} -////////////////////////////////////////////////////////////////////////// -Calculator::~Calculator() = default; -////////////////////////////////////////////////////////////////////////// -void Calculator::addCoProcessor(SPtr<CoProcessor> coProcessor) { coProcessors.push_back(coProcessor); } -////////////////////////////////////////////////////////////////////////// -void Calculator::coProcess(real step) -{ - for (SPtr<CoProcessor> cp : coProcessors) { - cp->process(step); - } -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initLocalConnectors() -{ - UBLOG(logDEBUG1, "Calculator::initLocalConnectors() - start"); - - for (int l = minLevel; l <= maxLevel; l++) { - for (SPtr<Block3D> block : blocks[l]) { - block->pushBackLocalSameLevelConnectors(localConns[l]); - - if (l != maxLevel) - block->pushBackLocalInterpolationConnectorsCF(localInterConns[l]); - } - if (l != maxLevel) { - for (SPtr<Block3D> block : blocks[l + 1]) { - block->pushBackLocalInterpolationConnectorsFC(localInterConns[l]); - } - } - UBLOG(logDEBUG5, "Calculator::initConnectors()-initConnectors(localConns[" << l << "])"); - initConnectors(localConns[l]); - - if (l != maxLevel) { - UBLOG(logDEBUG5, "Calculator::initConnectors()-initConnectors(localInterConns[" << l << "])"); - initConnectors(localInterConns[l]); - } - } - - UBLOG(logDEBUG1, "Calculator::initLocalConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initRemoteConnectors() -{ - std::vector<std::vector<SPtr<Block3DConnector>>> remoteInterConnsCF; - std::vector<std::vector<SPtr<Block3DConnector>>> remoteInterConnsFC; - remoteInterConnsCF.resize(maxLevel + 1); - remoteInterConnsFC.resize(maxLevel + 1); - - for (int l = minLevel; l <= maxLevel; l++) { - std::vector<SPtr<Block3D>> blockVector; - // grid->getBlocks(level, gridRank, true, blockVector); - grid->getBlocks(l, blockVector); - for (SPtr<Block3D> block : blockVector) { - int block_level = block->getLevel(); - block->pushBackRemoteSameLevelConnectors(remoteConns[block_level]); - - block->pushBackRemoteInterpolationConnectorsCF(remoteInterConnsCF[block_level]); - block->pushBackRemoteInterpolationConnectorsFC(remoteInterConnsFC[block_level]); - } - } - - for (int l = minLevel; l <= maxLevel; l++) { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-initConnectors(remoteConns[" << l << "])"); - initConnectors(remoteConns[l]); - if (l != maxLevel) { - for (size_t i = 0; i < remoteInterConnsCF[l].size(); i++) - remoteInterConns[l].push_back(remoteInterConnsCF[l][i]); - for (size_t i = 0; i < remoteInterConnsFC[l + 1].size(); i++) - remoteInterConns[l].push_back(remoteInterConnsFC[l + 1][i]); - } - } - ////////////////////////////////////////////////////////////////////////// - // UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - start"); - for (int l = minLevel; l <= maxLevel; l++) { - if (l != maxLevel) { - UBLOG(logDEBUG5, "Calculator::initRemoteConnectors()-initConnectors(remoteInterConns[" << l << "])"); - for (SPtr<Block3DConnector> c : remoteInterConns[l]) - c->init(); - } - } - // UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - end"); - ////////////////////////////////////////////////////////////////////////// - // sendTransmitterDataSize - // UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - start"); - for (int l = minLevel; l <= maxLevel; l++) { - if (l != maxLevel) { - UBLOG(logDEBUG5, - "Calculator::initRemoteConnectors()-sendTransmitterDataSize(remoteInterConns[" << l << "])"); - for (SPtr<Block3DConnector> c : remoteInterConns[l]) - c->sendTransmitterDataSize(); - } - } - // UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// - // receiveTransmitterDataSize - // wenn er hier bei verteilten berechnungen stopped, dann ist vermutlich auf einer seite ein nicht aktiver block!!! - // UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - start"); - for (int l = minLevel; l <= maxLevel; l++) { - if (l != maxLevel) { - UBLOG(logDEBUG5, - "Calculator::initRemoteConnectors()-receiveTransmitterDataSize(remoteInterConns[" << l << "])"); - for (SPtr<Block3DConnector> c : remoteInterConns[l]) - c->receiveTransmitterDataSize(); - } - } - // UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// -} -////////////////////////////////////////////////////////////////////////// -void Calculator::initConnectors(std::vector<SPtr<Block3DConnector>> &connectors) -{ - UBLOG(logDEBUG1, "Calculator::initConnectors() - start"); - - // initialization - ////////////////////////////////////////////////////////////////////////// - // initialize connectors - UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - start"); - for (SPtr<Block3DConnector> c : connectors) - c->init(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - connectoren initialisieren - end"); - ////////////////////////////////////////////////////////////////////////// - // sendTransmitterDataSize - UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - start"); - for (SPtr<Block3DConnector> c : connectors) - c->sendTransmitterDataSize(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - sendTransmitterDataSize - end"); - ////////////////////////////////////////////////////////////////////////// - // receiveTransmitterDataSize - // wenn er hier bei verteilten berechnungen stopped, dann ist vermutlich auf einer seite ein nicht aktiver block!!! - UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - start"); - for (SPtr<Block3DConnector> c : connectors) - c->receiveTransmitterDataSize(); - UBLOG(logDEBUG5, "Calculator::initConnectors() - receiveTransmitterDataSize - end"); - - UBLOG(logDEBUG1, "Calculator::initConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteBlocks() -{ - for (std::vector<SPtr<Block3D>> &bs : blocks) - bs.resize(0); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteConnectors() -{ - deleteConnectors(localConns); - deleteConnectors(remoteConns); - - deleteConnectors(localInterConns); - deleteConnectors(remoteInterConns); -} -////////////////////////////////////////////////////////////////////////// -void Calculator::deleteConnectors(std::vector<std::vector<SPtr<Block3DConnector>>> &conns) -{ - for (std::vector<SPtr<Block3DConnector>> &c : conns) - c.resize(0); -} -////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp index c4a1ab11ef476891a7339a8ab2ae3c63556c8cd1..02a94f573ed04a5509c71fb7890fe418d230f0fe 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp @@ -39,9 +39,9 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> -#include "BCAdapter.h" +#include "BC.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include "Grid3D.h" @@ -66,20 +66,20 @@ D3Q27Interactor::D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid this->initRayVectors(); } ////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type) +D3Q27Interactor::D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BC> BC, int type) : Interactor3D(geoObject3D, grid, type), relevantForForces(false) { this->reinitWithStoredQsFlag = false; - this->addBCAdapter(bcAdapter); + this->addBC(BC); this->initRayVectors(); } ////////////////////////////////////////////////////////////////////////// -D3Q27Interactor::D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type, +D3Q27Interactor::D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BC> BC, int type, Interactor3D::Accuracy a) : Interactor3D(geoObject3D, grid, type, a), relevantForForces(false) { this->reinitWithStoredQsFlag = false; - this->addBCAdapter(bcAdapter); + this->addBC(BC); this->initRayVectors(); } ////////////////////////////////////////////////////////////////////////// @@ -206,14 +206,14 @@ void D3Q27Interactor::initInteractor(const real &timeStep) ////////////////////////////////////////////////////////////////////////// // init bcs - int nofAdapter = (int)bcAdapters.size(); + int nofAdapter = (int)BCs.size(); if (nofAdapter == 0) { UBLOG(logWARNING, "WARNING - D3Q27Interactor::initInteractor Warning - no nodeAdapter available"); } bool needTimeDependence = false; for (int pos = 0; pos < nofAdapter; ++pos) { - bcAdapters[pos]->init(this, timeStep); - if (bcAdapters[pos]->isTimeDependent()) + BCs[pos]->init(this, timeStep); + if (BCs[pos]->isTimeDependent()) needTimeDependence = true; } if (needTimeDependence) @@ -230,7 +230,7 @@ void D3Q27Interactor::updateInteractor(const real ×tep) ////////////////////////////////////////////////////////////////////////// // update bcs - int nofAdapter = (int)bcAdapters.size(); + int nofAdapter = (int)BCs.size(); if (nofAdapter == 0) { UBLOG(logERROR, "WARNING - D3Q27Interactor::updateInteractor Warning - no nodeAdapter available for "); } @@ -238,8 +238,8 @@ void D3Q27Interactor::updateInteractor(const real ×tep) bool needTimeDependence = false; for (int pos = 0; pos < nofAdapter; ++pos) { - bcAdapters[pos]->update(this, timestep); - if (bcAdapters[pos]->isTimeDependent()) + BCs[pos]->update(this, timestep); + if (BCs[pos]->isTimeDependent()) needTimeDependence = true; } if (needTimeDependence) @@ -255,7 +255,7 @@ void D3Q27Interactor::updateInteractor(const real ×tep) continue; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); set<std::vector<int>>::iterator setPos; @@ -271,8 +271,8 @@ void D3Q27Interactor::updateInteractor(const real ×tep) SPtr<BoundaryConditions> bc = bcArray->getBC(x1, x2, x3); if (bc) // may be that the BC has been deleted by the solid setting of another interactor { - for (size_t i = 0; i < bcAdapters.size(); i++) - bcAdapters[i]->adaptBC(*this, bc, worldX1, worldX2, worldX3, timestep); + for (size_t i = 0; i < BCs.size(); i++) + BCs[i]->adaptBC(*this, bc, worldX1, worldX2, worldX3, timestep); } } } @@ -303,7 +303,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) SPtr<BoundaryConditions> bc; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); real internX1, internX2, internX3; @@ -415,8 +415,8 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) bc->setBoundaryVelocityX3(0.0); } - for (int index = (int)bcAdapters.size() - 1; index >= 0; --index) - bcAdapters[index]->adaptBCForDirection(*this, bc, internX1, internX2, internX3, + for (int index = (int)BCs.size() - 1; index >= 0; --index) + BCs[index]->adaptBCForDirection(*this, bc, internX1, internX2, internX3, q, fdir, timestep); } @@ -434,8 +434,8 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) p[2] = ix3; transNodeIndices.insert(p); - for (int index = (int)bcAdapters.size() - 1; index >= 0; --index) - bcAdapters[index]->adaptBC(*this, bc, internX1, internX2, internX3, timestep); + for (int index = (int)BCs.size() - 1; index >= 0; --index) + BCs[index]->adaptBC(*this, bc, internX1, internX2, internX3, timestep); } } } else if (this->isInverseSolid()) { @@ -534,8 +534,8 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) bc = std::make_shared<BoundaryConditions>(); bcArray->setBC(ix1, ix2, ix3, bc); } - for (int index = (int)bcAdapters.size() - 1; index >= 0; --index) - bcAdapters[index]->adaptBCForDirection(*this, bc, internX1, internX2, + for (int index = (int)BCs.size() - 1; index >= 0; --index) + BCs[index]->adaptBCForDirection(*this, bc, internX1, internX2, internX3, q, fdir, timestep); } @@ -558,8 +558,8 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) p[2] = ix3; transNodeIndices.insert(p); - for (int index = (int)bcAdapters.size() - 1; index >= 0; --index) - bcAdapters[index]->adaptBC(*this, bc, internX1, internX2, internX3, timestep); + for (int index = (int)BCs.size() - 1; index >= 0; --index) + BCs[index]->adaptBC(*this, bc, internX1, internX2, internX3, timestep); } } } @@ -583,7 +583,7 @@ void D3Q27Interactor::addQsLineSet(std::vector<UbTupleFloat3> &nodes, std::vecto UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); map<SPtr<Block3D>, set<std::vector<int>>>::iterator pos = bcNodeIndicesMap.find(block); if (pos == bcNodeIndicesMap.end()) { @@ -779,7 +779,7 @@ vector<pair<GbPoint3D, GbPoint3D>> D3Q27Interactor::getQsLineSet() for (SPtr<Block3D> block : bcBlocks) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block); // Check whether top row is real in the system or not diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h index 80a58efccb36588111ddf5301f3fb68068e20958..e0094d646a4dd621e7d5815fc7fc6ce6e4450dbe 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h @@ -48,7 +48,7 @@ #include "UbException.h" #include "UbTuple.h" -class BCAdapter; +class BC; class Block3D; class Grid3D; class GbObject3D; @@ -63,8 +63,8 @@ class D3Q27Interactor : public Interactor3D public: D3Q27Interactor(); D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type); - D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type); - D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type, + D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BC> BC, int type); + D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BC> BC, int type, Interactor3D::Accuracy a); ~D3Q27Interactor() override; @@ -72,8 +72,8 @@ public: void setRelevantForForces(const bool &value) { this->relevantForForces = value; } bool isRelevantForForces() { return this->relevantForForces; } - virtual void addBCAdapter(const SPtr<BCAdapter> bcAdapter) { bcAdapters.push_back(bcAdapter); } - void deleteBCAdapter() { bcAdapters.clear(); } + virtual void addBC(const SPtr<BC> BC) { BCs.push_back(BC); } + void deleteBC() { BCs.clear(); } void initInteractor(const real &timeStep = 0) override; void updateInteractor(const real ×tep = 0) override; @@ -106,7 +106,7 @@ protected: bool relevantForForces; bool reinitWithStoredQsFlag; - std::vector<SPtr<BCAdapter>> bcAdapters; + std::vector<SPtr<BC>> BCs; SolidNodeIndicesMap solidNodeIndicesMap; BcNodeIndicesMap bcNodeIndicesMap; diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp index d569d3c0f16b24ea7592c09b26a06b8be69e126c..237097ed5fd48f29b0b2e236cc497bd42110e681 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp @@ -8,12 +8,12 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include "Grid3D.h" #include "LBMKernel.h" -#include "VelocityBCAdapter.h" +#include "VelocityBC.h" #include "basics/utilities/UbTiming.h" #include <geometry3d/GbCuboid3D.h> #include <geometry3d/GbHalfSpace3D.h> @@ -37,15 +37,15 @@ D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(SPtr<Grid3D> /*grid*/, st } ////////////////////////////////////////////////////////////////////////// D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, - SPtr<BCAdapter> bcAdapter, int type) - : D3Q27Interactor(triFaceMesh, grid, bcAdapter, type) + SPtr<BC> BC, int type) + : D3Q27Interactor(triFaceMesh, grid, BC, type) { this->stressMode = STRESSNORMAL; } ////////////////////////////////////////////////////////////////////////// D3Q27TriFaceMeshInteractor::D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, - SPtr<BCAdapter> bcAdapter, int type, Interactor3D::Accuracy a) - : D3Q27Interactor(triFaceMesh, grid, bcAdapter, type, a) + SPtr<BC> BC, int type, Interactor3D::Accuracy a) + : D3Q27Interactor(triFaceMesh, grid, BC, type, a) { this->stressMode = STRESSNORMAL; } @@ -75,7 +75,7 @@ bool D3Q27TriFaceMeshInteractor::setDifferencesToGbObject3D(const SPtr<Block3D> SPtr<BoundaryConditions> bc; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); real internX1, internX2, internX3; @@ -138,15 +138,15 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) ////////////////////////////////////////////////////////////////////////// // init bcs ////////////////////////////////////////////////////////////////////////// - int nofAdapter = (int)this->bcAdapters.size(); + int nofAdapter = (int)this->BCs.size(); if (nofAdapter == 0) std::cout << "WARNING - D3Q27TriFaceMeshInteractor::initInteractor Warning - no nodeAdapter available for " /*<<this->getName()*/ << std::endl; bool needTimeDependence = false; for (int pos = 0; pos < nofAdapter; ++pos) { - this->bcAdapters[pos]->init(this, timeStep); - if (this->bcAdapters[pos]->isTimeDependent()) + this->BCs[pos]->init(this, timeStep); + if (this->BCs[pos]->isTimeDependent()) needTimeDependence = true; } if (needTimeDependence) @@ -351,7 +351,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) bool blockGotBCs = false; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); int indexMinX1 = 0; int indexMinX2 = 0; @@ -539,8 +539,8 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) bc->setBoundaryVelocityX2(vx2); bc->setBoundaryVelocityX3(vx3); - for (int index = (int)this->bcAdapters.size() - 1; index >= 0; --index) - this->bcAdapters[index]->adaptBCForDirection(*this, bc, internX1, internX2, + for (int index = (int)this->BCs.size() - 1; index >= 0; --index) + this->BCs[index]->adaptBCForDirection(*this, bc, internX1, internX2, internX3, q, fdir); // fuer beschleunigtes wiedereinlesen @@ -565,8 +565,8 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) p[2] = ix3; bcNodeIndices.insert(p); - for (int index = (int)this->bcAdapters.size() - 1; index >= 0; --index) - this->bcAdapters[index]->adaptBC(*this, bc, internX1, internX2, internX3); + for (int index = (int)this->BCs.size() - 1; index >= 0; --index) + this->BCs[index]->adaptBC(*this, bc, internX1, internX2, internX3); } } } @@ -617,15 +617,15 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) ////////////////////////////////////////////////////////////////////////// // init bcs ////////////////////////////////////////////////////////////////////////// - int nofAdapter = (int)this->bcAdapters.size(); + int nofAdapter = (int)this->BCs.size(); if (nofAdapter == 0) std::cout << "WARNING - D3Q27TriFaceMeshInteractor::initInteractor Warning - no nodeAdapter available for " /*<<this->getName()*/ << std::endl; bool needTimeDependence = false; for (int pos = 0; pos < nofAdapter; ++pos) { - this->bcAdapters[pos]->init(this, timeStep); - if (this->bcAdapters[pos]->isTimeDependent()) + this->BCs[pos]->init(this, timeStep); + if (this->BCs[pos]->isTimeDependent()) needTimeDependence = true; } if (needTimeDependence) @@ -870,7 +870,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) bool blockGotBCs = false; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); int indexMinX1 = 0; int indexMinX2 = 0; @@ -1066,8 +1066,8 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) bc->setBoundaryVelocityX2(vx2); bc->setBoundaryVelocityX3(vx3); - for (int index = (int)this->bcAdapters.size() - 1; index >= 0; --index) - this->bcAdapters[index]->adaptBCForDirection(*this, bc, internX1, internX2, + for (int index = (int)this->BCs.size() - 1; index >= 0; --index) + this->BCs[index]->adaptBCForDirection(*this, bc, internX1, internX2, internX3, q, fdir); // SG 26.08.2010 gotQs=blockGotBCs=true; @@ -1094,8 +1094,8 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) p[2] = ix3; bcNodeIndices.insert(p); - for (int index = (int)this->bcAdapters.size() - 1; index >= 0; --index) - this->bcAdapters[index]->adaptBC(*this, bc, internX1, internX2, internX3); + for (int index = (int)this->BCs.size() - 1; index >= 0; --index) + this->BCs[index]->adaptBC(*this, bc, internX1, internX2, internX3); } } } @@ -1168,7 +1168,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) SPtr<ILBMKernel> kernel = block->getKernel(); if (!kernel) throw UbException(UB_EXARGS, "na sowas kein kernel bzw. kernel=NULL (2)"); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); // bvd->getTimer().start(); // int indexMinX1 = 0; @@ -1847,7 +1847,7 @@ void D3Q27TriFaceMeshInteractor::reinitWithStoredQs(const real & /*timeStep*/) SPtr<Block3D> block = it1->first; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); std::set<UbTupleInt3> &indicesSet = it1->second; for (std::set<UbTupleInt3>::iterator setIt = indicesSet.begin(); setIt != indicesSet.end(); ++setIt) { @@ -1860,7 +1860,7 @@ void D3Q27TriFaceMeshInteractor::reinitWithStoredQs(const real & /*timeStep*/) for (it = bcNodeIndicesAndQsMap.begin(); it != bcNodeIndicesAndQsMap.end(); ++it) { SPtr<Block3D> block = it->first; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); std::map<UbTupleInt3, std::vector<float>>::iterator it2; for (it2 = it->second.begin(); it2 != it->second.end(); ++it2) { @@ -1894,14 +1894,14 @@ void D3Q27TriFaceMeshInteractor::reinitWithStoredQs(const real & /*timeStep*/) for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if (UbMath::greater(qs[fdir], -1.0) && UbMath::less(qs[fdir], bc->getQ(fdir))) { gotQs = true; - for (size_t index = 0; index < this->bcAdapters.size(); index++) - this->bcAdapters[index]->adaptBCForDirection(*this, bc, x1w, x2w, x3w, qs[fdir], fdir); + for (size_t index = 0; index < this->BCs.size(); index++) + this->BCs[index]->adaptBCForDirection(*this, bc, x1w, x2w, x3w, qs[fdir], fdir); } } if (gotQs) - for (size_t index = 0; index < this->bcAdapters.size(); index++) - this->bcAdapters[index]->adaptBC(*this, bc, x1w, x2w, x3w); + for (size_t index = 0; index < this->BCs.size(); index++) + this->BCs[index]->adaptBC(*this, bc, x1w, x2w, x3w); } } } diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h index 9e42de660502b33048abf31f5e831902134d3826..ddcac4ad22a50f31f1c1f884bc234b9bd49c6080 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h @@ -11,7 +11,7 @@ class GbObject3D; class Grid3D; -class BCAdapter; +class BC; class GbTriFaceMesh3D; class Block3D; @@ -24,11 +24,11 @@ public: D3Q27TriFaceMeshInteractor(); D3Q27TriFaceMeshInteractor(SPtr<Grid3D> grid, std::string name = "D3Q27TriFaceMeshInteractor"); D3Q27TriFaceMeshInteractor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type); - D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, + D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BC> BC, int type); - D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, + D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BC> BC, int type, Interactor3D::Accuracy a); - // D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, D3Q27BoundaryConditionAdapterPtr bcAdapter, int + // D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, D3Q27BoundaryConditionAdapterPtr BC, int // type, std::string name="D3Q27TriFaceMeshInteractor"); ~D3Q27TriFaceMeshInteractor() override; diff --git a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp index d27564c49cd2b115b9e4b4609b0ecf8f1a8a941b..b50103ff86077ef9079a66600935927d16e0037c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp @@ -1,6 +1,6 @@ #include "BGKLBMKernel.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27EsoTwist3DSoA.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "D3Q27System.h" @@ -27,7 +27,7 @@ SPtr<LBMKernel> BGKLBMKernel::clone() kernel->setNX(nx); std::dynamic_pointer_cast<BGKLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -69,7 +69,7 @@ void BGKLBMKernel::calculate(int step) zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); real f[D3Q27System::ENDF + 1]; real feq[D3Q27System::ENDF + 1]; real drho, vx1, vx2, vx3; @@ -141,39 +141,39 @@ void BGKLBMKernel::calculate(int step) real cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3); feq[DIR_000] = c8o27 * (drho - cu_sq); - 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_P00] = c2o27 * (drho + c3o1 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq); + feq[DIR_M00] = c2o27 * (drho + c3o1 * (-vx1) + c9o2 * (-vx1) * (-vx1) - cu_sq); + feq[DIR_0P0] = c2o27 * (drho + c3o1 * (vx2) + c9o2 * (vx2) * (vx2)-cu_sq); + feq[DIR_0M0] = c2o27 * (drho + c3o1 * (-vx2) + c9o2 * (-vx2) * (-vx2) - cu_sq); + feq[DIR_00P] = c2o27 * (drho + c3o1 * (vx3) + c9o2 * (vx3) * (vx3)-cu_sq); + feq[DIR_00M] = c2o27 * (drho + c3o1 * (-vx3) + c9o2 * (-vx3) * (-vx3) - cu_sq); + feq[DIR_PP0] = c1o54 * (drho + c3o1 * (vx1 + vx2) + c9o2 * (vx1 + vx2) * (vx1 + vx2) - cu_sq); + feq[DIR_MM0] = c1o54 * (drho + c3o1 * (-vx1 - vx2) + c9o2 * (-vx1 - vx2) * (-vx1 - vx2) - cu_sq); + feq[DIR_PM0] = c1o54 * (drho + c3o1 * (vx1 - vx2) + c9o2 * (vx1 - vx2) * (vx1 - vx2) - cu_sq); + feq[DIR_MP0] = c1o54 * (drho + c3o1 * (-vx1 + vx2) + c9o2 * (-vx1 + vx2) * (-vx1 + vx2) - cu_sq); + feq[DIR_P0P] = c1o54 * (drho + c3o1 * (vx1 + vx3) + c9o2 * (vx1 + vx3) * (vx1 + vx3) - cu_sq); + feq[DIR_M0M] = c1o54 * (drho + c3o1 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq); + feq[DIR_P0M] = c1o54 * (drho + c3o1 * (vx1 - vx3) + c9o2 * (vx1 - vx3) * (vx1 - vx3) - cu_sq); + feq[DIR_M0P] = c1o54 * (drho + c3o1 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq); + feq[DIR_0PP] = c1o54 * (drho + c3o1 * (vx2 + vx3) + c9o2 * (vx2 + vx3) * (vx2 + vx3) - cu_sq); + feq[DIR_0MM] = c1o54 * (drho + c3o1 * (-vx2 - vx3) + c9o2 * (-vx2 - vx3) * (-vx2 - vx3) - cu_sq); + feq[DIR_0PM] = c1o54 * (drho + c3o1 * (vx2 - vx3) + c9o2 * (vx2 - vx3) * (vx2 - vx3) - cu_sq); + feq[DIR_0MP] = c1o54 * (drho + c3o1 * (-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) + + (drho + c3o1 * (vx1 + vx2 + vx3) + c9o2 * (vx1 + vx2 + vx3) * (vx1 + vx2 + vx3) - cu_sq); + feq[DIR_MMM] = c1o216 * (drho + c3o1 * (-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) + + (drho + c3o1 * (vx1 + vx2 - vx3) + c9o2 * (vx1 + vx2 - vx3) * (vx1 + vx2 - vx3) - cu_sq); + feq[DIR_MMP] = c1o216 * (drho + c3o1 * (-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) + + (drho + c3o1 * (vx1 - vx2 + vx3) + c9o2 * (vx1 - vx2 + vx3) * (vx1 - vx2 + vx3) - cu_sq); + feq[DIR_MPM] = c1o216 * (drho + c3o1 * (-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) + + (drho + c3o1 * (vx1 - vx2 - vx3) + c9o2 * (vx1 - vx2 - vx3) * (vx1 - vx2 - vx3) - cu_sq); + feq[DIR_MPP] = c1o216 * (drho + c3o1 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq); // Relaxation @@ -217,33 +217,33 @@ void BGKLBMKernel::calculate(int step) forcingX2 = muForcingX2.Eval(); forcingX3 = muForcingX3.Eval(); - f[DIR_000] += 0.0; - 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); + f[DIR_000] += c0o1; + f[DIR_P00] += c3o1 * c2o27 * (forcingX1); + f[DIR_M00] += c3o1 * c2o27 * (-forcingX1); + f[DIR_0P0] += c3o1 * c2o27 * (forcingX2); + f[DIR_0M0] += c3o1 * c2o27 * (-forcingX2); + f[DIR_00P] += c3o1 * c2o27 * (forcingX3); + f[DIR_00M] += c3o1 * c2o27 * (-forcingX3); + f[DIR_PP0] += c3o1 * c1o54 * (forcingX1 + forcingX2); + f[DIR_MM0] += c3o1 * c1o54 * (-forcingX1 - forcingX2); + f[DIR_PM0] += c3o1 * c1o54 * (forcingX1 - forcingX2); + f[DIR_MP0] += c3o1 * c1o54 * (-forcingX1 + forcingX2); + f[DIR_P0P] += c3o1 * c1o54 * (forcingX1 + forcingX3); + f[DIR_M0M] += c3o1 * c1o54 * (-forcingX1 - forcingX3); + f[DIR_P0M] += c3o1 * c1o54 * (forcingX1 - forcingX3); + f[DIR_M0P] += c3o1 * c1o54 * (-forcingX1 + forcingX3); + f[DIR_0PP] += c3o1 * c1o54 * (forcingX2 + forcingX3); + f[DIR_0MM] += c3o1 * c1o54 * (-forcingX2 - forcingX3); + f[DIR_0PM] += c3o1 * c1o54 * (forcingX2 - forcingX3); + f[DIR_0MP] += c3o1 * c1o54 * (-forcingX2 + forcingX3); + f[DIR_PPP] += c3o1 * c1o216 * (forcingX1 + forcingX2 + forcingX3); + f[DIR_MMM] += c3o1 * c1o216 * (-forcingX1 - forcingX2 - forcingX3); + f[DIR_PPM] += c3o1 * c1o216 * (forcingX1 + forcingX2 - forcingX3); + f[DIR_MMP] += c3o1 * c1o216 * (-forcingX1 - forcingX2 + forcingX3); + f[DIR_PMP] += c3o1 * c1o216 * (forcingX1 - forcingX2 + forcingX3); + f[DIR_MPM] += c3o1 * c1o216 * (-forcingX1 + forcingX2 - forcingX3); + f[DIR_PMM] += c3o1 * c1o216 * (forcingX1 - forcingX2 - forcingX3); + f[DIR_MPP] += c3o1 * c1o216 * (-forcingX1 + forcingX2 + forcingX3); } ////////////////////////////////////////////////////////////////////////// #ifdef PROOF_CORRECTNESS @@ -302,4 +302,4 @@ void BGKLBMKernel::calculate(int step) } } ////////////////////////////////////////////////////////////////////////// -real BGKLBMKernel::getCalculationTime() { return 0.0; } +real BGKLBMKernel::getCalculationTime() { return vf::basics::constant::c0o1; } diff --git a/src/cpu/VirtualFluidsCore/LBM/BasicLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BasicLBMKernel.cpp index 12c4b6e891214a683e3e4ac23b52e14e72e093a2..97659e93ebe0970a7ffb0a01dd8c9d1b0d45721e 100644 --- a/src/cpu/VirtualFluidsCore/LBM/BasicLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/BasicLBMKernel.cpp @@ -1,7 +1,7 @@ #include "BasicLBMKernel.h" #include "D3Q27System.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" BasicLBMKernel::BasicLBMKernel() { @@ -28,7 +28,7 @@ void BasicLBMKernel::calculate(int step) initData(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp index 4f5ce06af1a85555933b7b3cd9413e1daee727a0..421f81a1ac3301d982178a06b4b8c6378f626e57 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp @@ -16,8 +16,8 @@ using namespace vf::basics::constant; CompressibleCumulant4thOrderViscosityLBMKernel::CompressibleCumulant4thOrderViscosityLBMKernel() { this->compressible = true; - this->bulkViscosity = 0; - this->OxxPyyPzz = 1.0; + this->bulkViscosity = vf::basics::constant::c0o1; + this->OxxPyyPzz = vf::basics::constant::c1o1; } ////////////////////////////////////////////////////////////////////////// CompressibleCumulant4thOrderViscosityLBMKernel::~CompressibleCumulant4thOrderViscosityLBMKernel(void) @@ -35,7 +35,7 @@ SPtr<LBMKernel> CompressibleCumulant4thOrderViscosityLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -77,7 +77,7 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step) muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0/3.0)*(1.0/collFactor - 1.0/2.0); + muNu = (c1o1/c3o1)*(c1o1/collFactor - c1o1/c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -93,7 +93,7 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -110,16 +110,16 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step) //LBMReal OxyyPxzz = eight*(-two+omega)*(one+two*omega)/(-eight-fourteen*omega+seven*omega*omega);//one; //LBMReal OxyyMxzz = eight*(-two+omega)*(-seven+four*omega)/(fiftysix-fifty*omega+nine*omega*omega);//one; //LBMReal Oxyz = twentyfour*(-two+omega)*(-two-seven*omega+three*omega*omega)/(fourtyeight+c152*omega-c130*omega*omega+twentynine*omega*omega*omega); - real OxyyPxzz = 8.0*(omega-2.0)*(OxxPyyPzz*(3.0*omega-1.0)-5.0*omega)/(8.0*(5.0-2.0*omega)*omega+OxxPyyPzz*(8.0+omega*(9.0*omega-26.0))); - real OxyyMxzz = 8.0*(omega-2.0)*(omega+OxxPyyPzz*(3.0*omega-7.0))/(OxxPyyPzz*(56.0-42.0*omega+9.0*omega*omega)-8.0*omega); - real Oxyz = 24.0*(omega-2.0)*(4.0*omega*omega+omega*OxxPyyPzz*(18.0-13.0*omega)+OxxPyyPzz*OxxPyyPzz*(2.0+omega*(6.0*omega-11.0)))/(16.0*omega*omega*(omega-6.0)-2.0*omega*OxxPyyPzz*(216.0+5.0*omega*(9.0*omega-46.0))+OxxPyyPzz*OxxPyyPzz*(omega*(3.0*omega-10.0)*(15.0*omega-28.0)-48.0)); + real OxyyPxzz = c8o1*(omega-c2o1)*(OxxPyyPzz*(c3o1*omega-c1o1)-c5o1*omega)/(c8o1 *(c5o1-c2o1*omega)*omega+OxxPyyPzz*(c8o1+omega*(c9o1*omega-c26o1))); + real OxyyMxzz = c8o1*(omega-c2o1)*(omega+OxxPyyPzz*(c3o1*omega-c7o1))/(OxxPyyPzz*(c56o1-c42o1*omega+c9o1*omega*omega)-c8o1*omega); + real Oxyz = c24o1*(omega-c2o1)*(c4o1*omega*omega+omega*OxxPyyPzz*(c18o1-c13o1*omega)+OxxPyyPzz*OxxPyyPzz*(c2o1+omega*(c6o1*omega-c11o1)))/(c16o1*omega*omega*(omega-c6o1)-c2o1*omega*OxxPyyPzz*(c216o1+c5o1*omega*(c9o1*omega-c46o1))+OxxPyyPzz*OxxPyyPzz*(omega*(c3o1*omega-c10o1)*(c15o1*omega-c28o1)-c48o1)); //LBMReal A = (four + two*omega - three*omega*omega) / (two - seven*omega + five*omega*omega); //LBMReal B = (four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega); - real 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)); + real A = (c4o1*omega*omega+c2o1*omega*OxxPyyPzz*(omega-c6o1)+OxxPyyPzz*OxxPyyPzz*(omega*(c10o1-c3o1*omega)-c4o1))/((omega-OxxPyyPzz)*(OxxPyyPzz*(c2o1+c3o1*omega)-c8o1*omega)); //FIXME: warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::DIR_00M' ) - real 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)); + real B = (c4o1*omega*OxxPyyPzz*(c9o1*omega-c16o1)-c4o1*omega*omega-c2o1*OxxPyyPzz*OxxPyyPzz*(c2o1+c9o1*omega*(omega-c2o1)))/(c3o1*(omega-OxxPyyPzz)*(OxxPyyPzz*(c2o1+c3o1*omega)-c8o1*omega)); for (int x3 = minX3; x3 < maxX3; x3++) { @@ -213,9 +213,9 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step) 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*c1o2; // X + vvy += forcingX2*deltaT*c1o2; // Y + vvz += forcingX3*deltaT*c1o2; // Z } /////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// @@ -230,9 +230,9 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step) vz2 = vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// real wadjust; - real qudricLimitP = 0.01;// * 0.0001f; - real qudricLimitM = 0.01;// * 0.0001f; - real qudricLimitD = 0.01;// * 0.001f; + real qudricLimitP = c1o100;// * 0.0001f; + real qudricLimitM = c1o100;// * 0.0001f; + real qudricLimitD = c1o100;// * 0.001f; //LBMReal s9 = minusomega; //test //s9 = 0.; diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.h index fc3e0dffb6abf836995aaecc95f07fc4fcaf1d64..3b7ee8f849187b2c40fc8f5803bdd04ad4982344 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.h @@ -2,7 +2,7 @@ #define CompressibleCumulant4thOrderViscosityLBMKernel_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp index 1c806225b9730e3f6b42c3487e20edf298199bf1..3c0795c21ed41c1f22dc06268e5fc1fa7922c845 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp @@ -15,9 +15,9 @@ CompressibleCumulantLBMKernel::CompressibleCumulantLBMKernel() { this->compressible = true; this->parameter = CompressibleCumulantLBMKernel::NORMAL; - this->OxyyMxzz = 1.0; + this->OxyyMxzz = c1o1; this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; + this->OxxPyyPzz = c1o1; } ////////////////////////////////////////////////////////////////////////// CompressibleCumulantLBMKernel::~CompressibleCumulantLBMKernel(void) @@ -35,7 +35,7 @@ SPtr<LBMKernel> CompressibleCumulantLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -47,10 +47,10 @@ SPtr<LBMKernel> CompressibleCumulantLBMKernel::clone() switch (parameter) { case NORMAL: - dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 1.0; + dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = c1o1; break; case MAGIC: - dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); + dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = c2o1 +(-collFactor); break; } @@ -85,7 +85,7 @@ void CompressibleCumulantLBMKernel::calculate(int step) muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0/3.0)*(1.0/collFactor - 1.0/2.0); + muNu = (c1o1 / c3o1)*(c1o1 /collFactor - c1o1 / c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -101,7 +101,7 @@ void CompressibleCumulantLBMKernel::calculate(int step) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -215,9 +215,9 @@ void CompressibleCumulantLBMKernel::calculate(int step) 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*c1o2; // X + vvy += forcingX2*deltaT*c1o2; // Y + vvz += forcingX3*deltaT*c1o2; // Z } /////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h index 7af69201cde7bd8812173f1b6bd9d397e731686b..84910ef267efcba7f4cb90cba8a7514642461420 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h @@ -2,7 +2,7 @@ #define CompressibleCumulantLBMKernel_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp index d98d7489a7fbe466a31278cc7ca555168e962f6d..5cf501e20012804b7e84090243dad466e06ad06c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp @@ -39,21 +39,21 @@ void CompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff, void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); + calcInterpolatedCoefficiets(icellC, omegaC, c1o2); + calcInterpolatedNodeCF(icellF.BSW, omegaF, -c1o4, -c1o4, -c1o4, calcPressBSW(), -c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BNE, omegaF, c1o4, c1o4, -c1o4, calcPressBNE(), c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TNW, omegaF, -c1o4, c1o4, c1o4, calcPressTNW(), -c1o1, c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TSE, omegaF, c1o4, -c1o4, c1o4, calcPressTSE(), c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.BNW, omegaF, -c1o4, c1o4, -c1o4, calcPressBNW(), -c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BSE, omegaF, c1o4, -c1o4, -c1o4, calcPressBSE(), c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TSW, omegaF, -c1o4, -c1o4, c1o4, calcPressTSW(), -c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); + calcInterpolatedCoefficiets(icellF, omegaF, c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// @@ -64,16 +64,16 @@ void CompressibleOffsetInterpolationProcessor::calcMoments(const real* const f, using namespace vf::lbm::dir; using namespace vf::basics::constant; - real drho = 0.0; + real drho = c0o1; D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); press = drho; //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[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); + kxy = -c3o1*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]))/(c1o1 + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 + kyz = -c3o1*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]))/(c1o1 + drho)-(vx2*vx3)); + kxz = -c3o1*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]))/(c1o1 + drho)-(vx1*vx3)); + kxxMyy = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx2*vx2)); + kxxMzz = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) @@ -166,122 +166,122 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const - + a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + + c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + + c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + + c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - + c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + + c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; + b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - + c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - + c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + + c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + + c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - + c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + + c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + + c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; + ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; + c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; + ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; + byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + + c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; + az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; + bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; + cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; + c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + + c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; + axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; + bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; + cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; + axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; + ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage =0;//(kxyFromfcNEQ_SWB+ + kxyAverage = c0o1;//(kxyFromfcNEQ_SWB+ //kxyFromfcNEQ_SWT+ //kxyFromfcNEQ_SET+ //kxyFromfcNEQ_SEB+ @@ -289,7 +289,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const //kxyFromfcNEQ_NWT+ //kxyFromfcNEQ_NET+ //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ + kyzAverage = c0o1;//(kyzFromfcNEQ_SWB+ //kyzFromfcNEQ_SWT+ //kyzFromfcNEQ_SET+ //kyzFromfcNEQ_SEB+ @@ -297,7 +297,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const //kyzFromfcNEQ_NWT+ //kyzFromfcNEQ_NET+ //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ + kxzAverage = c0o1;//(kxzFromfcNEQ_SWB+ //kxzFromfcNEQ_SWT+ //kxzFromfcNEQ_SET+ //kxzFromfcNEQ_SEB+ @@ -305,7 +305,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const //kxzFromfcNEQ_NWT+ //kxzFromfcNEQ_NET+ //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ + kxxMyyAverage = c0o1;//(kxxMyyFromfcNEQ_SWB+ //kxxMyyFromfcNEQ_SWT+ //kxxMyyFromfcNEQ_SET+ //kxxMyyFromfcNEQ_SEB+ @@ -313,7 +313,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const //kxxMyyFromfcNEQ_NWT+ //kxxMyyFromfcNEQ_NET+ //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ + kxxMzzAverage = c0o1;//(kxxMzzFromfcNEQ_SWB+ //kxxMzzFromfcNEQ_SWT+ //kxxMzzFromfcNEQ_SET+ //kxxMzzFromfcNEQ_SEB+ @@ -327,17 +327,17 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; + ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; + ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; + az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; + bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; + by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; + bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; + cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; + cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; + cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; axy= axy + zoff*axyz; axz= axz + yoff*axyz; ayz= ayz + xoff*axyz; @@ -351,110 +351,110 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const const real o = omega; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); + f_E = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); + f_ZERO = c0o1; + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); + + x_E = c1o4*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); + x_N = c1o4*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); + x_T = c1o4*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); + x_NE = c1o4*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_SE = c1o4*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_TE = c1o4*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); + x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); + x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); + x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); + x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); + x_TNW = c1o4*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); + + y_E = c1o4*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); + y_N = c1o4*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); + y_T = c1o4*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); + y_NE = c1o4*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_SE = c1o4*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_TE = c1o4*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); + y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); + y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); + y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); + y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); + y_TNW = c1o4*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); + + z_E = c1o4*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); + z_N = c1o4*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); + z_T = c1o4*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); + z_NE = c1o4*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_SE = c1o4*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_TE = c1o4*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); + z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); + z_TNW = c1o4*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); + + xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_T = -(c1o16*eps_new *(( c4o1*cxyz)/(c27o1*o))); + xy_NE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_SE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_TE = -(c1o16*eps_new *(( c3o1*axyz + cxyz)/(c54o1*o))); + xy_BE = -(c1o16*eps_new *((-c3o1*axyz + cxyz)/(c54o1*o))); + xy_TN = -(c1o16*eps_new *(( c3o1*bxyz + cxyz)/(c54o1*o))); + xy_BN = -(c1o16*eps_new *(( - c3o1*bxyz + cxyz)/(c54o1*o))); + //xy_ZERO= c1o16*eps_new; + xy_TNE = -(c1o16*eps_new *(( axyz + bxyz )/(c72o1*o))); + xy_TSW = c1o16*eps_new *(( axyz + bxyz )/(c72o1*o)); + xy_TSE = c1o16*eps_new *((- axyz + bxyz )/(c72o1*o)); + xy_TNW = c1o16*eps_new *(( axyz - bxyz )/(c72o1*o)); + + xz_E = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_N = -(c1o16*eps_new *(( c4o1*bxyz )/(c27o1*o))); + xz_T = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_NE = -(c1o16*eps_new *(( c3o1*axyz + bxyz )/(c54o1*o))); + xz_SE = -(c1o16*eps_new *((-c3o1*axyz + bxyz )/(c54o1*o))); + xz_TE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_BE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_TN = -(c1o16*eps_new *(( bxyz + c3o1*cxyz)/(c54o1*o))); + xz_BN = -(c1o16*eps_new *(( bxyz - c3o1*cxyz)/(c54o1*o))); + //xz_ZERO= c1o16*eps_new; + xz_TNE = -(c1o16*eps_new *(( axyz + cxyz)/(c72o1*o))); + xz_TSW = c1o16*eps_new *((- axyz + cxyz)/(c72o1*o)); + xz_TSE = c1o16*eps_new *(( axyz + cxyz)/(c72o1*o)); + xz_TNW = c1o16*eps_new *(( axyz - cxyz)/(c72o1*o)); + + yz_E = -(c1o16*eps_new *(( c4o1*axyz )/(c27o1*o))); + yz_N = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_T = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_NE = -(c1o16*eps_new *(( axyz + c3o1*bxyz )/(c54o1*o))); + yz_SE = -(c1o16*eps_new *(( axyz - c3o1*bxyz )/(c54o1*o))); + yz_TE = -(c1o16*eps_new *(( axyz + c3o1*cxyz)/(c54o1*o))); + yz_BE = -(c1o16*eps_new *(( axyz - c3o1*cxyz)/(c54o1*o))); + yz_TN = c1o16*eps_new *(( axyz )/(c27o1*o)); + yz_BN = c1o16*eps_new *(( axyz )/(c27o1*o)); + //yz_ZERO= c1o16*eps_new; + yz_TNE = -(c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o))); + yz_TSW = c1o16*eps_new *(( - bxyz + cxyz)/(c72o1*o)); + yz_TSE = c1o16*eps_new *(( bxyz - cxyz)/(c72o1*o)); + yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) @@ -463,9 +463,9 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(real* f, r using namespace vf::lbm::dir; real rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - real vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - real vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - real vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); + real vx1 = a0 + c1o4*( xs*ax + ys*ay + zs*az) + c1o16*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + c1o64*(xs*ys*zs*axyz); + real vx2 = b0 + c1o4*( xs*bx + ys*by + zs*bz) + c1o16*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + c1o64*(xs*ys*zs*bxyz); + real vx3 = c0 + c1o4*( xs*cx + ys*cy + zs*cz) + c1o16*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + c1o64*(xs*ys*zs*cxyz); ////////////////////////////////////////////////////////////////////////// //DRAFT @@ -504,108 +504,108 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(real* f, r 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 +//Position SWB -c1o4, -c1o4, -c1o4 real CompressibleOffsetInterpolationProcessor::calcPressBSW() { - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NET * (c1o64 - c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// -//Position SWT -0.25, -0.25, 0.25 +//Position SWT -c1o4, -c1o4, c1o4 real CompressibleOffsetInterpolationProcessor::calcPressTSW() { - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NEB * (c1o64 - c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 real CompressibleOffsetInterpolationProcessor::calcPressTSE() { - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NWB * (c1o64 + c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 real CompressibleOffsetInterpolationProcessor::calcPressBSE() { - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NWT * (c1o64 + c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c27o64 - c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 real CompressibleOffsetInterpolationProcessor::calcPressBNW() { - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SET * (c1o64 - c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NWB * (c27o64 + c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 real CompressibleOffsetInterpolationProcessor::calcPressTNW() { - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SEB * (c1o64 - c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 real CompressibleOffsetInterpolationProcessor::calcPressTNE() { - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SWB * (c1o64 + c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 real CompressibleOffsetInterpolationProcessor::calcPressBNE() { - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c1o64 + c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NEB * (c27o64 - c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 @@ -614,14 +614,14 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, r using namespace D3Q27System; using namespace vf::lbm::dir; - real press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); + real press = press_NET * (c4o32 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_NWT * (c4o32 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_SET * (c4o32 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_SWT * (c4o32 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_NEB * (c4o32 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_NWB * (c4o32 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_SEB * (c4o32 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + + press_SWB * (c4o32 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); real vx1 = a0; real vx2 = b0; real vx3 = c0; @@ -636,7 +636,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, r real feq[ENDF+1]; D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3); - real eps_new = 2.; + real eps_new = c2o1; real o = omega; // LBMReal op = 1.; @@ -655,20 +655,20 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, r //f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; //f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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 = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); + f_ZERO = c0o1; + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); f[DIR_P00] = f_E + feq[DIR_P00]; f[DIR_M00] = f_E + feq[DIR_M00]; @@ -708,10 +708,10 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(real x, ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); + tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; + tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; + tauzz=cz+c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y; + tauxy=c1o2*((ay+c2o1*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+c2o1*bxx*x+bxy*y+bxz*z+bxyz*y*z)); + tauxz=c1o2*((az+c2o1*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+c2o1*cxx*x+cxy*y+cxz*z+cxyz*y*z)); + tauyz=c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp index 68b8506d896c3d5c93c9021a7a03ab3fe7a8621e..74527c0c39d5255a4ca3e647a288fffa027373ac 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp @@ -7,8 +7,8 @@ using namespace vf::basics::constant; CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor() { - this->bulkViscosity = 0.0; - this->shearViscosity = 0.0; + this->bulkViscosity = c0o1; + this->shearViscosity = c0o1; this->OxxPyyPzzC = c1o1; this->OxxPyyPzzF = c1o1; } @@ -16,8 +16,8 @@ CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterp CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(real omegaC, real omegaF) : omegaC(omegaC), omegaF(omegaF) { - this->bulkViscosity = 0.0; - this->shearViscosity = 0.0; + this->bulkViscosity = c0o1; + this->shearViscosity = c0o1; this->OxxPyyPzzC = c1o1; this->OxxPyyPzzF = c1o1; } @@ -40,8 +40,8 @@ void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( real omegaC, re this->omegaC = omegaC; this->omegaF = omegaF; - real dtC = (3.0*shearViscosity)/((1/omegaC)-0.5); - real dtF = (3.0*shearViscosity)/((1/omegaF)-0.5); + real dtC = (c3o1 *shearViscosity)/((c1o1/omegaC)-c1o2); + real dtF = (c3o1 *shearViscosity)/((c1o1/omegaF)-c1o2); if (bulkViscosity != 0) { @@ -68,21 +68,21 @@ void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(real xoff, real void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); + calcInterpolatedCoefficiets(icellC, omegaC, c1o2); + calcInterpolatedNodeCF(icellF.BSW, omegaF, -c1o4, -c1o4, -c1o4, calcPressBSW(), -c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BNE, omegaF, c1o4, c1o4, -c1o4, calcPressBNE(), c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TNW, omegaF, -c1o4, c1o4, c1o4, calcPressTNW(), -c1o1, c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TSE, omegaF, c1o4, -c1o4, c1o4, calcPressTSE(), c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.BNW, omegaF, -c1o4, c1o4, -c1o4, calcPressBNW(), -c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BSE, omegaF, c1o4, -c1o4, -c1o4, calcPressBSE(), c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TSW, omegaF, -c1o4, -c1o4, c1o4, calcPressTSW(), -c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); + calcInterpolatedCoefficiets(icellF, omegaF, c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// @@ -92,16 +92,16 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const real* co using namespace D3Q27System; using namespace vf::lbm::dir; - real drho = 0.0; + real drho = c0o1; D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); press = drho; //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[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); + kxy = -c3o1*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]))/(c1o1 + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 + kyz = -c3o1*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]))/(c1o1 + drho)-(vx2*vx3)); + kxz = -c3o1*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]))/(c1o1 + drho)-(vx1*vx3)); + kxxMyy = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx2*vx2)); + kxxMzz = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) @@ -200,116 +200,116 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + + c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + + c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + + c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - + c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + + c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; + b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - + c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - + c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + + c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + + c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - + c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + + c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + + c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; + ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; + c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; + ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; + byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + + c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; + az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; + bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; + cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; + c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + + c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; + axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; + bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; + cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; + axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; + ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage =0;//(kxyFromfcNEQ_SWB+ + kxyAverage = c0o1;//(kxyFromfcNEQ_SWB+ //kxyFromfcNEQ_SWT+ //kxyFromfcNEQ_SET+ //kxyFromfcNEQ_SEB+ @@ -317,7 +317,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet //kxyFromfcNEQ_NWT+ //kxyFromfcNEQ_NET+ //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ + kyzAverage = c0o1;//(kyzFromfcNEQ_SWB+ //kyzFromfcNEQ_SWT+ //kyzFromfcNEQ_SET+ //kyzFromfcNEQ_SEB+ @@ -325,7 +325,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet //kyzFromfcNEQ_NWT+ //kyzFromfcNEQ_NET+ //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ + kxzAverage = c0o1;//(kxzFromfcNEQ_SWB+ //kxzFromfcNEQ_SWT+ //kxzFromfcNEQ_SET+ //kxzFromfcNEQ_SEB+ @@ -333,7 +333,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet //kxzFromfcNEQ_NWT+ //kxzFromfcNEQ_NET+ //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ + kxxMyyAverage = c0o1;//(kxxMyyFromfcNEQ_SWB+ //kxxMyyFromfcNEQ_SWT+ //kxxMyyFromfcNEQ_SET+ //kxxMyyFromfcNEQ_SEB+ @@ -341,7 +341,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet //kxxMyyFromfcNEQ_NWT+ //kxxMyyFromfcNEQ_NET+ //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ + kxxMzzAverage = c0o1;//(kxxMzzFromfcNEQ_SWB+ //kxxMzzFromfcNEQ_SWT+ //kxxMzzFromfcNEQ_SET+ //kxxMzzFromfcNEQ_SEB+ @@ -355,17 +355,17 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; + ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; + ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; + az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; + bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; + by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; + bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; + cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; + cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; + cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; axy= axy + zoff*axyz; axz= axz + yoff*axyz; ayz= ayz + xoff*axyz; @@ -379,110 +379,110 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiet const real o = omega; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); + f_E = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); - x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); - y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); - z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); + + x_E = c1o4*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); + x_N = c1o4*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); + x_T = c1o4*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); + x_NE = c1o4*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_SE = c1o4*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_TE = c1o4*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); + x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); + x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); + x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); + x_ZERO = c0o1; + x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); + x_TNW = c1o4*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); + + y_E = c1o4*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); + y_N = c1o4*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); + y_T = c1o4*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); + y_NE = c1o4*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_SE = c1o4*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_TE = c1o4*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); + y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); + y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); + y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); + y_ZERO = c0o1; + y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); + y_TNW = c1o4*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); + + z_E = c1o4*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); + z_N = c1o4*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); + z_T = c1o4*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); + z_NE = c1o4*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_SE = c1o4*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_TE = c1o4*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_ZERO = c0o1; + z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); + z_TNW = c1o4*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); + + xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_T = -(c1o16*eps_new *(( c4o1*cxyz)/(c27o1*o))); + xy_NE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_SE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_TE = -(c1o16*eps_new *(( c3o1*axyz + cxyz)/(c54o1*o))); + xy_BE = -(c1o16*eps_new *((-c3o1*axyz + cxyz)/(c54o1*o))); + xy_TN = -(c1o16*eps_new *(( c3o1*bxyz + cxyz)/(c54o1*o))); + xy_BN = -(c1o16*eps_new *(( - c3o1*bxyz + cxyz)/(c54o1*o))); + //xy_ZERO= c1o16*eps_new; + xy_TNE = -(c1o16*eps_new *(( axyz + bxyz )/(c72o1*o))); + xy_TSW = c1o16*eps_new *(( axyz + bxyz )/(c72o1*o)); + xy_TSE = c1o16*eps_new *((- axyz + bxyz )/(c72o1*o)); + xy_TNW = c1o16*eps_new *(( axyz - bxyz )/(c72o1*o)); + + xz_E = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_N = -(c1o16*eps_new *(( c4o1*bxyz )/(c27o1*o))); + xz_T = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_NE = -(c1o16*eps_new *(( c3o1*axyz + bxyz )/(c54o1*o))); + xz_SE = -(c1o16*eps_new *((-c3o1*axyz + bxyz )/(c54o1*o))); + xz_TE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_BE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_TN = -(c1o16*eps_new *(( bxyz + c3o1*cxyz)/(c54o1*o))); + xz_BN = -(c1o16*eps_new *(( bxyz - c3o1*cxyz)/(c54o1*o))); + //xz_ZERO= c1o16*eps_new; + xz_TNE = -(c1o16*eps_new *(( axyz + cxyz)/(c72o1*o))); + xz_TSW = c1o16*eps_new *((- axyz + cxyz)/(c72o1*o)); + xz_TSE = c1o16*eps_new *(( axyz + cxyz)/(c72o1*o)); + xz_TNW = c1o16*eps_new *(( axyz - cxyz)/(c72o1*o)); + + yz_E = -(c1o16*eps_new *(( c4o1*axyz )/(c27o1*o))); + yz_N = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_T = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_NE = -(c1o16*eps_new *(( axyz + c3o1*bxyz )/(c54o1*o))); + yz_SE = -(c1o16*eps_new *(( axyz - c3o1*bxyz )/(c54o1*o))); + yz_TE = -(c1o16*eps_new *(( axyz + c3o1*cxyz)/(c54o1*o))); + yz_BE = -(c1o16*eps_new *(( axyz - c3o1*cxyz)/(c54o1*o))); + yz_TN = c1o16*eps_new *(( axyz )/(c27o1*o)); + yz_BN = c1o16*eps_new *(( axyz )/(c27o1*o)); + //yz_ZERO= c1o16*eps_new; + yz_TNE = -(c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o))); + yz_TSW = c1o16*eps_new *(( - bxyz + cxyz)/(c72o1*o)); + yz_TSE = c1o16*eps_new *(( bxyz - cxyz)/(c72o1*o)); + yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs) @@ -491,15 +491,15 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(rea using namespace vf::lbm::dir; using namespace vf::basics::constant; - real eps_new = 0.5; + real eps_new = c1o2; real o = omega; //bulk viscosity real oP = OxxPyyPzzF; -// LBMReal rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - real vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - real vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - real vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); +// LBMReal rho = press ;//+ (c2o1*axx*x+axy*y+axz*z+axyz*y*z+ax + c2o1*byy*y+bxy*x+byz*z+bxyz*x*z+by + c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/c3o1; + real vx1 = a0 + c1o4*( xs*ax + ys*ay + zs*az) + c1o16*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + c1o64*(xs*ys*zs*axyz); + real vx2 = b0 + c1o4*( xs*bx + ys*by + zs*bz) + c1o16*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + c1o64*(xs*ys*zs*bxyz); + real vx3 = c0 + c1o4*( xs*cx + ys*cy + zs*cz) + c1o16*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + c1o64*(xs*ys*zs*cxyz); real mfcbb = c0o1; real mfabb = c0o1; @@ -536,7 +536,7 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(rea real vx3Sq = vx3*vx3; real oMdrho = c1o1; - //2.f + //c2o1f // linear combinations real mxxPyyPzz = mfaaa - c2o3*(ax + by + c2o1 *axx*x + bxy*x + axy*y + c2o1 *byy*y + axz*z + byz*z + bxyz*x*z + axyz*y*z + cz - cxz*x + cyz*y + cxyz*x*y + c2o1 *czz*z)*eps_new / oP* (c1o1 + press); @@ -821,105 +821,105 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(rea //Position SWB -0.25, -0.25, -0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressBSW() { - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NET * (c1o64 - c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressTSW() { - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NEB * (c1o64 - c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressTSE() { - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NWB * (c1o64 + c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressBSE() { - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NWT * (c1o64 + c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c27o64 - c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressBNW() { - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SET * (c1o64 - c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NWB * (c27o64 + c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressTNW() { - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SEB * (c1o64 - c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressTNE() { - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SWB * (c1o64 + c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 real CompressibleOffsetMomentsInterpolationProcessor::calcPressBNE() { - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c1o64 + c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NEB * (c27o64 - c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 @@ -928,21 +928,21 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(rea using namespace D3Q27System; using namespace vf::lbm::dir; - real press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); + real press = press_NET * (c4o32 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_NWT * (c4o32 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_SET * (c4o32 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_SWT * (c4o32 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_NEB * (c4o32 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_NWB * (c4o32 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_SEB * (c4o32 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + + press_SWB * (c4o32 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); real vx1 = a0; real vx2 = b0; real vx3 = c0; -// LBMReal rho = press ;//+ (ax+by+cz)/3.; +// LBMReal rho = press ;//+ (ax+by+cz)/c3o1; - real eps_new = 2.; + real eps_new = c2o1; real o = omega; //bulk viscosity real oP = OxxPyyPzzC; @@ -1276,12 +1276,12 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(r ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); + tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; + tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; + tauzz=cz+c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y; + tauxy= c1o2*((ay+c2o1*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+c2o1*bxx*x+bxy*y+bxz*z+bxyz*y*z)); + tauxz= c1o2*((az+c2o1*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+c2o1*cxx*x+cxy*y+cxz*z+cxyz*y*z)); + tauyz= c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::setBulkViscosity(real shearViscosity, real bulkViscosity) diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp index 80eb84112dc43ab2a502c9213636b7f8dde18a35..dee6d12a5812e29d91aa1c12c25d61ade0759ef8 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp @@ -58,21 +58,21 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::setOffsets(real xof void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); + calcInterpolatedCoefficiets(icellC, omegaC, c1o2); + calcInterpolatedNodeCF(icellF.BSW, omegaF, -c1o4, -c1o4, -c1o4, calcPressBSW(), -c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BNE, omegaF, c1o4, c1o4, -c1o4, calcPressBNE(), c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TNW, omegaF, -c1o4, c1o4, c1o4, calcPressTNW(), -c1o1, c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TSE, omegaF, c1o4, -c1o4, c1o4, calcPressTSE(), c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.BNW, omegaF, -c1o4, c1o4, -c1o4, calcPressBNW(), -c1o1, c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.BSE, omegaF, c1o4, -c1o4, -c1o4, calcPressBSE(), c1o1, -c1o1, -c1o1); + calcInterpolatedNodeCF(icellF.TSW, omegaF, -c1o4, -c1o4, c1o4, calcPressTSW(), -c1o1, -c1o1, c1o1); + calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); + calcInterpolatedCoefficiets(icellF, omegaF, c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// @@ -82,16 +82,16 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcMoments(const r using namespace D3Q27System; using namespace vf::lbm::dir; - real drho = 0.0; + real drho = c0o1; D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); press = drho; //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[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + 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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); + kxy = -c3o1*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]))/(c1o1 + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 + kyz = -c3o1*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]))/(c1o1 + drho)-(vx2*vx3)); + kxz = -c3o1*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]))/(c1o1 + drho)-(vx1*vx3)); + kxxMyy = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx2*vx2)); + kxxMzz = -c3o1/c2o1*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]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) @@ -190,116 +190,116 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + + c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + + c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + + c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - + c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + + c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; + b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - + c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - + c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + + c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + + c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - + c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + + c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + + c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; + ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; + c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; + ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; + byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + + c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; + az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; + bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; + cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; + c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + + c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; + axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; + bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; + cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; + axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; + ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage =0;//(kxyFromfcNEQ_SWB+ + kxyAverage = c0o1;//(kxyFromfcNEQ_SWB+ //kxyFromfcNEQ_SWT+ //kxyFromfcNEQ_SET+ //kxyFromfcNEQ_SEB+ @@ -307,7 +307,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe //kxyFromfcNEQ_NWT+ //kxyFromfcNEQ_NET+ //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ + kyzAverage = c0o1;//(kyzFromfcNEQ_SWB+ //kyzFromfcNEQ_SWT+ //kyzFromfcNEQ_SET+ //kyzFromfcNEQ_SEB+ @@ -315,7 +315,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe //kyzFromfcNEQ_NWT+ //kyzFromfcNEQ_NET+ //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ + kxzAverage = c0o1;//(kxzFromfcNEQ_SWB+ //kxzFromfcNEQ_SWT+ //kxzFromfcNEQ_SET+ //kxzFromfcNEQ_SEB+ @@ -323,7 +323,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe //kxzFromfcNEQ_NWT+ //kxzFromfcNEQ_NET+ //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ + kxxMyyAverage = c0o1;//(kxxMyyFromfcNEQ_SWB+ //kxxMyyFromfcNEQ_SWT+ //kxxMyyFromfcNEQ_SET+ //kxxMyyFromfcNEQ_SEB+ @@ -331,7 +331,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe //kxxMyyFromfcNEQ_NWT+ //kxxMyyFromfcNEQ_NET+ //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ + kxxMzzAverage = c0o1;//(kxxMzzFromfcNEQ_SWB+ //kxxMzzFromfcNEQ_SWT+ //kxxMzzFromfcNEQ_SET+ //kxxMzzFromfcNEQ_SEB+ @@ -345,17 +345,17 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; + ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; + ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; + az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; + bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; + by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; + bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; + cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; + cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; + cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; axy= axy + zoff*axyz; axz= axz + yoff*axyz; ayz= ayz + xoff*axyz; @@ -369,110 +369,110 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe const real o = omega; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); + f_E = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); + + x_E = c1o4*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); + x_N = c1o4*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); + x_T = c1o4*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); + x_NE = c1o4*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_SE = c1o4*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_TE = c1o4*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); + x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); + x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); + x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); + x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); + x_TNW = c1o4*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); + + y_E = c1o4*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); + y_N = c1o4*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); + y_T = c1o4*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); + y_NE = c1o4*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_SE = c1o4*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_TE = c1o4*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); + y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); + y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); + y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); + y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); + y_TNW = c1o4*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); + + z_E = c1o4*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); + z_N = c1o4*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); + z_T = c1o4*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); + z_NE = c1o4*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_SE = c1o4*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_TE = c1o4*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); + z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); + z_TNW = c1o4*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); + + xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_T = -(c1o16*eps_new *(( c4o1*cxyz)/(c27o1*o))); + xy_NE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_SE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_TE = -(c1o16*eps_new *(( c3o1*axyz + cxyz)/(c54o1*o))); + xy_BE = -(c1o16*eps_new *((-c3o1*axyz + cxyz)/(c54o1*o))); + xy_TN = -(c1o16*eps_new *(( c3o1*bxyz + cxyz)/(c54o1*o))); + xy_BN = -(c1o16*eps_new *(( - c3o1*bxyz + cxyz)/(c54o1*o))); + //xy_ZERO= c1o16*eps_new; + xy_TNE = -(c1o16*eps_new *(( axyz + bxyz )/(c72o1*o))); + xy_TSW = c1o16*eps_new *(( axyz + bxyz )/(c72o1*o)); + xy_TSE = c1o16*eps_new *((- axyz + bxyz )/(c72o1*o)); + xy_TNW = c1o16*eps_new *(( axyz - bxyz )/(c72o1*o)); + + xz_E = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_N = -(c1o16*eps_new *(( c4o1*bxyz )/(c27o1*o))); + xz_T = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_NE = -(c1o16*eps_new *(( c3o1*axyz + bxyz )/(c54o1*o))); + xz_SE = -(c1o16*eps_new *((-c3o1*axyz + bxyz )/(c54o1*o))); + xz_TE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_BE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_TN = -(c1o16*eps_new *(( bxyz + c3o1*cxyz)/(c54o1*o))); + xz_BN = -(c1o16*eps_new *(( bxyz - c3o1*cxyz)/(c54o1*o))); + //xz_ZERO= c1o16*eps_new; + xz_TNE = -(c1o16*eps_new *(( axyz + cxyz)/(c72o1*o))); + xz_TSW = c1o16*eps_new *((- axyz + cxyz)/(c72o1*o)); + xz_TSE = c1o16*eps_new *(( axyz + cxyz)/(c72o1*o)); + xz_TNW = c1o16*eps_new *(( axyz - cxyz)/(c72o1*o)); + + yz_E = -(c1o16*eps_new *(( c4o1*axyz )/(c27o1*o))); + yz_N = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_T = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_NE = -(c1o16*eps_new *(( axyz + c3o1*bxyz )/(c54o1*o))); + yz_SE = -(c1o16*eps_new *(( axyz - c3o1*bxyz )/(c54o1*o))); + yz_TE = -(c1o16*eps_new *(( axyz + c3o1*cxyz)/(c54o1*o))); + yz_BE = -(c1o16*eps_new *(( axyz - c3o1*cxyz)/(c54o1*o))); + yz_TN = c1o16*eps_new *(( axyz )/(c27o1*o)); + yz_BN = c1o16*eps_new *(( axyz )/(c27o1*o)); + //yz_ZERO= c1o16*eps_new; + yz_TNE = -(c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o))); + yz_TSW = c1o16*eps_new *(( - bxyz + cxyz)/(c72o1*o)); + yz_TSE = c1o16*eps_new *(( bxyz - cxyz)/(c72o1*o)); + yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs) @@ -480,20 +480,20 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod using namespace D3Q27System; using namespace vf::lbm::dir; - real eps_new = 0.5; + real eps_new = c1o2; real o = omega; //bulk viscosity real oP = OxxPyyPzzF; - real rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; + real rho = press ;//+ (c2o1*axx*x+axy*y+axz*z+axyz*y*z+ax + c2o1*byy*y+bxy*x+byz*z+bxyz*x*z+by + c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - real laplaceRho = (xoff!=0.0 || yoff!=0.0 || zoff!= 0.0) ? 0.0 :(-3.0*(by*by+ax*ax+cz*cz)-6.0*(ay*bx+bz*cy+az*cx))*(1.0+rho); + real laplaceRho = (xoff!=c0o1 || yoff!=c0o1 || zoff!= c0o1) ? c0o1 :(-c3o1*(by*by+ax*ax+cz*cz)-c6o1*(ay*bx+bz*cy+az*cx))*(c1o1+rho); - rho=rho+laplaceRho*(3.0/16.0); + rho=rho+laplaceRho*(c3o1/c16o1); - real vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - real vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - real vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); + real vx1 = a0 + c1o4*( xs*ax + ys*ay + zs*az) + c1o16*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + c1o64*(xs*ys*zs*axyz); + real vx2 = b0 + c1o4*( xs*bx + ys*by + zs*bz) + c1o16*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + c1o64*(xs*ys*zs*bxyz); + real vx3 = c0 + c1o4*( xs*cx + ys*cy + zs*cz) + c1o16*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + c1o64*(xs*ys*zs*cxyz); real mfcbb = c0o1; real mfabb = c0o1; @@ -812,108 +812,108 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod f[DIR_MMM] = mfaaa; } ////////////////////////////////////////////////////////////////////////// -//Position SWB -0.25, -0.25, -0.25 +//Position SWB -c1o4, -c1o4, -c1o4 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSW() { - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NET * (c1o64 - c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSW() { - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NEB * (c1o64 - c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSE() { - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NWB * (c1o64 + c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSE() { - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NWT * (c1o64 + c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c27o64 - c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNW() { - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SET * (c1o64 - c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NWB * (c27o64 + c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNW() { - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SEB * (c1o64 - c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNE() { - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SWB * (c1o64 + c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNE() { - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c1o64 + c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NEB * (c27o64 - c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 @@ -922,14 +922,14 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod using namespace D3Q27System; using namespace vf::lbm::dir; - real press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); + real press = press_NET * (c1o8 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_NWT * (c1o8 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_SET * (c1o8 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_SWT * (c1o8 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_NEB * (c1o8 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_NWB * (c1o8 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_SEB * (c1o8 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + + press_SWB * (c1o8 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); real vx1 = a0; real vx2 = b0; real vx3 = c0; @@ -937,11 +937,11 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod real rho = press ;//+ (ax+by+cz)/3.; - real laplaceRho = (xoff!=0.0 || yoff!=0.0 || zoff!= 0.0) ? 0.0 :(-3.0*(by*by+ax*ax+cz*cz)-6.0*(ay*bx+bz*cy+az*cx))*(1.0+rho); + real laplaceRho = (xoff!=c0o1 || yoff!=c0o1 || zoff!= c0o1) ? c0o1 :(-c3o1*(by*by+ax*ax+cz*cz)-c6o1*(ay*bx+bz*cy+az*cx))*(c1o1+rho); - rho=rho-laplaceRho*0.25; + rho=rho-laplaceRho*c1o4; - real eps_new = 2.0; + real eps_new = c2o1; real o = omega; //bulk viscosity real oP = OxxPyyPzzC; @@ -1008,7 +1008,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod real mxxyMyzz = c0o1; real mxxzPyyz = c0o1; real mxxzMyyz = c0o1; - real mxyyPxzz = c0o1; + real mxyyPxzz = c0o1; real mxyyMxzz = c0o1; // linear combinations back @@ -1275,12 +1275,12 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedVel ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); + tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; + tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; + tauzz=cz+c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y; + tauxy=c1o2*((ay+c2o1*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+c2o1*bxx*x+bxy*y+bxz*z+bxyz*y*z)); + tauxz=c1o2*((az+c2o1*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+c2o1*cxx*x+cxy*y+cxz*z+cxyz*y*z)); + tauyz=c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetSquarePressureInterpolationProcessor::setBulkOmegaToOmega(bool value) diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp index 736dbb791547633f22e0e9a0efd572271f28552c..9c89f6c6b549fed93fca097232bcc086e3c380a8 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp @@ -62,7 +62,7 @@ SPtr<LBMKernel> CumulantK17LBMKernel::clone() kernel->setNX(nx); std::dynamic_pointer_cast<CumulantK17LBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -103,7 +103,7 @@ void CumulantK17LBMKernel::calculate(int step) muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0); + muNu = (c1o1 / c3o1) * (c1o1 / collFactor - c1o1 / c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -115,7 +115,7 @@ void CumulantK17LBMKernel::calculate(int step) nonLocalDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); restDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h index 84b14553dc2100aa244a5f7e3fc0d5025d93e195..2bcdf8551bef28aa46932a180268f05873d7ecc0 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h @@ -35,7 +35,7 @@ #define CumulantK17LBMKernel_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp index e95271b949ff91dc7ec2c62a4a45227f8e25f519..2a791636d42e8f17761873cd5e95c8dcf933e0b6 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp @@ -67,7 +67,7 @@ SPtr<LBMKernel> CumulantK17LBMKernelUnified::clone() kernel->setNX(nx); std::dynamic_pointer_cast<CumulantK17LBMKernelUnified>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -108,7 +108,7 @@ void CumulantK17LBMKernelUnified::calculate(int step) muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0); + muNu = (c1o1 / c3o1) * (c1o1 / collFactor - c1o1 / c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -120,7 +120,7 @@ void CumulantK17LBMKernelUnified::calculate(int step) nonLocalDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); restDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -201,7 +201,7 @@ void CumulantK17LBMKernelUnified::calculate(int step) real mfbbb = (*this->restDistributions)(x1, x2, x3); - real forces[3] = {0., 0., 0.}; + real forces[3] = { c0o1, c0o1, c0o1 }; if (withForcing) { muX1 = static_cast<real>(x1 - 1 + ix1 * maxX1); diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.h b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.h index d13e82efce5f5bc9211476ea86d989fe8663ab8c..9c6876f4d4de855f931ea90e8764cb1e9a39202a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.h @@ -35,7 +35,7 @@ #define CumulantK17LBMKernelUnified_h__ #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp index d2f25ad275a5c01d685e915f2b37f101b40d556d..548339f940d45ab2239ce6cb1cebbfa9bf0082b5 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp @@ -16,9 +16,9 @@ CumulantLBMKernel::CumulantLBMKernel() { this->compressible = true; this->parameter = CumulantLBMKernel::NORMAL; - this->OxyyMxzz = 1.0; + this->OxyyMxzz = c1o1; this->bulkOmegaToOmega = false; - this->OxxPyyPzz = 1.0; + this->OxxPyyPzz = c1o1; } ////////////////////////////////////////////////////////////////////////// void CumulantLBMKernel::initDataSet() @@ -33,7 +33,7 @@ SPtr<LBMKernel> CumulantLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<CumulantLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -45,10 +45,10 @@ SPtr<LBMKernel> CumulantLBMKernel::clone() switch (parameter) { case NORMAL: - dynamicPointerCast<CumulantLBMKernel>(kernel)->OxyyMxzz = 1.0; + dynamicPointerCast<CumulantLBMKernel>(kernel)->OxyyMxzz = c1o1; break; case MAGIC: - dynamicPointerCast<CumulantLBMKernel>(kernel)->OxyyMxzz = 2.0 + (-collFactor); + dynamicPointerCast<CumulantLBMKernel>(kernel)->OxyyMxzz = c2o1 + (-collFactor); break; } @@ -99,7 +99,7 @@ SPtr<LBMKernel> CumulantLBMKernel::clone() // nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); // zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); // -// SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); +// SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); // // const int bcArrayMaxX1 = (int)bcArray->getNX1(); // const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -1060,7 +1060,7 @@ void CumulantLBMKernel::initData() muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0); + muNu = (c1o1 / c3o1) * (c1o1 / collFactor - c1o1 / c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -1158,9 +1158,9 @@ void CumulantLBMKernel::nodeCollision(int step, int x1, int x2, int x3) 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 * c1o2; // X + vvy += forcingX2 * deltaT * c1o2; // Y + vvz += forcingX3 * deltaT * c1o2; // Z } /////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.h index 9fb6d834fc8904af84e20798b03ea23b68ad63a4..3ba644ccccd6d2fef780f8175b8140e9053d77e6 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.h @@ -2,7 +2,7 @@ #define CumulantLBMKernel_h__ #include "BasicLBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp index 5c9be26b7b1ace78e81f1a1c1f28a1e089c9a013..a35465e8cfde1f84a5446e4bbfcb02fc5478b8f1 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp @@ -6,6 +6,7 @@ namespace D3Q27System { //using namespace UbMath; using namespace vf::basics::constant; + using namespace vf::lbm::dir; // 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 @@ -24,9 +25,9 @@ const real 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[] = { vf::lbm::dir::DIR_000, vf::lbm::dir::INV_P00, vf::lbm::dir::INV_M00, vf::lbm::dir::INV_0P0, vf::lbm::dir::INV_0M0, vf::lbm::dir::INV_00P, vf::lbm::dir::INV_00M, vf::lbm::dir::INV_PP0, vf::lbm::dir::INV_MM0, vf::lbm::dir::INV_PM0, - vf::lbm::dir::INV_MP0, vf::lbm::dir::INV_P0P, vf::lbm::dir::INV_M0M, vf::lbm::dir::INV_P0M, vf::lbm::dir::INV_M0P, vf::lbm::dir::INV_0PP, vf::lbm::dir::INV_0MM, vf::lbm::dir::INV_0PM, vf::lbm::dir::INV_0MP, - vf::lbm::dir::INV_PPP, vf::lbm::dir::INV_MPP, vf::lbm::dir::INV_PMP, vf::lbm::dir::INV_MMP, vf::lbm::dir::INV_PPM, vf::lbm::dir::INV_MPM, vf::lbm::dir::INV_PMM, vf::lbm::dir::INV_MMM }; +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 diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index 2843a77a21310a9569c3abb3552eea42bbd4f250..2f5cbdc30ea8ae1368b59b6888a464700c1d8af5 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -37,6 +37,7 @@ #include <cmath> #include <string> #include <iostream> +#include <array> #include "lbm/constants/D3Q27.h" #include "LBMSystem.h" @@ -1393,6 +1394,662 @@ static inline real getShearRate(const real *const f, real collFactorF) return sqrt(vf::basics::constant::c2o1 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz) / (rho + vf::basics::constant::c1o1); } + +static inline std::array<real,6> getSecondMoments(const real *const f, real collFactorF) +{ + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + + real mfcbb = f[DIR_P00]; + real mfbcb = f[DIR_0P0]; + real mfbbc = f[DIR_00P]; + real mfccb = f[DIR_PP0]; + real mfacb = f[DIR_MP0]; + real mfcbc = f[DIR_P0P]; + real mfabc = f[DIR_M0P]; + real mfbcc = f[DIR_0PP]; + real mfbac = f[DIR_0MP]; + real mfccc = f[DIR_PPP]; + real mfacc = f[DIR_MPP]; + real mfcac = f[DIR_PMP]; + real mfaac = f[DIR_MMP]; + + real mfabb = f[DIR_M00]; + real mfbab = f[DIR_0M0]; + real mfbba = f[DIR_00M]; + real mfaab = f[DIR_MM0]; + real mfcab = f[DIR_PM0]; + real mfaba = f[DIR_M0M]; + real mfcba = f[DIR_P0M]; + real mfbaa = f[DIR_0MM]; + real mfbca = f[DIR_0PM]; + real mfaaa = f[DIR_MMM]; + real mfcaa = f[DIR_PMM]; + real mfaca = f[DIR_MPM]; + real mfcca = f[DIR_PPM]; + + real mfbbb = f[DIR_000]; + + real m0, m1, m2; + + //real rho = (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; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + (mfcbb - mfabb)); + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + (mfbcb - mfbab)); + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + (mfbbc - mfbba)); + + real 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 = 1. - (oMdrho + m0); + + real vx2; + real vy2; + real vz2; + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + //////////////////////////////////////////////////////////////////////////////////// + // 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 + //////////////////////////////////////////////////////////////////////////////////// + real OxxPyyPzz = 1.; // omega2 or bulk viscosity + + real mxxPyyPzz = mfcaa + mfaca + mfaac; + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + + // average pre and post collision + std::array<real, 6> moments = { + (mxxPyyPzz-mfaaa) * (c1o1 - c1o2 * OxxPyyPzz), + (mxxMyy) * (c1o1 - c1o2 * collFactorF), + (mxxMzz) * (c1o1 - c1o2 * collFactorF), + (mfbba) * (c1o1 - c1o2 * collFactorF), + (mfbab) * (c1o1 - c1o2 * collFactorF), + (mfabb) * (c1o1 - c1o2 * collFactorF) + }; + + return moments; +} +static inline std::array<real, 6> getStressTensor(const real *const f, real collFactorF) +{ + using namespace vf::lbm::dir; + using namespace vf::basics::constant; + + real mfcbb = f[DIR_P00]; + real mfbcb = f[DIR_0P0]; + real mfbbc = f[DIR_00P]; + real mfccb = f[DIR_PP0]; + real mfacb = f[DIR_MP0]; + real mfcbc = f[DIR_P0P]; + real mfabc = f[DIR_M0P]; + real mfbcc = f[DIR_0PP]; + real mfbac = f[DIR_0MP]; + real mfccc = f[DIR_PPP]; + real mfacc = f[DIR_MPP]; + real mfcac = f[DIR_PMP]; + real mfaac = f[DIR_MMP]; + + real mfabb = f[DIR_M00]; + real mfbab = f[DIR_0M0]; + real mfbba = f[DIR_00M]; + real mfaab = f[DIR_MM0]; + real mfcab = f[DIR_PM0]; + real mfaba = f[DIR_M0M]; + real mfcba = f[DIR_P0M]; + real mfbaa = f[DIR_0MM]; + real mfbca = f[DIR_0PM]; + real mfaaa = f[DIR_MMM]; + real mfcaa = f[DIR_PMM]; + real mfaca = f[DIR_MPM]; + real mfcca = f[DIR_PPM]; + + real mfbbb = f[DIR_000]; + + real m0, m1, m2; + + //real rho = (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; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + (mfcbb - mfabb)); + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + (mfbcb - mfbab)); + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + (mfbbc - mfbba)); + + real 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 = 1. - (oMdrho + m0); + + real vx2; + real vy2; + real vz2; + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + //////////////////////////////////////////////////////////////////////////////////// + // 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 + //////////////////////////////////////////////////////////////////////////////////// + real OxxPyyPzz = 1.; // omega2 or bulk viscosity + + real mxxPyyPzz = mfcaa + mfaca + mfaac; + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + + real dxux = -c1o2 * collFactorF * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz); + real dyuy = dxux + collFactorF * c3o2 * mxxMyy; + real dzuz = dxux + collFactorF * c3o2 * mxxMzz; + + real Dxy = -c3o1 * collFactorF * mfbba; + real Dxz = -c3o1 * collFactorF * mfbab; + real Dyz = -c3o1 * collFactorF * mfabb; + real nu = c1o3 * (c1o1 / collFactorF - c1o2); + + // average pre and post collision + std::array<real, 6> moments = { -c1o3 * mfaaa + c2o1*nu*dxux, + -c1o3 * mfaaa + c2o1*nu*dyuy, + -c1o3 * mfaaa + c2o1*nu*dzuz, + nu*Dxy,nu*Dxz,nu*Dyz}; + + return moments; +} //Multiphase stuff ////////////////////////////////////////////////////////////////////////// static void calcMultiphaseFeq(real *const &feq /*[27]*/, const real &rho, const real &p1, const real &vx1, diff --git a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h index ab047a86081f9afc1a099eea0087f2728bfa519d..490aafc1c54d806a997021415004eec9c4579168 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h @@ -38,7 +38,7 @@ #include "LBMSystem.h" -class BCProcessor; +class BCSet; class DataSet3D; //! Abstract class provides interface for LBM kernel @@ -52,8 +52,8 @@ public: virtual void swapDistributions() = 0; virtual bool getCompressible() const = 0; - virtual SPtr<BCProcessor> getBCProcessor() const = 0; - virtual void setBCProcessor(SPtr<BCProcessor> bcProcessor) = 0; + virtual SPtr<BCSet> getBCSet() const = 0; + virtual void setBCSet(SPtr<BCSet> BCSet) = 0; virtual SPtr<DataSet3D> getDataSet() const = 0; virtual real getCollisionFactor() const = 0; virtual void setCollisionFactor(real collFactor) = 0; diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp index abac1e285d7945c5180d1acb62457a2a9a718c46..990bb8f89f4b6abb1a0e77b550af4d751ad49a40 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp @@ -15,7 +15,7 @@ using namespace vf::basics::constant; IncompressibleCumulantLBMKernel::IncompressibleCumulantLBMKernel() { this->parameter = NORMAL; - this->OxyyMxzz = 1.0; + this->OxyyMxzz = c1o1; this->compressible = false; } ////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ SPtr<LBMKernel> IncompressibleCumulantLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<IncompressibleCumulantLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -46,10 +46,10 @@ SPtr<LBMKernel> IncompressibleCumulantLBMKernel::clone() switch (parameter) { case NORMAL: - dynamicPointerCast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 1.0; + dynamicPointerCast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = c1o1; break; case MAGIC: - dynamicPointerCast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); + dynamicPointerCast<IncompressibleCumulantLBMKernel>(kernel)->OxyyMxzz = c2o1 +(-collFactor); break; } return kernel; @@ -75,7 +75,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) muForcingX2.DefineVar("dt", &muDeltaT); muForcingX3.DefineVar("dt", &muDeltaT); - muNu = (1.0/3.0)*(1.0/collFactor - 1.0/2.0); + muNu = (c1o1/c3o1)*(c1o1/collFactor - c1o1/c2o1); muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); @@ -91,7 +91,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -194,9 +194,9 @@ void IncompressibleCumulantLBMKernel::calculate(int step) 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*c1o2; // X + vvy += forcingX2*deltaT*c1o2; // Y + vvz += forcingX3*deltaT*c1o2; // Z } /////////////////////////////////////////////////////////////////////////////////////////// real oMdrho; @@ -225,7 +225,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) m2=mfbba+mfbbc; m0+=m1+m2; m0+=mfbbb; //hat gefehlt - oMdrho = 1. - (oMdrho + m0); + oMdrho = c1o1 - (oMdrho + m0); real vx2; real vy2; @@ -235,7 +235,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) vz2=vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// real wadjust; - real qudricLimit = 0.01; + real qudricLimit = c1o100; //////////////////////////////////////////////////////////////////////////////////// //Hin //////////////////////////////////////////////////////////////////////////////////// @@ -248,7 +248,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaaa = m0; m0 += c1o36 * oMdrho; mfaab = m1 - m0 * vvz; - mfaac = m2 - 2. * m1 * vvz + vz2 * m0; + mfaac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaba + mfabc; m1 = mfabc - mfaba; @@ -256,7 +256,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaba = m0; m0 += c1o9 * oMdrho; mfabb = m1 - m0 * vvz; - mfabc = m2 - 2. * m1 * vvz + vz2 * m0; + mfabc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaca + mfacc; m1 = mfacc - mfaca; @@ -264,7 +264,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaca = m0; m0 += c1o36 * oMdrho; mfacb = m1 - m0 * vvz; - mfacc = m2 - 2. * m1 * vvz + vz2 * m0; + mfacc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfbaa + mfbac; @@ -273,7 +273,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfbaa = m0; m0 += c1o9 * oMdrho; mfbab = m1 - m0 * vvz; - mfbac = m2 - 2. * m1 * vvz + vz2 * m0; + mfbac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbba + mfbbc; m1 = mfbbc - mfbba; @@ -281,7 +281,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfbba = m0; m0 += c4o9 * oMdrho; mfbbb = m1 - m0 * vvz; - mfbbc = m2 - 2. * m1 * vvz + vz2 * m0; + mfbbc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbca + mfbcc; m1 = mfbcc - mfbca; @@ -289,7 +289,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfbca = m0; m0 += c1o9 * oMdrho; mfbcb = m1 - m0 * vvz; - mfbcc = m2 - 2. * m1 * vvz + vz2 * m0; + mfbcc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfcaa + mfcac; @@ -298,7 +298,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfcaa = m0; m0 += c1o36 * oMdrho; mfcab = m1 - m0 * vvz; - mfcac = m2 - 2. * m1 * vvz + vz2 * m0; + mfcac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcba + mfcbc; m1 = mfcbc - mfcba; @@ -306,7 +306,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfcba = m0; m0 += c1o9 * oMdrho; mfcbb = m1 - m0 * vvz; - mfcbc = m2 - 2. * m1 * vvz + vz2 * m0; + mfcbc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcca + mfccc; m1 = mfccc - mfcca; @@ -314,7 +314,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfcca = m0; m0 += c1o36 * oMdrho; mfccb = m1 - m0 * vvz; - mfccc = m2 - 2. * m1 * vvz + vz2 * m0; + mfccc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren @@ -326,14 +326,14 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaaa = m0; m0 += c1o6 * oMdrho; mfaba = m1 - m0 * vvy; - mfaca = m2 - 2. * m1 * vvy + vy2 * m0; + mfaca = m2 - c2o1 * 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; + mfacb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaac + mfacc; m1 = mfacc - mfaac; @@ -341,7 +341,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaac = m0; m0 += c1o18 * oMdrho; mfabc = m1 - m0 * vvy; - mfacc = m2 - 2. * m1 * vvy + vy2 * m0; + mfacc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfbaa + mfbca; @@ -350,14 +350,14 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfbaa = m0; m0 += c2o3 * oMdrho; mfbba = m1 - m0 * vvy; - mfbca = m2 - 2. * m1 * vvy + vy2 * m0; + mfbca = m2 - c2o1 * 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; + mfbcb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbac + mfbcc; m1 = mfbcc - mfbac; @@ -365,7 +365,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfbac = m0; m0 += c2o9 * oMdrho; mfbbc = m1 - m0 * vvy; - mfbcc = m2 - 2. * m1 * vvy + vy2 * m0; + mfbcc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfcaa + mfcca; @@ -374,14 +374,14 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfcaa = m0; m0 += c1o6 * oMdrho; mfcba = m1 - m0 * vvy; - mfcca = m2 - 2. * m1 * vvy + vy2 * m0; + mfcca = m2 - c2o1 * 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; + mfccb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcac + mfccc; m1 = mfccc - mfcac; @@ -389,7 +389,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfcac = m0; m0 += c1o18 * oMdrho; mfcbc = m1 - m0 * vvy; - mfccc = m2 - 2. * m1 * vvy + vy2 * m0; + mfccc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren @@ -399,16 +399,16 @@ void IncompressibleCumulantLBMKernel::calculate(int step) m1 = mfcaa - mfaaa; m0 = m2 + mfbaa; mfaaa = m0; - m0 += 1. * oMdrho; + m0 += c1o1 * oMdrho; mfbaa = m1 - m0 * vvx; - mfcaa = m2 - 2. * m1 * vvx + vx2 * m0; + mfcaa = m2 - c2o1 * 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; + mfcba = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaca + mfcca; m1 = mfcca - mfaca; @@ -416,7 +416,7 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaca = m0; m0 += c1o3 * oMdrho; mfbca = m1 - m0 * vvx; - mfcca = m2 - 2. * m1 * vvx + vx2 * m0; + mfcca = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfaab + mfcab; @@ -424,21 +424,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) m0 = m2 + mfbab; mfaab = m0; mfbab = m1 - m0 * vvx; - mfcab = m2 - 2. * m1 * vvx + vx2 * m0; + mfcab = m2 - c2o1 * 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; + mfcbb = m2 - c2o1 * 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; + mfccb = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfaac + mfcac; @@ -447,14 +447,14 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfaac = m0; m0 += c1o3 * oMdrho; mfbac = m1 - m0 * vvx; - mfcac = m2 - 2. * m1 * vvx + vx2 * m0; + mfcac = m2 - c2o1 * 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; + mfcbc = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfacc + mfccc; m1 = mfccc - mfacc; @@ -462,46 +462,46 @@ void IncompressibleCumulantLBMKernel::calculate(int step) mfacc = m0; m0 += c1o9 * oMdrho; mfbcc = m1 - m0 * vvx; - mfccc = m2 - 2. * m1 * vvx + vx2 * m0; + mfccc = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// // Cumulants //////////////////////////////////////////////////////////////////////////////////// - real OxxPyyPzz = 1.; //omega2 or bulk viscosity - real OxyyPxzz = 1.;//-s9;//2+s9;// - //real OxyyMxzz = 1.;//2+s9;// - real O4 = 1.; - real O5 = 1.; - real O6 = 1.; + real OxxPyyPzz = c1o1; //omega2 or bulk viscosity + real OxyyPxzz = c1o1;//-s9;//2+s9;// + //real OxyyMxzz = c1o1;//2+s9;// + real O4 = c1o1; + real O5 = c1o1; + real O6 = c1o1; //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 - real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); - real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); - real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); + real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + c2o1 * mfbba * mfbab); + real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + c2o1 * mfbba * mfabb); + real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + c2o1 * mfbab * mfabb); - real CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1.)*oMdrho); - real CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1.)*oMdrho); - real CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1.)*oMdrho); + real CUMcca = mfcca - ((mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-c1o1)*oMdrho); + real CUMcac = mfcac - ((mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-c1o1)*oMdrho); + real CUMacc = mfacc - ((mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-c1o1)*oMdrho); //Cum 5. - real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; - real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; - real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; + real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; + real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; + real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; //Cum 6. - real CUMccc = mfccc +((-4. * mfbbb * mfbbb + real CUMccc = mfccc +((-c4o1 * 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) + - c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) + - c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + +(c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + + c16o1 * 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) + - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(c1o1-c2o1* oMdrho)- c1o27* oMdrho * oMdrho*(-c2o1* oMdrho) + +(c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) +c1o27*oMdrho; //2. @@ -515,9 +515,9 @@ void IncompressibleCumulantLBMKernel::calculate(int step) real dzuz = dxux + collFactor * c3o2 * mxxMzz; //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - mxxMyy += collFactor * (-mxxMyy) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); - mxxMzz += collFactor * (-mxxMzz) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); + mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += collFactor * (-mxxMyy) - c3o1 * (c1o1 - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += collFactor * (-mxxMzz) - c3o1 * (c1o1 - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); mfabb += collFactor * (-mfabb); mfbab += collFactor * (-mfbab); @@ -525,8 +525,8 @@ void IncompressibleCumulantLBMKernel::calculate(int step) // linear combinations back mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); + mfaac = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); //3. // linear combinations @@ -540,19 +540,19 @@ void IncompressibleCumulantLBMKernel::calculate(int step) real mxyyMxzz = mfbca - mfbac; //relax - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); mxyyMxzz += wadjust * (-mxyyMxzz); // linear combinations back @@ -586,30 +586,30 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //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); + mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + c2o1 * mfbba * mfbab); + mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + c2o1 * mfbba * mfabb); + mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + c2o1 * 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; + mfcca = CUMcca + (mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + mfcac = CUMcac + (mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + mfacc = CUMacc + (mfaac * mfaca + c2o1 * 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; + mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho; + mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho; + mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho; //6. - mfccc = CUMccc -((-4. * mfbbb * mfbbb + mfccc = CUMccc -((-c4o1 * 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) + - c4o1 * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) + - c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + +(c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + + c16o1 * 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) + - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(c1o1-c2o1* oMdrho)- c1o27* oMdrho * oMdrho*(-c2o1* oMdrho) + +(c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) -c1o27*oMdrho; //////////////////////////////////////////////////////////////////////////////////// @@ -625,22 +625,22 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //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; + m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + c1o1 * oMdrho) * (vz2 - vvz) * c1o2; + m1 = -mfaac - c2o1 * mfaab * vvz + mfaaa * (c1o1 - vz2) - c1o1 * oMdrho * vz2; + m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + c1o1 * 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); + m1 = -mfabc - c2o1 * mfabb * vvz + mfaba * (c1o1 - 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; + m1 = -mfacc - c2o1 * mfacb * vvz + mfaca * (c1o1 - vz2) - c1o3 * oMdrho * vz2; m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2; mfaca = m0; mfacb = m1; @@ -648,21 +648,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2; - m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2); + m1 = -mfbac - c2o1 * mfbab * vvz + mfbaa * (c1o1 - 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); + m1 = -mfbbc - c2o1 * mfbbb * vvz + mfbba * (c1o1 - 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); + m1 = -mfbcc - c2o1 * mfbcb * vvz + mfbca * (c1o1 - vz2); m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2; mfbca = m0; mfbcb = m1; @@ -670,21 +670,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2; - m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2; + m1 = -mfcac - c2o1 * mfcab * vvz + mfcaa * (c1o1 - 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); + m1 = -mfcbc - c2o1 * mfcbb * vvz + mfcba * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfccb * vvz + mfcca * (c1o1 - vz2) - c1o9 * oMdrho * vz2; m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2; mfcca = m0; mfccb = m1; @@ -695,21 +695,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// // 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; + m1 = -mfaca - c2o1 * mfaba * vvy + mfaaa * (c1o1 - 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; + m1 = -mfacb - c2o1 * mfabb * vvy + mfaab * (c1o1 - 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; + m1 = -mfacc - c2o1 * mfabc * vvy + mfaac * (c1o1 - vy2) - c1o6 * oMdrho * vy2; m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2; mfaac = m0; mfabc = m1; @@ -717,21 +717,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2; - m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2); + m1 = -mfbca - c2o1 * mfbba * vvy + mfbaa * (c1o1 - 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); + m1 = -mfbcb - c2o1 * mfbbb * vvy + mfbab * (c1o1 - 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); + m1 = -mfbcc - c2o1 * mfbbc * vvy + mfbac * (c1o1 - vy2); m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2; mfbac = m0; mfbbc = m1; @@ -739,21 +739,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2; - m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2; + m1 = -mfcca - c2o1 * mfcba * vvy + mfcaa * (c1o1 - 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; + m1 = -mfccb - c2o1 * mfcbb * vvy + mfcab * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfcbc * vvy + mfcac * (c1o1 - vy2) - c1o18 * oMdrho * vy2; m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2; mfcac = m0; mfcbc = m1; @@ -764,21 +764,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// // 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; + m1 = -mfcaa - c2o1 * mfbaa * vvx + mfaaa * (c1o1 - 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; + m1 = -mfcba - c2o1 * mfbba * vvx + mfaba * (c1o1 - 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; + m1 = -mfcca - c2o1 * mfbca * vvx + mfaca * (c1o1 - vx2) - c1o36 * oMdrho * vx2; m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; mfaca = m0; mfbca = m1; @@ -786,21 +786,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2; - m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2; + m1 = -mfcab - c2o1 * mfbab * vvx + mfaab * (c1o1 - 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; + m1 = -mfcbb - c2o1 * mfbbb * vvx + mfabb * (c1o1 - 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; + m1 = -mfccb - c2o1 * mfbcb * vvx + mfacb * (c1o1 - vx2) - c1o9 * oMdrho * vx2; m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2; mfacb = m0; mfbcb = m1; @@ -808,21 +808,21 @@ void IncompressibleCumulantLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2; - m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2; + m1 = -mfcac - c2o1 * mfbac * vvx + mfaac * (c1o1 - 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; + m1 = -mfcbc - c2o1 * mfbbc * vvx + mfabc * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfbcc * vvx + mfacc * (c1o1 - vx2) - c1o36 * oMdrho * vx2; m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; mfacc = m0; mfbcc = m1; diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h index 5abe9afc29caf6fe178d6b0e7c3b44e373c6defb..99e64ce0cac5a0a1e53a40f1eb4a4ab36cfa2f81 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h @@ -4,7 +4,7 @@ #define IncompressibleCumulantLBMKernel_H #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "basics/utilities/UbTiming.h" #include "basics/container/CbArray4D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp index 7f2bf15a1d919a02cdad290265d741eee080f108..0ac578d90615b0ab0ba4989b6b70d680eb0e8c44 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.cpp @@ -47,7 +47,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::initRelaxFactor(int vdir, r real spongeFactor; - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -74,38 +74,38 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::initRelaxFactor(int vdir, r case DIR_P00: muX1 = (real)(x1 + ix1 * maxX1); if (muX1 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeX - (muX1 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; case DIR_M00: muX1 = (real)(x1 + ix1 * maxX1); if (muX1 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX1 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeSP - (muX1 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; case DIR_0P0: muX2 = (real)(x2 + ix2 * maxX2); if (muX2 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeX - (muX2 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; case DIR_0M0: muX2 = (real)(x2 + ix2 * maxX2); if (muX2 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX2 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeSP - (muX2 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; case DIR_00P: muX3 = (real)(x3 + ix3 * maxX3); if (muX3 >= (sizeX - sizeSP) / deltaT) - spongeFactor = (sizeX - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeX - (muX3 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; case DIR_00M: muX3 = (real)(x3 + ix3 * maxX3); if (muX3 <= sizeSP / deltaT) - spongeFactor = (sizeSP - (muX3 * deltaT + 1)) / sizeSP / 2.0 + 0.5; - else spongeFactor = 1.0; + spongeFactor = (sizeSP - (muX3 * deltaT + c1o1)) / sizeSP / c2o1 + c1o2; + else spongeFactor = c1o1; break; default: throw UbException(UB_EXARGS, "unknown dir"); } @@ -122,7 +122,7 @@ SPtr<LBMKernel> IncompressibleCumulantWithSpongeLayerLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -134,10 +134,10 @@ SPtr<LBMKernel> IncompressibleCumulantWithSpongeLayerLBMKernel::clone() switch (parameter) { case NORMAL: - dynamicPointerCast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = 1.0; + dynamicPointerCast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = c1o1; break; case MAGIC: - dynamicPointerCast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = 2.0 +(-collFactor); + dynamicPointerCast<IncompressibleCumulantWithSpongeLayerLBMKernel>(kernel)->OxyyMxzz = c2o1 +(-collFactor); break; } @@ -169,7 +169,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) // muForcingX2.DefineVar("dx",&muDeltaT); // muForcingX3.DefineVar("dx",&muDeltaT); - // muNu = (1.0/3.0)*(1.0/collFactor - 1.0/2.0); + // muNu = (1.0/3.0)*(1.0/collFactor - 1.0/c2o10); // muForcingX1.DefineVar("nu",&muNu); // muForcingX2.DefineVar("nu",&muNu); @@ -193,7 +193,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); SPtr<RelaxationFactorArray3D> relaxationFactorPtr = dataSet->getRelaxationFactor(); const int bcArrayMaxX1 = (int)bcArray->getNX1(); @@ -352,7 +352,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) m2=mfbba+mfbbc; m0+=m1+m2; m0+=mfbbb; //hat gefehlt - oMdrho = 1. - (oMdrho + m0); + oMdrho = c1o1 - (oMdrho + m0); real vx2; real vy2; @@ -362,7 +362,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) vz2=vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// real wadjust; - real qudricLimit = 0.01; + real qudricLimit = c1o100; //////////////////////////////////////////////////////////////////////////////////// //Hin //////////////////////////////////////////////////////////////////////////////////// @@ -375,7 +375,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaaa = m0; m0 += c1o36 * oMdrho; mfaab = m1 - m0 * vvz; - mfaac = m2 - 2. * m1 * vvz + vz2 * m0; + mfaac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaba + mfabc; m1 = mfabc - mfaba; @@ -383,7 +383,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaba = m0; m0 += c1o9 * oMdrho; mfabb = m1 - m0 * vvz; - mfabc = m2 - 2. * m1 * vvz + vz2 * m0; + mfabc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaca + mfacc; m1 = mfacc - mfaca; @@ -391,7 +391,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaca = m0; m0 += c1o36 * oMdrho; mfacb = m1 - m0 * vvz; - mfacc = m2 - 2. * m1 * vvz + vz2 * m0; + mfacc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfbaa + mfbac; @@ -400,7 +400,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfbaa = m0; m0 += c1o9 * oMdrho; mfbab = m1 - m0 * vvz; - mfbac = m2 - 2. * m1 * vvz + vz2 * m0; + mfbac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbba + mfbbc; m1 = mfbbc - mfbba; @@ -408,7 +408,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfbba = m0; m0 += c4o9 * oMdrho; mfbbb = m1 - m0 * vvz; - mfbbc = m2 - 2. * m1 * vvz + vz2 * m0; + mfbbc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbca + mfbcc; m1 = mfbcc - mfbca; @@ -416,7 +416,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfbca = m0; m0 += c1o9 * oMdrho; mfbcb = m1 - m0 * vvz; - mfbcc = m2 - 2. * m1 * vvz + vz2 * m0; + mfbcc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfcaa + mfcac; @@ -425,7 +425,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfcaa = m0; m0 += c1o36 * oMdrho; mfcab = m1 - m0 * vvz; - mfcac = m2 - 2. * m1 * vvz + vz2 * m0; + mfcac = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcba + mfcbc; m1 = mfcbc - mfcba; @@ -433,7 +433,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfcba = m0; m0 += c1o9 * oMdrho; mfcbb = m1 - m0 * vvz; - mfcbc = m2 - 2. * m1 * vvz + vz2 * m0; + mfcbc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcca + mfccc; m1 = mfccc - mfcca; @@ -441,7 +441,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfcca = m0; m0 += c1o36 * oMdrho; mfccb = m1 - m0 * vvz; - mfccc = m2 - 2. * m1 * vvz + vz2 * m0; + mfccc = m2 - c2o1 * m1 * vvz + vz2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // mit 1/6, 0, 1/18, 2/3, 0, 2/9, 1/6, 0, 1/18 Konditionieren @@ -453,14 +453,14 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaaa = m0; m0 += c1o6 * oMdrho; mfaba = m1 - m0 * vvy; - mfaca = m2 - 2. * m1 * vvy + vy2 * m0; + mfaca = m2 - c2o1 * 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; + mfacb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaac + mfacc; m1 = mfacc - mfaac; @@ -468,7 +468,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaac = m0; m0 += c1o18 * oMdrho; mfabc = m1 - m0 * vvy; - mfacc = m2 - 2. * m1 * vvy + vy2 * m0; + mfacc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfbaa + mfbca; @@ -477,14 +477,14 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfbaa = m0; m0 += c2o3 * oMdrho; mfbba = m1 - m0 * vvy; - mfbca = m2 - 2. * m1 * vvy + vy2 * m0; + mfbca = m2 - c2o1 * 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; + mfbcb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfbac + mfbcc; m1 = mfbcc - mfbac; @@ -492,7 +492,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfbac = m0; m0 += c2o9 * oMdrho; mfbbc = m1 - m0 * vvy; - mfbcc = m2 - 2. * m1 * vvy + vy2 * m0; + mfbcc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfcaa + mfcca; @@ -501,14 +501,14 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfcaa = m0; m0 += c1o6 * oMdrho; mfcba = m1 - m0 * vvy; - mfcca = m2 - 2. * m1 * vvy + vy2 * m0; + mfcca = m2 - c2o1 * 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; + mfccb = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfcac + mfccc; m1 = mfccc - mfcac; @@ -516,7 +516,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfcac = m0; m0 += c1o18 * oMdrho; mfcbc = m1 - m0 * vvy; - mfccc = m2 - 2. * m1 * vvy + vy2 * m0; + mfccc = m2 - c2o1 * m1 * vvy + vy2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren @@ -526,16 +526,16 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) m1 = mfcaa - mfaaa; m0 = m2 + mfbaa; mfaaa = m0; - m0 += 1. * oMdrho; + m0 += c1o1 * oMdrho; mfbaa = m1 - m0 * vvx; - mfcaa = m2 - 2. * m1 * vvx + vx2 * m0; + mfcaa = m2 - c2o1 * 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; + mfcba = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfaca + mfcca; m1 = mfcca - mfaca; @@ -543,7 +543,7 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaca = m0; m0 += c1o3 * oMdrho; mfbca = m1 - m0 * vvx; - mfcca = m2 - 2. * m1 * vvx + vx2 * m0; + mfcca = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfaab + mfcab; @@ -551,21 +551,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) m0 = m2 + mfbab; mfaab = m0; mfbab = m1 - m0 * vvx; - mfcab = m2 - 2. * m1 * vvx + vx2 * m0; + mfcab = m2 - c2o1 * 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; + mfcbb = m2 - c2o1 * 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; + mfccb = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m2 = mfaac + mfcac; @@ -574,14 +574,14 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfaac = m0; m0 += c1o3 * oMdrho; mfbac = m1 - m0 * vvx; - mfcac = m2 - 2. * m1 * vvx + vx2 * m0; + mfcac = m2 - c2o1 * 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; + mfcbc = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// m2 = mfacc + mfccc; m1 = mfccc - mfacc; @@ -589,42 +589,42 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) mfacc = m0; m0 += c1o9 * oMdrho; mfbcc = m1 - m0 * vvx; - mfccc = m2 - 2. * m1 * vvx + vx2 * m0; + mfccc = m2 - c2o1 * m1 * vvx + vx2 * m0; //////////////////////////////////////////////////////////////////////////////////// // Cumulants //////////////////////////////////////////////////////////////////////////////////// - real OxxPyyPzz = 1.; - real OxyyPxzz = 1.;//-s9;//2+s9;// - //real OxyyMxzz = 1.;//2+s9;// - real O4 = 1.; - real O5 = 1.; - real O6 = 1.; + real OxxPyyPzz = c1o1; + real OxyyPxzz = c1o1;//-s9;//2+s9;// + //real OxyyMxzz = c1o1;//2+s9;// + real O4 = c1o1; + real O5 = c1o1; + real O6 = c1o1; - //Cum 4. - real CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); - real CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); - real CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); + //Cum c4o1 + real CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + c2o1 * mfbba * mfbab); + real CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + c2o1 * mfbba * mfabb); + real CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + c2o1 * mfbab * mfabb); - real CUMcca = mfcca - (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - real CUMcac = mfcac - (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; - real CUMacc = mfacc - (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + real CUMcca = mfcca - (mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + real CUMcac = mfcac - (mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + real CUMacc = mfacc - (mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; //Cum 5. - real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; - real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; - real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; + real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; + real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; + real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; //Cum 6. - real CUMccc = mfccc +((-4. * mfbbb * mfbbb + real CUMccc = mfccc +((-c4o1 * 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) + - c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) + - c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + +( c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + + c16o1 * 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) + - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(c1o1-c2o1* oMdrho)- c1o27* oMdrho * oMdrho*(-c2o1* oMdrho) + +( c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) +c1o27*oMdrho; //2. @@ -638,9 +638,9 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) real dzuz = dxux + collFactor * c3o2 * mxxMzz; //relax - mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); - mxxMyy += collFactor * (-mxxMyy) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); - mxxMzz += collFactor * (-mxxMzz) - 3. * (1. - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); + mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz)- c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += collFactor * (-mxxMyy) - c3o1 * (c1o1 - c1o2 * collFactor) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += collFactor * (-mxxMzz) - c3o1 * (c1o1 - c1o2 * collFactor) * (vx2 * dxux - vz2 * dzuz); mfabb += collFactor * (-mfabb); mfbab += collFactor * (-mfbab); @@ -648,8 +648,8 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) // linear combinations back mfcaa = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * ( mxxMyy - 2. * mxxMzz + mxxPyyPzz); + mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); + mfaac = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); //3. // linear combinations @@ -663,19 +663,19 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) real mxyyMxzz = mfbca - mfbac; //relax - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mfbbb)/(fabs(mfbbb)+qudricLimit); mfbbb += wadjust * (-mfbbb); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxxyPyzz)/(fabs(mxxyPyzz)+qudricLimit); mxxyPyzz += wadjust * (-mxxyPyzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxxyMyzz)/(fabs(mxxyMyzz)+qudricLimit); mxxyMyzz += wadjust * (-mxxyMyzz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxxzPyyz)/(fabs(mxxzPyyz)+qudricLimit); mxxzPyyz += wadjust * (-mxxzPyyz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxxzMyyz)/(fabs(mxxzMyyz)+qudricLimit); mxxzMyyz += wadjust * (-mxxzMyyz); - wadjust = OxyyPxzz+(1.-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); + wadjust = OxyyPxzz+(c1o1-OxyyPxzz)*fabs(mxyyPxzz)/(fabs(mxyyPxzz)+qudricLimit); mxyyPxzz += wadjust * (-mxyyPxzz); - wadjust = OxyyMxzz+(1.-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); + wadjust = OxyyMxzz+(c1o1-OxyyMxzz)*fabs(mxyyMxzz)/(fabs(mxyyMxzz)+qudricLimit); mxyyMxzz += wadjust * (-mxyyMxzz); // linear combinations back @@ -705,30 +705,30 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //back cumulants to central moments //4. - mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); - mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); - mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); + mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + c2o1 * mfbba * mfbab); + mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + c2o1 * mfbba * mfabb); + mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + c2o1 * 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; + mfcca = CUMcca + (mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + mfcac = CUMcac + (mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(oMdrho-1)*oMdrho; + mfacc = CUMacc + (mfaac * mfaca + c2o1 * 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; + mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho; + mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho; + mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho; //6. - mfccc = CUMccc -((-4. * mfbbb * mfbbb + mfccc = CUMccc -((-c4o1 * 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) + - c4o1 * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) + - c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + +( c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + + c16o1 * 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) + - c1o9* (mfcaa + mfaca + mfaac) * oMdrho*(c1o1-c2o1* oMdrho)- c1o27* oMdrho * oMdrho*(-c2o1* oMdrho) + +( c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3*oMdrho) -c1o27*oMdrho; //////////////////////////////////////////////////////////////////////////////////// @@ -744,22 +744,22 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //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; + m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + c1o1 * oMdrho) * ( vz2 - vvz) * c1o2; + m1 = -mfaac - c2o1 * mfaab * vvz + mfaaa * (c1o1 - vz2) - c1o1 * oMdrho * vz2; + m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + c1o1 * 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); + m1 = -mfabc - c2o1 * mfabb * vvz + mfaba * (c1o1 - 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; + m1 = -mfacc - c2o1 * mfacb * vvz + mfaca * (c1o1 - vz2) - c1o3 * oMdrho * vz2; m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; mfaca = m0; mfacb = m1; @@ -767,21 +767,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * ( vz2 - vvz) * c1o2; - m1 = -mfbac - 2. * mfbab * vvz + mfbaa * (1. - vz2); + m1 = -mfbac - c2o1 * mfbab * vvz + mfbaa * (c1o1 - 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); + m1 = -mfbbc - c2o1 * mfbbb * vvz + mfbba * (c1o1 - 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); + m1 = -mfbcc - c2o1 * mfbcb * vvz + mfbca * (c1o1 - vz2); m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * ( vz2 + vvz) * c1o2; mfbca = m0; mfbcb = m1; @@ -789,21 +789,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfcac - 2. * mfcab * vvz + mfcaa * (1. - vz2) - c1o3 * oMdrho * vz2; + m1 = -mfcac - c2o1 * mfcab * vvz + mfcaa * (c1o1 - 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); + m1 = -mfcbc - c2o1 * mfcbb * vvz + mfcba * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfccb * vvz + mfcca * (c1o1 - vz2) - c1o9 * oMdrho * vz2; m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 + vvz) * c1o2; mfcca = m0; mfccb = m1; @@ -814,21 +814,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// // 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; + m1 = -mfaca - c2o1 * mfaba * vvy + mfaaa * (c1o1 - 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; + m1 = -mfacb - c2o1 * mfabb * vvy + mfaab * (c1o1 - 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; + m1 = -mfacc - c2o1 * mfabc * vvy + mfaac * (c1o1 - vy2) - c1o6 * oMdrho * vy2; m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; mfaac = m0; mfabc = m1; @@ -836,21 +836,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * ( vy2 - vvy) * c1o2; - m1 = -mfbca - 2. * mfbba * vvy + mfbaa * (1. - vy2); + m1 = -mfbca - c2o1 * mfbba * vvy + mfbaa * (c1o1 - 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); + m1 = -mfbcb - c2o1 * mfbbb * vvy + mfbab * (c1o1 - 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); + m1 = -mfbcc - c2o1 * mfbbc * vvy + mfbac * (c1o1 - vy2); m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * ( vy2 + vvy) * c1o2; mfbac = m0; mfbbc = m1; @@ -858,21 +858,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfcca - 2. * mfcba * vvy + mfcaa * (1. - vy2) - c1o18 * oMdrho * vy2; + m1 = -mfcca - c2o1 * mfcba * vvy + mfcaa * (c1o1 - 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; + m1 = -mfccb - c2o1 * mfcbb * vvy + mfcab * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfcbc * vvy + mfcac * (c1o1 - vy2) - c1o18 * oMdrho * vy2; m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; mfcac = m0; mfcbc = m1; @@ -883,21 +883,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// // 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; + m1 = -mfcaa - c2o1 * mfbaa * vvx + mfaaa * (c1o1 - 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; + m1 = -mfcba - c2o1 * mfbba * vvx + mfaba * (c1o1 - 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; + m1 = -mfcca - c2o1 * mfbca * vvx + mfaca * (c1o1 - vx2) - c1o36 * oMdrho * vx2; m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; mfaca = m0; mfbca = m1; @@ -905,21 +905,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcab - 2. * mfbab * vvx + mfaab * (1. - vx2) - c1o9 * oMdrho * vx2; + m1 = -mfcab - c2o1 * mfbab * vvx + mfaab * (c1o1 - 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; + m1 = -mfcbb - c2o1 * mfbbb * vvx + mfabb * (c1o1 - 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; + m1 = -mfccb - c2o1 * mfbcb * vvx + mfacb * (c1o1 - vx2) - c1o9 * oMdrho * vx2; m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; mfacb = m0; mfbcb = m1; @@ -927,21 +927,21 @@ void IncompressibleCumulantWithSpongeLayerLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcac - 2. * mfbac * vvx + mfaac * (1. - vx2) - c1o36 * oMdrho * vx2; + m1 = -mfcac - c2o1 * mfbac * vvx + mfaac * (c1o1 - 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; + m1 = -mfcbc - c2o1 * mfbbc * vvx + mfabc * (c1o1 - 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; + m1 = -mfccc - c2o1 * mfbcc * vvx + mfacc * (c1o1 - vx2) - c1o36 * oMdrho * vx2; m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; mfacc = m0; mfbcc = m1; diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp index c4759d786367fc9c5030898839b57cbec7bd48ec..26635dbac5d4b2844e6f0205f30a063c5533d612 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp @@ -37,22 +37,24 @@ void IncompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff ////////////////////////////////////////////////////////////////////////// void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { + using namespace vf::basics::constant; + setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, 0.5); - calcInterpolatedNode(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1); - calcInterpolatedNode(icellF.BNE, omegaF, 0.25, 0.25, -0.25, calcPressBNE(), 1, 1, -1); - calcInterpolatedNode(icellF.TNW, omegaF, -0.25, 0.25, 0.25, calcPressTNW(), -1, 1, 1); - calcInterpolatedNode(icellF.TSE, omegaF, 0.25, -0.25, 0.25, calcPressTSE(), 1, -1, 1); - calcInterpolatedNode(icellF.BNW, omegaF, -0.25, 0.25, -0.25, calcPressBNW(), -1, 1, -1); - calcInterpolatedNode(icellF.BSE, omegaF, 0.25, -0.25, -0.25, calcPressBSE(), 1, -1, -1); - calcInterpolatedNode(icellF.TSW, omegaF, -0.25, -0.25, 0.25, calcPressTSW(), -1, -1, 1); - calcInterpolatedNode(icellF.TNE, omegaF, 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); + calcInterpolatedCoefficiets(icellC, omegaC, c1o2); + calcInterpolatedNode(icellF.BSW, omegaF, -c1o4, -c1o4, -c1o4, calcPressBSW(), -c1o1, -c1o1, -c1o1); + calcInterpolatedNode(icellF.BNE, omegaF, c1o4, c1o4, -c1o4, calcPressBNE(), c1o1, c1o1, -c1o1); + calcInterpolatedNode(icellF.TNW, omegaF, -c1o4, c1o4, c1o4, calcPressTNW(), -c1o1, c1o1, c1o1); + calcInterpolatedNode(icellF.TSE, omegaF, c1o4, -c1o4, c1o4, calcPressTSE(), c1o1, -c1o1, c1o1); + calcInterpolatedNode(icellF.BNW, omegaF, -c1o4, c1o4, -c1o4, calcPressBNW(), -c1o1, c1o1, -c1o1); + calcInterpolatedNode(icellF.BSE, omegaF, c1o4, -c1o4, -c1o4, calcPressBSE(), c1o1, -c1o1, -c1o1); + calcInterpolatedNode(icellF.TSW, omegaF, -c1o4, -c1o4, c1o4, calcPressTSW(), -c1o1, -c1o1, c1o1); + calcInterpolatedNode(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, 2.0); + calcInterpolatedCoefficiets(icellF, omegaF, vf::basics::constant::c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// @@ -61,11 +63,12 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const real* const f { using namespace D3Q27System; using namespace vf::lbm::dir; + using namespace vf::basics::constant; //UBLOG(logINFO,"D3Q27System::DIR_M0M = " << D3Q27System::DIR_M0M); //UBLOG(logINFO,"BW = " << BW);; - real rho = 0.0; + real rho = c0o1; D3Q27System::calcIncompMacroscopicValues(f,rho,vx1,vx2,vx3); ////////////////////////////////////////////////////////////////////////// @@ -83,12 +86,12 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const real* const f //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[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[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)); + kxy = -c3o1*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 = -c3o1*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 = -c3o1*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 = -c3o1/c2o1*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]))-(vx1*vx1-vx2*vx2)); + kxxMzz = -c3o1/c2o1*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 = -c3o1/c2o1*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]))); //UBLOG(logINFO, "kxxMzz = "<<kxxMzz); @@ -103,6 +106,8 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const real* const f ////////////////////////////////////////////////////////////////////////// void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) { + using namespace vf::basics::constant; + real vx1_SWT,vx2_SWT,vx3_SWT; real vx1_NWT,vx2_NWT,vx3_NWT; real vx1_NET,vx2_NET,vx3_NET; @@ -197,109 +202,109 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT + - 2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT + - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT + - 8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB + - 8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET - - 2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + - 2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; - b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT - - 2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT - + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + + c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + + c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + + c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - + c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + + c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; + b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - + c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - 2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT - - 2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT + - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT + - 8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT + - 8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.; + c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - + c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + + c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + + c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - 2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT - - 2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT - - 2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT - - 2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT - - 2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT + - 2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT + - 8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT + - 8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - + c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - + c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - + c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + + c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + + c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + + c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; + ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT - - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.; + c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - 2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT + - 2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.; + c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + + c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; + ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; + by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; + cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.; - byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT + - 2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT + + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; + byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + + c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - 2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT - - 2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.; + c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - + c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - 2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT - - 2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.; + c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - + c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; + az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; + bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; + cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT + - 2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + + c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - 2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT - - 2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.; + c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - + c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - 2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT + - 2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT - - 2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT - - 2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT - - 2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT + - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.; + c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + + c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - + c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - + c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - + c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + + c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; + axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; + bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; + cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; + axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; + ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; + byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; + cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; @@ -351,7 +356,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con // kxxMzzFromfcNEQ_NWT+ // kxxMzzFromfcNEQ_NET+ // kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - kxyAverage =0;//(kxyFromfcNEQ_SWB+ + kxyAverage = c0o1;//(kxyFromfcNEQ_SWB+ //kxyFromfcNEQ_SWT+ //kxyFromfcNEQ_SET+ //kxyFromfcNEQ_SEB+ @@ -359,7 +364,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con //kxyFromfcNEQ_NWT+ //kxyFromfcNEQ_NET+ //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage =0;//(kyzFromfcNEQ_SWB+ + kyzAverage = c0o1;//(kyzFromfcNEQ_SWB+ //kyzFromfcNEQ_SWT+ //kyzFromfcNEQ_SET+ //kyzFromfcNEQ_SEB+ @@ -367,7 +372,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con //kyzFromfcNEQ_NWT+ //kyzFromfcNEQ_NET+ //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage =0;//(kxzFromfcNEQ_SWB+ + kxzAverage = c0o1;//(kxzFromfcNEQ_SWB+ //kxzFromfcNEQ_SWT+ //kxzFromfcNEQ_SET+ //kxzFromfcNEQ_SEB+ @@ -375,7 +380,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con //kxzFromfcNEQ_NWT+ //kxzFromfcNEQ_NET+ //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage =0;//(kxxMyyFromfcNEQ_SWB+ + kxxMyyAverage = c0o1;//(kxxMyyFromfcNEQ_SWB+ //kxxMyyFromfcNEQ_SWT+ //kxxMyyFromfcNEQ_SET+ //kxxMyyFromfcNEQ_SEB+ @@ -383,7 +388,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con //kxxMyyFromfcNEQ_NWT+ //kxxMyyFromfcNEQ_NET+ //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage =0;//(kxxMzzFromfcNEQ_SWB+ + kxxMzzAverage = c0o1;//(kxxMzzFromfcNEQ_SWB+ //kxxMzzFromfcNEQ_SWT+ //kxxMzzFromfcNEQ_SET+ //kxxMzzFromfcNEQ_SEB+ @@ -397,17 +402,17 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; + ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; + ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; + az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; + bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; + by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; + bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; + cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; + cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; + cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; axy= axy + zoff*axyz; axz= axz + yoff*axyz; ayz= ayz + xoff*axyz; @@ -421,121 +426,122 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con const real o = omega; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); + f_E = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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)); - - x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o)); - x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o)); - x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o)); - x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o)); - x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o)); - x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o)); - x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o)); - x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o)); - x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o)); + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); + + x_E = 0.25*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); + x_N = 0.25*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); + x_T = 0.25*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); + x_NE = 0.25*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_SE = 0.25*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_TE = 0.25*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); + x_BE = 0.25*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); + x_TN = 0.25*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); + x_BN = 0.25*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o)); - x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o)); - x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o)); - - y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o); - y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o); - y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o); - y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o)); - y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o)); - y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o)); - y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o)); - y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o)); + x_TNE = 0.25*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSW = 0.25*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSE = 0.25*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); + x_TNW = 0.25*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); + + y_E = 0.25*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); + y_N = 0.25*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); + y_T = 0.25*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); + y_NE = 0.25*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_SE = 0.25*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_TE = 0.25*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); + y_BE = 0.25*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); + y_TN = 0.25*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); + y_BN = 0.25*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o)); - y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o)); - y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o)); - - z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o)); - z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o)); - z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o)); - z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o)); - z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o)); - z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o)); - z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o)); - z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o)); - z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o)); + y_TNE = 0.25*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSW = 0.25*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSE = 0.25*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); + y_TNW = 0.25*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); + + z_E = 0.25*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); + z_N = 0.25*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); + z_T = 0.25*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); + z_NE = 0.25*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_SE = 0.25*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_TE = 0.25*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_BE = 0.25*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_TN = 0.25*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_BN = 0.25*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o)); - z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o)); - z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o)); - - xy_E = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_N = 0.0625*eps_new *(( 2.*cxyz)/(27.*o)); - xy_T = -(0.0625*eps_new *(( 4.*cxyz)/(27.*o))); - xy_NE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_SE = 0.0625*eps_new *( cxyz /(27.*o)); - xy_TE = -(0.0625*eps_new *(( 3.*axyz + cxyz)/(54.*o))); - xy_BE = -(0.0625*eps_new *((-3.*axyz + cxyz)/(54.*o))); - xy_TN = -(0.0625*eps_new *(( 3.*bxyz + cxyz)/(54.*o))); - xy_BN = -(0.0625*eps_new *(( - 3.*bxyz + cxyz)/(54.*o))); - //xy_ZERO= 0.0625*eps_new; - xy_TNE = -(0.0625*eps_new *(( axyz + bxyz )/(72.*o))); - xy_TSW = 0.0625*eps_new *(( axyz + bxyz )/(72.*o)); - xy_TSE = 0.0625*eps_new *((- axyz + bxyz )/(72.*o)); - xy_TNW = 0.0625*eps_new *(( axyz - bxyz )/(72.*o)); - - xz_E = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_N = -(0.0625*eps_new *(( 4.*bxyz )/(27.*o))); - xz_T = 0.0625*eps_new *(( 2.*bxyz )/(27.*o)); - xz_NE = -(0.0625*eps_new *(( 3.*axyz + bxyz )/(54.*o))); - xz_SE = -(0.0625*eps_new *((-3.*axyz + bxyz )/(54.*o))); - xz_TE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_BE = 0.0625*eps_new *(( bxyz )/(27.*o)); - xz_TN = -(0.0625*eps_new *(( bxyz + 3.*cxyz)/(54.*o))); - xz_BN = -(0.0625*eps_new *(( bxyz - 3.*cxyz)/(54.*o))); - //xz_ZERO= 0.0625*eps_new; - xz_TNE = -(0.0625*eps_new *(( axyz + cxyz)/(72.*o))); - xz_TSW = 0.0625*eps_new *((- axyz + cxyz)/(72.*o)); - xz_TSE = 0.0625*eps_new *(( axyz + cxyz)/(72.*o)); - xz_TNW = 0.0625*eps_new *(( axyz - cxyz)/(72.*o)); - - yz_E = -(0.0625*eps_new *(( 4.*axyz )/(27.*o))); - yz_N = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_T = 0.0625*eps_new *(( 2.*axyz )/(27.*o)); - yz_NE = -(0.0625*eps_new *(( axyz + 3.*bxyz )/(54.*o))); - yz_SE = -(0.0625*eps_new *(( axyz - 3.*bxyz )/(54.*o))); - yz_TE = -(0.0625*eps_new *(( axyz + 3.*cxyz)/(54.*o))); - yz_BE = -(0.0625*eps_new *(( axyz - 3.*cxyz)/(54.*o))); - yz_TN = 0.0625*eps_new *(( axyz )/(27.*o)); - yz_BN = 0.0625*eps_new *(( axyz )/(27.*o)); - //yz_ZERO= 0.0625*eps_new; - yz_TNE = -(0.0625*eps_new *(( bxyz + cxyz)/(72.*o))); - yz_TSW = 0.0625*eps_new *(( - bxyz + cxyz)/(72.*o)); - yz_TSE = 0.0625*eps_new *(( bxyz - cxyz)/(72.*o)); - yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); + z_TNE = 0.25*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSW = 0.25*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSE = 0.25*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); + z_TNW = 0.25*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); + + xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); + xy_T = -(c1o16*eps_new *(( c4o1*cxyz)/(c27o1*o))); + xy_NE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_SE = c1o16*eps_new *( cxyz /(c27o1*o)); + xy_TE = -(c1o16*eps_new *(( c3o1*axyz + cxyz)/(c54o1*o))); + xy_BE = -(c1o16*eps_new *((-c3o1*axyz + cxyz)/(c54o1*o))); + xy_TN = -(c1o16*eps_new *(( c3o1*bxyz + cxyz)/(c54o1*o))); + xy_BN = -(c1o16*eps_new *(( - c3o1*bxyz + cxyz)/(c54o1*o))); + //xy_ZERO= c1o16*eps_new; + xy_TNE = -(c1o16*eps_new *(( axyz + bxyz )/(c72o1*o))); + xy_TSW = c1o16*eps_new *(( axyz + bxyz )/(c72o1*o)); + xy_TSE = c1o16*eps_new *((- axyz + bxyz )/(c72o1*o)); + xy_TNW = c1o16*eps_new *(( axyz - bxyz )/(c72o1*o)); + + xz_E = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_N = -(c1o16*eps_new *(( c4o1*bxyz )/(c27o1*o))); + xz_T = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); + xz_NE = -(c1o16*eps_new *(( c3o1*axyz + bxyz )/(c54o1*o))); + xz_SE = -(c1o16*eps_new *((-c3o1*axyz + bxyz )/(c54o1*o))); + xz_TE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_BE = c1o16*eps_new *(( bxyz )/(c27o1*o)); + xz_TN = -(c1o16*eps_new *(( bxyz + c3o1*cxyz)/(c54o1*o))); + xz_BN = -(c1o16*eps_new *(( bxyz - c3o1*cxyz)/(c54o1*o))); + //xz_ZERO= c1o16*eps_new; + xz_TNE = -(c1o16*eps_new *(( axyz + cxyz)/(c72o1*o))); + xz_TSW = c1o16*eps_new *((- axyz + cxyz)/(c72o1*o)); + xz_TSE = c1o16*eps_new *(( axyz + cxyz)/(c72o1*o)); + xz_TNW = c1o16*eps_new *(( axyz - cxyz)/(c72o1*o)); + + yz_E = -(c1o16*eps_new *(( c4o1*axyz )/(c27o1*o))); + yz_N = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_T = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); + yz_NE = -(c1o16*eps_new *(( axyz + c3o1*bxyz )/(c54o1*o))); + yz_SE = -(c1o16*eps_new *(( axyz - c3o1*bxyz )/(c54o1*o))); + yz_TE = -(c1o16*eps_new *(( axyz + c3o1*cxyz)/(c54o1*o))); + yz_BE = -(c1o16*eps_new *(( axyz - c3o1*cxyz)/(c54o1*o))); + yz_TN = c1o16*eps_new *(( axyz )/(c27o1*o)); + yz_BN = c1o16*eps_new *(( axyz )/(c27o1*o)); + //yz_ZERO= c1o16*eps_new; + yz_TNE = -(c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o))); + yz_TSW = c1o16*eps_new *(( - bxyz + cxyz)/(c72o1*o)); + yz_TSE = c1o16*eps_new *(( bxyz - cxyz)/(c72o1*o)); + yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) { using namespace D3Q27System; using namespace vf::lbm::dir; + using namespace vf::basics::constant; real rho = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.; - real vx1 = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz); - real vx2 = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz); - real vx3 = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz); + real vx1 = a0 + c1o4*( xs*ax + ys*ay + zs*az) + c1o16*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + c1o64*(xs*ys*zs*axyz); + real vx2 = b0 + c1o4*( xs*bx + ys*by + zs*bz) + c1o16*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + c1o64*(xs*ys*zs*bxyz); + real vx3 = c0 + c1o4*( xs*cx + ys*cy + zs*cz) + c1o16*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + c1o64*(xs*ys*zs*cxyz); ////////////////////////////////////////////////////////////////////////// //DRAFT @@ -577,105 +583,121 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(real* f, r //Position SWB -0.25, -0.25, -0.25 real IncompressibleOffsetInterpolationProcessor::calcPressBSW() { - return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NET * (c1o64 - c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 real IncompressibleOffsetInterpolationProcessor::calcPressTSW() { - return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NEB * (c1o64 - c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 real IncompressibleOffsetInterpolationProcessor::calcPressTSE() { - return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) + - press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + + press_NWB * (c1o64 + c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 real IncompressibleOffsetInterpolationProcessor::calcPressBSE() { - return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) + - press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + + press_NWT * (c1o64 + c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c27o64 - c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 real IncompressibleOffsetInterpolationProcessor::calcPressBNW() { - return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SET * (c1o64 - c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SEB * (c3o64 - c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NEB * (c9o64 - c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SWB * (c9o64 + c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NWB * (c27o64 + c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 real IncompressibleOffsetInterpolationProcessor::calcPressTNW() { - return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c9o64 + c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SEB * (c1o64 - c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NEB * (c3o64 - c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SWB * (c3o64 + c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NWB * (c9o64 + c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 real IncompressibleOffsetInterpolationProcessor::calcPressTNE() { - return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + - press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + - press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) + - press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) + - press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) + - press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) + - press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) + - press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + + press_SET * (c9o64 - c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + + press_SWT * (c3o64 + c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + + press_SWB * (c1o64 + c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + + press_NWB * (c3o64 + c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + + press_SEB * (c3o64 - c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + + press_NEB * (c9o64 - c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 real IncompressibleOffsetInterpolationProcessor::calcPressBNE() { - return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + - press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + - press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) + - press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) + - press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) + - press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) + - press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) + - press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff); + using namespace vf::basics::constant; + + return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + + press_SET * (c3o64 - c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + + press_SWT * (c1o64 + c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + + press_SWB * (c3o64 + c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + + press_NWB * (c9o64 + c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + + press_SEB * (c9o64 - c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + + press_NEB * (c27o64 - c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 @@ -683,15 +705,16 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, { using namespace D3Q27System; using namespace vf::lbm::dir; - - real press = press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) + - press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) + - press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) + - press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) + - press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff); + using namespace vf::basics::constant; + + real press = press_NET * (c4o32 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_NWT * (c4o32 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + press_SET * (c4o32 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_SWT * (c4o32 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + press_NEB * (c4o32 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_NWB * (c4o32 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + press_SEB * (c4o32 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + + press_SWB * (c4o32 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); real vx1 = a0; real vx2 = b0; real vx3 = c0; @@ -706,7 +729,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, real feq[ENDF+1]; D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3); - real eps_new = 2.; + real eps_new = c2o1; real o = omega; // LBMReal op = 1.; @@ -725,20 +748,20 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, //f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; //f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; - f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o)); - f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o)); - f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o)); - f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o)); - f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o)); - f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o)); - f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o)); - f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o)); - f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o)); - 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 = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); + f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); + f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); + f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); + f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); + f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); + f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); + f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); + f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); + f_ZERO = c0o1; + f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); + f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); + f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); f[DIR_P00] = f_E + feq[DIR_P00]; f[DIR_M00] = f_E + feq[DIR_M00]; @@ -778,10 +801,12 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(real x ////////////////////////////////////////////////////////////////////////// void IncompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { - tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); + using namespace vf::basics::constant; + + tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; + tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; + tauzz=cz+c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y; + tauxy=c1o2*((ay+c2o1*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+c2o1*bxx*x+bxy*y+bxz*z+bxyz*y*z)); + tauxz=c1o2*((az+c2o1*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+c2o1*cxx*x+cxy*y+cxz*z+cxyz*y*z)); + tauyz=c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp index 927dfeb158d0a89ca2081545420ac537ad7ae2e9..bf68b4d43930eb431b6cb23f0647266225298165 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp @@ -1,6 +1,6 @@ #include "InitDensityLBMKernel.h" #include "D3Q27EsoTwist3DSplittedVector.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "DataSet3D.h" #include "BCArray3D.h" #include "basics/constants/NumericConstants.h" @@ -30,7 +30,7 @@ SPtr<LBMKernel> InitDensityLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<InitDensityLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -61,7 +61,7 @@ real InitDensityLBMKernel::getCalculationTime() // nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); // zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); // -// BCArray3D<D3Q27BoundaryCondition>& bcArray = dynamicPointerCast<D3Q27ETBCProcessor>(this->getBCProcessor())->getBCArray(); +// BCArray3D<D3Q27BoundaryCondition>& bcArray = dynamicPointerCast<D3Q27ETBCSet>(this->getBCSet())->getBCArray(); // // const int bcArrayMaxX1 = (int)bcArray->getNX1(); // const int bcArrayMaxX2 = (int)bcArray->getNX2(); @@ -864,7 +864,7 @@ void InitDensityLBMKernel::calculate(int /*step*/) nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); SPtr<BoundaryConditions> bcPtr; real f[D3Q27System::ENDF+1]; real feq[D3Q27System::ENDF+1]; @@ -960,32 +960,32 @@ void InitDensityLBMKernel::calculate(int /*step*/) real cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3); feq[DIR_000] = c8o27*(drho-cu_sq); - 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[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); + feq[DIR_P00] = c2o27*(drho+c3o1*(vx1)+c9o2*(vx1)*(vx1)-cu_sq); + feq[DIR_M00] = c2o27*(drho+c3o1*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq); + feq[DIR_0P0] = c2o27*(drho+c3o1*(vx2)+c9o2*(vx2)*(vx2)-cu_sq); + feq[DIR_0M0] = c2o27*(drho+c3o1*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq); + feq[DIR_00P] = c2o27*(drho+c3o1*(vx3)+c9o2*(vx3)*(vx3)-cu_sq); + feq[DIR_00M] = c2o27*(drho+c3o1*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq); + feq[DIR_PP0] = c1o54*(drho+c3o1*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq); + feq[DIR_MM0] = c1o54*(drho+c3o1*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); + feq[DIR_PM0] = c1o54*(drho+c3o1*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq); + feq[DIR_MP0] = c1o54*(drho+c3o1*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); + feq[DIR_P0P] = c1o54*(drho+c3o1*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq); + feq[DIR_M0M] = c1o54*(drho+c3o1*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); + feq[DIR_P0M] = c1o54*(drho+c3o1*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq); + feq[DIR_M0P] = c1o54*(drho+c3o1*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); + feq[DIR_0PP] = c1o54*(drho+c3o1*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq); + feq[DIR_0MM] = c1o54*(drho+c3o1*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); + feq[DIR_0PM] = c1o54*(drho+c3o1*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq); + feq[DIR_0MP] = c1o54*(drho+c3o1*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); + feq[DIR_PPP] = c1o216*(drho+c3o1*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq); + feq[DIR_MMM] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + feq[DIR_PPM] = c1o216*(drho+c3o1*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq); + feq[DIR_MMP] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + feq[DIR_PMP] = c1o216*(drho+c3o1*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq); + feq[DIR_MPM] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + feq[DIR_PMM] = c1o216*(drho+c3o1*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq); + feq[DIR_MPP] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //Relaxation f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor; diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp index 33bf1e623ce943d4edf3b11c3f51ad585adf4262..f4b54988b4c3c20928f93359b22d74cf671c03e6 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp @@ -7,15 +7,15 @@ InterpolationHelper::~InterpolationHelper() = default; void InterpolationHelper::interpolate8to1(D3Q27ICell &icellF, real *icellC, real /*x1*/, real /*x2*/, real /*x3*/, real omega) { - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 1.0); + iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c1o1); iProcessor->calcInterpolatedNodeFC(icellC, omega); } ////////////////////////////////////////////////////////////////////////// void InterpolationHelper::interpolate8to1WithVelocity(D3Q27ICell &icellF, real x1, real x2, real x3, real omega, real &vx1, real &vx2, real &vx3) { - iProcessor->setOffsets(0.0, 0.0, 0.0); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0); + iProcessor->setOffsets(vf::basics::constant::c0o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); + iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c0o1); iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); } ////////////////////////////////////////////////////////////////////////// @@ -25,8 +25,8 @@ void InterpolationHelper::interpolate8to1WithVelocityWithShearStress(D3Q27ICell real &tauyy, real &tauzz, real &tauxy, real &tauxz, real &tauyz) { - iProcessor->setOffsets(0.0, 0.0, 0.0); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0); + iProcessor->setOffsets(vf::basics::constant::c0o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); + iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c0o1); iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); iProcessor->calcInterpolatedShearStress(x1, x2, x3, tauxx, tauyy, tauzz, tauxy, tauxz, tauyz); } diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp index 0f9a9a96586268c872562e4d2ddfab5ef8e6377c..7a86aaa19ea0f6ae170e4543c27c7cede7a859b4 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp @@ -33,7 +33,7 @@ #include "LBMKernel.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" @@ -49,9 +49,9 @@ LBMKernel::LBMKernel() this->nx[2] = 0; } ////////////////////////////////////////////////////////////////////////// -void LBMKernel::setBCProcessor(SPtr<BCProcessor> bcp) { bcProcessor = bcp; } +void LBMKernel::setBCSet(SPtr<BCSet> bcp) { bcSet = bcp; } ////////////////////////////////////////////////////////////////////////// -SPtr<BCProcessor> LBMKernel::getBCProcessor() const { return bcProcessor; } +SPtr<BCSet> LBMKernel::getBCSet() const { return bcSet; } ////////////////////////////////////////////////////////////////////////// void LBMKernel::setCollisionFactor(real collFactor) { this->collFactor = collFactor; } ////////////////////////////////////////////////////////////////////////// @@ -111,7 +111,9 @@ void LBMKernel::setForcingX3(const std::string &muParserString) ////////////////////////////////////////////////////////////////////////// void LBMKernel::checkFunction(mu::Parser fct) { - real x1 = 1.0, x2 = 1.0, x3 = 1.0, dt = 1.0, nue = 1.0, rho = 1.0; + using namespace vf::basics::constant; + + real x1 = c1o1, x2 = c1o1, x3 = c1o1, dt = c1o1, nue = c1o1, rho = c1o1; fct.DefineVar("x1", &x1); fct.DefineVar("x2", &x2); fct.DefineVar("x3", &x3); @@ -183,7 +185,7 @@ std::array<int, 3> LBMKernel::getNX() { return nx; } ////////////////////////////////////////////////////////////////////////// bool LBMKernel::isInsideOfDomain(const int &x1, const int &x2, const int &x3) const { - const SPtr<BCArray3D> bcArray = this->bcProcessor->getBCArray(); + const SPtr<BCArray3D> bcArray = this->bcSet->getBCArray(); return bcArray->isInsideOfDomain(x1, x2, x3, ghostLayerWidth); } ////////////////////////////////////////////////////////////////////////// @@ -234,3 +236,6 @@ void LBMKernel::setMobility(real mob) { this->mob = mob; } ////////////////////////////////////////////////////////////////////////// void LBMKernel::setInterfaceWidth(real w) { this->interfaceWidth = w; } ////////////////////////////////////////////////////////////////////////// +void LBMKernel::setSigma(real sigma){ this->sigma = sigma;} +////////////////////////////////////////////////////////////////////////// +real LBMKernel::getSigma() const { return sigma;} diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index bc12a1ed93ffc241f4e121207376e44533908259..fe397429610c6c76e6502a9956584b1cdd05f1cd 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -41,7 +41,7 @@ #include <limits> #include <muParser.h> -class BCProcessor; +class BCSet; class DataSet3D; class Block3D; @@ -59,8 +59,8 @@ public: void calculate(int step) override = 0; real getCalculationTime() override = 0; - void setBCProcessor(SPtr<BCProcessor> bcp) override; - SPtr<BCProcessor> getBCProcessor() const override; + void setBCSet(SPtr<BCSet> bcp) override; + SPtr<BCSet> getBCSet() const override; void setCollisionFactor(real collFactor) override; real getCollisionFactor() const override; @@ -129,10 +129,12 @@ public: real getPhaseFieldRelaxation() const; void setMobility(real mob); void setInterfaceWidth(real w); + void setSigma(real sigma); + real getSigma() const; protected: SPtr<DataSet3D> dataSet; - SPtr<BCProcessor> bcProcessor; + SPtr<BCSet> bcSet; real collFactor; int ghostLayerWidth{ 1 }; bool compressible{ false }; @@ -159,6 +161,7 @@ protected: real densityRatio; real beta; real kappa; + real sigma; real contactAngle; real phiL; real phiH; diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp index 1f7128541ebbff53ea2638998f2a1c576a65b33c..318b8cc037581a2239d0a1a487d70afdcd2d8685 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernelETD3Q27BGK.cpp @@ -3,7 +3,7 @@ #include "D3Q27EsoTwist3DSplittedVector.h" #include "D3Q27EsoTwist3DSoA.h" #include "DataSet3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "BCArray3D.h" #include "basics/constants/NumericConstants.h" @@ -33,7 +33,7 @@ SPtr<LBMKernel> LBMKernelETD3Q27BGK::clone() SPtr<LBMKernel> kernel(new LBMKernelETD3Q27BGK()); std::dynamic_pointer_cast<LBMKernelETD3Q27BGK>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -53,9 +53,9 @@ void LBMKernelETD3Q27BGK::calculate(int /*step*/) 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); - forcingX1 = 0; - forcingX2 = 0; - forcingX3 = 0; + forcingX1 = c0o1; + forcingX2 = c0o1; + forcingX3 = c0o1; } ///////////////////////////////////// @@ -63,7 +63,7 @@ void LBMKernelETD3Q27BGK::calculate(int /*step*/) nonLocalDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); zeroDistributions = std::dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); real f[D3Q27System::ENDF+1]; real feq[D3Q27System::ENDF+1]; real drho,vx1,vx2,vx3; @@ -140,35 +140,35 @@ void LBMKernelETD3Q27BGK::calculate(int /*step*/) + 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]; - real cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3); + real cu_sq= c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); feq[DIR_000] = c8o27*(drho-cu_sq); - 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[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); + feq[DIR_P00] = c2o27*(drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + feq[DIR_M00] = c2o27*(drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + feq[DIR_0P0] = c2o27*(drho+c3o1*( vx2)+c9o2*( vx2)*( vx2)-cu_sq); + feq[DIR_0M0] = c2o27*(drho+c3o1*( -vx2)+c9o2*( -vx2)*( -vx2)-cu_sq); + feq[DIR_00P] = c2o27*(drho+c3o1*( vx3 )+c9o2*( vx3)*( vx3)-cu_sq); + feq[DIR_00M] = c2o27*(drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + feq[DIR_PP0] = c1o54*(drho+c3o1*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq); + feq[DIR_MM0] = c1o54*(drho+c3o1*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq); + feq[DIR_PM0] = c1o54*(drho+c3o1*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq); + feq[DIR_MP0] = c1o54*(drho+c3o1*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq); + feq[DIR_P0P] = c1o54*(drho+c3o1*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq); + feq[DIR_M0M] = c1o54*(drho+c3o1*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq); + feq[DIR_P0M] = c1o54*(drho+c3o1*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq); + feq[DIR_M0P] = c1o54*(drho+c3o1*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq); + feq[DIR_0PP] = c1o54*(drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + feq[DIR_0MM] = c1o54*(drho+c3o1*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq); + feq[DIR_0PM] = c1o54*(drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + feq[DIR_0MP] = c1o54*(drho+c3o1*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq); + feq[DIR_PPP]= c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + feq[DIR_MMM]= c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + feq[DIR_PPM]= c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + feq[DIR_MMP]= c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + feq[DIR_PMP]= c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + feq[DIR_MPM]= c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + feq[DIR_PMM]= c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + feq[DIR_MPP]= c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //Relaxation f[DIR_000] += (feq[DIR_000]-f[DIR_000])*collFactor; @@ -212,33 +212,33 @@ void LBMKernelETD3Q27BGK::calculate(int /*step*/) forcingX2 = muForcingX2.Eval(); forcingX3 = muForcingX3.Eval(); - f[DIR_000] += 0.0 ; - 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) ; + f[DIR_000] += c0o1; + f[DIR_P00] += c3o1*c2o27 * (forcingX1) ; + f[DIR_M00] += c3o1*c2o27 * (-forcingX1) ; + f[DIR_0P0] += c3o1*c2o27 * (forcingX2) ; + f[DIR_0M0] += c3o1*c2o27 * (-forcingX2) ; + f[DIR_00P] += c3o1*c2o27 * (forcingX3) ; + f[DIR_00M] += c3o1*c2o27 * (-forcingX3); + f[DIR_PP0] += c3o1*c1o54 * ( forcingX1+forcingX2 ) ; + f[DIR_MM0 ] += c3o1*c1o54 * (-forcingX1-forcingX2 ) ; + f[DIR_PM0 ] += c3o1*c1o54 * ( forcingX1-forcingX2 ) ; + f[DIR_MP0 ] += c3o1*c1o54 * (-forcingX1+forcingX2 ) ; + f[DIR_P0P ] += c3o1*c1o54 * ( forcingX1 +forcingX3) ; + f[DIR_M0M ] += c3o1*c1o54 * (-forcingX1 -forcingX3) ; + f[DIR_P0M ] += c3o1*c1o54 * ( forcingX1 -forcingX3) ; + f[DIR_M0P ] += c3o1*c1o54 * (-forcingX1 +forcingX3) ; + f[DIR_0PP ] += c3o1*c1o54 * ( forcingX2+forcingX3) ; + f[DIR_0MM ] += c3o1*c1o54 * ( -forcingX2-forcingX3) ; + f[DIR_0PM ] += c3o1*c1o54 * ( forcingX2-forcingX3) ; + f[DIR_0MP ] += c3o1*c1o54 * ( -forcingX2+forcingX3) ; + f[DIR_PPP] += c3o1*c1o216* ( forcingX1+forcingX2+forcingX3) ; + f[DIR_MMM] += c3o1*c1o216* (-forcingX1-forcingX2-forcingX3) ; + f[DIR_PPM] += c3o1*c1o216* ( forcingX1+forcingX2-forcingX3) ; + f[DIR_MMP] += c3o1*c1o216* (-forcingX1-forcingX2+forcingX3) ; + f[DIR_PMP] += c3o1*c1o216* ( forcingX1-forcingX2+forcingX3) ; + f[DIR_MPM] += c3o1*c1o216* (-forcingX1+forcingX2-forcingX3) ; + f[DIR_PMM] += c3o1*c1o216* ( forcingX1-forcingX2-forcingX3) ; + f[DIR_MPP] += c3o1*c1o216* (-forcingX1+forcingX2+forcingX3) ; } ////////////////////////////////////////////////////////////////////////// #ifdef PROOF_CORRECTNESS @@ -299,5 +299,5 @@ void LBMKernelETD3Q27BGK::calculate(int /*step*/) ////////////////////////////////////////////////////////////////////////// real LBMKernelETD3Q27BGK::getCalculationTime() { - return 0.0; + return c0o1; } diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old b/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old deleted file mode 100644 index 2ab0e9df73c83b4de2b8824667452414f42dfa1d..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseSimpleVelocityBaseExternalPressureLBMKernel.cpp.old +++ /dev/null @@ -1,3024 +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 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/VoidLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp index 83d6a791e761190e3cdd34d101c4fd1d1588a191..7ab956494af3121eedfb56a22cb638a04c08efba 100644 --- a/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp @@ -1,7 +1,8 @@ #include "VoidLBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "DataSet3D.h" #include "VoidData3D.h" +#include "D3Q27System.h" VoidLBMKernel::VoidLBMKernel() = default; ////////////////////////////////////////////////////////////////////////// @@ -19,7 +20,7 @@ SPtr<LBMKernel> VoidLBMKernel::clone() kernel->setNX(nx); dynamicPointerCast<VoidLBMKernel>(kernel)->initDataSet(); kernel->setCollisionFactor(this->collFactor); - kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setBCSet(bcSet->clone(kernel)); kernel->setWithForcing(withForcing); kernel->setForcingX1(muForcingX1); kernel->setForcingX2(muForcingX2); @@ -31,4 +32,4 @@ SPtr<LBMKernel> VoidLBMKernel::clone() ////////////////////////////////////////////////////////////////////////// void VoidLBMKernel::calculate(int step) {} ////////////////////////////////////////////////////////////////////////// -real VoidLBMKernel::getCalculationTime() { return 0.0; } +real VoidLBMKernel::getCalculationTime() { return vf::basics::constant::c0o1; } diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h index bbc4face9f784d120c80dcfbbbd73d07951fe49b..e84d4b7cd7e205c5403e57b4f9a737e8007e2ee2 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h +++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h @@ -56,7 +56,7 @@ struct dataSetParam { }; //! \struct DataSetRestart -//! \brief Structure describes parameters of the dataSet in MPIIORestartCoProcessor format +//! \brief Structure describes parameters of the dataSet in MPIIORestartSimulationObserver format //! \details The structure is used when reading from the file struct DataSetRestart { real collFactor; @@ -74,7 +74,7 @@ struct DataSetRestart { }; //! \struct DataSetMigration -//! \brief Structure describes parameters of the dataSet in MPIIOMigrationCoProcessor format +//! \brief Structure describes parameters of the dataSet in MPIIOMigrationSimulationObserver format //! \details The structure is used to find the needed block in the grid when restoring a dataSet struct DataSetMigration { real collFactor; @@ -89,7 +89,7 @@ struct DataSetMigration { }; //! \struct DataSetSmallRead -//! \brief Structure describes parameters of the DataSetSmall in MPIIORestartCoProcessor format +//! \brief Structure describes parameters of the DataSetSmall in MPIIORestartSimulationObserver format //! \details The structure is used when reading from the file struct DataSetSmallRestart { int x1; @@ -98,7 +98,7 @@ struct DataSetSmallRestart { int level; }; //! \struct dataSetSmall -//! \brief Structure containes information identifying the block in MPIIOMigrationCoProcessor format +//! \brief Structure containes information identifying the block in MPIIOMigrationSimulationObserver format //! \details The structure is used to find the needed block in the grid when restoring a dataSet arrays struct DataSetSmallMigration { int globalID; @@ -138,7 +138,7 @@ struct boundCondParam { }; //! \struct BCAddRead -//! \brief Structure describes parameters of the BCAdd in MPIIORestartCoProcessor format +//! \brief Structure describes parameters of the BCAdd in MPIIORestartSimulationObserver format //! \details The structure is used when reading from the file struct BCAddRestart { int x1; // to find the right block @@ -151,7 +151,7 @@ struct BCAddRestart { //! \struct BCAdd //! \brief Structure containes information identifying the block and some parameters of the arrays -//! \of boundary conditions that are equal in all blocks in MPIIOMigrationCoProcessor format +//! \of boundary conditions that are equal in all blocks in MPIIOMigrationSimulationObserver format //! \details The structure is used to find the needed block in the grid when restoring a dataSet //! and to set common parameters struct BCAddMigration { diff --git a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp index 220fe67c5d0c34ecb40e4066c68d84649ca0dfc1..820af332b19754ee2a4325f0328bdb01de3d784b 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp +++ b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp @@ -76,7 +76,7 @@ void ZoltanPartitioner::partition() &exportToPart); /* Partition to which each vertex will belong */ if (rc != ZOLTAN_OK) { - cout << "Partitioning failed on process " << rank << "\n" << endl; + cout << "Partitioning failed on update " << rank << "\n" << endl; MPI_Finalize(); Zoltan_Destroy(&zz); exit(0); diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp b/src/cpu/VirtualFluidsCore/Simulation/Block3D.cpp similarity index 100% rename from src/cpu/VirtualFluidsCore/Grid/Block3D.cpp rename to src/cpu/VirtualFluidsCore/Simulation/Block3D.cpp diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.h b/src/cpu/VirtualFluidsCore/Simulation/Block3D.h similarity index 99% rename from src/cpu/VirtualFluidsCore/Grid/Block3D.h rename to src/cpu/VirtualFluidsCore/Simulation/Block3D.h index 686d8df0f9a4dda1b8d744b11b18a7bddf7e3f77..e909ae0723c6bc1c2bda778831a18e33851ec249 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Block3D.h +++ b/src/cpu/VirtualFluidsCore/Simulation/Block3D.h @@ -27,7 +27,7 @@ // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // //! \file Block3D.h -//! \ingroup Grid +//! \ingroup Simulation //! \author Konstantin Kutscher //======================================================================================= diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp similarity index 100% rename from src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp rename to src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h similarity index 99% rename from src/cpu/VirtualFluidsCore/Grid/Grid3D.h rename to src/cpu/VirtualFluidsCore/Simulation/Grid3D.h index 41a99d6cc7be5177cc0f3ff2e89591b28317fede..821adff473961fafa00be08ca2cf8e2339353b51 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h +++ b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h @@ -27,7 +27,7 @@ // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // //! \file Grid.h -//! \ingroup Grid +//! \ingroup Simulation //! \author Konstantin Kutscher, Soeren Freudiger, Sebastian Geller //======================================================================================= diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp b/src/cpu/VirtualFluidsCore/Simulation/Simulation.cpp similarity index 54% rename from src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp rename to src/cpu/VirtualFluidsCore/Simulation/Simulation.cpp index 92559f5f37d0b39a086b6bab0e63157b79c9f718..e3b0169847d43efd62bdf7dabf80fdc009027d46 100644 --- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/Simulation/Simulation.cpp @@ -26,16 +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 BasicCalculator.cpp +//! \file Simulation.cpp //! \ingroup Grid //! \author Konstantin Kutscher //======================================================================================= -#include "BasicCalculator.h" +#include "Simulation.h" -#include "BCProcessor.h" #include "Block3D.h" #include "Block3DConnector.h" +#include "SimulationObserver.h" +#include "Grid3D.h" +#include "BCSet.h" +#include "Block3DConnector.h" #include "LBMKernel.h" #include "UbLogger.h" #include "UbScheduler.h" @@ -45,22 +48,207 @@ #endif #define OMP_SCHEDULE guided -//#define TIMING -//#include "UbTiming.h" +// #define TIMING +// #include "UbTiming.h" + +#include <basics/utilities/UbException.h> + + +Simulation::Simulation(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps) + : grid(grid), additionalGhostLayerUpdateScheduler(additionalGhostLayerUpdateScheduler), + numberOfTimeSteps(numberOfTimeSteps) +{ + this->grid = grid; + startTimeStep = int(grid->getTimeStep()) + 1; + minLevel = grid->getCoarsestInitializedLevel(); + maxLevel = grid->getFinestInitializedLevel(); + if (maxLevel > 0) + refinement = true; + else + refinement = false; + blocks.resize(maxLevel + 1); + localConns.resize(maxLevel + 1); + remoteConns.resize(maxLevel + 1); + localInterConns.resize(maxLevel); + remoteInterConns.resize(maxLevel); + + int gridRank = grid->getRank(); + + for (int level = minLevel; level <= maxLevel; level++) { + std::vector<SPtr<Block3D>> blockVector; + grid->getBlocks(level, gridRank, true, blockVector); + for (const auto &block : blockVector) + if (block) + blocks[block->getLevel()].push_back(block); + } + + initLocalConnectors(); + initRemoteConnectors(); +} +////////////////////////////////////////////////////////////////////////// +Simulation::~Simulation() = default; +////////////////////////////////////////////////////////////////////////// +void Simulation::addSimulationObserver(SPtr<SimulationObserver> coProcessor) { simulationObserver.push_back(coProcessor); } +////////////////////////////////////////////////////////////////////////// +void Simulation::notifyObservers(real step) +{ + for (SPtr<SimulationObserver> cp : simulationObserver) { + cp->update(step); + } +} +////////////////////////////////////////////////////////////////////////// +void Simulation::initLocalConnectors() +{ + UBLOG(logDEBUG1, "Simulation::initLocalConnectors() - start"); + + for (int l = minLevel; l <= maxLevel; l++) { + for (SPtr<Block3D> block : blocks[l]) { + block->pushBackLocalSameLevelConnectors(localConns[l]); + + if (l != maxLevel) + block->pushBackLocalInterpolationConnectorsCF(localInterConns[l]); + } + if (l != maxLevel) { + for (SPtr<Block3D> block : blocks[l + 1]) { + block->pushBackLocalInterpolationConnectorsFC(localInterConns[l]); + } + } + UBLOG(logDEBUG5, "Simulation::initConnectors()-initConnectors(localConns[" << l << "])"); + initConnectors(localConns[l]); + + if (l != maxLevel) { + UBLOG(logDEBUG5, "Simulation::initConnectors()-initConnectors(localInterConns[" << l << "])"); + initConnectors(localInterConns[l]); + } + } + + UBLOG(logDEBUG1, "Simulation::initLocalConnectors() - end"); +} +////////////////////////////////////////////////////////////////////////// +void Simulation::initRemoteConnectors() +{ + std::vector<std::vector<SPtr<Block3DConnector>>> remoteInterConnsCF; + std::vector<std::vector<SPtr<Block3DConnector>>> remoteInterConnsFC; + remoteInterConnsCF.resize(maxLevel + 1); + remoteInterConnsFC.resize(maxLevel + 1); + + for (int l = minLevel; l <= maxLevel; l++) { + std::vector<SPtr<Block3D>> blockVector; + // grid->getBlocks(level, gridRank, true, blockVector); + grid->getBlocks(l, blockVector); + for (SPtr<Block3D> block : blockVector) { + int block_level = block->getLevel(); + block->pushBackRemoteSameLevelConnectors(remoteConns[block_level]); + + block->pushBackRemoteInterpolationConnectorsCF(remoteInterConnsCF[block_level]); + block->pushBackRemoteInterpolationConnectorsFC(remoteInterConnsFC[block_level]); + } + } + + for (int l = minLevel; l <= maxLevel; l++) { + UBLOG(logDEBUG5, "Simulation::initRemoteConnectors()-initConnectors(remoteConns[" << l << "])"); + initConnectors(remoteConns[l]); + if (l != maxLevel) { + for (size_t i = 0; i < remoteInterConnsCF[l].size(); i++) + remoteInterConns[l].push_back(remoteInterConnsCF[l][i]); + for (size_t i = 0; i < remoteInterConnsFC[l + 1].size(); i++) + remoteInterConns[l].push_back(remoteInterConnsFC[l + 1][i]); + } + } + ////////////////////////////////////////////////////////////////////////// + // UBLOG(logDEBUG5, "Simulation::initConnectors() - connectoren initialisieren - start"); + for (int l = minLevel; l <= maxLevel; l++) { + if (l != maxLevel) { + UBLOG(logDEBUG5, "Simulation::initRemoteConnectors()-initConnectors(remoteInterConns[" << l << "])"); + for (SPtr<Block3DConnector> c : remoteInterConns[l]) + c->init(); + } + } + // UBLOG(logDEBUG5, "Simulation::initConnectors() - connectoren initialisieren - end"); + ////////////////////////////////////////////////////////////////////////// + // sendTransmitterDataSize + // UBLOG(logDEBUG5, "Simulation::initConnectors() - sendTransmitterDataSize - start"); + for (int l = minLevel; l <= maxLevel; l++) { + if (l != maxLevel) { + UBLOG(logDEBUG5, + "Simulation::initRemoteConnectors()-sendTransmitterDataSize(remoteInterConns[" << l << "])"); + for (SPtr<Block3DConnector> c : remoteInterConns[l]) + c->sendTransmitterDataSize(); + } + } + // UBLOG(logDEBUG5, "Simulation::initConnectors() - sendTransmitterDataSize - end"); + ////////////////////////////////////////////////////////////////////////// + // receiveTransmitterDataSize + // if it stops here during distributed calculations, then there is probably an inactive block on one side!!! + // UBLOG(logDEBUG5, "Simulation::initConnectors() - receiveTransmitterDataSize - start"); + for (int l = minLevel; l <= maxLevel; l++) { + if (l != maxLevel) { + UBLOG(logDEBUG5, + "Simulation::initRemoteConnectors()-receiveTransmitterDataSize(remoteInterConns[" << l << "])"); + for (SPtr<Block3DConnector> c : remoteInterConns[l]) + c->receiveTransmitterDataSize(); + } + } + // UBLOG(logDEBUG5, "Simulation::initConnectors() - receiveTransmitterDataSize - end"); + ////////////////////////////////////////////////////////////////////////// +} +////////////////////////////////////////////////////////////////////////// +void Simulation::initConnectors(std::vector<SPtr<Block3DConnector>> &connectors) +{ + UBLOG(logDEBUG1, "Simulation::initConnectors() - start"); + + // initialization + ////////////////////////////////////////////////////////////////////////// + // initialize connectors + UBLOG(logDEBUG5, "Simulation::initConnectors() - connectoren initialisieren - start"); + for (SPtr<Block3DConnector> c : connectors) + c->init(); + UBLOG(logDEBUG5, "Simulation::initConnectors() - connectoren initialisieren - end"); + ////////////////////////////////////////////////////////////////////////// + // sendTransmitterDataSize + UBLOG(logDEBUG5, "Simulation::initConnectors() - sendTransmitterDataSize - start"); + for (SPtr<Block3DConnector> c : connectors) + c->sendTransmitterDataSize(); + UBLOG(logDEBUG5, "Simulation::initConnectors() - sendTransmitterDataSize - end"); + ////////////////////////////////////////////////////////////////////////// + // receiveTransmitterDataSize + // if it stops here during distributed calculations, then there is probably an inactive block on one side!!! + UBLOG(logDEBUG5, "Simulation::initConnectors() - receiveTransmitterDataSize - start"); + for (SPtr<Block3DConnector> c : connectors) + c->receiveTransmitterDataSize(); + UBLOG(logDEBUG5, "Simulation::initConnectors() - receiveTransmitterDataSize - end"); -BasicCalculator::BasicCalculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, - int numberOfTimeSteps) - : Calculator(grid, additionalGhostLayerUpdateScheduler, numberOfTimeSteps) + UBLOG(logDEBUG1, "Simulation::initConnectors() - end"); +} +////////////////////////////////////////////////////////////////////////// +void Simulation::deleteBlocks() { + for (std::vector<SPtr<Block3D>> &bs : blocks) + bs.resize(0); +} +////////////////////////////////////////////////////////////////////////// +void Simulation::deleteConnectors() +{ + deleteConnectors(localConns); + deleteConnectors(remoteConns); + + deleteConnectors(localInterConns); + deleteConnectors(remoteInterConns); } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::calculate() +void Simulation::deleteConnectors(std::vector<std::vector<SPtr<Block3DConnector>>> &conns) { - UBLOG(logDEBUG1, "OMPCalculator::calculate() - started"); + for (std::vector<SPtr<Block3DConnector>> &c : conns) + c.resize(0); +} +////////////////////////////////////////////////////////////////////////// +void Simulation::run() +{ + UBLOG(logDEBUG1, "OMPSimulation::calculate() - started"); int calcStep = 0; try { - int minInitLevel = minLevel; - int maxInitLevel = maxLevel - minLevel; + int minInitLevel = minLevel; + int maxInitLevel = maxLevel - minLevel; int straightStartLevel = minInitLevel; int internalIterations = 1 << (maxInitLevel - minInitLevel); int threshold; @@ -75,16 +263,15 @@ void BasicCalculator::calculate() #ifdef TIMING UBLOG(logINFO, "calcStep = " << calcStep); #endif - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - for (int staggeredStep = 1; staggeredStep <= internalIterations; staggeredStep++) - { - if (staggeredStep == internalIterations) straightStartLevel = minInitLevel; - else - { - for (straightStartLevel = maxInitLevel, threshold = 1; - (staggeredStep & threshold) != threshold; straightStartLevel--, threshold <<= 1); - } + for (int staggeredStep = 1; staggeredStep <= internalIterations; staggeredStep++) { + if (staggeredStep == internalIterations) + straightStartLevel = minInitLevel; + else { + for (straightStartLevel = maxInitLevel, threshold = 1; (staggeredStep & threshold) != threshold; straightStartLevel--, threshold <<= 1) + ; + } #ifdef TIMING timer.resetAndStart(); #endif @@ -124,8 +311,7 @@ void BasicCalculator::calculate() #endif ////////////////////////////////////////////////////////////////////////// if (refinement) { - if (straightStartLevel < maxInitLevel) - exchangeBlockData(straightStartLevel, maxInitLevel); + if (straightStartLevel < maxInitLevel) exchangeBlockData(straightStartLevel, maxInitLevel); ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[4] = timer.stop(); @@ -147,10 +333,10 @@ void BasicCalculator::calculate() if (additionalGhostLayerUpdateScheduler->isDue(calcStep)) { exchangeBlockData(straightStartLevel, maxInitLevel); } - coProcess((real)(calcStep)); + notifyObservers((real)(calcStep)); // now ghost nodes have actual values } - UBLOG(logDEBUG1, "OMPCalculator::calculate() - stoped"); + UBLOG(logDEBUG1, "OMPSimulation::calculate() - stoped"); } catch (std::exception &e) { UBLOG(logERROR, e.what()); UBLOG(logERROR, " step = " << calcStep); @@ -167,7 +353,7 @@ void BasicCalculator::calculate() } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::calculateBlocks(int startLevel, int maxInitLevel, int calcStep) +void Simulation::calculateBlocks(int startLevel, int maxInitLevel, int calcStep) { #ifdef _OPENMP #pragma omp parallel @@ -199,7 +385,7 @@ void BasicCalculator::calculateBlocks(int startLevel, int maxInitLevel, int calc } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::exchangeBlockData(int startLevel, int maxInitLevel) +void Simulation::exchangeBlockData(int startLevel, int maxInitLevel) { // startLevel bis maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { @@ -213,7 +399,7 @@ void BasicCalculator::exchangeBlockData(int startLevel, int maxInitLevel) } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::swapDistributions(int startLevel, int maxInitLevel) +void Simulation::swapDistributions(int startLevel, int maxInitLevel) { #ifdef _OPENMP #pragma omp parallel @@ -232,7 +418,7 @@ void BasicCalculator::swapDistributions(int startLevel, int maxInitLevel) } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::connectorsPrepareLocal(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsPrepareLocal(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); #ifdef _OPENMP @@ -249,7 +435,7 @@ void BasicCalculator::connectorsPrepareLocal(std::vector<SPtr<Block3DConnector>> } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::connectorsSendLocal(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsSendLocal(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); #ifdef _OPENMP @@ -266,7 +452,7 @@ void BasicCalculator::connectorsSendLocal(std::vector<SPtr<Block3DConnector>> &c } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::connectorsReceiveLocal(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsReceiveLocal(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); #ifdef _OPENMP @@ -277,7 +463,7 @@ void BasicCalculator::connectorsReceiveLocal(std::vector<SPtr<Block3DConnector>> connectors[i]->distributeReceiveVectors(); } } -void BasicCalculator::connectorsPrepareRemote(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsPrepareRemote(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); for (int i = 0; i < size; i++) { @@ -286,7 +472,7 @@ void BasicCalculator::connectorsPrepareRemote(std::vector<SPtr<Block3DConnector> } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::connectorsSendRemote(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsSendRemote(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); for (int i = 0; i < size; i++) { @@ -295,7 +481,7 @@ void BasicCalculator::connectorsSendRemote(std::vector<SPtr<Block3DConnector>> & } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::connectorsReceiveRemote(std::vector<SPtr<Block3DConnector>> &connectors) +void Simulation::connectorsReceiveRemote(std::vector<SPtr<Block3DConnector>> &connectors) { int size = (int)connectors.size(); for (int i = 0; i < size; i++) { @@ -304,7 +490,7 @@ void BasicCalculator::connectorsReceiveRemote(std::vector<SPtr<Block3DConnector> } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::interpolation(int startLevel, int maxInitLevel) +void Simulation::interpolation(int startLevel, int maxInitLevel) { for (int level = startLevel; level < maxInitLevel; level++) { connectorsPrepareLocal(localInterConns[level]); @@ -322,7 +508,7 @@ void BasicCalculator::interpolation(int startLevel, int maxInitLevel) } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) +void Simulation::applyPreCollisionBC(int startLevel, int maxInitLevel) { // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { @@ -332,7 +518,7 @@ void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) #endif for (int i = 0; i < size; i++) { try { - blocks[level][i]->getKernel()->getBCProcessor()->applyPreCollisionBC(); + blocks[level][i]->getKernel()->getBCSet()->applyPreCollisionBC(); } catch (std::exception &e) { UBLOG(logERROR, e.what()); exit(EXIT_FAILURE); @@ -347,7 +533,7 @@ void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) } } ////////////////////////////////////////////////////////////////////////// -void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) +void Simulation::applyPostCollisionBC(int startLevel, int maxInitLevel) { // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { @@ -357,7 +543,7 @@ void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) #endif for (int i = 0; i < size; i++) { try { - blocks[level][i]->getKernel()->getBCProcessor()->applyPostCollisionBC(); + blocks[level][i]->getKernel()->getBCSet()->applyPostCollisionBC(); } catch (std::exception &e) { UBLOG(logERROR, e.what()); exit(EXIT_FAILURE); @@ -370,4 +556,4 @@ void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) } } } -} +} \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/Grid/Calculator.h b/src/cpu/VirtualFluidsCore/Simulation/Simulation.h similarity index 71% rename from src/cpu/VirtualFluidsCore/Grid/Calculator.h rename to src/cpu/VirtualFluidsCore/Simulation/Simulation.h index 759541dd5c1a85cac727c9a714407d1fa10a1cb7..ba66b385a3eb9da2e15af72eaa31c8e896780f30 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Calculator.h +++ b/src/cpu/VirtualFluidsCore/Simulation/Simulation.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 Calculator.h -//! \ingroup Grid +//! \file Simulation.h +//! \ingroup Simulation //! \author Konstantin Kutscher //======================================================================================= -#ifndef CALCULATOR_H -#define CALCULATOR_H +#ifndef Simulation_H +#define Simulation_H #include <PointerDefinitions.h> #include <vector> @@ -42,21 +42,21 @@ class Grid3D; class UbScheduler; class Block3D; class Block3DConnector; -class CoProcessor; +class SimulationObserver; -//! \class Calculator -//! \brief A base class for main calculation loop +//! \class Simulation +//! \brief A base class for main simulation loop -class Calculator +class Simulation { public: - Calculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps); - virtual ~Calculator(); + Simulation(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps); + virtual ~Simulation(); //! control of coProcessors - void addCoProcessor(SPtr<CoProcessor> coProcessor); - void coProcess(real step); + void addSimulationObserver(SPtr<SimulationObserver> coProcessor); + void notifyObservers(real step); - virtual void calculate() = 0; + virtual void run(); protected: virtual void initLocalConnectors(); @@ -66,6 +66,19 @@ protected: void deleteConnectors(); void deleteConnectors(std::vector<std::vector<SPtr<Block3DConnector>>> &conns); + void calculateBlocks(int startLevel, int maxInitLevel, int calcStep); + void swapDistributions(int startLevel, int maxInitLevel); + void exchangeBlockData(int startLevel, int maxInitLevel); + void connectorsPrepareLocal(std::vector<SPtr<Block3DConnector>> &connectors); + void connectorsSendLocal(std::vector<SPtr<Block3DConnector>> &connectors); + void connectorsReceiveLocal(std::vector<SPtr<Block3DConnector>> &connectors); + void connectorsPrepareRemote(std::vector<SPtr<Block3DConnector>> &connectors); + void connectorsSendRemote(std::vector<SPtr<Block3DConnector>> &connectors); + void connectorsReceiveRemote(std::vector<SPtr<Block3DConnector>> &connectors); + void interpolation(int startLevel, int maxInitLevel); + void applyPreCollisionBC(int startLevel, int maxInitLevel); + void applyPostCollisionBC(int startLevel, int maxInitLevel); + int minLevel, maxLevel; int startTimeStep; int numberOfTimeSteps; @@ -86,7 +99,7 @@ protected: std::vector<std::vector<SPtr<Block3DConnector>>> localInterConns; std::vector<std::vector<SPtr<Block3DConnector>>> remoteInterConns; - std::vector<SPtr<CoProcessor>> coProcessors; + std::vector<SPtr<SimulationObserver>> simulationObserver; }; #endif diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp similarity index 90% rename from src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp index f3137e5f63dff257d1311eee8d75550f186b480e..2254b9b02ea383e18c654a7569f0e5b2e973c839 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp @@ -1,8 +1,8 @@ /* - * D3Q27AdjustForcingCoProcessor.cpp + * D3Q27AdjustForcingSimulationObserver.cpp * Author: Konstantin Kutscher */ -#include "AdjustForcingCoProcessor.h" +#include "AdjustForcingSimulationObserver.h" #include <fstream> @@ -12,11 +12,11 @@ #include "UbScheduler.h" #include <SetForcingBlockVisitor.h> -AdjustForcingCoProcessor::AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +AdjustForcingSimulationObserver::AdjustForcingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> integrateValues, real vTarged, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), integrateValues(integrateValues), comm(comm), vx1Targed(vTarged) + : SimulationObserver(grid, s), path(path), integrateValues(integrateValues), comm(comm), vx1Targed(vTarged) { // cnodes = integrateValues->getCNodes(); root = comm->isRoot(); @@ -71,13 +71,13 @@ AdjustForcingCoProcessor::AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbSch } ////////////////////////////////////////////////////////////////////////// -void AdjustForcingCoProcessor::process(real step) +void AdjustForcingSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void AdjustForcingCoProcessor::collectData(real step) +void AdjustForcingSimulationObserver::collectData(real step) { ////////////////////////////////////////////////////////////////////////////////////////////////// // temporary solution @@ -140,7 +140,7 @@ void AdjustForcingCoProcessor::collectData(real step) //} if (root) { - // UBLOG(logINFO, "D3Q27AdjustForcingCoProcessor step: " << static_cast<int>(step)); + // UBLOG(logINFO, "D3Q27AdjustForcingSimulationObserver step: " << static_cast<int>(step)); // UBLOG(logINFO, "new forcing is: " << forcing); std::string fname = path + "/forcing/forcing.csv"; // std::string fname = path + "/forcing/forcing_"+UbSystem::toString(comm->getProcessID())+".csv"; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h similarity index 79% rename from src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h index be8dbc69f957521cff88cfbcc2b7260db05d6cdc..9e570e34dc43fa025c47c3d3c29c0dad4a262b99 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h @@ -1,10 +1,10 @@ -#ifndef D3Q27ADJUSTFORCINGCoProcessor_H -#define D3Q27ADJUSTFORCINGCoProcessor_H +#ifndef D3Q27ADJUSTFORCINGSimulationObserver_H +#define D3Q27ADJUSTFORCINGSimulationObserver_H #include <PointerDefinitions.h> #include <string> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "lbm/constants/D3Q27.h" namespace vf::mpi {class Communicator;} @@ -18,13 +18,13 @@ class IntegrateValuesHelper; //! Integrate values helper, scheduler must be set in test case. //! \author: Konstantin Kutscher -class AdjustForcingCoProcessor : public CoProcessor +class AdjustForcingSimulationObserver : public SimulationObserver { public: - AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + AdjustForcingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> integrateValues, real vTarged, std::shared_ptr<vf::mpi::Communicator> comm); //!< calls collect PostprocessData - void process(real step) override; + void update(real step) override; protected: //!< object that can compute spacial average values in 3D-subdomain. @@ -55,4 +55,4 @@ private: std::string path; }; -#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */ +#endif /* D3Q27RHODIFFERENCESimulationObserver_H_ */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp similarity index 94% rename from src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp index 1a5276fcf44098254cee825af503a4752df60cd5..1adf3ad9944a49c8065756988e95ab837e9f6d15 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "AverageValuesCoProcessor.h" +#include "AverageValuesSimulationObserver.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "LBMKernel.h" #include "basics/writer/WbWriterVtkXmlASCII.h" @@ -15,12 +15,12 @@ using namespace std; -AverageValuesCoProcessor::AverageValuesCoProcessor() = default; +AverageValuesSimulationObserver::AverageValuesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -AverageValuesCoProcessor::AverageValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, +AverageValuesSimulationObserver::AverageValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, SPtr<UbScheduler> Avs, SPtr<UbScheduler> rsMeans, SPtr<UbScheduler> rsRMS, bool restart) - : CoProcessor(grid, s), averageScheduler(Avs), resetSchedulerMeans(rsMeans), resetSchedulerRMS(rsRMS), path(path), + : SimulationObserver(grid, s), averageScheduler(Avs), resetSchedulerMeans(rsMeans), resetSchedulerRMS(rsRMS), path(path), writer(writer) { resetStepMeans = (int)rsMeans->getMinBegin(); @@ -54,7 +54,7 @@ AverageValuesCoProcessor::AverageValuesCoProcessor(SPtr<Grid3D> grid, const std: // restartStep = 0.0; } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::process(real step) +void AverageValuesSimulationObserver::update(real step) { // resetRMS(step); if (resetSchedulerRMS->isDue(step)) @@ -73,10 +73,10 @@ void AverageValuesCoProcessor::process(real step) collectData(step); } - UBLOG(logDEBUG3, "AverageValuesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "AverageValuesSimulationObserver::update:" << step); } -void AverageValuesCoProcessor::resetDataRMS(real step) +void AverageValuesSimulationObserver::resetDataRMS(real step) { resetStepRMS = (int)step; @@ -84,7 +84,7 @@ void AverageValuesCoProcessor::resetDataRMS(real step) for (SPtr<Block3D> block : blockVector[level]) { if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); @@ -120,7 +120,7 @@ void AverageValuesCoProcessor::resetDataRMS(real step) } } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::resetDataMeans(real step) +void AverageValuesSimulationObserver::resetDataMeans(real step) { resetStepMeans = (int)step; @@ -128,7 +128,7 @@ void AverageValuesCoProcessor::resetDataMeans(real step) for (SPtr<Block3D> block : blockVector[level]) { if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); @@ -161,7 +161,7 @@ void AverageValuesCoProcessor::resetDataMeans(real step) } } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::collectData(real step) +void AverageValuesSimulationObserver::collectData(real step) { int istep = int(step); @@ -195,18 +195,18 @@ void AverageValuesCoProcessor::collectData(real step) vector<string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "AverageValuesCoProcessor step: " << istep); + UBLOG(logINFO, "AverageValuesSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::clearData() +void AverageValuesSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -214,7 +214,7 @@ void AverageValuesCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::addData(const SPtr<Block3D> block) +void AverageValuesSimulationObserver::addData(const SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); // UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -238,7 +238,7 @@ void AverageValuesCoProcessor::addData(const SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); // int ghostLayerWidth = kernel->getGhostLayerWidth(); @@ -330,7 +330,7 @@ void AverageValuesCoProcessor::addData(const SPtr<Block3D> block) } } ////////////////////////////////////////////////////////////////////////// -void AverageValuesCoProcessor::calculateAverageValues(real timeStep) +void AverageValuesSimulationObserver::calculateAverageValues(real timeStep) { using namespace D3Q27System; @@ -348,7 +348,7 @@ void AverageValuesCoProcessor::calculateAverageValues(real timeStep) for (SPtr<Block3D> block : blockVector[level]) { if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); @@ -446,7 +446,7 @@ void AverageValuesCoProcessor::calculateAverageValues(real timeStep) } } //////////////////////////////////////////////////////////////////////////// -// void AverageValuesCoProcessor::initPlotData(double step) +// void AverageValuesSimulationObserver::initPlotData(double step) //{ // std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); // if (comm->getProcessID() == comm->getRoot()) @@ -469,7 +469,7 @@ void AverageValuesCoProcessor::calculateAverageValues(real timeStep) // } //} ////////////////////////////////////////////////////////////////////////////// -// void AverageValuesCoProcessor::collectPlotData(double step) +// void AverageValuesSimulationObserver::collectPlotData(double step) //{ // // double hminX1 = 0.9; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.h similarity index 88% rename from src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.h index b45118adb5b9a18de0eabcc061fa18e11c042bdf..b5ce823ba3cedffd145d0d513c5acf715a631430 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.h @@ -1,11 +1,11 @@ -#ifndef AverageValuesCoProcessor_H -#define AverageValuesCoProcessor_H +#ifndef AverageValuesSimulationObserver_H +#define AverageValuesSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -22,14 +22,14 @@ class Block3D; // //! \author Sonja Uphoff, Kostyantyn Kucher // \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ -class AverageValuesCoProcessor : public CoProcessor +class AverageValuesSimulationObserver : public SimulationObserver { public: - AverageValuesCoProcessor(); - AverageValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, + AverageValuesSimulationObserver(); + AverageValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, SPtr<UbScheduler> Avs, SPtr<UbScheduler> rsMeans, SPtr<UbScheduler> rsRMS, bool restart); //! Make update - void process(real step) override; + void update(real step) override; //! Resets averaged velocity and RMS-values according to ResetSceduler void reset(real step); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp similarity index 87% rename from src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp index d50c58d5698a7faa0939fedd613075873d9e5363..8610c5df9e4b56496c3dc3ba1c25fabfd355f294 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "CalculateForcesCoProcessor.h" -#include "BCProcessor.h" +#include "CalculateForcesSimulationObserver.h" +#include "BCSet.h" #include "BCArray3D.h" #include "Block3D.h" @@ -13,9 +13,9 @@ #include "LBMKernel.h" #include "UbScheduler.h" -CalculateForcesCoProcessor::CalculateForcesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +CalculateForcesSimulationObserver::CalculateForcesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm, real v, real a) - : CoProcessor(grid, s), path(path), comm(comm), v(v), a(a), forceX1global(0), forceX2global(0), forceX3global(0) + : SimulationObserver(grid, s), path(path), comm(comm), v(v), a(a), forceX1global(0), forceX2global(0), forceX3global(0) { if (comm->getProcessID() == comm->getRoot()) { std::ofstream ostr; @@ -55,17 +55,17 @@ CalculateForcesCoProcessor::CalculateForcesCoProcessor(SPtr<Grid3D> grid, SPtr<U } } ////////////////////////////////////////////////////////////////////////// -CalculateForcesCoProcessor::~CalculateForcesCoProcessor() = default; +CalculateForcesSimulationObserver::~CalculateForcesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::process(real step) +void CalculateForcesSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "D3Q27ForcesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::collectData(real step) +void CalculateForcesSimulationObserver::collectData(real step) { calculateForces(); @@ -101,7 +101,7 @@ void CalculateForcesCoProcessor::collectData(real step) } } ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::calculateForces() +void CalculateForcesSimulationObserver::calculateForces() { forceX1global = 0.0; forceX2global = 0.0; @@ -117,7 +117,7 @@ void CalculateForcesCoProcessor::calculateForces() std::set<std::vector<int>> &transNodeIndicesSet = t.second; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); distributions->swap(); @@ -184,7 +184,7 @@ void CalculateForcesCoProcessor::calculateForces() } } ////////////////////////////////////////////////////////////////////////// -UbTupleDouble3 CalculateForcesCoProcessor::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, +UbTupleDouble3 CalculateForcesSimulationObserver::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) { UbTupleDouble3 force(0.0, 0.0, 0.0); @@ -215,7 +215,7 @@ UbTupleDouble3 CalculateForcesCoProcessor::getForces(int x1, int x2, int x3, SPt return force; } ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::calculateCoefficients() +void CalculateForcesSimulationObserver::calculateCoefficients() { real F1 = forceX1global; real F2 = forceX2global; @@ -227,9 +227,9 @@ void CalculateForcesCoProcessor::calculateCoefficients() C3 = 2.0 * F3 / (v * v * a); } ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } +void CalculateForcesSimulationObserver::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } ////////////////////////////////////////////////////////////////////////// -void CalculateForcesCoProcessor::write(std::ofstream *fileObject, real value, char *separator) +void CalculateForcesSimulationObserver::write(std::ofstream *fileObject, real value, char *separator) { (*fileObject).width(12); //(*fileObject).precision(2); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h similarity index 71% rename from src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h index d282ae8ed10ae177ae78e4f559018d7ff0959be7..02b76e77bc6bfb3ee375e79465f2d548226189cb 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h @@ -1,18 +1,18 @@ /* - * D3Q27ForcesCoProcessor.h + * D3Q27ForcesSimulationObserver.h * * Created on: 29.09.2012 * Author: K. Kucher */ -#ifndef D3Q27ForcesCoProcessor_H -#define D3Q27ForcesCoProcessor_H +#ifndef D3Q27ForcesSimulationObserver_H +#define D3Q27ForcesSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "UbTuple.h" #include "lbm/constants/D3Q27.h" @@ -24,16 +24,16 @@ class D3Q27Interactor; class DistributionArray3D; class BoundaryConditions; -class CalculateForcesCoProcessor : public CoProcessor +class CalculateForcesSimulationObserver : public SimulationObserver { public: //! Constructor //! \param v - velocity of fluid in LB units //! \param a - area of object in LB units - CalculateForcesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm, + CalculateForcesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm, real v, real a); - ~CalculateForcesCoProcessor() override; - void process(real step) override; + ~CalculateForcesSimulationObserver() override; + void update(real step) override; void addInteractor(SPtr<D3Q27Interactor> interactor); protected: @@ -58,4 +58,4 @@ private: real C3; }; -#endif /* D3Q27ForcesCoProcessor_H */ +#endif /* D3Q27ForcesSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..768fbbb26241edfe5771bf056b6b83be21b02312 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp @@ -0,0 +1,294 @@ +#include "NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h" +#include "BCSet.h" + +#include <mpi/Communicator.h> +#include "D3Q27Interactor.h" +#include "UbScheduler.h" +#include "Grid3D.h" +#include "BoundaryConditions.h" +#include "DataSet3D.h" +#include "Block3D.h" +#include "LBMKernel.h" +#include "BCArray3D.h" +#include "EsoTwist3D.h" +#include "DistributionArray3D.h" +#include "NonNewtonianFluids/LBM/Rheology.h" + +CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) +{ + if (comm->getProcessID() == comm->getRoot()) + { + std::ofstream ostr; + std::string fname = path_; + ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); + if(!ostr) + { + ostr.clear(); + const std::string path = UbSystem::getPathFromString(fname); + if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} + if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); + } + + ostr << "step;"; + ostr << "Tx;"; + ostr << "Ty;"; + ostr << "Tz" << std::endl; + ostr.close(); + } +} +////////////////////////////////////////////////////////////////////////// +CalculateTorqueSimulationObserver::~CalculateTorqueSimulationObserver() +{ + +} +////////////////////////////////////////////////////////////////////////// +void CalculateTorqueSimulationObserver::update( real step ) +{ + if(scheduler->isDue(step) ) + collectData(step); + + UBLOG(logDEBUG3, "D3Q27ForcesSimulationObserver::update:" << step); +} +////////////////////////////////////////////////////////////////////////// +void CalculateTorqueSimulationObserver::collectData( real step ) +{ + calculateForces(); + + if (comm->getProcessID() == comm->getRoot()) + { + int istep = static_cast<int>(step); + std::ofstream ostr; + std::string fname = path; + ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); + if(!ostr) + { + ostr.clear(); + std::string path = UbSystem::getPathFromString(fname); + if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);} + if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname); + } + + ostr << istep << ";"; + ostr << torqueX1global << ";"; + ostr << torqueX2global << ";"; + ostr << torqueX3global << ";"; + ostr << Fx << ";"; + ostr << Fy << ";"; + ostr << Fz; + ostr << std::endl; + ostr.close(); + } +} +////////////////////////////////////////////////////////////////////////// +void CalculateTorqueSimulationObserver::calculateForces() +{ + torqueX1global = 0.0; + torqueX2global = 0.0; + torqueX3global = 0.0; + + for(SPtr<D3Q27Interactor> interactor : interactors) + { + real x1Centre = interactor->getGbObject3D()->getX1Centroid(); + real x2Centre = interactor->getGbObject3D()->getX2Centroid(); + real x3Centre = interactor->getGbObject3D()->getX3Centroid(); + + for(BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) + { + real torqueX1 = 0.0; + real torqueX2 = 0.0; + real torqueX3 = 0.0; + + SPtr<Block3D> block = t.first; + std::set< std::vector<int> >& transNodeIndicesSet = t.second; + + real deltaX = grid->getDeltaX(block); + + SPtr<ILBMKernel> kernel = block->getKernel(); + + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); + SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); + + int ghostLayerWidth = kernel->getGhostLayerWidth(); + int minX1 = ghostLayerWidth; + int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayerWidth; + int minX2 = ghostLayerWidth; + int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayerWidth; + int minX3 = ghostLayerWidth; + int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayerWidth; + + for(std::vector<int> node : transNodeIndicesSet) + { + int x1 = node[0]; + int x2 = node[1]; + int x3 = node[2]; + + //without ghost nodes + if (x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 ||x3 < minX3 || x3 > maxX3 ) continue; + + if(bcArray->isFluid(x1,x2,x3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!! + { + SPtr<BoundaryConditions> bc = bcArray->getBC(x1,x2,x3); + + Vector3D worldCoordinates = grid->getNodeCoordinates(block, x1, x2, x3); + real rx = (worldCoordinates[0] - x1Centre) / deltaX; + real ry = (worldCoordinates[1] - x2Centre) / deltaX; + real rz = (worldCoordinates[2] - x3Centre) / deltaX; + + // real nx = rx / sqrt(rx * rx + ry * ry + rz * rz); + // real ny = ry / sqrt(rx * rx + ry * ry + rz * rz); + // real nz = rz / sqrt(rx * rx + ry * ry + rz * rz); + + UbTupleDouble3 forceVec = getForces(x1, x2, x3, distributions, bc); + //UbTupleDouble3 forceVec = getForcesFromMoments(x1, x2, x3, kernel, distributions, bc, nx, ny, nz); + //UbTupleDouble3 forceVec = getForcesFromStressTensor(x1, x2, x3, kernel, distributions, bc, nx, ny, nz); + /*real*/ Fx = val<1>(forceVec); + /*real*/ Fy = val<2>(forceVec); + /*real*/ Fz = val<3>(forceVec); + + + + torqueX1 += ry * Fz - rz * Fy; + torqueX2 += rz * Fx - rx * Fz; + torqueX3 += rx * Fy - ry * Fx; + } + } + + torqueX1global += torqueX1; + torqueX2global += torqueX2; + torqueX3global += torqueX3; + } + } + std::vector<real> values; + std::vector<real> rvalues; + values.push_back(torqueX1global); + values.push_back(torqueX2global); + values.push_back(torqueX3global); + + rvalues = comm->gather(values); + if (comm->getProcessID() == comm->getRoot()) + { + torqueX1global = 0.0; + torqueX2global = 0.0; + torqueX3global = 0.0; + + for (int i = 0; i < (int)rvalues.size(); i+=3) + { + torqueX1global += rvalues[i]; + torqueX2global += rvalues[i+1]; + torqueX3global += rvalues[i+2]; + } + } +} +////////////////////////////////////////////////////////////////////////// +UbTupleDouble3 CalculateTorqueSimulationObserver::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) +{ + UbTupleDouble3 force(0.0,0.0,0.0); + + if(bc) + { + //references to tuple "force" + real& forceX1 = val<1>(force); + real& forceX2 = val<2>(force); + real& forceX3 = val<3>(force); + real f, fnbr; + + dynamicPointerCast<EsoTwist3D>(distributions)->swap(); + + for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) + { + if(bc->hasNoSlipBoundaryFlag(fdir) || bc->hasVelocityBoundaryFlag(fdir)) + { + const int invDir = D3Q27System::INVDIR[fdir]; + 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); + + forceX1 += (f + fnbr) * D3Q27System::DX1[invDir]; + forceX2 += (f + fnbr) * D3Q27System::DX2[invDir]; + forceX3 += (f + fnbr) * D3Q27System::DX3[invDir]; + } + } + + dynamicPointerCast<EsoTwist3D>(distributions)->swap(); + } + + return force; +} +////////////////////////////////////////////////////////////////////////// +UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromMoments(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) +{ + using namespace vf::basics::constant; + UbTupleDouble3 force(0.0, 0.0, 0.0); + + + if (bc) { + real f[D3Q27System::ENDF + 1]; + distributions->getDistribution(f, x1, x2, x3); + real collFactor = kernel->getCollisionFactor(); + real shearRate = D3Q27System::getShearRate(f, collFactor); + real rho = D3Q27System::getDensity(f); + real omega = Rheology::getBinghamCollFactor(collFactor, shearRate, rho); + std::array<real, 6> moments = D3Q27System::getSecondMoments(f, omega); + + // references to tuple "force" + real &forceX1 = val<1>(force); + real &forceX2 = val<2>(force); + real &forceX3 = val<3>(force); + + real mxx = (moments[0] + moments[1] + moments[2])*c1o3; + real myy = (-c2o1 * moments[1] + moments[2] + moments[0]) * c1o3; + real mzz = (-c2o1 * moments[2] + moments[1] + moments[0]) * c1o3; + real mxy = moments[3]; + real mxz = moments[4]; + real myz = moments[5]; + + forceX1 = mxx *nx + mxy*ny + mxz*nz; + forceX2 = mxy *nx + myy*ny + myz*nz; + forceX3 = mxz *nx + myz*ny + mzz*nz; + } + + return force; +} +////////////////////////////////////////////////////////////////////////// +UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromStressTensor(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) +{ + using namespace vf::basics::constant; + UbTupleDouble3 force(0.0, 0.0, 0.0); + + if (bc) { + real f[D3Q27System::ENDF + 1]; + distributions->getDistribution(f, x1, x2, x3); + real collFactor = kernel->getCollisionFactor(); + real shearRate = D3Q27System::getShearRate(f, collFactor); + real rho = D3Q27System::getDensity(f); + real omega = Rheology::getBinghamCollFactor(collFactor, shearRate, rho); + std::array<real, 6> stress = D3Q27System::getStressTensor(f, omega); + + // references to tuple "force" + real &forceX1 = val<1>(force); + real &forceX2 = val<2>(force); + real &forceX3 = val<3>(force); + + real &tauXX = stress[0]; + real &tauYY = stress[1]; + real &tauZZ = stress[2]; + real &tauXY = stress[3]; + real &tauXZ = stress[4]; + real &tauYZ = stress[5]; + + //https: // journals.aps.org/pre/pdf/10.1103/PhysRevE.88.013303 + + forceX1 = tauXX * nx + tauXY * ny + tauXZ * nz; + forceX2 = tauXY * nx + tauYY * ny + tauYZ * nz; + forceX3 = tauXZ * nx + tauYZ * ny + tauZZ * nz; + } + + return force; +} +////////////////////////////////////////////////////////////////////////// +void CalculateTorqueSimulationObserver::addInteractor( SPtr<D3Q27Interactor> interactor ) +{ + interactors.push_back(interactor); +} + + + diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp similarity index 76% rename from src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp index 0221bf38a599352728dbd42f37b78bc5fa6ff1ee..0754491767b55e2a6059c8eef160a94a1f087540 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp @@ -1,11 +1,11 @@ /* - * DecreaseViscosityCoProcessor + * DecreaseViscositySimulationObserver * * Created on: 10.05.2013 * Author: uphoff */ -#include "DecreaseViscosityCoProcessor.h" +#include "DecreaseViscositySimulationObserver.h" #include <vector> @@ -15,27 +15,27 @@ #include "LBMKernel.h" #include "UbScheduler.h" -DecreaseViscosityCoProcessor::DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, +DecreaseViscositySimulationObserver::DecreaseViscositySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), nueFunc(nueFunc), comm(comm) + : SimulationObserver(grid, s), nueFunc(nueFunc), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { } } ////////////////////////////////////////////////////////////////////////// -DecreaseViscosityCoProcessor::~DecreaseViscosityCoProcessor() = default; +DecreaseViscositySimulationObserver::~DecreaseViscositySimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void DecreaseViscosityCoProcessor::process(real step) +void DecreaseViscositySimulationObserver::update(real step) { if (scheduler->isDue(step)) setViscosity(step); } ////////////////////////////////////////////////////////////////////////// -void DecreaseViscosityCoProcessor::setViscosity(real step) +void DecreaseViscositySimulationObserver::setViscosity(real step) { - UBLOG(logDEBUG3, "DecreaseViscosityCoProcessor::update:" << step); + UBLOG(logDEBUG3, "DecreaseViscositySimulationObserver::update:" << step); int gridRank = grid->getRank(); int minInitLevel = this->grid->getCoarsestInitializedLevel(); int maxInitLevel = this->grid->getFinestInitializedLevel(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h similarity index 61% rename from src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h index aaa8a3c0b8db4d9adb9b28c19ef993444e7106c0..2e2c655d223619169e0f3edd3bfa554e924639e0 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h @@ -1,9 +1,9 @@ -#ifndef DecreaseViscosityCoProcessor_H -#define DecreaseViscosityCoProcessor_H +#ifndef DecreaseViscositySimulationObserver_H +#define DecreaseViscositySimulationObserver_H #include <PointerDefinitions.h> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "IntegrateValuesHelper.h" #include "LBMUnitConverter.h" @@ -20,18 +20,18 @@ namespace vf::mpi {class Communicator;} //! decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)"); //this function is time-dependent, the viscosity decreases a 1/t^2 //! decrViscFunc.DefineConst("nue0", nueLB); //! decrViscFunc.DefineConst("c0", 0.1); //constants such as c0 controll how fast the viscosity decreasis -//! SPtr<UbScheduler> DecrViscSch(new UbScheduler()); //the CoProcessor is called according to a Scheduler +//! SPtr<UbScheduler> DecrViscSch(new UbScheduler()); //the SimulationObserver is called according to a Scheduler //! DecrViscSch->addSchedule(10,10,1000); //in this case the viscosity is reset every 10 timesteps for the -//! first 1000 timesteps DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm); \endcode +//! first 1000 timesteps DecreaseViscositySimulationObserver decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm); \endcode //! \author Sonja Uphoff -class DecreaseViscosityCoProcessor : public CoProcessor +class DecreaseViscositySimulationObserver : public SimulationObserver { public: - DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, std::shared_ptr<vf::mpi::Communicator> comm); - ~DecreaseViscosityCoProcessor() override; + DecreaseViscositySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, std::shared_ptr<vf::mpi::Communicator> comm); + ~DecreaseViscositySimulationObserver() override; //! calls collect PostprocessData. - void process(real step) override; + void update(real step) override; protected: //! resets the collision factor depending on the current timestep. @@ -43,4 +43,4 @@ private: mu::Parser *nueFunc; }; -#endif /* DecreaseViscosityCoProcessor_H_ */ +#endif /* DecreaseViscositySimulationObserver_H_ */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp similarity index 59% rename from src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp index fc181e266e0453a12a149a4c69083497617c61ea..a6826a713b45f74239c603d9a23b946169ac60d5 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp @@ -1,15 +1,15 @@ -#include "EmergencyExitCoProcessor.h" +#include "EmergencyExitSimulationObserver.h" #include <mpi/Communicator.h> #include "Grid3D.h" -#include "MPIIORestartCoProcessor.h" +#include "MPIIORestartSimulationObserver.h" #include "UbLogger.h" #include "UbScheduler.h" #include <basics/utilities/UbFileInputASCII.h> #include <basics/utilities/UbFileOutputASCII.h> -EmergencyExitCoProcessor::EmergencyExitCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<MPIIORestartCoProcessor> rp, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), rp(rp), comm(comm) +EmergencyExitSimulationObserver::EmergencyExitSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::mpi::Communicator> comm) + : SimulationObserver(grid, s), path(path), rp(rp), comm(comm) { this->path = path + "/exit"; metafile = this->path + "/stop.txt"; @@ -20,40 +20,40 @@ EmergencyExitCoProcessor::EmergencyExitCoProcessor(SPtr<Grid3D> grid, SPtr<UbSch comm->barrier(); } ////////////////////////////////////////////////////////////////////////// -EmergencyExitCoProcessor::~EmergencyExitCoProcessor() = default; +EmergencyExitSimulationObserver::~EmergencyExitSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::process(real step) +void EmergencyExitSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "EmergencyExitCoProcessor::update:" << step); + UBLOG(logDEBUG3, "EmergencyExitSimulationObserver::update:" << step); } -void EmergencyExitCoProcessor::collectData(real step) +void EmergencyExitSimulationObserver::collectData(real step) { if (readMetafile()) { - rp->process((int)step); + rp->update((int)step); if (comm->getProcessID() == comm->getRoot()) - UBLOG(logINFO, "EmergencyExitCoProcessor save step: " << step); + UBLOG(logINFO, "EmergencyExitSimulationObserver save step: " << step); comm->barrier(); exit(EXIT_SUCCESS); } } ////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::writeMetafile(int /*status*/) +void EmergencyExitSimulationObserver::writeMetafile(int /*status*/) { UbFileOutputASCII out(metafile); out.writeBool(false); } ////////////////////////////////////////////////////////////////////////// -bool EmergencyExitCoProcessor::readMetafile() +bool EmergencyExitSimulationObserver::readMetafile() { UbFileInputASCII in(metafile); return in.readBool(); } ////////////////////////////////////////////////////////////////////////// -void EmergencyExitCoProcessor::checkMetafile() +void EmergencyExitSimulationObserver::checkMetafile() { std::ifstream file(metafile.c_str()); if (!file.is_open()) { diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..f4a8e79f6f8b89f1b4e37714f0c42d2be4be1810 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h @@ -0,0 +1,43 @@ +/* + * EmergencyExitSimulationObserver.h + * + * Created on: 05.10.2012 + * Author: K. Kucher + */ + +#ifndef EmergencyExitSimulationObserver_H +#define EmergencyExitSimulationObserver_H + +#include <PointerDefinitions.h> +#include <string> + +#include "SimulationObserver.h" + +class MPIIORestartSimulationObserver; +namespace vf::mpi {class Communicator;} +class Grid3D; +class UbScheduler; + +class EmergencyExitSimulationObserver : public SimulationObserver +{ +public: + EmergencyExitSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::mpi::Communicator> comm); + ~EmergencyExitSimulationObserver() override; + + void update(real step) override; + +protected: + void collectData(real step); + void writeMetafile(int status); + bool readMetafile(); + void checkMetafile(); + +private: + std::string path; + std::shared_ptr<vf::mpi::Communicator> comm; + SPtr<MPIIORestartSimulationObserver> rp; + std::string metafile; +}; + +#endif /* EmergencyExitSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp similarity index 98% rename from src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp index 918e3afbe8d454ac97707b8c79f927bca324cb52..9a39ce11ed15e939e9fc32eaeb15d541675387aa 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp @@ -1,5 +1,5 @@ #include "ForceCalculator.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "BCArray3D.h" #include "Block3D.h" @@ -66,7 +66,7 @@ void ForceCalculator::calculateForces(std::vector<SPtr<D3Q27Interactor>> interac SPtr<Block3D> block = t.first; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); distributions->swap(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.h b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h similarity index 100% rename from src/cpu/VirtualFluidsCore/CoProcessors/ForceCalculator.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp index 741f1f340c4c02e9f5b08854e7205ab2aa5e507b..4e8fd6d5f39fbeb581ace18bf544fa5346719850 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp @@ -1,7 +1,7 @@ #ifdef VF_CATALYST -#include "InSituCatalystCoProcessor.h" -#include <D3Q27ETBCProcessor.h> +#include "InSituCatalystSimulationObserver.h" +#include <D3Q27ETBCSet.h> #include <LBMKernel.h> #include <string> #include <vector> @@ -15,10 +15,10 @@ using namespace std; -InSituCatalystCoProcessor::InSituCatalystCoProcessor() {} +InSituCatalystSimulationObserver::InSituCatalystSimulationObserver() {} ////////////////////////////////////////////////////////////////////////// -InSituCatalystCoProcessor::InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script) - : CoProcessor(grid, s) +InSituCatalystSimulationObserver::InSituCatalystSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script) + : SimulationObserver(grid, s) { gridRank = vf::mpi::Communicator::getInstance()->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -40,17 +40,17 @@ InSituCatalystCoProcessor::InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbS buildVTKGrid(); } ////////////////////////////////////////////////////////////////////////// -InSituCatalystCoProcessor::~InSituCatalystCoProcessor() {} +InSituCatalystSimulationObserver::~InSituCatalystSimulationObserver() {} ////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::process(real step) +void InSituCatalystSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "InSituCatalystCoProcessor::update:" << step); + UBLOG(logDEBUG3, "InSituCatalystSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::collectData(real step) +void InSituCatalystSimulationObserver::collectData(real step) { unsigned int istep = static_cast<int>(step); @@ -86,10 +86,10 @@ void InSituCatalystCoProcessor::collectData(real step) Processor->CoProcess(dataDescription.GetPointer()); } - UBLOG(logINFO, "InSituCatalystCoProcessor step: " << istep); + UBLOG(logINFO, "InSituCatalystSimulationObserver step: " << istep); } ////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::addData(SPtr<Block3D> block) +void InSituCatalystSimulationObserver::addData(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -97,7 +97,7 @@ void InSituCatalystCoProcessor::addData(SPtr<Block3D> block) real dx = grid->getDeltaX(block); SPtr<LBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; @@ -166,7 +166,7 @@ void InSituCatalystCoProcessor::addData(SPtr<Block3D> block) } } ////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::buildVTKGrid() +void InSituCatalystSimulationObserver::buildVTKGrid() { unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New(); points = vtkPoints::New(); @@ -206,7 +206,7 @@ void InSituCatalystCoProcessor::buildVTKGrid() vx3Array.resize(numOfPoints); } ////////////////////////////////////////////////////////////////////////// -void InSituCatalystCoProcessor::addVTKGridData(SPtr<Block3D> block) +void InSituCatalystSimulationObserver::addVTKGridData(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -214,7 +214,7 @@ void InSituCatalystCoProcessor::addVTKGridData(SPtr<Block3D> block) real dx = grid->getDeltaX(block); SPtr<LBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.h similarity index 73% rename from src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.h index e1c9fb95c7ff420362c3dcbe4b7444902beb6ba1..f81fe767a448a75f04d8cf965b33a14cdf36b2b4 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.h @@ -1,9 +1,9 @@ #ifdef VF_CATALYST -#ifndef InSituCatalystCoProcessor_h__ -#define InSituCatalystCoProcessor_h__ +#ifndef InSituCatalystSimulationObserver_h__ +#define InSituCatalystSimulationObserver_h__ -#include <CoProcessor.h> +#include <SimulationObserver.h> #include <Grid3D.h> #include <LBMUnitConverter.h> #include "lbm/constants/D3Q27.h" @@ -19,13 +19,13 @@ #include <vtkSmartPointer.h> #include <vtkUnstructuredGrid.h> -class InSituCatalystCoProcessor : public CoProcessor +class InSituCatalystSimulationObserver : public SimulationObserver { public: - InSituCatalystCoProcessor(); - InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script); - virtual ~InSituCatalystCoProcessor(); - void process(real step); + InSituCatalystSimulationObserver(); + InSituCatalystSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script); + virtual ~InSituCatalystSimulationObserver(); + void update(real step); protected: void collectData(real step); @@ -52,6 +52,6 @@ private: real & /*vx2*/, real & /*vx3*/); CalcMacrosFct calcMacros; }; -#endif // InSituCatalystCoProcessor_h__ +#endif // InSituCatalystSimulationObserver_h__ #endif diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp similarity index 92% rename from src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp index 6b8026cedd8331c02b52a06c86c0e5d7821d0aa2..74c1b653bd4f8b5f2def3492f83fa38677170feb 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp @@ -1,8 +1,8 @@ #ifdef VF_VTK -#include "InSituVTKCoProcessor.h" +#include "InSituVTKSimulationObserver.h" #include <BCArray3D.h> -#include <BCProcessor.h> +#include <BCSet.h> #include <Block3D.h> #include <BoundaryConditions.h> #include <Communicator.h> @@ -24,11 +24,11 @@ using namespace std; -InSituVTKCoProcessor::InSituVTKCoProcessor() {} +InSituVTKSimulationObserver::InSituVTKSimulationObserver() {} ////////////////////////////////////////////////////////////////////////// -InSituVTKCoProcessor::InSituVTKCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &configFile, +InSituVTKSimulationObserver::InSituVTKSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &configFile, SPtr<LBMUnitConverter> conv) - : CoProcessor(grid, s), conv(conv) + : SimulationObserver(grid, s), conv(conv) { gridRank = vf::mpi::Communicator::getInstance()->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -55,17 +55,17 @@ InSituVTKCoProcessor::InSituVTKCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> } } ////////////////////////////////////////////////////////////////////////// -InSituVTKCoProcessor::~InSituVTKCoProcessor() { comm->CloseConnection(); } +InSituVTKSimulationObserver::~InSituVTKSimulationObserver() { comm->CloseConnection(); } ////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::process(real step) +void InSituVTKSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "InSituVTKCoProcessor::update:" << step); + UBLOG(logDEBUG3, "InSituVTKSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::collectData(real step) +void InSituVTKSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -119,10 +119,10 @@ void InSituVTKCoProcessor::collectData(real step) // writer->SetDataModeToAscii(); // writer->Update(); - UBLOG(logINFO, "InSituVTKCoProcessor step: " << istep); + UBLOG(logINFO, "InSituVTKSimulationObserver step: " << istep); } ////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::addData(SPtr<Block3D> block) +void InSituVTKSimulationObserver::addData(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -130,7 +130,7 @@ void InSituVTKCoProcessor::addData(SPtr<Block3D> block) real dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; @@ -259,7 +259,7 @@ void InSituVTKCoProcessor::addData(SPtr<Block3D> block) } } ////////////////////////////////////////////////////////////////////////// -void InSituVTKCoProcessor::readConfigFile(const std::string &configFile) +void InSituVTKSimulationObserver::readConfigFile(const std::string &configFile) { ifstream ifs; ifs.open(configFile, ifstream::in); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.h similarity index 69% rename from src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.h index 9456bf298b4e6e4af1e07ae14a46c3e11259cbaa..1171c54252fa315d1e9e84caed34d2596b9520c2 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.h @@ -1,9 +1,9 @@ #ifdef VF_VTK -#ifndef InSituVTKCoProcessor_h__ -#define InSituVTKCoProcessor_h__ +#ifndef InSituVTKSimulationObserver_h__ +#define InSituVTKSimulationObserver_h__ -#include <CoProcessor.h> +#include <SimulationObserver.h> #include <Grid3D.h> #include <LBMUnitConverter.h> @@ -16,14 +16,14 @@ #include <vtkSocketController.h> #include <vtkUnstructuredGrid.h> -class InSituVTKCoProcessor : public CoProcessor +class InSituVTKSimulationObserver : public SimulationObserver { public: - InSituVTKCoProcessor(); - InSituVTKCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &configFile, + InSituVTKSimulationObserver(); + InSituVTKSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &configFile, SPtr<LBMUnitConverter> conv); - virtual ~InSituVTKCoProcessor(); - void process(real step); + virtual ~InSituVTKSimulationObserver(); + void update(real step); protected: void collectData(real step); @@ -48,6 +48,6 @@ private: std::string wIP; }; -#endif // InSituVTKCoProcessor_h__ +#endif // InSituVTKSimulationObserver_h__ #endif diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp similarity index 98% rename from src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp index 0d8b7827b48fb2a5e6e16d13538f63209e03e244..7eabcd2849f2fca11cb057357492fa1062c46dce 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp @@ -5,7 +5,7 @@ #include <vector> #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "DataSet3D.h" #include "LBMKernel.h" @@ -65,7 +65,7 @@ void IntegrateValuesHelper::init(int level) orgX3 = val<3>(org); SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel()); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); int ghostLayerWitdh = kernel->getGhostLayerWidth(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real internX1, internX2, internX3; @@ -193,7 +193,7 @@ void IntegrateValuesHelper::calculateMQ() calcMacros = &D3Q27System::calcIncompMacroscopicValues; } - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); for (UbTupleInt3 node : cn.nodes) { distributions->getDistribution(f, val<1>(node), val<2>(node), val<3>(node)); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h similarity index 100% rename from src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp similarity index 90% rename from src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp index 98d0188fc25def9ee613e85f98d9623b0dfdf702..75350fb6e0904c434519a241228d7662c84ecf22 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "LineTimeSeriesCoProcessor.h" -#include "BCProcessor.h" +#include "LineTimeSeriesSimulationObserver.h" +#include "BCSet.h" #include "WbWriterVtkXmlASCII.h" #include "Block3D.h" @@ -12,9 +12,9 @@ #include "LBMKernel.h" #include "UbScheduler.h" -LineTimeSeriesCoProcessor::LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +LineTimeSeriesSimulationObserver::LineTimeSeriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<GbLine3D> line, int level, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), length(0), ix1(0), ix2(0), ix3(0), level(level), line(line) + : SimulationObserver(grid, s), path(path), length(0), ix1(0), ix2(0), ix3(0), level(level), line(line) { root = comm->isRoot(); fname = path; @@ -23,7 +23,7 @@ LineTimeSeriesCoProcessor::LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbS numOfProc = comm->getNumberOfProcesses(); gridRank = comm->getProcessID(); - real dx = CoProcessor::grid->getDeltaX(level); + real dx = SimulationObserver::grid->getDeltaX(level); SPtr<CoordinateTransformation3D> trafo = grid->getCoordinateTransformator(); real orgX1 = trafo->getX1CoordinateOffset(); @@ -61,16 +61,16 @@ LineTimeSeriesCoProcessor::LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbS ix3 = x3min % val<3>(blockNx) + 1; } ////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::process(real step) +void LineTimeSeriesSimulationObserver::update(real step) { if (scheduler->isDue(step)) { collectData(); } - UBLOG(logDEBUG3, "MacroscopicQuantitiesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "MacroscopicQuantitiesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::writeLine(const std::string &path) +void LineTimeSeriesSimulationObserver::writeLine(const std::string &path) { std::vector<UbTupleFloat3> nodes(2); std::vector<UbTupleInt2> lines(1); @@ -86,7 +86,7 @@ void LineTimeSeriesCoProcessor::writeLine(const std::string &path) writer->writeLines(path, nodes, lines); } ////////////////////////////////////////////////////////////////////////// -void LineTimeSeriesCoProcessor::collectData() +void LineTimeSeriesSimulationObserver::collectData() { real f[27]; real vx1, vx2, vx3, rho; @@ -104,7 +104,7 @@ void LineTimeSeriesCoProcessor::collectData() blockix3 = x / blocknx; } - SPtr<Block3D> block = CoProcessor::grid->getBlock(blockix1, blockix2, blockix3, level); + SPtr<Block3D> block = SimulationObserver::grid->getBlock(blockix1, blockix2, blockix3, level); if (block) { if (block->getRank() == gridRank) { SPtr<ILBMKernel> kernel = block->getKernel(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h similarity index 71% rename from src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h index c510a9b46b265344242ab8e3c75560d370a53921..0f8a9ab44ac60e16708be7453e65809ec0505155 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h @@ -1,12 +1,12 @@ -#ifndef LineTimeSeriesCoProcessor_h__ -#define LineTimeSeriesCoProcessor_h__ +#ifndef LineTimeSeriesSimulationObserver_h__ +#define LineTimeSeriesSimulationObserver_h__ #include <PointerDefinitions.h> #include <string> #include <mpi.h> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" namespace vf::mpi {class Communicator;} @@ -20,17 +20,17 @@ class GbLine3D; // //! \author Konstantin Kutscher -class LineTimeSeriesCoProcessor : public CoProcessor +class LineTimeSeriesSimulationObserver : public SimulationObserver { public: enum Direction { X1, X2, X3 }; public: - LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<GbLine3D> line, + LineTimeSeriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<GbLine3D> line, int level, std::shared_ptr<vf::mpi::Communicator> comm); - ~LineTimeSeriesCoProcessor() override = default; + ~LineTimeSeriesSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; void writeLine(const std::string &path); protected: @@ -58,4 +58,4 @@ private: int gridRank; Direction dir; }; -#endif // LineTimeSeriesCoProcessor_h__ +#endif // LineTimeSeriesSimulationObserver_h__ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp similarity index 92% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp index fd08df50a3f0cb9b85fd3255465170a4ef1681a9..ef220856838baabadb3b8cf40270d0e505147069 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "MPIIOMigrationBECoProcessor.h" +#include "MPIIOMigrationBESimulationObserver.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include <mpi/Communicator.h> @@ -25,8 +25,8 @@ 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, std::shared_ptr<vf::mpi::Communicator> comm) - : MPIIOCoProcessor(grid, s, path, comm), nue(-999.999), nuL(-999.999), nuG(-999.999), densityRatio(-999.999) +MPIIOMigrationBESimulationObserver::MPIIOMigrationBESimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) + : MPIIOSimulationObserver(grid, s, path, comm), nue(-999.999), nuL(-999.999), nuG(-999.999), densityRatio(-999.999) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); metisVisitor = mV; @@ -38,13 +38,13 @@ MPIIOMigrationBECoProcessor::MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr } ////////////////////////////////////////////////////////////////////////// -MPIIOMigrationBECoProcessor::~MPIIOMigrationBECoProcessor() { MPI_Type_free(&sendBlockIntType); } +MPIIOMigrationBESimulationObserver::~MPIIOMigrationBESimulationObserver() { MPI_Type_free(&sendBlockIntType); } -void MPIIOMigrationBECoProcessor::process(real step) +void MPIIOMigrationBESimulationObserver::update(real step) { if (scheduler->isDue(step)) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIOMigrationBECoProcessor save step: " << step); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver save step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); clearAllFiles((int)step); @@ -60,13 +60,13 @@ void MPIIOMigrationBECoProcessor::process(real step) } } -void MPIIOMigrationBECoProcessor::clearAllFiles(int step) +void MPIIOMigrationBESimulationObserver::clearAllFiles(int step) { MPI_File file_handler; MPI_Info info = MPI_INFO_NULL; MPI_Offset new_size = 0; - MPIIOCoProcessor::clearAllFiles(step); + MPIIOSimulationObserver::clearAllFiles(step); UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); @@ -87,16 +87,16 @@ void MPIIOMigrationBECoProcessor::clearAllFiles(int step) MPI_File_close(&file_handler); } -void MPIIOMigrationBECoProcessor::writeBlocks(int step) +void MPIIOMigrationBESimulationObserver::writeBlocks(int step) { grid->deleteBlockIDs(); RenumberGridVisitor renumber(comm); grid->accept(renumber); - MPIIOCoProcessor::writeBlocks(step); + MPIIOSimulationObserver::writeBlocks(step); } -void MPIIOMigrationBECoProcessor::writeDataSet(int step) +void MPIIOMigrationBESimulationObserver::writeDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -121,7 +121,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeDataSet start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeDataSet start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -290,7 +290,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -362,7 +362,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeDataSet time: " << finish - start << " s"); } MPI_File file_handler1; @@ -409,7 +409,7 @@ void MPIIOMigrationBECoProcessor::writeDataSet(int step) } -void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std::string fname) +void MPIIOMigrationBESimulationObserver::write4DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -436,7 +436,7 @@ void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write4DArray start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write4DArray start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -462,7 +462,7 @@ void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std:: ___Array = block->getKernel()->getDataSet()->getShearStressValues(); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationBECoProcessor::write4DArray : 4D array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationBESimulationObserver::write4DArray : 4D array type does not exist!")); break; } @@ -489,7 +489,7 @@ void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write4DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write4DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -524,11 +524,11 @@ void MPIIOMigrationBECoProcessor::write4DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write4DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write4DArray time: " << finish - start << " s"); } } -void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std::string fname) +void MPIIOMigrationBESimulationObserver::write3DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -555,7 +555,7 @@ void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write3DArray start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write3DArray start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -579,7 +579,7 @@ void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std:: break; default: UB_THROW(UbException(UB_EXARGS, - "MPIIOMigrationBECoProcessor::write3DArray : 3D array type does not exist!")); + "MPIIOMigrationBESimulationObserver::write3DArray : 3D array type does not exist!")); break; } @@ -606,7 +606,7 @@ void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write3DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write3DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -641,11 +641,11 @@ void MPIIOMigrationBECoProcessor::write3DArray(int step, Arrays arrayType, std:: if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::write3DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::write3DArray time: " << finish - start << " s"); } } -void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) +void MPIIOMigrationBESimulationObserver::writeBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -653,7 +653,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeBoundaryConds start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeBoundaryConds start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -685,7 +685,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) { for (SPtr<Block3D> block : blocksVector[level]) // all the blocks of the current level { - bcArr = block->getKernel()->getBCProcessor()->getBCArray(); + bcArr = block->getKernel()->getBCSet()->getBCArray(); bcAddArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block @@ -716,7 +716,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); + bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector[ic].push_back(*bouCond); @@ -752,7 +752,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -835,7 +835,7 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::writeBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::writeBoundaryConds time: " << finish - start << " s"); } delete[] bcAddArray; @@ -845,10 +845,10 @@ void MPIIOMigrationBECoProcessor::writeBoundaryConds(int step) } //------------------------------------------- READ ----------------------------------------------- -void MPIIOMigrationBECoProcessor::restart(int step) +void MPIIOMigrationBESimulationObserver::restart(int step) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIOMigrationBECoProcessor restart step: " << step); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver restart step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); @@ -863,9 +863,9 @@ void MPIIOMigrationBECoProcessor::restart(int step) UBLOG(logINFO, "Load check point - end"); } -void MPIIOMigrationBECoProcessor::readBlocks(int step) { MPIIOCoProcessor::readBlocks(step); } +void MPIIOMigrationBESimulationObserver::readBlocks(int step) { MPIIOSimulationObserver::readBlocks(step); } -void MPIIOMigrationBECoProcessor::blocksExchange(int tagN, int ind1, int ind2, int doubleCountInBlock, std::vector<real> &pV, std::vector<real> *rawDataReceive) +void MPIIOMigrationBESimulationObserver::blocksExchange(int tagN, int ind1, int ind2, int doubleCountInBlock, std::vector<real> &pV, std::vector<real> *rawDataReceive) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -893,7 +893,7 @@ void MPIIOMigrationBECoProcessor::blocksExchange(int tagN, int ind1, int ind2, i { tempBlock = grid->getBlock(indexB + int(ind)); if (!tempBlock) - throw UbException(UB_EXARGS, "MPIIOMigrationBECoProcessor::blocksExchange -- null block pointer!!!"); + throw UbException(UB_EXARGS, "MPIIOMigrationBESimulationObserver::blocksExchange -- null block pointer!!!"); tempRank = tempBlock->getRank(); @@ -998,7 +998,7 @@ void MPIIOMigrationBECoProcessor::blocksExchange(int tagN, int ind1, int ind2, i delete[] requests; } -void MPIIOMigrationBECoProcessor::readDataSet(int step) +void MPIIOMigrationBESimulationObserver::readDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1006,8 +1006,8 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) if (!lbmKernel) UB_THROW(UbException(UB_EXARGS, "lbmKernel does not exist!")); - if (!bcProcessor) - UB_THROW(UbException(UB_EXARGS, "bcProcessor does not exist!")); + if (!bcSet) + UB_THROW(UbException(UB_EXARGS, "BCSet does not exist!")); if (nue == -999.999) UB_THROW(UbException(UB_EXARGS, "nue is not initialised!")); if (nuL == -999.999 ) @@ -1019,7 +1019,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1109,8 +1109,8 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet start of exchange of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet start of exchange of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1139,8 +1139,8 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1252,7 +1252,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readDataSet end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readDataSet end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1306,7 +1306,7 @@ void MPIIOMigrationBECoProcessor::readDataSet(int step) delete[] rawDataReceiveH2; } -void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::string fname) +void MPIIOMigrationBESimulationObserver::readArray(int step, Arrays arrType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1314,7 +1314,7 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1362,8 +1362,8 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray start of exchange of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray start of exchange of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1376,9 +1376,9 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray end of exchange of data, rank = " << rank); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray end of exchange of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1452,7 +1452,7 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin block->getKernel()->getDataSet()->setPressureField(___3DArray); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationBECoProcessor::readArray : array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationBESimulationObserver::readArray : array type does not exist!")); break; } } @@ -1462,12 +1462,12 @@ void MPIIOMigrationBECoProcessor::readArray(int step, Arrays arrType, std::strin if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readArray end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readArray end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } } -void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) +void MPIIOMigrationBESimulationObserver::readBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1475,7 +1475,7 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1521,8 +1521,8 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds start of exchange of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds start of exchange of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1601,9 +1601,9 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds end of exchange of data, rank = " << rank); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds end of exchange of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1681,7 +1681,7 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) bc->nx3 = bcArray[ibc].nx3; for (int iq = 0; iq < 26; iq++) bc->setQ(bcArray[ibc].q[iq], iq); - bc->setBcAlgorithmType(bcArray[ibc].algorithmType); + bc->setBCStrategyType(bcArray[ibc].algorithmType); } bcVector.push_back(bc); @@ -1690,14 +1690,14 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, boundCondParamStr.nx1, boundCondParamStr.nx2, boundCondParamStr.nx3); SPtr<Block3D> block1 = grid->getBlock(blockID); - SPtr<BCProcessor> bcProc = bcProcessor->clone(block1->getKernel()); + SPtr<BCSet> bcProc = bcSet->clone(block1->getKernel()); SPtr<BCArray3D> bcArr(new BCArray3D()); bcArr->bcindexmatrix = bcim; bcArr->bcvector = bcVector; bcArr->indexContainer = indexContainerV; bcProc->setBCArray(bcArr); - block1->getKernel()->setBCProcessor(bcProc); + block1->getKernel()->setBCSet(bcProc); } } @@ -1714,20 +1714,20 @@ void MPIIOMigrationBECoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds end of restore of data, rank = " << rank); - UBLOG(logINFO, "MPIIOMigrationBECoProcessor::readBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationBESimulationObserver::readBoundaryConds time: " << finish - start << " s"); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationBECoProcessor::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } +void MPIIOMigrationBESimulationObserver::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationBECoProcessor::setBCProcessor(SPtr<BCProcessor> bcProcessor) { this->bcProcessor = bcProcessor; } +void MPIIOMigrationBESimulationObserver::setBCSet(SPtr<BCSet> bcSet) { this->bcSet = bcSet; } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationBECoProcessor::setNu(real nu) { this->nue = nu; } +void MPIIOMigrationBESimulationObserver::setNu(real nu) { this->nue = nu; } -void MPIIOMigrationBECoProcessor::setNuLG(real cfL, real cfG) { this->nuL = cfL; this->nuG = cfG; } +void MPIIOMigrationBESimulationObserver::setNuLG(real cfL, real cfG) { this->nuL = cfL; this->nuG = cfG; } -void MPIIOMigrationBECoProcessor::setDensityRatio(real dr) { this->densityRatio = dr; } +void MPIIOMigrationBESimulationObserver::setDensityRatio(real dr) { this->densityRatio = dr; } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h similarity index 84% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h index d29ecca36d194cd0498b3347b9e59eefced8a475..fa55ea17a350ec9a1de215892258526142f6d19b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationBECoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h @@ -1,23 +1,23 @@ -#ifndef _MPIIOMigrationBECoProcessor_H_ -#define _MPIIOMigrationBECoProcessor_H_ +#ifndef _MPIIOMigrationBESimulationObserver_H_ +#define _MPIIOMigrationBESimulationObserver_H_ #include <mpi.h> #include <string> #include <vector> -#include "MPIIOCoProcessor.h" +#include "MPIIOSimulationObserver.h" #include "MPIIODataStructures.h" class Grid3D; class UbScheduler; namespace vf::mpi {class Communicator;} -class BCProcessor; +class BCSet; class LBMKernel; class Grid3DVisitor; -//! \class MPIWriteBlocksBECoProcessor +//! \class MPIWriteBlocksBESimulationObserver //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIOMigrationBECoProcessor : public MPIIOCoProcessor +class MPIIOMigrationBESimulationObserver : public MPIIOSimulationObserver { enum Arrays { AverageDensity = 1, @@ -32,11 +32,11 @@ class MPIIOMigrationBECoProcessor : public MPIIOCoProcessor }; public: - MPIIOMigrationBECoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, + MPIIOMigrationBESimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~MPIIOMigrationBECoProcessor() override; + ~MPIIOMigrationBESimulationObserver() override; //! Each timestep writes the grid into the files - void process(real step) override; + void update(real step) override; //! Reads the grid from the files before grid reconstruction void restart(int step); //! Writes the blocks of the grid into the file cpBlocks.bin @@ -69,8 +69,8 @@ public: void readBoundaryConds(int step); //! The function sets LBMKernel void setLBMKernel(SPtr<LBMKernel> kernel); - //! The function sets BCProcessor - void setBCProcessor(SPtr<BCProcessor> bcProcessor); + //! The function sets BCSet + void setBCSet(SPtr<BCSet> BCSet); //! The function truncates the data files void clearAllFiles(int step); void setNu(real nu); @@ -90,7 +90,7 @@ private: MPIIODataStructures::boundCondParam boundCondParamStr; SPtr<LBMKernel> lbmKernel; - SPtr<BCProcessor> bcProcessor; + SPtr<BCSet> bcSet; SPtr<Grid3DVisitor> metisVisitor; real nue; real nuL; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp index 4e3a84aa8a47051aee123181fc63741266dbacc0..32e6ba5188626c0a37fba8e9db0ad4447502d001 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "MPIIOMigrationCoProcessor.h" +#include "MPIIOMigrationSimulationObserver.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include <mpi/Communicator.h> @@ -22,8 +22,8 @@ using namespace MPIIODataStructures; -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) +MPIIOMigrationSimulationObserver::MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) + : MPIIOSimulationObserver(grid, s, path, comm) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); metisVisitor = mV; @@ -60,7 +60,7 @@ MPIIOMigrationCoProcessor::MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbS MPI_Type_commit(&boundCondTypeAdd); } ////////////////////////////////////////////////////////////////////////// -MPIIOMigrationCoProcessor::~MPIIOMigrationCoProcessor() +MPIIOMigrationSimulationObserver::~MPIIOMigrationSimulationObserver() { MPI_Type_free(&dataSetType); MPI_Type_free(&dataSetSmallType); @@ -69,12 +69,12 @@ MPIIOMigrationCoProcessor::~MPIIOMigrationCoProcessor() } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationCoProcessor::process(real step) +void MPIIOMigrationSimulationObserver::update(real step) { if (scheduler->isDue(step)) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIOMigrationCoProcessor save step: " << step); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver save step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); /*if (comm->isRoot())*/ clearAllFiles((int)step); @@ -90,13 +90,13 @@ void MPIIOMigrationCoProcessor::process(real step) } } -void MPIIOMigrationCoProcessor::clearAllFiles(int step) +void MPIIOMigrationSimulationObserver::clearAllFiles(int step) { MPI_File file_handler; MPI_Info info = MPI_INFO_NULL; MPI_Offset new_size = 0; - MPIIOCoProcessor::clearAllFiles(step); + MPIIOSimulationObserver::clearAllFiles(step); UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); @@ -108,13 +108,13 @@ void MPIIOMigrationCoProcessor::clearAllFiles(int step) MPI_File_close(&file_handler); } -void MPIIOMigrationCoProcessor::writeBlocks(int step) +void MPIIOMigrationSimulationObserver::writeBlocks(int step) { grid->renumberBlockIDs(); - MPIIOCoProcessor::writeBlocks(step); + MPIIOSimulationObserver::writeBlocks(step); } -void MPIIOMigrationCoProcessor::writeDataSet(int step) +void MPIIOMigrationSimulationObserver::writeDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -139,7 +139,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeDataSet start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeDataSet start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -324,7 +324,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -410,7 +410,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeDataSet time: " << finish - start << " s"); } delete[] dataSetArray; @@ -453,7 +453,7 @@ void MPIIOMigrationCoProcessor::writeDataSet(int step) } -void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::string fname) +void MPIIOMigrationSimulationObserver::write4DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -476,7 +476,7 @@ void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write4DArray start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write4DArray start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -509,7 +509,7 @@ void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::st ___Array = block->getKernel()->getDataSet()->getShearStressValues(); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationCoProcessor::write4DArray : 4D array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationSimulationObserver::write4DArray : 4D array type does not exist!")); break; } @@ -538,7 +538,7 @@ void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write4DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write4DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -577,13 +577,13 @@ void MPIIOMigrationCoProcessor::write4DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write4DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write4DArray time: " << finish - start << " s"); } delete[] dataSetSmallArray; } -void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::string fname) +void MPIIOMigrationSimulationObserver::write3DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -606,7 +606,7 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write3DArray start collect data to file = " << fname); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write3DArray start collect data to file = " << fname); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -636,7 +636,7 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st ___Array = block->getKernel()->getDataSet()->getPressureField(); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationCoProcessor::write3DArray : 3D array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationSimulationObserver::write3DArray : 3D array type does not exist!")); break; } @@ -665,7 +665,7 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write3DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write3DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -710,13 +710,13 @@ void MPIIOMigrationCoProcessor::write3DArray(int step, Arrays arrayType, std::st if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::write3DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::write3DArray time: " << finish - start << " s"); } delete[] dataSetSmallArray; } -void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) +void MPIIOMigrationSimulationObserver::writeBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -724,7 +724,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeBoundaryConds start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeBoundaryConds start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -756,7 +756,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) { for (SPtr<Block3D> block : blocksVector[level]) // all the blocks of the current level { - bcArr = block->getKernel()->getBCProcessor()->getBCArray(); + bcArr = block->getKernel()->getBCSet()->getBCArray(); bcAddArray[ic].globalID = block->getGlobalID(); // id of the block needed to find it while regenerating the grid bcAddArray[ic].boundCond_count = 0; // how many BoundaryConditions in this block @@ -788,7 +788,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); + bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector[ic].push_back(*bouCond); @@ -824,7 +824,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: "<< Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -897,7 +897,7 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::writeBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::writeBoundaryConds time: " << finish - start << " s"); } delete[] bcAddArray; @@ -908,10 +908,10 @@ void MPIIOMigrationCoProcessor::writeBoundaryConds(int step) } //------------------------------------------- READ ----------------------------------------------- -void MPIIOMigrationCoProcessor::restart(int step) +void MPIIOMigrationSimulationObserver::restart(int step) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIOMigrationCoProcessor restart step: " << step); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver restart step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); @@ -928,9 +928,9 @@ void MPIIOMigrationCoProcessor::restart(int step) UBLOG(logINFO, "Load check point - end"); } -void MPIIOMigrationCoProcessor::readBlocks(int step) { MPIIOCoProcessor::readBlocks(step); } +void MPIIOMigrationSimulationObserver::readBlocks(int step) { MPIIOSimulationObserver::readBlocks(step); } -void MPIIOMigrationCoProcessor::readDataSet(int step) +void MPIIOMigrationSimulationObserver::readDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -938,7 +938,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1063,8 +1063,8 @@ void MPIIOMigrationCoProcessor::readDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readDataSet time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readDataSet start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readDataSet start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1170,7 +1170,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readDataSet end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readDataSet end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1216,7 +1216,7 @@ void MPIIOMigrationCoProcessor::readDataSet(int step) } -void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string fname) +void MPIIOMigrationSimulationObserver::readArray(int step, Arrays arrType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1224,7 +1224,7 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray start fname = " << fname); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readArray start fname = " << fname); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1285,8 +1285,8 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray readArray: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readArray readArray: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readArray start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1353,21 +1353,21 @@ void MPIIOMigrationCoProcessor::readArray(int step, Arrays arrType, std::string block->getKernel()->getDataSet()->setPressureField(___3DArray); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationCoProcessor::readArray : array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIOMigrationSimulationObserver::readArray : array type does not exist!")); break; } } if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readArray end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::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 MPIIOMigrationCoProcessor::readBoundaryConds(int step) +void MPIIOMigrationSimulationObserver::readBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1375,7 +1375,7 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1416,8 +1416,8 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readBoundaryConds start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readBoundaryConds start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1481,7 +1481,7 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step) bc->nx3 = bcArray[ibc].nx3; for (int iq = 0; iq < 26; iq++) bc->setQ(bcArray[ibc].q[iq], iq); - bc->setBcAlgorithmType(bcArray[ibc].algorithmType); + bc->setBCStrategyType(bcArray[ibc].algorithmType); } bcVector.push_back(bc); @@ -1496,14 +1496,14 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step) CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, boundCondParamStr.nx1, boundCondParamStr.nx2, boundCondParamStr.nx3); SPtr<Block3D> block1 = grid->getBlock(bcAddArray[ic].globalID); - SPtr<BCProcessor> bcProc = bcProcessor->clone(block1->getKernel()); + SPtr<BCSet> bcProc = bcSet->clone(block1->getKernel()); SPtr<BCArray3D> bcArr(new BCArray3D()); bcArr->bcindexmatrix = bcim; bcArr->bcvector = bcVector; bcArr->indexContainer = indexContainerV; bcProc->setBCArray(bcArr); - block1->getKernel()->setBCProcessor(bcProc); + block1->getKernel()->setBCSet(bcProc); delete bcArray; delete intArray1; @@ -1519,12 +1519,12 @@ void MPIIOMigrationCoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOMigrationCoProcessor::readBoundaryConds end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOMigrationSimulationObserver::readBoundaryConds end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationCoProcessor::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } +void MPIIOMigrationSimulationObserver::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } ////////////////////////////////////////////////////////////////////////// -void MPIIOMigrationCoProcessor::setBCProcessor(SPtr<BCProcessor> bcProcessor) { this->bcProcessor = bcProcessor; } +void MPIIOMigrationSimulationObserver::setBCSet(SPtr<BCSet> bcSet) { this->bcSet = bcSet; } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h similarity index 81% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h index 4b8c6231176923618b1a394f125ff32b0e450d54..588366a6498c107600d377a65819e11100aa6702 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOMigrationCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h @@ -1,22 +1,22 @@ -#ifndef _MPIIOMigrationCoProcessor_H_ -#define _MPIIOMigrationCoProcessor_H_ +#ifndef _MPIIOMigrationSimulationObserver_H_ +#define _MPIIOMigrationSimulationObserver_H_ #include <mpi.h> #include <string> -#include "MPIIOCoProcessor.h" +#include "MPIIOSimulationObserver.h" #include "MPIIODataStructures.h" class Grid3D; class UbScheduler; namespace vf::mpi {class Communicator;} -class BCProcessor; +class BCSet; class LBMKernel; class Grid3DVisitor; -//! \class MPIWriteBlocksCoProcessor +//! \class MPIWriteBlocksSimulationObserver //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIOMigrationCoProcessor : public MPIIOCoProcessor +class MPIIOMigrationSimulationObserver : public MPIIOSimulationObserver { public: enum Arrays { @@ -31,10 +31,10 @@ public: PressureField = 9 }; - MPIIOMigrationCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~MPIIOMigrationCoProcessor() override; + MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + ~MPIIOMigrationSimulationObserver() override; //! Each timestep writes the grid into the files - void process(real step) override; + void update(real step) override; //! Reads the grid from the files before grid reconstruction void restart(int step); //! Writes the blocks of the grid into the file cpBlocks.bin @@ -67,8 +67,8 @@ public: void readBoundaryConds(int step); //! The function sets LBMKernel void setLBMKernel(SPtr<LBMKernel> kernel); - //! The function sets BCProcessor - void setBCProcessor(SPtr<BCProcessor> bcProcessor); + //! The function sets BCSet + void setBCSet(SPtr<BCSet> BCSet); //! The function truncates the data files void clearAllFiles(int step); // void setNu(real nu); @@ -80,7 +80,7 @@ private: MPIIODataStructures::boundCondParam boundCondParamStr; SPtr<LBMKernel> lbmKernel; - SPtr<BCProcessor> bcProcessor; + SPtr<BCSet> bcSet; SPtr<Grid3DVisitor> metisVisitor; }; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp index f55d2e08a847e0892810ea12da8d97454c1416f7..fdc3f4d4347f56d52c2b8a4952da3309ca90fe19 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "MPIIORestartCoProcessor.h" +#include "MPIIORestartSimulationObserver.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include <mpi/Communicator.h> @@ -25,8 +25,8 @@ using namespace MPIIODataStructures; -MPIIORestartCoProcessor::MPIIORestartCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) - : MPIIOCoProcessor(grid, s, path, comm) +MPIIORestartSimulationObserver::MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) + : MPIIOSimulationObserver(grid, s, path, comm) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); @@ -67,7 +67,7 @@ MPIIORestartCoProcessor::MPIIORestartCoProcessor(SPtr<Grid3D> grid, SPtr<UbSched MPI_Type_commit(&boundCondTypeAdd); } ////////////////////////////////////////////////////////////////////////// -MPIIORestartCoProcessor::~MPIIORestartCoProcessor() +MPIIORestartSimulationObserver::~MPIIORestartSimulationObserver() { MPI_Type_free(&dataSetType); MPI_Type_free(&dataSetSmallType); @@ -77,12 +77,12 @@ MPIIORestartCoProcessor::~MPIIORestartCoProcessor() } ////////////////////////////////////////////////////////////////////////// -void MPIIORestartCoProcessor::process(real step) +void MPIIORestartSimulationObserver::update(real step) { if (scheduler->isDue(step)) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIORestartCoProcessor save step: " << step); + UBLOG(logINFO, "MPIIORestartSimulationObserver save step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Save check point - start"); /*if (comm->isRoot())*/ clearAllFiles((int)step); @@ -98,7 +98,7 @@ void MPIIORestartCoProcessor::process(real step) } } ////////////////////////////////////////////////////////////////////////// -void MPIIORestartCoProcessor::clearAllFiles(int step) +void MPIIORestartSimulationObserver::clearAllFiles(int step) { MPI_File file_handler; MPI_Info info = MPI_INFO_NULL; @@ -106,7 +106,7 @@ void MPIIORestartCoProcessor::clearAllFiles(int step) UbSystem::makeDirectory(path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step)); - MPIIOCoProcessor::clearAllFiles(step); + MPIIOSimulationObserver::clearAllFiles(step); std::string filename10 = path + "/mpi_io_cp/mpi_io_cp_" + UbSystem::toString(step) + "/cpBC.bin"; int rc10 = @@ -117,9 +117,9 @@ void MPIIORestartCoProcessor::clearAllFiles(int step) MPI_File_close(&file_handler); } ////////////////////////////////////////////////////////////////////////// -void MPIIORestartCoProcessor::writeBlocks(int step) { MPIIOCoProcessor::writeBlocks(step); } +void MPIIORestartSimulationObserver::writeBlocks(int step) { MPIIOSimulationObserver::writeBlocks(step); } -void MPIIORestartCoProcessor::writeDataSet(int step) +void MPIIORestartSimulationObserver::writeDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -144,7 +144,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::writeDataSet start collect data rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeDataSet start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -331,7 +331,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::writeDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -433,7 +433,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor::writeDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeDataSet time: " << finish - start << " s"); } MPI_File file_handler1; @@ -474,7 +474,7 @@ void MPIIORestartCoProcessor::writeDataSet(int step) } -void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::string fname) +void MPIIORestartSimulationObserver::write4DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -497,7 +497,7 @@ void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::writeAverageDensityArray start collect data to file = " << fname); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeAverageDensityArray start collect data to file = " << fname); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -533,7 +533,7 @@ void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::stri ___Array = block->getKernel()->getDataSet()->getShearStressValues(); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::write4DArray : 4D array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIORestartSimulationObserver::write4DArray : 4D array type does not exist!")); break; } @@ -562,7 +562,7 @@ void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::write4DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::write4DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -625,13 +625,13 @@ void MPIIORestartCoProcessor::write4DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor::write4DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::write4DArray time: " << finish - start << " s"); } delete[] dataSetSmallArray; } -void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::string fname) +void MPIIORestartSimulationObserver::write3DArray(int step, Arrays arrayType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -654,7 +654,7 @@ void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::write3DArray start collect data to file = " << fname); + UBLOG(logINFO, "MPIIORestartSimulationObserver::write3DArray start collect data to file = " << fname); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -687,7 +687,7 @@ void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::stri ___Array = block->getKernel()->getDataSet()->getPressureField(); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::write3DArray : 3D array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIORestartSimulationObserver::write3DArray : 3D array type does not exist!")); break; } @@ -716,7 +716,7 @@ void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::write3DArray start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::write3DArray start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -782,13 +782,13 @@ void MPIIORestartCoProcessor::write3DArray(int step, Arrays arrayType, std::stri if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor ::write3DArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver ::write3DArray time: " << finish - start << " s"); } delete[] dataSetSmallArray; } -void MPIIORestartCoProcessor::writeBoundaryConds(int step) +void MPIIORestartSimulationObserver::writeBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -796,7 +796,7 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::writeBoundaryConds start collect data rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeBoundaryConds start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -826,7 +826,7 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step) { for (SPtr<Block3D> block : blocksVector[level]) // all the blocks of the current level { - bcArr = block->getKernel()->getBCProcessor()->getBCArray(); + bcArr = block->getKernel()->getBCSet()->getBCArray(); bcAddArray[ic].x1 = block->getX1(); // coordinates of the block needed to find it while regenerating the grid bcAddArray[ic].x2 = block->getX2(); @@ -859,7 +859,7 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step) bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); - bouCond->algorithmType = bcArr->bcvector[bc]->getBcAlgorithmType(); + bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector.push_back(*bouCond); @@ -929,7 +929,7 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::writeBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -986,17 +986,17 @@ void MPIIORestartCoProcessor::writeBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor::writeBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::writeBoundaryConds time: " << finish - start << " s"); } delete[] bcAddArray; } //------------------------------------------- READ ----------------------------------------------- -void MPIIORestartCoProcessor::restart(int step) +void MPIIORestartSimulationObserver::restart(int step) { if (comm->isRoot()) - UBLOG(logINFO, "MPIIORestartCoProcessor restart step: " << step); + UBLOG(logINFO, "MPIIORestartSimulationObserver restart step: " << step); if (comm->isRoot()) UBLOG(logINFO, "Load check point - start"); @@ -1010,9 +1010,9 @@ void MPIIORestartCoProcessor::restart(int step) UBLOG(logINFO, "Load check point - end"); } -void MPIIORestartCoProcessor::readBlocks(int step) { MPIIOCoProcessor::readBlocks(step); } +void MPIIORestartSimulationObserver::readBlocks(int step) { MPIIOSimulationObserver::readBlocks(step); } -void MPIIORestartCoProcessor::readDataSet(int step) +void MPIIORestartSimulationObserver::readDataSet(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1020,7 +1020,7 @@ void MPIIORestartCoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readDataSet start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readDataSet start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1120,8 +1120,8 @@ void MPIIORestartCoProcessor::readDataSet(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor::readDataSet time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIORestartCoProcessor::readDataSet start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readDataSet time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readDataSet start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1224,7 +1224,7 @@ void MPIIORestartCoProcessor::readDataSet(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readDataSet end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readDataSet end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1270,7 +1270,7 @@ void MPIIORestartCoProcessor::readDataSet(int step) } -void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fname) +void MPIIORestartSimulationObserver::readArray(int step, Arrays arrType, std::string fname) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1278,7 +1278,7 @@ void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fn if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readArray start fname = " << fname); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readArray start fname = " << fname); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1341,8 +1341,8 @@ void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fn 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, "MPIIORestartSimulationObserver::readArray time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readArray start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1410,21 +1410,21 @@ void MPIIORestartCoProcessor::readArray(int step, Arrays arrType, std::string fn block->getKernel()->getDataSet()->setPressureField(___3DArray); break; default: - UB_THROW(UbException(UB_EXARGS, "MPIIORestartCoProcessor::readArray : array type does not exist!")); + UB_THROW(UbException(UB_EXARGS, "MPIIORestartSimulationObserver::readArray : array type does not exist!")); break; } } if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readArray end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::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::readBoundaryConds(int step) +void MPIIORestartSimulationObserver::readBoundaryConds(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -1432,7 +1432,7 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readBoundaryConds start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readBoundaryConds start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1506,8 +1506,8 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIORestartCoProcessor::readBoundaryConds time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIORestartCoProcessor::readBoundaryConds start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readBoundaryConds time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readBoundaryConds start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -1546,7 +1546,7 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step) bc->nx3 = bcArray[index].nx3; for (int iq = 0; iq < 26; iq++) bc->setQ(bcArray[index].q[iq], iq); - bc->setBcAlgorithmType(bcArray[index].algorithmType); + bc->setBCStrategyType(bcArray[index].algorithmType); } bcVector.push_back(bc); @@ -1562,14 +1562,14 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step) CbArray3D<int, IndexerX3X2X1> bcim(bcindexmatrixV, boundCondParamStr.nx1, boundCondParamStr.nx2, boundCondParamStr.nx3); SPtr<Block3D> block = grid->getBlock(bcAddArray[n].x1, bcAddArray[n].x2, bcAddArray[n].x3, bcAddArray[n].level); - SPtr<BCProcessor> bcProc = bcProcessor->clone(block->getKernel()); + SPtr<BCSet> bcSetNew = bcSet->clone(block->getKernel()); SPtr<BCArray3D> bcArr(new BCArray3D()); bcArr->bcindexmatrix = bcim; bcArr->bcvector = bcVector; bcArr->indexContainer = indexContainerV; - bcProc->setBCArray(bcArr); + bcSetNew->setBCArray(bcArr); - block->getKernel()->setBCProcessor(bcProc); + block->getKernel()->setBCSet(bcSetNew); } delete nullBouCond; @@ -1579,11 +1579,11 @@ void MPIIORestartCoProcessor::readBoundaryConds(int step) delete[] intArray2; if (comm->isRoot()) { - UBLOG(logINFO, "MPIIORestartCoProcessor::readBoundaryConds end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIORestartSimulationObserver::readBoundaryConds end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } } ////////////////////////////////////////////////////////////////////////// -void MPIIORestartCoProcessor::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } +void MPIIORestartSimulationObserver::setLBMKernel(SPtr<LBMKernel> kernel) { this->lbmKernel = kernel; } ////////////////////////////////////////////////////////////////////////// -void MPIIORestartCoProcessor::setBCProcessor(SPtr<BCProcessor> bcProcessor) { this->bcProcessor = bcProcessor; } +void MPIIORestartSimulationObserver::setBCSet(SPtr<BCSet> bcSet) { this->bcSet = bcSet; } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h similarity index 83% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h index a4c1b32efbafbdb467eee7facede5f8d834e1a93..5681d9886e3a6f9a4b8d1cf1b8d32e9970fb8855 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIORestartCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h @@ -1,23 +1,23 @@ -#ifndef _MPIIORestartCoProcessor_H_ -#define _MPIIORestartCoProcessor_H_ +#ifndef _MPIIORestartSimulationObserver_H_ +#define _MPIIORestartSimulationObserver_H_ #include <mpi.h> //#include <PointerDefinitions.h> #include <string> #include <vector> -#include "MPIIOCoProcessor.h" +#include "MPIIOSimulationObserver.h" #include "MPIIODataStructures.h" class Grid3D; class UbScheduler; namespace vf::mpi {class Communicator;} -class BCProcessor; +class BCSet; class LBMKernel; -//! \class MPIIORestartCoProcessor +//! \class MPIIORestartSimulationObserver //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIORestartCoProcessor : public MPIIOCoProcessor +class MPIIORestartSimulationObserver : public MPIIOSimulationObserver { public: enum Arrays { @@ -32,10 +32,10 @@ public: PressureField = 9 }; - MPIIORestartCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~MPIIORestartCoProcessor() override; + MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + ~MPIIORestartSimulationObserver() override; //! Each timestep writes the grid into the files - void process(real step) override; + void update(real step) override; //! Reads the grid from the files before grid reconstruction void restart(int step); //! Writes the blocks of the grid into the file cpBlocks.bin @@ -74,8 +74,8 @@ public: void readBoundaryConds(int step); //! The function sets LBMKernel void setLBMKernel(SPtr<LBMKernel> kernel); - //! The function sets BCProcessor - void setBCProcessor(SPtr<BCProcessor> bcProcessor); + //! The function sets BCSet + void setBCSet(SPtr<BCSet> BCSet); //! The function truncates the data files void clearAllFiles(int step); @@ -86,7 +86,7 @@ private: MPIIODataStructures::boundCondParam boundCondParamStr; SPtr<LBMKernel> lbmKernel; - SPtr<BCProcessor> bcProcessor; + SPtr<BCSet> bcSet; //std::vector<double> doubleValuesArrayRW; }; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp similarity index 95% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp index e238ec8b0f4f342fd24c39ed1e60ab2ad1d137fc..adb47a75a2fbd7fc0e8242ef9b013f6324ae066b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp @@ -1,4 +1,4 @@ -#include "MPIIOCoProcessor.h" +#include "MPIIOSimulationObserver.h" #include "Block3D.h" #include <mpi/Communicator.h> #include "CoordinateTransformation3D.h" @@ -12,9 +12,9 @@ using namespace MPIIODataStructures; -MPIIOCoProcessor::MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +MPIIOSimulationObserver::MPIIOSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), comm(comm) + : SimulationObserver(grid, s), path(path), comm(comm) { UbSystem::makeDirectory(path + "/mpi_io_cp"); @@ -74,7 +74,7 @@ MPIIOCoProcessor::MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const MPI_Type_commit(&arrayPresenceType); } -MPIIOCoProcessor::~MPIIOCoProcessor() +MPIIOSimulationObserver::~MPIIOSimulationObserver() { MPI_Type_free(&gridParamType); MPI_Type_free(&block3dType); @@ -83,7 +83,7 @@ MPIIOCoProcessor::~MPIIOCoProcessor() MPI_Type_free(&arrayPresenceType); } -void MPIIOCoProcessor::writeBlocks(int step) +void MPIIOSimulationObserver::writeBlocks(int step) { int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -91,7 +91,7 @@ void MPIIOCoProcessor::writeBlocks(int step) size = 1; if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOCoProcessor::writeBlocksToFile start collect data rank = " << rank); + UBLOG(logINFO, "MPIIOSimulationObserver::writeBlocksToFile start collect data rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -187,7 +187,7 @@ void MPIIOCoProcessor::writeBlocks(int step) } if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOCoProcessor::writeBlocksToFile start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOSimulationObserver::writeBlocksToFile start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -223,21 +223,21 @@ void MPIIOCoProcessor::writeBlocks(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOCoProcessor::writeBlocksToFile time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOSimulationObserver::writeBlocksToFile time: " << finish - start << " s"); } delete[] block3dArray; delete gridParameters; } -void MPIIOCoProcessor::readBlocks(int step) +void MPIIOSimulationObserver::readBlocks(int step) { int rank; // int size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); // size = 1; if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOCoProcessor::readBlocks start MPI IO rank = " << rank); + UBLOG(logINFO, "MPIIOSimulationObserver::readBlocks start MPI IO rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -276,8 +276,8 @@ void MPIIOCoProcessor::readBlocks(int step) if (comm->isRoot()) { finish = MPI_Wtime(); - UBLOG(logINFO, "MPIIOCoProcessor::readBlocks time: " << finish - start << " s"); - UBLOG(logINFO, "MPIIOCoProcessor::readBlocks start of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOSimulationObserver::readBlocks time: " << finish - start << " s"); + UBLOG(logINFO, "MPIIOSimulationObserver::readBlocks start of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } @@ -359,13 +359,13 @@ void MPIIOCoProcessor::readBlocks(int step) delete[] block3dArray; if (comm->isRoot()) { - UBLOG(logINFO, "MPIIOCoProcessor::readBlocks end of restore of data, rank = " << rank); + UBLOG(logINFO, "MPIIOSimulationObserver::readBlocks end of restore of data, rank = " << rank); UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe() / 1073741824.0 << " GB"); } } -void MPIIOCoProcessor::clearAllFiles(int step) +void MPIIOSimulationObserver::clearAllFiles(int step) { MPI_File file_handler; MPI_Info info = MPI_INFO_NULL; @@ -480,7 +480,7 @@ void MPIIOCoProcessor::clearAllFiles(int step) } -void MPIIOCoProcessor::writeCpTimeStep(int step) +void MPIIOSimulationObserver::writeCpTimeStep(int step) { if (comm->isRoot()) { UbFileOutputASCII f(path + "/mpi_io_cp/cp.txt"); @@ -488,7 +488,7 @@ void MPIIOCoProcessor::writeCpTimeStep(int step) } } ////////////////////////////////////////////////////////////////////////// -int MPIIOCoProcessor::readCpTimeStep() +int MPIIOSimulationObserver::readCpTimeStep() { UbFileInputASCII f(path + "/mpi_io_cp/cp.txt"); int step = f.readInteger(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h similarity index 65% rename from src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h index 68759639d10d0032114bfc30ca0ed5d650f35a3f..c04938a71e62db4753689ad35160a7f980c0c0cb 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MPIIOCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h @@ -1,7 +1,7 @@ -#ifndef _MPIIOCoProcessor_H_ -#define _MPIIOCoProcessor_H_ +#ifndef _MPIIOSimulationObserver_H_ +#define _MPIIOSimulationObserver_H_ -#include "CoProcessor.h" +#include "SimulationObserver.h" #include <PointerDefinitions.h> #include <mpi.h> #include <string> @@ -10,16 +10,16 @@ class Grid3D; class UbScheduler; namespace vf::mpi {class Communicator;} -//! \class MPIWriteBlocksBECoProcessor +//! \class MPIWriteBlocksBESimulationObserver //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating -class MPIIOCoProcessor : public CoProcessor +class MPIIOSimulationObserver : public SimulationObserver { public: - MPIIOCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~MPIIOCoProcessor() override; + MPIIOSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + ~MPIIOSimulationObserver() override; //! Each timestep writes the grid into the files - void process(real step) override = 0; + void update(real step) override = 0; //! Writes the blocks of the grid into the file cpBlocks.bin void writeBlocks(int step); @@ -40,5 +40,5 @@ protected: std::shared_ptr<vf::mpi::Communicator> comm; MPI_Datatype gridParamType, block3dType, dataSetParamType, boundCondType, arrayPresenceType; }; -#endif // ! _MPIIOCoProcessor_H_ -#define _MPIIOCoProcessor_H_ +#endif // ! _MPIIOSimulationObserver_H_ +#define _MPIIOSimulationObserver_H_ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp similarity index 85% rename from src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp index f1762b5fdcfa8a2d4b20ee95665a2a3329e85196..2979c841c9c07e44b5a22998897d5665c67b51dc 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "MicrophoneArrayCoProcessor.h" +#include "MicrophoneArraySimulationObserver.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include <mpi/Communicator.h> #include "D3Q27System.h" @@ -12,17 +12,17 @@ #include "Vector3D.h" #include <sstream> -MicrophoneArrayCoProcessor::MicrophoneArrayCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +MicrophoneArraySimulationObserver::MicrophoneArraySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), comm(comm) + : SimulationObserver(grid, s), path(path), comm(comm) { count = 0; micID = 0; } -MicrophoneArrayCoProcessor::~MicrophoneArrayCoProcessor() = default; +MicrophoneArraySimulationObserver::~MicrophoneArraySimulationObserver() = default; -void MicrophoneArrayCoProcessor::process(real step) +void MicrophoneArraySimulationObserver::update(real step) { if (microphones.size() > 0) { collectData(step); @@ -31,10 +31,10 @@ void MicrophoneArrayCoProcessor::process(real step) writeFile(step); } - UBLOG(logDEBUG3, "MicrophoneArrayCoProcessor::process:" << step); + UBLOG(logDEBUG3, "MicrophoneArraySimulationObserver::update:" << step); } -bool MicrophoneArrayCoProcessor::addMicrophone(Vector3D coords) +bool MicrophoneArraySimulationObserver::addMicrophone(Vector3D coords) { micID++; // UbTupleInt3 blockIndexes = grid->getBlockIndexes(coords[0], coords[1], coords[2]); @@ -48,7 +48,7 @@ bool MicrophoneArrayCoProcessor::addMicrophone(Vector3D coords) if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); if (kernel) { - SPtr<BCArray3D> bcarray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcarray = kernel->getBCSet()->getBCArray(); UbTupleInt3 nodes = grid->getNodeIndexes(block, coords[0], coords[1], coords[2]); if (!bcarray->isUndefined(val<1>(nodes), val<2>(nodes), val<3>(nodes))) { @@ -89,7 +89,7 @@ bool MicrophoneArrayCoProcessor::addMicrophone(Vector3D coords) return false; } -void MicrophoneArrayCoProcessor::collectData(real step) +void MicrophoneArraySimulationObserver::collectData(real step) { for (std::size_t i = 0; i < microphones.size(); i++) { real f[D3Q27System::ENDF + 1]; @@ -102,7 +102,7 @@ void MicrophoneArrayCoProcessor::collectData(real step) } } -void MicrophoneArrayCoProcessor::writeFile(real /*step*/) +void MicrophoneArraySimulationObserver::writeFile(real /*step*/) { for (std::size_t i = 0; i < microphones.size(); i++) { std::string fname = path + "/mic/mic_" + UbSystem::toString(microphones[i]->id) + ".csv"; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h similarity index 72% rename from src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h index 140ac5a48405adb96b64941144a13fa6790a9e8c..e87954fa2902df3c27833729869a70abac348508 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h @@ -1,7 +1,7 @@ -#ifndef MicrophoneArrayCoProcessor_h__ -#define MicrophoneArrayCoProcessor_h__ +#ifndef MicrophoneArraySimulationObserver_h__ +#define MicrophoneArraySimulationObserver_h__ -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" #include <array> @@ -19,15 +19,15 @@ class DistributionArray3D; //! \author Konstantin Kutscher //! \date February 2019 -class MicrophoneArrayCoProcessor : public CoProcessor +class MicrophoneArraySimulationObserver : public SimulationObserver { public: - MicrophoneArrayCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + MicrophoneArraySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~MicrophoneArrayCoProcessor() override; + ~MicrophoneArraySimulationObserver() override; //! calls collectData. - void process(real step) override; + void update(real step) override; //! add microphone bool addMicrophone(Vector3D coords); @@ -56,4 +56,4 @@ private: CalcMacrosFct calcMacros; }; -#endif // MicrophoneArrayCoProcessor_h__ +#endif // MicrophoneArraySimulationObserver_h__ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp similarity index 86% rename from src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp index af8cf408369454127a1fd246cf19f2e9fecefc96..3bd0bd6f888e64da0db8f492c872c4b15a518b4a 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp @@ -26,20 +26,20 @@ // 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 NUPSCounterCoProcessor.cpp -//! \ingroup CoProcessors +//! \file NUPSCounterSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "NUPSCounterCoProcessor.h" +#include "NUPSCounterSimulationObserver.h" #include <mpi/Communicator.h> #include "Grid3D.h" #include "UbScheduler.h" -NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, +NUPSCounterSimulationObserver::NUPSCounterSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), numOfThreads(numOfThreads), nup(0), nup_t(0), nupsStep(0.0), comm(comm) + : SimulationObserver(grid, s), numOfThreads(numOfThreads), nup(0), nup_t(0), nupsStep(0.0), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { timer.resetAndStart(); @@ -59,15 +59,15 @@ NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbSchedul } } ////////////////////////////////////////////////////////////////////////// -NUPSCounterCoProcessor::~NUPSCounterCoProcessor() = default; +NUPSCounterSimulationObserver::~NUPSCounterSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void NUPSCounterCoProcessor::process(real step) +void NUPSCounterSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void NUPSCounterCoProcessor::collectData(real step) +void NUPSCounterSimulationObserver::collectData(real step) { if (comm->getProcessID() == comm->getRoot()) { real time = timer.stop(); @@ -76,7 +76,7 @@ void NUPSCounterCoProcessor::collectData(real step) real tnups = nups / (real)numOfThreads; UBLOG(logINFO, "Calculation step = " << step); UBLOG(logINFO, "Total performance = " << nups_t << " NUPS"); - UBLOG(logINFO, "Performance per process = " << nups << " NUPS"); + UBLOG(logINFO, "Performance per update = " << nups << " NUPS"); UBLOG(logINFO, "Performance per thread = " << tnups << " NUPS"); UBLOG(logINFO, "Time for " << step - nupsStep << " steps = " << time << " s"); nupsStep = step; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h similarity index 82% rename from src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h index b178c97fe25647c7bec60883811a3263abc046bc..fdce1c4d67519b6d0a109e3cbd13e23b69d0fb19 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h @@ -26,38 +26,38 @@ // 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 NUPSCounterCoProcessor.h -//! \ingroup CoProcessors +//! \file NUPSCounterSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef NUPSCOUNTERCoProcessor_H_ -#define NUPSCOUNTERCoProcessor_H_ +#ifndef NUPSCOUNTERSimulationObserver_H_ +#define NUPSCOUNTERSimulationObserver_H_ #include <PointerDefinitions.h> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "basics/utilities/UbTiming.h" namespace vf::mpi {class Communicator;} class Grid3D; class UbScheduler; -//! \class NUPSCounterCoProcessor +//! \class NUPSCounterSimulationObserver //! \brief A class calculates Nodal Updates Per Second (NUPS) -class NUPSCounterCoProcessor : public CoProcessor +class NUPSCounterSimulationObserver : public SimulationObserver { public: - //! \brief Construct NUPSCounterCoProcessor object for grid object and scheduler object. + //! \brief Construct NUPSCounterSimulationObserver object for grid object and scheduler 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 numOfThreads is number of threads //! \param comm is Communicator object - NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, std::shared_ptr<vf::mpi::Communicator> comm); - ~NUPSCounterCoProcessor() override; + NUPSCounterSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, std::shared_ptr<vf::mpi::Communicator> comm); + ~NUPSCounterSimulationObserver() override; - void process(real step) override; + void update(real step) override; protected: //! Collect data for calculation of NUPS diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp similarity index 87% rename from src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp index 4197c5cfe7e9d8f0f9da618ff58f4b421ae3d4fa..7c9cd4b85e1404339b2c180bef93eafedff38c23 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp @@ -1,8 +1,8 @@ -#include "PressureCoefficientCoProcessor.h" +#include "PressureCoefficientSimulationObserver.h" #include <WbWriterVtkXmlASCII.h> #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include <mpi/Communicator.h> #include "D3Q27Interactor.h" @@ -12,26 +12,26 @@ #include "LBMKernel.h" #include "UbScheduler.h" -PressureCoefficientCoProcessor::PressureCoefficientCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +PressureCoefficientSimulationObserver::PressureCoefficientSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, GbCuboid3DPtr plane, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), plane(plane), path(path), comm(comm) + : SimulationObserver(grid, s), plane(plane), path(path), comm(comm) { maxStep = scheduler->getMaxEnd(); numberOfSteps = int(maxStep - scheduler->getMinBegin()); } ////////////////////////////////////////////////////////////////////////// -PressureCoefficientCoProcessor::~PressureCoefficientCoProcessor() = default; +PressureCoefficientSimulationObserver::~PressureCoefficientSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::process(real step) +void PressureCoefficientSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "D3Q27ForcesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::collectData(real step) +void PressureCoefficientSimulationObserver::collectData(real step) { calculateRho(); @@ -40,7 +40,7 @@ void PressureCoefficientCoProcessor::collectData(real step) } } ////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::calculateRho() +void PressureCoefficientSimulationObserver::calculateRho() { real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; @@ -54,7 +54,7 @@ void PressureCoefficientCoProcessor::calculateRho() std::set<std::vector<int>> &bcNodeIndicesSet = t.second; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); @@ -120,7 +120,7 @@ void PressureCoefficientCoProcessor::calculateRho() } } ////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::writeValues(int step) +void PressureCoefficientSimulationObserver::writeValues(int step) { if (comm->getProcessID() == comm->getRoot()) { datanames.resize(0); @@ -176,10 +176,10 @@ void PressureCoefficientCoProcessor::writeValues(int step) out.close(); - UBLOG(logINFO, "PressureCoefficientCoProcessor::writeValues() step: " << (int)step); + UBLOG(logINFO, "PressureCoefficientSimulationObserver::writeValues() step: " << (int)step); } } -void PressureCoefficientCoProcessor::readValues(int step) +void PressureCoefficientSimulationObserver::readValues(int step) { if (comm->isRoot()) { std::string fname = path + UbSystem::toString(step) + ".bin"; @@ -199,11 +199,11 @@ void PressureCoefficientCoProcessor::readValues(int step) in.close(); - UBLOG(logINFO, "PressureCoefficientCoProcessor::readValues() step: " << (int)step); + UBLOG(logINFO, "PressureCoefficientSimulationObserver::readValues() step: " << (int)step); } } ////////////////////////////////////////////////////////////////////////// -void PressureCoefficientCoProcessor::addInteractor(SPtr<D3Q27Interactor> interactor) +void PressureCoefficientSimulationObserver::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h similarity index 69% rename from src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h index 26b8117aea007671bc1d6b17104f015cd62ddda3..bfb56a65dd31fd6f434462471c6a236340b05db0 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureCoefficientCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h @@ -1,11 +1,11 @@ -#ifndef PressureCoefficientCoProcessor_h__ -#define PressureCoefficientCoProcessor_h__ +#ifndef PressureCoefficientSimulationObserver_h__ +#define PressureCoefficientSimulationObserver_h__ #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -15,14 +15,14 @@ namespace vf::mpi {class Communicator;} class Grid3D; class UbScheduler; -class PressureCoefficientCoProcessor : public CoProcessor +class PressureCoefficientSimulationObserver : public SimulationObserver { public: - PressureCoefficientCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbCuboid3D> plane, + PressureCoefficientSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbCuboid3D> plane, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~PressureCoefficientCoProcessor() override; + ~PressureCoefficientSimulationObserver() override; - void process(real step) override; + void update(real step) override; void addInteractor(SPtr<D3Q27Interactor> interactor); void readValues(int step); @@ -50,4 +50,4 @@ private: CalcMacrosFct calcMacros; }; -#endif // PressureDistributionCoProcessor_h__ +#endif // PressureDistributionSimulationObserver_h__ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp similarity index 88% rename from src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp index a486da249e5c2ce2eeaaf53fa4601d39bda689b0..9b3c63f407b9fac00de6177a369fec2cb3e74a82 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp @@ -1,11 +1,11 @@ /* - * D3Q27RhoCoProcessor.cpp + * D3Q27RhoSimulationObserver.cpp * * Created on: 28.12.2010 * Author: kucher */ -#include "PressureDifferenceCoProcessor.h" +#include "PressureDifferenceSimulationObserver.h" #include <fstream> @@ -15,12 +15,12 @@ #include "LBMUnitConverter.h" #include "UbScheduler.h" -PressureDifferenceCoProcessor::PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +PressureDifferenceSimulationObserver::PressureDifferenceSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, real rhoReal, real uReal, real uLB, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), h1(h1), h2(h2), comm(comm) + : SimulationObserver(grid, s), path(path), h1(h1), h2(h2), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { std::ofstream ostr; @@ -69,15 +69,15 @@ PressureDifferenceCoProcessor::PressureDifferenceCoProcessor(SPtr<Grid3D> grid, } } ////////////////////////////////////////////////////////////////////////// -PressureDifferenceCoProcessor::~PressureDifferenceCoProcessor() = default; +PressureDifferenceSimulationObserver::~PressureDifferenceSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void PressureDifferenceCoProcessor::process(real step) +void PressureDifferenceSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void PressureDifferenceCoProcessor::collectData(real step) +void PressureDifferenceSimulationObserver::collectData(real step) { h1->calculateMQ(); h2->calculateMQ(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h similarity index 67% rename from src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h index 09523552289297b78fb59b66e86e7ba84e1ed00b..35356d25f9fa941500188fc75850d1bb7c8f86fb 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h @@ -1,17 +1,17 @@ /* - * D3Q27PressureDifferenceCoProcessor.h + * D3Q27PressureDifferenceSimulationObserver.h * * Created on: 28.12.2010 * Author: kucher */ -#ifndef D3Q27PRESSUREDIFFERENCECoProcessor_H -#define D3Q27PRESSUREDIFFERENCECoProcessor_H +#ifndef D3Q27PRESSUREDIFFERENCESimulationObserver_H +#define D3Q27PRESSUREDIFFERENCESimulationObserver_H #include <PointerDefinitions.h> #include <string> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" namespace vf::mpi {class Communicator;} @@ -20,16 +20,16 @@ class UbScheduler; class LBMUnitConverter; class IntegrateValuesHelper; -class PressureDifferenceCoProcessor : public CoProcessor +class PressureDifferenceSimulationObserver : public SimulationObserver { public: - PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + PressureDifferenceSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, real rhoReal, real uReal, real uLB, /*const SPtr<LBMUnitConverter> conv,*/ std::shared_ptr<vf::mpi::Communicator> comm); - ~PressureDifferenceCoProcessor() override; + ~PressureDifferenceSimulationObserver() override; - void process(real step) override; + void update(real step) override; protected: SPtr<IntegrateValuesHelper> h1, h2; @@ -43,4 +43,4 @@ protected: //uReal in SI }; -#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */ +#endif /* D3Q27RHODIFFERENCESimulationObserver_H_ */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp similarity index 91% rename from src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp index 4e62a1c6bbb4c9f9a74968170c5821cc0f46fd23..010d9ff664e22519ceb169c549ecc05307655ed4 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "QCriterionCoProcessor.h" -#include "BCProcessor.h" +#include "QCriterionSimulationObserver.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "Grid3D.h" @@ -10,14 +10,14 @@ #include <mpi/Communicator.h> #include "UbScheduler.h" -QCriterionCoProcessor::QCriterionCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, +QCriterionSimulationObserver::QCriterionSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), comm(comm), writer(writer) + : SimulationObserver(grid, s), path(path), comm(comm), writer(writer) { init(); } ////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::init() +void QCriterionSimulationObserver::init() { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -28,19 +28,19 @@ void QCriterionCoProcessor::init() for (int level = minInitLevel; level <= maxInitLevel; level++) { grid->getBlocks( level, gridRank, true, - blockVector[level]); // grid: private variable in CoProcessor. Initialized by filling with blocks + blockVector[level]); // grid: private variable in SimulationObserver. Initialized by filling with blocks } } ////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::process(real step) +void QCriterionSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "QCriterionCoProcessor::update:" << step); + UBLOG(logDEBUG3, "QCriterionSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::collectData(real step) +void QCriterionSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -59,7 +59,7 @@ void QCriterionCoProcessor::collectData(real step) std::vector<std::string> cellDataNames; - // distributed writing as in MacroscopicValuesCoProcessor.cpp + // distributed writing as in MacroscopicValuesSimulationObserver.cpp std::vector<std::string> pieces = comm->gather(piece); // comm: MPI-Wrapper if (comm->getProcessID() == comm->getRoot()) { std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile( @@ -67,19 +67,19 @@ void QCriterionCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(pname); - if (step == CoProcessor::scheduler->getMinBegin()) // first time in timeseries + if (step == SimulationObserver::scheduler->getMinBegin()) // first time in timeseries { WbWriterVtkXmlASCII::getInstance()->writeCollection(path + "_collection", filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path + "_collection", filenames, istep, false); } - UBLOG(logINFO, "QCriterionCoProcessor step: " << istep); + UBLOG(logINFO, "QCriterionSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::clearData() +void QCriterionSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -87,7 +87,7 @@ void QCriterionCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::addData(const SPtr<Block3D> block) +void QCriterionSimulationObserver::addData(const SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); // UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -101,7 +101,7 @@ void QCriterionCoProcessor::addData(const SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); int minX1 = 0; @@ -200,11 +200,11 @@ void QCriterionCoProcessor::addData(const SPtr<Block3D> block) } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3, +void QCriterionSimulationObserver::getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3, const SPtr<Block3D> block, real *vE, real *vW) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); bool compressible = block->getKernel()->getCompressible(); @@ -217,7 +217,7 @@ void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, int maxX2 = (int)(distributions->getNX2()); int maxX3 = (int)(distributions->getNX3()); if (maxX1 < 3) - throw UbException(UB_EXARGS, "QCriterionCoProcessor: NX1 too small for FD stencils!"); + throw UbException(UB_EXARGS, "QCriterionSimulationObserver: NX1 too small for FD stencils!"); maxX1 -= 2; maxX2 -= 2; maxX3 -= 2; @@ -280,7 +280,7 @@ void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, if (!checkInterpolation || neighNodeIsBC) { SPtr<ILBMKernel> kernelW = blockNeighW->getKernel(); - SPtr<BCArray3D> bcArrayW = kernelW->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayW = kernelW->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributionsW = kernelW->getDataSet()->getFdistributions(); real fW2[27]; real fW[27]; @@ -312,7 +312,7 @@ void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, // throw UbException(UB_EXARGS,"Parallel or Non-Uniform Simulation -- not yet implemented"); } else { SPtr<ILBMKernel> kernelW = blockNeighW->getKernel(); - SPtr<BCArray3D> bcArrayW = kernelW->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayW = kernelW->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributionsW = kernelW->getDataSet()->getFdistributions(); real fW[27]; @@ -343,7 +343,7 @@ void QCriterionCoProcessor::getNeighborVelocities(int offx, int offy, int offz, } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void QCriterionCoProcessor::computeVelocity(real *f, real *v, bool compressible) +void QCriterionSimulationObserver::computeVelocity(real *f, real *v, bool compressible) { ////////////////////////////////////////////////////////////////////////// // compute x,y,z-velocity components from distribution diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h similarity index 84% rename from src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h index 38cd47fb890ffc79bb3f43ecc17bbe42885fa114..1d5aec23f9d4af9d9e232dd215fbde060a7c6f7c 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h @@ -1,15 +1,15 @@ -//! \file QCriterionCoProcessor.h +//! \file QCriterionSimulationObserver.h //! \brief Created on: 25.08.2013 //! \author: Sonja Uphoff -#ifndef QCriterionCoProcessor_H -#define QCriterionCoProcessor_H +#ifndef QCriterionSimulationObserver_H +#define QCriterionSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -25,13 +25,13 @@ class Block3D; //! Q-Criterion: Visualize Vorteces as regions where Vorticity is larger than strain rate (Hunt, 1988) //! \author Sonja Uphoff -class QCriterionCoProcessor : public CoProcessor +class QCriterionSimulationObserver : public SimulationObserver { public: - QCriterionCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, + QCriterionSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm); //! Make update if timestep is write-timestep specified in SPtr<UbScheduler> s - void process(real step) override; + void update(real step) override; protected: //! Prepare data and write in .vtk file @@ -50,7 +50,7 @@ private: void init(); std::vector<UbTupleFloat3> nodes; std::vector<UbTupleUInt8> cells; - std::vector<std::string> datanames; // only one entry for QKrit-CoProcessor: Q + std::vector<std::string> datanames; // only one entry for QKrit-SimulationObserver: Q std::vector<std::vector<real>> data; std::vector<std::vector<SPtr<Block3D>>> blockVector; int minInitLevel; // go through all levels for block vector of current process from minInitLevel to maxInitLevel diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp similarity index 96% rename from src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp index cd1f9c54cb50585b572a61cdc7d8c884386b864c..92c8f5f60344019cff472851104b86e5838302a8 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "ShearStressCoProcessor.h" -#include "BCProcessor.h" +#include "ShearStressSimulationObserver.h" +#include "BCSet.h" #include "WbWriterVtkXmlASCII.h" #include "BCArray3D.h" @@ -12,9 +12,9 @@ #include "LBMKernel.h" #include "UbScheduler.h" -ShearStressCoProcessor::ShearStressCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, +ShearStressSimulationObserver::ShearStressSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, SPtr<UbScheduler> rs) - : CoProcessor(grid, s), Resetscheduler(rs), path(path), writer(writer) + : SimulationObserver(grid, s), Resetscheduler(rs), path(path), writer(writer) { std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); normals.push_back(0); @@ -36,9 +36,9 @@ ShearStressCoProcessor::ShearStressCoProcessor(SPtr<Grid3D> grid, const std::str } } ////////////////////////////////////////////////////////////////////////// -ShearStressCoProcessor::~ShearStressCoProcessor() = default; +ShearStressSimulationObserver::~ShearStressSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::process(real step) +void ShearStressSimulationObserver::update(real step) { if (step == 0) { initDistance(); @@ -46,10 +46,10 @@ void ShearStressCoProcessor::process(real step) calculateShearStress(step); if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "D3Q27ShearStressCoProcessor::update:" << step); + UBLOG(logDEBUG3, "D3Q27ShearStressSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::collectData(real step) +void ShearStressSimulationObserver::collectData(real step) { using namespace std; @@ -71,7 +71,7 @@ void ShearStressCoProcessor::collectData(real step) // vector<string> filenames; // filenames.push_back(pname); - // if (step == CoProcessor::scheduler->getMinBegin()) + // if (step == SimulationObserver::scheduler->getMinBegin()) // { // WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"__Shear_collection",filenames,istep,false); // } @@ -79,7 +79,7 @@ void ShearStressCoProcessor::collectData(real step) // { // WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path+"__Shear_collection",filenames,istep,false); // } - // UBLOG(logINFO,"D3Q27ShearStressCoProcessor step: " << istep); + // UBLOG(logINFO,"D3Q27ShearStressSimulationObserver step: " << istep); //} string pfilePath, partPath, subfolder, cfilePath; @@ -104,25 +104,25 @@ void ShearStressCoProcessor::collectData(real step) vector<string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "D3Q27ShearStressCoProcessor step: " << istep); + UBLOG(logINFO, "D3Q27ShearStressSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::clearData() +void ShearStressSimulationObserver::clearData() { nodes.clear(); datanames.clear(); data.clear(); } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::calculateShearStress(real timeStep) +void ShearStressSimulationObserver::calculateShearStress(real timeStep) { using namespace vf::lbm::dir; using namespace D3Q27System; @@ -137,7 +137,7 @@ void ShearStressCoProcessor::calculateShearStress(real timeStep) std::set<std::vector<int>> &transNodeIndicesSet = t.second; SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<ShearStressValuesArray3D> ssv = kernel->getDataSet()->getShearStressValues(); @@ -231,7 +231,7 @@ void ShearStressCoProcessor::calculateShearStress(real timeStep) } } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::addData() +void ShearStressSimulationObserver::addData() { // Diese Daten werden geschrieben: datanames.resize(0); @@ -253,7 +253,7 @@ void ShearStressCoProcessor::addData() real dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<ShearStressValuesArray3D> ssv = kernel->getDataSet()->getShearStressValues(); @@ -345,15 +345,15 @@ void ShearStressCoProcessor::addData() } } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::reset(real step) +void ShearStressSimulationObserver::reset(real step) { if (Resetscheduler->isDue(step)) resetData(step); - UBLOG(logDEBUG3, "resetCoProcessor::update:" << step); + UBLOG(logDEBUG3, "resetSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::resetData(real /*step*/) +void ShearStressSimulationObserver::resetData(real /*step*/) { for (int level = minInitLevel; level <= maxInitLevel; level++) { for (const auto &block : blockVector[level]) { @@ -364,7 +364,7 @@ void ShearStressCoProcessor::resetData(real /*step*/) // double dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<ShearStressValuesArray3D> ssv = kernel->getDataSet()->getShearStressValues(); @@ -403,9 +403,9 @@ void ShearStressCoProcessor::resetData(real /*step*/) } } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } +void ShearStressSimulationObserver::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } ////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> grid, SPtr<Block3D> block, real &A, +void ShearStressSimulationObserver::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> grid, SPtr<Block3D> block, real &A, real &B, real &C, real &D, real &ii) { using namespace vf::lbm::dir; @@ -417,7 +417,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g real dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); bcPtr = bcArray->getBC(ix1, ix2, ix3); int x, y, z; @@ -823,7 +823,7 @@ void ShearStressCoProcessor::findPlane(int ix1, int ix2, int ix3, SPtr<Grid3D> g } //////////////////////////////////////////////////////////////////////////////////////////////////////// -bool ShearStressCoProcessor::checkUndefindedNodes(SPtr<BCArray3D> bcArray, int ix1, int ix2, int ix3) +bool ShearStressSimulationObserver::checkUndefindedNodes(SPtr<BCArray3D> bcArray, int ix1, int ix2, int ix3) { for (int i = ix1; i <= ix1 + 1; i++) { for (int j = ix2; j <= ix2 + 1; j++) { @@ -836,7 +836,7 @@ bool ShearStressCoProcessor::checkUndefindedNodes(SPtr<BCArray3D> bcArray, int i return false; } ////////////////////////////////////////////////////////////////////////////////////// -void ShearStressCoProcessor::initDistance() +void ShearStressSimulationObserver::initDistance() { using namespace vf::lbm::dir; @@ -852,7 +852,7 @@ void ShearStressCoProcessor::initDistance() // double dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<ShearStressValuesArray3D> ssv = kernel->getDataSet()->getShearStressValues(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.h similarity index 82% rename from src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.h index 73fd42d6485321a26e11b2cf0b4b2a521a0881fd..66a76356d5a1fe8d7b096e3db0e1452dca8d613f 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.h @@ -1,5 +1,5 @@ -#ifndef D3Q27ShearStressCoProcessor_H -#define D3Q27ShearStressCoProcessor_H +#ifndef D3Q27ShearStressSimulationObserver_H +#define D3Q27ShearStressSimulationObserver_H #include <PointerDefinitions.h> #include <string> @@ -7,7 +7,7 @@ #include <basics/utilities/UbTuple.h> -#include "CoProcessor.h" +#include "SimulationObserver.h" class Block3D; class Grid3D; @@ -21,17 +21,17 @@ class WbWriter; //! Take root to obtain during post processing (paraview). //! \author K. Kucher, S. Uphoff, M. Geier, E. Goraki Fard -class ShearStressCoProcessor : public CoProcessor +class ShearStressSimulationObserver : public SimulationObserver { public: //! Default constructor - ShearStressCoProcessor() = default; + ShearStressSimulationObserver() = default; //! Constructor - ShearStressCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, + ShearStressSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, SPtr<UbScheduler> rs); - ~ShearStressCoProcessor() override; + ~ShearStressSimulationObserver() override; - void process(real step) override; + void update(real step) override; void addInteractor(SPtr<D3Q27Interactor> interactor); @@ -82,4 +82,4 @@ private: }; }; -#endif /* D3Q27ShearStressCoProcessor_H */ +#endif /* D3Q27ShearStressSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.cpp similarity index 87% rename from src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.cpp index 6572ac8b5c6a21eb29c773f0da8bcd1d4fa2e286..cef156e5689ee19f99c756771341a81a46357323 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.cpp @@ -26,18 +26,18 @@ // 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 CoProcessor.cpp -//! \ingroup CoProcessors +//! \file SimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "Grid3D.h" #include "UbScheduler.h" -CoProcessor::CoProcessor() = default; +SimulationObserver::SimulationObserver() = default; -CoProcessor::CoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : grid(grid), scheduler(s) {} +SimulationObserver::SimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : grid(grid), scheduler(s) {} -CoProcessor::~CoProcessor() = default; +SimulationObserver::~SimulationObserver() = default; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.h similarity index 82% rename from src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.h index 7aae7505b02ed9248a31b2a009cdc75f09ecd73a..f0c8e0e2c6428c4093f5a94204851988af38a5cd 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/CoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/SimulationObserver.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 CoProcessor.h -//! \ingroup CoProcessors +//! \file SimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef CoProcessor_H -#define CoProcessor_H +#ifndef SimulationObserver_H +#define SimulationObserver_H #include <PointerDefinitions.h> #include "lbm/constants/D3Q27.h" @@ -40,26 +40,26 @@ class Grid3D; class UbScheduler; -//! \class CoProcessor +//! \class SimulationObserver //! \brief An abstract class implements observer design pettern -class CoProcessor +class SimulationObserver { public: //! Class default constructor - CoProcessor(); - //! \brief Construct CoProcessor object for grid object and scheduler object. + SimulationObserver(); + //! \brief Construct SimulationObserver object for grid object and scheduler object. //! \pre The Grid3D and UbScheduler objects must exist. //! \param grid is observable Grid3D object //! \param s is UbScheduler object for scheduling of observer //! \details - //! Class CoProcessor implements the observer design pettern. CoProcessor object is observer. Grid3D object is + //! Class SimulationObserver implements the observer design pettern. SimulationObserver object is observer. Grid3D object is //! observable. - CoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s); + SimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s); //! Class destructor - virtual ~CoProcessor(); + virtual ~SimulationObserver(); //! \brief Updates observer //! \param step is the actual time step - virtual void process(real step) = 0; + virtual void update(real step) = 0; protected: SPtr<Grid3D> grid; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp similarity index 95% rename from src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp index 8fa95c121ee61f419d778a636cacbb129ecdfe9e..ebd65f625600a1c68f48d00c33a79976ea6d1a5a 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp @@ -1,6 +1,6 @@ -#include "TimeAveragedValuesCoProcessor.h" +#include "TimeAveragedValuesSimulationObserver.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "LBMKernel.h" #include "Block3D.h" @@ -12,31 +12,31 @@ #include "BCArray3D.h" -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor() = default; +TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, +TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options) - : CoProcessor(grid, s), path(path), writer(writer), comm(comm), options(options) + : SimulationObserver(grid, s), path(path), writer(writer), comm(comm), options(options) { init(); planarAveraging = false; timeAveraging = true; } ////////////////////////////////////////////////////////////////////////// -TimeAveragedValuesCoProcessor::TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, +TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options, std::vector<int> levels, std::vector<real> &levelCoords, std::vector<real> &bounds, bool timeAveraging) - : CoProcessor(grid, s), path(path), writer(writer), comm(comm), options(options), levels(levels), + : SimulationObserver(grid, s), path(path), writer(writer), comm(comm), options(options), levels(levels), levelCoords(levelCoords), bounds(bounds), timeAveraging(timeAveraging) { init(); planarAveraging = true; } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::init() +void TimeAveragedValuesSimulationObserver::init() { root = comm->isRoot(); gridRank = grid->getRank(); @@ -75,7 +75,7 @@ void TimeAveragedValuesCoProcessor::init() } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::initData() +void TimeAveragedValuesSimulationObserver::initData() { blockVector.clear(); blockVector.resize(maxInitLevel + 1); @@ -116,7 +116,7 @@ void TimeAveragedValuesCoProcessor::initData() } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::process(real step) +void TimeAveragedValuesSimulationObserver::update(real step) { if (step == minStep) { initData(); @@ -146,10 +146,10 @@ void TimeAveragedValuesCoProcessor::process(real step) } } - UBLOG(logDEBUG3, "AverageValuesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "AverageValuesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::collectData(real step) +void TimeAveragedValuesSimulationObserver::collectData(real step) { int istep = int(step); @@ -176,13 +176,13 @@ void TimeAveragedValuesCoProcessor::collectData(real step) if (root) { std::string pname = WbWriterVtkXmlASCII::getInstance()->writeParallelFile(pfilePath, pieces, datanames, cellDataNames); - UBLOG(logINFO, "TimeAveragedValuesCoProcessor::collectData() step: " << istep); + UBLOG(logINFO, "TimeAveragedValuesSimulationObserver::collectData() step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::clearData() +void TimeAveragedValuesSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -190,7 +190,7 @@ void TimeAveragedValuesCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::addData(const SPtr<Block3D> block) +void TimeAveragedValuesSimulationObserver::addData(const SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); // UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -244,7 +244,7 @@ void TimeAveragedValuesCoProcessor::addData(const SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> ar = kernel->getDataSet()->getAverageDensity(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageVelocity(); @@ -352,7 +352,7 @@ void TimeAveragedValuesCoProcessor::addData(const SPtr<Block3D> block) } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::calculateAverageValues(real timeSteps) +void TimeAveragedValuesSimulationObserver::calculateAverageValues(real timeSteps) { for (int level = minInitLevel; level <= maxInitLevel; level++) { int i; @@ -365,7 +365,7 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(real timeSteps) SPtr<Block3D> block = blockVector[level][i]; if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> ar = kernel->getDataSet()->getAverageDensity(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageVelocity(); @@ -463,7 +463,7 @@ void TimeAveragedValuesCoProcessor::calculateAverageValues(real timeSteps) } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::calculateSubtotal(real step) +void TimeAveragedValuesSimulationObserver::calculateSubtotal(real step) { if (scheduler->isDue(step)) { @@ -487,7 +487,7 @@ void TimeAveragedValuesCoProcessor::calculateSubtotal(real step) SPtr<Block3D> block = blockVector[level][i]; if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> ar = kernel->getDataSet()->getAverageDensity(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageVelocity(); @@ -574,7 +574,7 @@ void TimeAveragedValuesCoProcessor::calculateSubtotal(real step) } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::planarAverage(real step) +void TimeAveragedValuesSimulationObserver::planarAverage(real step) { std::ofstream ostr; @@ -692,11 +692,11 @@ void TimeAveragedValuesCoProcessor::planarAverage(real step) if (root) { ostr.close(); - UBLOG(logINFO, "TimeAveragedValuesCoProcessor::planarAverage() step: " << (int)step); + UBLOG(logINFO, "TimeAveragedValuesSimulationObserver::planarAverage() step: " << (int)step); } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::reset() +void TimeAveragedValuesSimulationObserver::reset() { for (int level = minInitLevel; level <= maxInitLevel; level++) { for (SPtr<Block3D> block : blockVector[level]) { @@ -725,7 +725,7 @@ void TimeAveragedValuesCoProcessor::reset() } } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::setWithGhostLayer(bool val) +void TimeAveragedValuesSimulationObserver::setWithGhostLayer(bool val) { withGhostLayer = val; @@ -736,9 +736,9 @@ void TimeAveragedValuesCoProcessor::setWithGhostLayer(bool val) } } ////////////////////////////////////////////////////////////////////////// -bool TimeAveragedValuesCoProcessor::getWithGhostLayer() { return withGhostLayer; } +bool TimeAveragedValuesSimulationObserver::getWithGhostLayer() { return withGhostLayer; } ////////////////////////////////////////////////////////////////////////// -void TimeAveragedValuesCoProcessor::calculateAverageValuesForPlane( +void TimeAveragedValuesSimulationObserver::calculateAverageValuesForPlane( std::vector<IntegrateValuesHelper::CalcNodes> &cnodes) { saVx = 0; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h similarity index 89% rename from src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h index 72a0f6fe16ef3805ff496ccff924b8ecf541bfef..14a1f6354aa57ca588361299caf7a1d336001f9e 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h @@ -1,11 +1,11 @@ -#ifndef TimeAveragedValuesCoProcessor_H -#define TimeAveragedValuesCoProcessor_H +#ifndef TimeAveragedValuesSimulationObserver_H +#define TimeAveragedValuesSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "IntegrateValuesHelper.h" #include "LBMSystem.h" @@ -24,7 +24,7 @@ class Block3D; //! \author Konstantin Kutscher // \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$ -class TimeAveragedValuesCoProcessor : public CoProcessor +class TimeAveragedValuesSimulationObserver : public SimulationObserver { public: enum Options { @@ -39,15 +39,15 @@ public: }; public: - TimeAveragedValuesCoProcessor(); - TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, + TimeAveragedValuesSimulationObserver(); + TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options); - TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, + TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options, std::vector<int> levels, std::vector<real> &levelCoords, std::vector<real> &bounds, bool timeAveraging = true); //! Make update - void process(real step) override; + void update(real step) override; //! Computes subtotal of velocity , fluctuations and triple correlations void calculateSubtotal(real step); void addLevelCoordinate(real c); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cedf228b665fff58a777f01aee8832c0e8e1cec4 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.cpp @@ -0,0 +1,22 @@ +#include "TimeDependentBCSimulationObserver.h" + +#include "Grid3D.h" +#include "Interactor3D.h" +#include "UbScheduler.h" + +TimeDependentBCSimulationObserver::TimeDependentBCSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : SimulationObserver(grid, s) {} +////////////////////////////////////////////////////////////////////////// +TimeDependentBCSimulationObserver::~TimeDependentBCSimulationObserver() = default; +////////////////////////////////////////////////////////////////////////// +void TimeDependentBCSimulationObserver::update(real step) +{ + if (scheduler->isDue(step)) { + for (SPtr<Interactor3D> inter : interactors) + inter->updateInteractor(step); + UBLOG(logDEBUG3, "TimeDependentBCSimulationObserver::update:" << step); + } +} +////////////////////////////////////////////////////////////////////////// +void TimeDependentBCSimulationObserver::addInteractor(SPtr<Interactor3D> interactor) { interactors.push_back(interactor); } + +////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..0c72054f2feadcaa6cf9792453d1e3389e7213bb --- /dev/null +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeDependentBCSimulationObserver.h @@ -0,0 +1,30 @@ +#ifndef TimeDependentBCSimulationObserver_H +#define TimeDependentBCSimulationObserver_H + +#include <PointerDefinitions.h> +#include <vector> + +#include "SimulationObserver.h" + +class Interactor3D; +class Grid3D; + +//! \brief The class update interactors depend of time step. +//! \details TimeDependentBCSimulationObserver update every time step information in BCs throw Interactors +//! \author Sonja Uphoff, Kostyantyn Kucher +class TimeDependentBCSimulationObserver : public SimulationObserver +{ +public: + TimeDependentBCSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s); + ~TimeDependentBCSimulationObserver() override; + + void update(real step) override; + + //! add interactors to SimulationObserver + void addInteractor(SPtr<Interactor3D> interactor); + +private: + std::vector<SPtr<Interactor3D>> interactors; +}; + +#endif /* TimeDependentBCSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp similarity index 77% rename from src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp index b897d4df17ceb61d88f242c17de3e2030d01e120..e0560e2767b70dcc51db08f807a29e467efa6a2d 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp @@ -1,11 +1,11 @@ /* - * TimeseriesWriterCoProcessor.h + * TimeseriesWriterSimulationObserver.h * * Created on: 08.05.2013 * Author: uphoff */ -#include "TimeseriesCoProcessor.h" +#include "TimeseriesSimulationObserver.h" #include <fstream> @@ -15,15 +15,15 @@ #include "LBMUnitConverter.h" #include "UbScheduler.h" -TimeseriesCoProcessor::TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, +TimeseriesSimulationObserver::TimeseriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), h1(h1), path(path), comm(comm) + : SimulationObserver(grid, s), h1(h1), path(path), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { std::ofstream ostr; // fname = path+"/timeseries/timeseries"+UbSystem::toString(grid->getTimeStep())+".csv"; fname = path + ".csv"; - UBLOG(logINFO, "TimeseriesWriterCoProcessor::fname:" << fname); + UBLOG(logINFO, "TimeseriesWriterSimulationObserver::fname:" << fname); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); if (!ostr) { ostr.clear(); @@ -37,23 +37,23 @@ TimeseriesCoProcessor::TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler } ostr << "step;rho;vx;vy;vz;volume\n"; ostr.close(); - UBLOG(logINFO, "TimeseriesWriterCoProcessor::Constructor:end"); + UBLOG(logINFO, "TimeseriesWriterSimulationObserver::Constructor:end"); } } ////////////////////////////////////////////////////////////////////////// -TimeseriesCoProcessor::~TimeseriesCoProcessor() = default; +TimeseriesSimulationObserver::~TimeseriesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void TimeseriesCoProcessor::process(real step) +void TimeseriesSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void TimeseriesCoProcessor::collectData(real step) +void TimeseriesSimulationObserver::collectData(real step) { h1->calculateMQ(); - UBLOG(logDEBUG3, "TimeseriesWriterCoProcessor::update:" << step); + UBLOG(logDEBUG3, "TimeseriesWriterSimulationObserver::update:" << step); if (comm->getProcessID() == comm->getRoot()) { int istep = static_cast<int>(step); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h similarity index 66% rename from src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h index 7cdc98fd02b2776e970e52ccacf9966a4411a309..db41bd2ecea38ac86e97740310ba9501f94caa4a 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h @@ -1,17 +1,17 @@ /* - * TimeseriesCoProcessor.h + * TimeseriesSimulationObserver.h * * Created on: 08.05.2013 * Author: uphoff */ -#ifndef TimeseriesCoProcessor_H -#define TimeseriesCoProcessor_H +#ifndef TimeseriesSimulationObserver_H +#define TimeseriesSimulationObserver_H #include <PointerDefinitions.h> #include <string> -#include "CoProcessor.h" +#include "SimulationObserver.h" namespace vf::mpi {class Communicator;} class Grid3D; @@ -23,15 +23,15 @@ class IntegrateValuesHelper; //! \author Sonja Uphoff //! \date May 2013 -class TimeseriesCoProcessor : public CoProcessor +class TimeseriesSimulationObserver : public SimulationObserver { public: - TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, + TimeseriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); - ~TimeseriesCoProcessor() override; + ~TimeseriesSimulationObserver() override; //! calls collectData. - void process(real step) override; + void update(real step) override; protected: void collectData(real step); @@ -45,4 +45,4 @@ private: std::string fname; }; -#endif /* TimeseriesCoProcessor_H */ +#endif /* TimeseriesSimulationObserver_H */ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp similarity index 92% rename from src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp index 4714349a9c25ec2b5d427e3b64ad00be738915f6..47b865ed7b80fd1c420d59fa54144d5afa1471f5 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp @@ -1,7 +1,7 @@ -#include "TurbulenceIntensityCoProcessor.h" +#include "TurbulenceIntensitySimulationObserver.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include <mpi/Communicator.h> #include "DataSet3D.h" @@ -12,15 +12,15 @@ #include "basics/utilities/UbMath.h" #include "basics/writer/WbWriterVtkXmlASCII.h" -TurbulenceIntensityCoProcessor::TurbulenceIntensityCoProcessor(SPtr<Grid3D> grid, const std::string &path, +TurbulenceIntensitySimulationObserver::TurbulenceIntensitySimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), comm(comm), writer(writer) + : SimulationObserver(grid, s), path(path), comm(comm), writer(writer) { init(); } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::init() +void TurbulenceIntensitySimulationObserver::init() { gridRank = grid->getRank(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -40,17 +40,17 @@ void TurbulenceIntensityCoProcessor::init() } } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::process(real step) +void TurbulenceIntensitySimulationObserver::update(real step) { calculateAverageValues(int(step)); if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "TurbulenceIntensityCoProcessor::update:" << step); + UBLOG(logDEBUG3, "TurbulenceIntensitySimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::collectData(real step) +void TurbulenceIntensitySimulationObserver::collectData(real step) { int istep = int(step); @@ -76,18 +76,18 @@ void TurbulenceIntensityCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(pname); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(path + "_collection", filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path + "_collection", filenames, istep, false); } - UBLOG(logINFO, "TurbulenceIntensityCoProcessor step: " << istep); + UBLOG(logINFO, "TurbulenceIntensitySimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::clearData() +void TurbulenceIntensitySimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -95,7 +95,7 @@ void TurbulenceIntensityCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::addData(const SPtr<Block3D> block) +void TurbulenceIntensitySimulationObserver::addData(const SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); // UbTupleDouble3 blockLengths = grid->getBlockLengths(block); @@ -109,7 +109,7 @@ void TurbulenceIntensityCoProcessor::addData(const SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); // int ghostLayerWidth = kernel->getGhostLayerWidth(); @@ -179,7 +179,7 @@ void TurbulenceIntensityCoProcessor::addData(const SPtr<Block3D> block) } } ////////////////////////////////////////////////////////////////////////// -void TurbulenceIntensityCoProcessor::calculateAverageValues(real timeStep) +void TurbulenceIntensitySimulationObserver::calculateAverageValues(real timeStep) { using namespace vf::lbm::dir; using namespace D3Q27System; @@ -193,7 +193,7 @@ void TurbulenceIntensityCoProcessor::calculateAverageValues(real timeStep) for (SPtr<Block3D> block : blockVector[level]) { if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); SPtr<AverageValuesArray3D> av = kernel->getDataSet()->getAverageValues(); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h similarity index 73% rename from src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h index 8f11e94b446050d2069f89dd8971fb3acc8fb787..c615bbda5cb58a522e6853fcf3f8475bc3320b52 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h @@ -1,11 +1,11 @@ -#ifndef TurbulenceIntensityCoProcessor_H -#define TurbulenceIntensityCoProcessor_H +#ifndef TurbulenceIntensitySimulationObserver_H +#define TurbulenceIntensitySimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "UbTuple.h" namespace vf::mpi {class Communicator;} @@ -14,12 +14,12 @@ class UbScheduler; class WbWriter; class Block3D; -class TurbulenceIntensityCoProcessor : public CoProcessor +class TurbulenceIntensitySimulationObserver : public SimulationObserver { public: - TurbulenceIntensityCoProcessor(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, + TurbulenceIntensitySimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm); - void process(real step) override; + void update(real step) override; protected: void collectData(real step); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp similarity index 92% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp index de781d96b582f83e38e74ca0643a0d0c23b170c0..fd983bd02bd0bf3a7ae0cd0af96b2f169180f31b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.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 WriteBlocksCoProcessor.cpp -//! \ingroup CoProcessors +//! \file WriteBlocksSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "WriteBlocksCoProcessor.h" +#include "WriteBlocksSimulationObserver.h" #include "basics/writer/WbWriterVtkXmlASCII.h" #include <logger/Logger.h> @@ -41,21 +41,21 @@ #include "Grid3D.h" #include "UbScheduler.h" -WriteBlocksCoProcessor::WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +WriteBlocksSimulationObserver::WriteBlocksSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { } ////////////////////////////////////////////////////////////////////////// -WriteBlocksCoProcessor::~WriteBlocksCoProcessor() = default; +WriteBlocksSimulationObserver::~WriteBlocksSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void WriteBlocksCoProcessor::process(real step) +void WriteBlocksSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void WriteBlocksCoProcessor::collectData(real step) +void WriteBlocksSimulationObserver::collectData(real step) { if (comm->getProcessID() == comm->getRoot()) { int istep = int(step); @@ -173,7 +173,7 @@ void WriteBlocksCoProcessor::collectData(real step) path + "/blocks/blocks_" + UbSystem::toString(grid->getRank()) + "_" + UbSystem::toString(istep), nodes, cells, celldatanames, celldata)); - if (istep == CoProcessor::scheduler->getMinBegin()) { + if (istep == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(path + "/blocks/blocks_collection", filenames, istep, false); } else { @@ -181,6 +181,6 @@ void WriteBlocksCoProcessor::collectData(real step) istep, false); } - VF_LOG_INFO("WriteBlocksCoProcessor step: {}", istep); + VF_LOG_INFO("WriteBlocksSimulationObserver step: {}", istep); } } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h similarity index 83% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h index c94cd1e64861cead5d01becbd80e5b3381e6e159..805605b64564272c6a327545a4b01bc89926da38 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h @@ -26,41 +26,41 @@ // 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 WriteBlocksCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteBlocksSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteBlocksCoProcessor_H_ -#define WriteBlocksCoProcessor_H_ +#ifndef WriteBlocksSimulationObserver_H_ +#define WriteBlocksSimulationObserver_H_ #include <PointerDefinitions.h> #include <string> -#include "CoProcessor.h" +#include "SimulationObserver.h" namespace vf::mpi {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; -//! \class WriteBlocksCoProcessor +//! \class WriteBlocksSimulationObserver //! \brief A class writes a block grid to a VTK-file -class WriteBlocksCoProcessor : public CoProcessor +class WriteBlocksSimulationObserver : public SimulationObserver { public: - //! \brief Construct WriteBlocksCoProcessor object. + //! \brief Construct WriteBlocksSimulationObserver 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 comm is Communicator object - WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, + WriteBlocksSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteBlocksCoProcessor() override; + ~WriteBlocksSimulationObserver() override; - void process(real step) override; + void update(real step) override; protected: //! Collect data for VTK-file diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp similarity index 89% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp index 4ed68397a7813314450ddd7dea33ca1824f54ac9..9d09db9e2c839f5db6bdd4c95e348e3ade094759 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp @@ -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 WriteBoundaryConditionsCoProcessor.cpp -//! \ingroup CoProcessors +//! \file WriteBoundaryConditionsSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "WriteBoundaryConditionsCoProcessor.h" -#include "BCProcessor.h" +#include "WriteBoundaryConditionsSimulationObserver.h" +#include "BCSet.h" #include "LBMKernel.h" #include <string> #include <vector> @@ -51,12 +51,12 @@ using namespace std; -WriteBoundaryConditionsCoProcessor::WriteBoundaryConditionsCoProcessor() = default; +WriteBoundaryConditionsSimulationObserver::WriteBoundaryConditionsSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteBoundaryConditionsCoProcessor::WriteBoundaryConditionsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +WriteBoundaryConditionsSimulationObserver::WriteBoundaryConditionsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -69,15 +69,15 @@ WriteBoundaryConditionsCoProcessor::WriteBoundaryConditionsCoProcessor(SPtr<Grid } } ////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::process(real step) +void WriteBoundaryConditionsSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "WriteBoundaryConditionsCoProcessor::update:" << step); + UBLOG(logDEBUG3, "WriteBoundaryConditionsSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::collectData(real step) +void WriteBoundaryConditionsSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -111,18 +111,18 @@ void WriteBoundaryConditionsCoProcessor::collectData(real step) vector<string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - VF_LOG_INFO("WriteBoundaryConditionsCoProcessor step: {}", istep); + VF_LOG_INFO("WriteBoundaryConditionsSimulationObserver step: {}", istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::clearData() +void WriteBoundaryConditionsSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -130,7 +130,7 @@ void WriteBoundaryConditionsCoProcessor::clearData() data.clear(); } ////////////////////////////////////////////////////////////////////////// -void WriteBoundaryConditionsCoProcessor::addDataGeo(SPtr<Block3D> block) +void WriteBoundaryConditionsSimulationObserver::addDataGeo(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); @@ -147,7 +147,7 @@ void WriteBoundaryConditionsCoProcessor::addDataGeo(SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); int minX1 = 0; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h similarity index 84% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h index 31f2a5c8e31820217d76745d371a8a812acb3b67..ad5b20df942748e065cebe926ba346581b9bf30b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h @@ -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 WriteBoundaryConditionsCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteBoundaryConditionsSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteBoundaryConditionsCoProcessor_H -#define WriteBoundaryConditionsCoProcessor_H +#ifndef WriteBoundaryConditionsSimulationObserver_H +#define WriteBoundaryConditionsSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "UbTuple.h" namespace vf::mpi {class Communicator;} @@ -49,22 +49,22 @@ class Block3D; class LBMUnitConverter; //! \brief A class writes boundary conditions information to a VTK-file -class WriteBoundaryConditionsCoProcessor : public CoProcessor +class WriteBoundaryConditionsSimulationObserver : public SimulationObserver { public: - WriteBoundaryConditionsCoProcessor(); - //! \brief Construct WriteBoundaryConditionsCoProcessor object + WriteBoundaryConditionsSimulationObserver(); + //! \brief Construct WriteBoundaryConditionsSimulationObserver 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 comm is Communicator object - WriteBoundaryConditionsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + WriteBoundaryConditionsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteBoundaryConditionsCoProcessor() override = default; + ~WriteBoundaryConditionsSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; protected: //! Collect data for VTK-file diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp similarity index 73% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp index b47f1056172c07855eda232bede05eef475c4718..62178444f92abffebe8ce5d2ad1bd8a1f54960f0 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp @@ -1,4 +1,4 @@ -#include "WriteGbObjectsCoProcessor.h" +#include "WriteGbObjectsSimulationObserver.h" #include <mpi/Communicator.h> #include "GbObject3D.h" #include "UbScheduler.h" @@ -6,23 +6,23 @@ #include "WbWriterVtkXmlBinary.h" #include <vector> -WriteGbObjectsCoProcessor::WriteGbObjectsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, +WriteGbObjectsSimulationObserver::WriteGbObjectsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { } ////////////////////////////////////////////////////////////////////////// -WriteGbObjectsCoProcessor::~WriteGbObjectsCoProcessor() = default; +WriteGbObjectsSimulationObserver::~WriteGbObjectsSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -void WriteGbObjectsCoProcessor::process(real step) +void WriteGbObjectsSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); } ////////////////////////////////////////////////////////////////////////// -void WriteGbObjectsCoProcessor::addGbObject(SPtr<GbObject3D> object) { objects.push_back(object); } +void WriteGbObjectsSimulationObserver::addGbObject(SPtr<GbObject3D> object) { objects.push_back(object); } ////////////////////////////////////////////////////////////////////////// -void WriteGbObjectsCoProcessor::collectData(real step) +void WriteGbObjectsSimulationObserver::collectData(real step) { std::vector<UbTupleFloat3> nodes; std::vector<UbTupleInt3> triangles; @@ -62,12 +62,12 @@ void WriteGbObjectsCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "WriteGbObjectsCoProcessor number of objects: " << numObjcts); - UBLOG(logINFO, "WriteGbObjectsCoProcessor step: " << istep); + UBLOG(logINFO, "WriteGbObjectsSimulationObserver number of objects: " << numObjcts); + UBLOG(logINFO, "WriteGbObjectsSimulationObserver step: " << istep); } } diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h similarity index 63% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h index 5b502044f0556d2519afc23b72ea2b50bd664832..50f88c65ddbf87bb9960f2be61e380e9ad2d570b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteGbObjectsCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h @@ -1,7 +1,7 @@ -#ifndef WriteGbObjectsCoProcessor_h__ -#define WriteGbObjectsCoProcessor_h__ +#ifndef WriteGbObjectsSimulationObserver_h__ +#define WriteGbObjectsSimulationObserver_h__ -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "UbTuple.h" #include <vector> @@ -17,14 +17,14 @@ class WbWriter; //! \author Konstantin Kutscher //! \date December 2018 -class WriteGbObjectsCoProcessor : public CoProcessor +class WriteGbObjectsSimulationObserver : public SimulationObserver { public: - WriteGbObjectsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, + WriteGbObjectsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteGbObjectsCoProcessor() override; + ~WriteGbObjectsSimulationObserver() override; //! calls collectData. - void process(real step) override; + void update(real step) override; //! adds geometry object void addGbObject(SPtr<GbObject3D> object); @@ -38,4 +38,4 @@ private: std::shared_ptr<vf::mpi::Communicator> comm; }; -#endif // WriteGbObjectsCoProcessor_h__ \ No newline at end of file +#endif // WriteGbObjectsSimulationObserver_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp similarity index 89% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp index 2b49861af9fd53cdec491527f40f96b4f8bc0484..caf1e8c1ed2d4c43a219e1fd7a09b3a96e0e2370 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp @@ -1,5 +1,5 @@ -#include "WriteMQFromSelectionCoProcessor.h" -#include "BCProcessor.h" +#include "WriteMQFromSelectionSimulationObserver.h" +#include "BCSet.h" #include "LBMKernel.h" #include <string> #include <vector> @@ -14,13 +14,13 @@ #include "UbScheduler.h" #include "basics/writer/WbWriterVtkXmlASCII.h" -WriteMQFromSelectionCoProcessor::WriteMQFromSelectionCoProcessor() = default; +WriteMQFromSelectionSimulationObserver::WriteMQFromSelectionSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteMQFromSelectionCoProcessor::WriteMQFromSelectionCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +WriteMQFromSelectionSimulationObserver::WriteMQFromSelectionSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbObject3D> gbObject, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), gbObject(gbObject), path(path), writer(writer), conv(conv), comm(comm) + : SimulationObserver(grid, s), gbObject(gbObject), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -33,17 +33,17 @@ WriteMQFromSelectionCoProcessor::WriteMQFromSelectionCoProcessor(SPtr<Grid3D> gr } } ////////////////////////////////////////////////////////////////////////// -void WriteMQFromSelectionCoProcessor::init() {} +void WriteMQFromSelectionSimulationObserver::init() {} ////////////////////////////////////////////////////////////////////////// -void WriteMQFromSelectionCoProcessor::process(real step) +void WriteMQFromSelectionSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "WriteMQFromSelectionCoProcessor::update:" << step); + UBLOG(logDEBUG3, "WriteMQFromSelectionSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void WriteMQFromSelectionCoProcessor::collectData(real step) +void WriteMQFromSelectionSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -90,25 +90,25 @@ void WriteMQFromSelectionCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) { + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "WriteMQFromSelectionCoProcessor step: " << istep); + UBLOG(logINFO, "WriteMQFromSelectionSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteMQFromSelectionCoProcessor::clearData() +void WriteMQFromSelectionSimulationObserver::clearData() { nodes.clear(); datanames.clear(); data.clear(); } ////////////////////////////////////////////////////////////////////////// -void WriteMQFromSelectionCoProcessor::addDataMQ(SPtr<Block3D> block) +void WriteMQFromSelectionSimulationObserver::addDataMQ(SPtr<Block3D> block) { real level = (real)block->getLevel(); // double blockID = (double)block->getGlobalID(); @@ -126,7 +126,7 @@ void WriteMQFromSelectionCoProcessor::addDataMQ(SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h similarity index 71% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h index 64e7572797a613815d62eec91a61d68120ee1a2e..e91fc369e1ddb33af68629d6aab75cf5b3756290 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMQFromSelectionCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h @@ -1,11 +1,11 @@ -#ifndef WriteMQFromSelectionCoProcessor_H -#define WriteMQFromSelectionCoProcessor_H +#ifndef WriteMQFromSelectionSimulationObserver_H +#define WriteMQFromSelectionSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -18,16 +18,16 @@ class WbWriter; class Block3D; class GbObject3D; -class WriteMQFromSelectionCoProcessor : public CoProcessor +class WriteMQFromSelectionSimulationObserver : public SimulationObserver { public: - WriteMQFromSelectionCoProcessor(); - WriteMQFromSelectionCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbObject3D> gbObject, + WriteMQFromSelectionSimulationObserver(); + WriteMQFromSelectionSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbObject3D> gbObject, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteMQFromSelectionCoProcessor() override = default; + ~WriteMQFromSelectionSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; protected: void collectData(real step); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp similarity index 90% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp index 5c4f80887349280856a2de3791d9d0fb9012f53b..142bcc52b053f0be71c8a1ca41eaf0dfeaf24f1b 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp @@ -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 WriteMacroscopicQuantitiesPlusMassCoProcessor.cpp -//! \ingroup CoProcessors +//! \file WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "WriteMacroscopicQuantitiesPlusMassCoProcessor.h" -#include "BCProcessor.h" +#include "WriteMacroscopicQuantitiesPlusMassSimulationObserver.h" +#include "BCSet.h" #include "LBMKernel.h" #include <string> #include <vector> @@ -46,14 +46,14 @@ #include "UbScheduler.h" #include "basics/writer/WbWriterVtkXmlASCII.h" -WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMassCoProcessor() = default; +WriteMacroscopicQuantitiesPlusMassSimulationObserver::WriteMacroscopicQuantitiesPlusMassSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMassCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +WriteMacroscopicQuantitiesPlusMassSimulationObserver::WriteMacroscopicQuantitiesPlusMassSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -68,20 +68,20 @@ WriteMacroscopicQuantitiesPlusMassCoProcessor::WriteMacroscopicQuantitiesPlusMas } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesPlusMassCoProcessor::init() +void WriteMacroscopicQuantitiesPlusMassSimulationObserver::init() {} ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesPlusMassCoProcessor::process(real step) +void WriteMacroscopicQuantitiesPlusMassSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesPlusMassCoProcessor::update:" << step); + UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesPlusMassSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesPlusMassCoProcessor::collectData(real step) +void WriteMacroscopicQuantitiesPlusMassSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -118,21 +118,21 @@ void WriteMacroscopicQuantitiesPlusMassCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "WriteMacroscopicQuantitiesPlusMassCoProcessor step: " << istep); + UBLOG(logINFO, "WriteMacroscopicQuantitiesPlusMassSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesPlusMassCoProcessor::clearData() +void WriteMacroscopicQuantitiesPlusMassSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -141,7 +141,7 @@ void WriteMacroscopicQuantitiesPlusMassCoProcessor::clearData() } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesPlusMassCoProcessor::addDataMQ(SPtr<Block3D> block) +void WriteMacroscopicQuantitiesPlusMassSimulationObserver::addDataMQ(SPtr<Block3D> block) { real level = (real)block->getLevel(); @@ -160,7 +160,7 @@ void WriteMacroscopicQuantitiesPlusMassCoProcessor::addDataMQ(SPtr<Block3D> bloc data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h similarity index 83% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h index 1815d480f392fa47cdbf64038791929dc32a2ff3..ce6946528269adec3374dff655991b4a8cb0aaf7 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h @@ -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 WriteMacroscopicQuantitiesCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteMacroscopicQuantitiesPlusMassSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteMacroscopicQuantitiesCoProcessor_H -#define WriteMacroscopicQuantitiesCoProcessor_H +#ifndef WriteMacroscopicQuantitiesPlusMassSimulationObserver_H +#define WriteMacroscopicQuantitiesPlusMassSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -50,11 +50,11 @@ class WbWriter; class Block3D; //! \brief A class writes macroscopic quantities information to a VTK-file -class WriteMacroscopicQuantitiesCoProcessor : public CoProcessor +class WriteMacroscopicQuantitiesPlusMassSimulationObserver : public SimulationObserver { public: - WriteMacroscopicQuantitiesCoProcessor(); - //! \brief Construct WriteMacroscopicQuantitiesCoProcessor object + WriteMacroscopicQuantitiesPlusMassSimulationObserver(); + //! \brief Construct WriteMacroscopicQuantitiesPlusMassSimulationObserver object //! \pre The Grid3D and UbScheduler objects must exist //! \param grid is observable Grid3D object //! \param s is UbScheduler object for scheduling of observer @@ -62,11 +62,11 @@ public: //! \param writer is WbWriter object //! \param conv is LBMUnitConverter object //! \param comm is Communicator object - WriteMacroscopicQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, + WriteMacroscopicQuantitiesPlusMassSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteMacroscopicQuantitiesCoProcessor() override = default; + ~WriteMacroscopicQuantitiesPlusMassSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; protected: //! Collect data for VTK-file diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp similarity index 91% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp index 58ed15604f8937b0b33fca96dab69250a404242c..b87b5cfcfc5b10b3fc97d54b135a745c811f9e0e 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp @@ -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 WriteMacroscopicQuantitiesCoProcessor.cpp -//! \ingroup CoProcessors +//! \file WriteMacroscopicQuantitiesSimulationObserver.cpp +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#include "WriteMacroscopicQuantitiesCoProcessor.h" -#include "BCProcessor.h" +#include "WriteMacroscopicQuantitiesSimulationObserver.h" +#include "BCSet.h" #include "LBMKernel.h" #include <string> #include <vector> @@ -46,14 +46,14 @@ #include "UbScheduler.h" #include "basics/writer/WbWriterVtkXmlASCII.h" -WriteMacroscopicQuantitiesCoProcessor::WriteMacroscopicQuantitiesCoProcessor() = default; +WriteMacroscopicQuantitiesSimulationObserver::WriteMacroscopicQuantitiesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteMacroscopicQuantitiesCoProcessor::WriteMacroscopicQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, +WriteMacroscopicQuantitiesSimulationObserver::WriteMacroscopicQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) - : CoProcessor(grid, s), path(path), writer(writer), conv(conv), comm(comm) + : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -68,20 +68,20 @@ WriteMacroscopicQuantitiesCoProcessor::WriteMacroscopicQuantitiesCoProcessor(SPt } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::init() +void WriteMacroscopicQuantitiesSimulationObserver::init() {} ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::process(real step) +void WriteMacroscopicQuantitiesSimulationObserver::update(real step) { if (scheduler->isDue(step)) collectData(step); - UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesCoProcessor::update:" << step); + UBLOG(logDEBUG3, "WriteMacroscopicQuantitiesSimulationObserver::update:" << step); } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::collectData(real step) +void WriteMacroscopicQuantitiesSimulationObserver::collectData(real step) { int istep = static_cast<int>(step); @@ -118,21 +118,21 @@ void WriteMacroscopicQuantitiesCoProcessor::collectData(real step) std::vector<std::string> filenames; filenames.push_back(piece); - if (step == CoProcessor::scheduler->getMinBegin()) + if (step == SimulationObserver::scheduler->getMinBegin()) { WbWriterVtkXmlASCII::getInstance()->writeCollection(cfilePath, filenames, istep, false); } else { WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(cfilePath, filenames, istep, false); } - UBLOG(logINFO, "WriteMacroscopicQuantitiesCoProcessor step: " << istep); + UBLOG(logINFO, "WriteMacroscopicQuantitiesSimulationObserver step: " << istep); } clearData(); } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::clearData() +void WriteMacroscopicQuantitiesSimulationObserver::clearData() { nodes.clear(); cells.clear(); @@ -141,7 +141,7 @@ void WriteMacroscopicQuantitiesCoProcessor::clearData() } ////////////////////////////////////////////////////////////////////////// -void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) +void WriteMacroscopicQuantitiesSimulationObserver::addDataMQ(SPtr<Block3D> block) { real level = (real)block->getLevel(); @@ -160,7 +160,7 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) data.resize(datanames.size()); SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h similarity index 84% rename from src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h rename to src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h index 9251bfc22549a7a366e57540ea8387e851d4756f..85de0336487a71774d63c86f4c6ba1b65b15fe2a 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesPlusMassCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h @@ -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 WriteMacroscopicQuantitiesPlusMassCoProcessor.h -//! \ingroup CoProcessors +//! \file WriteMacroscopicQuantitiesSimulationObserver.h +//! \ingroup SimulationObservers //! \author Konstantin Kutscher //======================================================================================= -#ifndef WriteMacroscopicQuantitiesPlusMassCoProcessor_H -#define WriteMacroscopicQuantitiesPlusMassCoProcessor_H +#ifndef WriteMacroscopicQuantitiesSimulationObserver_H +#define WriteMacroscopicQuantitiesSimulationObserver_H #include <PointerDefinitions.h> #include <string> #include <vector> -#include "CoProcessor.h" +#include "SimulationObserver.h" #include "LBMSystem.h" #include "UbTuple.h" @@ -50,11 +50,11 @@ class WbWriter; class Block3D; //! \brief A class writes macroscopic quantities information to a VTK-file -class WriteMacroscopicQuantitiesPlusMassCoProcessor : public CoProcessor +class WriteMacroscopicQuantitiesSimulationObserver : public SimulationObserver { public: - WriteMacroscopicQuantitiesPlusMassCoProcessor(); - //! \brief Construct WriteMacroscopicQuantitiesPlusMassCoProcessor object + WriteMacroscopicQuantitiesSimulationObserver(); + //! \brief Construct WriteMacroscopicQuantitiesSimulationObserver object //! \pre The Grid3D and UbScheduler objects must exist //! \param grid is observable Grid3D object //! \param s is UbScheduler object for scheduling of observer @@ -62,11 +62,11 @@ public: //! \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, + WriteMacroscopicQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); - ~WriteMacroscopicQuantitiesPlusMassCoProcessor() override = default; + ~WriteMacroscopicQuantitiesSimulationObserver() override = default; - void process(real step) override; + void update(real step) override; protected: //! Collect data for VTK-file diff --git a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp index 3fbd3643d71409fe21aa800473310399757f3a44..dbfb8907dacdad96849812a1cf5b01ccb52e1483 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp +++ b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp @@ -5,7 +5,7 @@ #include "IntegrateValuesHelper.h" #include "BoundaryConditions.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" namespace Utilities { @@ -16,7 +16,7 @@ namespace Utilities for(IntegrateValuesHelper::CalcNodes cn : cnodes) { SPtr<ILBMKernel> kernel = cn.block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); for(UbTupleInt3 node : cn.nodes) { SPtr<BoundaryConditions> bc = bcArray->getBC(val<1>(node), val<2>(node), val<3>(node)); diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp index 53282294203213fe98b8867dfaf2fde523490bc5..358dabf437fb69325a905d968e8dc6547127fd8f 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp +++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp @@ -162,7 +162,7 @@ void CheckpointConverter::convertBlocks(int step, int procCount) // calculate the read offset procCount = - 1; // readBlocks and writeBlocks in both MPIIORestartCoProcessor and MPIIOMigrationCoProcessor have size == 1! + 1; // readBlocks and writeBlocks in both MPIIORestartSimulationObserver and MPIIOMigrationSimulationObserver have size == 1! MPI_Offset read_offset = (MPI_Offset)(procCount * sizeof(int)); // read parameters of the grid and blocks diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h index 6fe24772d574a6db67428a820027971b4c7fd230..bab67ae662c10e31158b47e1725788dc38794560 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h +++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h @@ -11,7 +11,7 @@ class Grid3D; namespace vf::mpi {class Communicator;} //! \class UtilConvertor -//! \brief Converts timestep data from MPIIORestartCoProcessor format into MPIIOMigrationCoProcessor format +//! \brief Converts timestep data from MPIIORestartSimulationObserver format into MPIIOMigrationSimulationObserver format class CheckpointConverter { public: diff --git a/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp b/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp index 7ac3aa19578b0735ffab354a8f45ec714bacd314..1903cba9b2318f094142bdd1f2562a845d05f069 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp +++ b/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp @@ -2,7 +2,7 @@ #define VoxelMatrixUtil_h__ #include "GbCuboid3D.h" -#include "NoSlipBCAdapter.h" +#include "NoSlipBC.h" #include "D3Q27Interactor.h" #include "SetBcBlocksBlockVisitor.h" #include "Block3D.h" @@ -13,7 +13,7 @@ namespace Utilities { void voxelMatrixDiscretisation(SPtr<GbVoxelMatrix3D> matrix, std::string& pathname, int myid, int fileCounter, SPtr<Grid3D> grid, int bounceBackOption, bool vmFile) { - SPtr<BCAdapter> noSlipPM(new NoSlipBCAdapter(bounceBackOption)); + SPtr<BC> noSlipPM(new NoSlipBC(bounceBackOption)); SPtr<D3Q27Interactor> vmInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(matrix, grid, noSlipPM, Interactor3D::SOLID)); if (vmFile) diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp index fbfbd1bcab135056fa6b62e31d50b63c898bb83a..db18f090ab566bad0f4bb39493216e8db7c7be2c 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp @@ -32,26 +32,19 @@ //======================================================================================= #include "BoundaryConditionsBlockVisitor.h" -#include "BCAdapter.h" +#include "BC.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" #include "Grid3D.h" #include "D3Q27System.h" -#include "BCAdapter.h" +#include "BC.h" #include "Block3D.h" #include "BCArray3D.h" #include "ILBMKernel.h" -#include "ThixotropyDensityBCAlgorithm.h" -#include "ThixotropyVelocityBCAlgorithm.h" -#include "ThixotropyNoSlipBCAlgorithm.h" -#include "ThixotropyNonReflectingOutflowBCAlgorithm.h" -#include "ThixotropyVelocityWithDensityBCAlgorithm.h" - - BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL) { } @@ -67,13 +60,13 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc throw UbException(UB_EXARGS, "LBMKernel in " + block->toString() + "is not exist!"); } - SPtr<BCProcessor> bcProcessor = kernel->getBCProcessor(); + SPtr<BCSet> bcSet = kernel->getBCSet(); - if (!bcProcessor) { + if (!bcSet) { throw UbException(UB_EXARGS, "Boundary Conditions Processor is not exist!"); } - SPtr<BCArray3D> bcArray = bcProcessor->getBCArray(); + SPtr<BCArray3D> bcArray = bcSet->getBCArray(); bool compressible = kernel->getCompressible(); real collFactor = kernel->getCollisionFactor(); @@ -86,7 +79,7 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc int maxX3 = (int)bcArray->getNX3(); SPtr<BoundaryConditions> bcPtr; - bcProcessor->clearBC(); + bcSet->clearBC(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); @@ -95,8 +88,8 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc for (int x1 = minX1; x1 < maxX1; x1++) { if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { if ((bcPtr = bcArray->getBC(x1, x2, x3)) != NULL) { - char alg = bcPtr->getBcAlgorithmType(); - SPtr<BCAlgorithm> bca = bcMap[alg]; + char alg = bcPtr->getBCStrategyType(); + SPtr<BCStrategy> bca = bcMap[alg]; if (bca) { bca = bca->clone(); @@ -104,27 +97,10 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc bca->setNodeIndex(x1, x2, x3); bca->setBcPointer(bcPtr); bca->addDistributions(distributions); - - if (alg == BCAlgorithm::ThixotropyVelocityBCAlgorithm) - std::static_pointer_cast<ThixotropyVelocityBCAlgorithm>(bca)->addDistributionsH( - kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::ThixotropyDensityBCAlgorithm) - std::static_pointer_cast<ThixotropyDensityBCAlgorithm>(bca)->addDistributionsH( - kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::ThixotropyNoSlipBCAlgorithm) - std::static_pointer_cast<ThixotropyNoSlipBCAlgorithm>(bca)->addDistributionsH( - kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm) - std::static_pointer_cast<ThixotropyNonReflectingOutflowBCAlgorithm>(bca) - ->addDistributionsH(kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm) - std::static_pointer_cast<ThixotropyVelocityWithDensityBCAlgorithm>(bca) - ->addDistributionsH(kernel->getDataSet()->getHdistributions()); - bca->setCollFactor(collFactor); bca->setCompressible(compressible); bca->setBcArray(bcArray); - bcProcessor->addBC(bca); + bcSet->addBC(bca); } } } @@ -134,7 +110,7 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc } } ////////////////////////////////////////////////////////////////////////// -void BoundaryConditionsBlockVisitor::addBC(SPtr<BCAdapter> bc) +void BoundaryConditionsBlockVisitor::addBC(SPtr<BC> bc) { - bcMap.insert(std::make_pair(bc->getBcAlgorithmType(), bc->getAlgorithm())); + bcMap.insert(std::make_pair(bc->getBCStrategyType(), bc->getAlgorithm())); } diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h index 42eefd93077c56f12c2eec3282cb3f7a1e67c208..8954bf73a6a459a795e916f24192f5db698b1426 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h @@ -41,8 +41,8 @@ class Grid3D; class Block3D; -class BCAlgorithm; -class BCAdapter; +class BCStrategy; +class BC; //! \brief set boundary conditions class BoundaryConditionsBlockVisitor : public Block3DVisitor @@ -52,10 +52,10 @@ public: ~BoundaryConditionsBlockVisitor() override; void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; - void addBC(SPtr<BCAdapter> bc); + void addBC(SPtr<BC> bc); protected: private: - std::map<char, SPtr<BCAlgorithm>> bcMap; + std::map<char, SPtr<BCStrategy>> bcMap; }; #endif // BoundaryConditionBlockVisitor_h__ diff --git a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp index c541465183dd084135d60b7112182daae33e22ab..682f1d65b2475001d59d4fad57fb3b4f39eaa918 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.cpp @@ -1,6 +1,6 @@ #include "ChangeBoundaryDensityBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include "Grid3D.h" @@ -19,7 +19,7 @@ void ChangeBoundaryDensityBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> b { if (block->getRank() == grid->getRank()) { SPtr<ILBMKernel> kernel = block->getKernel(); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); int minX1 = 0; int minX2 = 0; diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp index 1c4860070a5ca8aefc4850a9b16dd7273c65f231..2e24a2e26d1709b5c1af33d2210f269ca59f2e40 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp @@ -33,7 +33,7 @@ #include "InitDistributionsBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "EsoTwist3D.h" @@ -157,7 +157,7 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> else calcFeqsFct = &D3Q27System::calcIncompFeq; - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); real o = kernel->getCollisionFactor(); diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp index 2632f2c59db6d4982806c50dcc50f743cc5c2ad3..3a51f5532532e4ac116221a551a1d4ad9bb5e66c 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.cpp @@ -1,6 +1,6 @@ #include "InitDistributionsFromFileBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "EsoTwist3D.h" @@ -73,7 +73,7 @@ void InitDistributionsFromFileBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr< // UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<EsoTwist3D> distributions = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); real f[D3Q27System::ENDF + 1]; diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp index 6dd6976ca3cb250e720079031632b9b5e3902696..660363e22e7c315a40df596aa95137f5589fff72 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp @@ -2,7 +2,7 @@ #include "mpi.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" @@ -178,7 +178,7 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseT SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCSet()->getBCArray(); SPtr<ILBMKernel> newKernel = newBlock->getKernel(); if (!newKernel) @@ -279,7 +279,7 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarse MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCSet()->getBCArray(); std::vector<int> &bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD); } else if (newBlockRank == newGridRank && newBlock->isActive()) { @@ -408,7 +408,7 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToC SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions()); - SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCSet()->getBCArray(); SPtr<ILBMKernel> newKernel = newBlock->getKernel(); if (!newKernel) @@ -510,7 +510,7 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineTo MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD); - SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCSet()->getBCArray(); std::vector<int> &bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector(); MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD); } else if (newBlockRank == newGridRank && newBlock->isActive()) { diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp index 0c666958912c7f73f74d91b179e19cf6d3b06dd1..be0c694bc733ff3b9ebd808d533757f98eefe73c 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp @@ -33,7 +33,7 @@ #include "InitThixotropyBlockVisitor.h" #include "LBMKernel.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "D3Q27System.h" #include "DataSet3D.h" #include "EsoTwist3D.h" @@ -250,7 +250,7 @@ void InitThixotropyBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) else calcFeqsFct = &D3Q27System::calcIncompFeq; - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getHdistributions(); real h[D3Q27System::ENDF+1]; diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp index 54271370c11700886f969eeef75a2389ef062828..fed80000c562b8aafdefd83ff2791781a8907f7a 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp @@ -34,7 +34,7 @@ #include "SetKernelBlockVisitor.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "DataSet3D.h" #include "Grid3D.h" @@ -88,24 +88,24 @@ void SetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) newKernel->setDataSet(dataSet); - SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); + SPtr<BCSet> bcProc = block->getKernel()->getBCSet(); if (!bcProc) { UB_THROW(UbException( UB_EXARGS, - "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); + "It is not possible to change a BCSet in kernel! Old BCSet is not exist!")); } - newKernel->setBCProcessor(bcProc); + newKernel->setBCSet(bcProc); block->setKernel(newKernel); } break; case SetKernelBlockVisitor::ChangeKernelWithData: { - SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); + SPtr<BCSet> bcProc = block->getKernel()->getBCSet(); if (!bcProc) { UB_THROW(UbException( UB_EXARGS, - "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); + "It is not possible to change a BCSet in kernel! Old BCSet is not exist!")); } - newKernel->setBCProcessor(bcProc); + newKernel->setBCSet(bcProc); block->setKernel(newKernel); } break; } diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp index bb6cc5dc6fe06b1a63647d83897bc1fe83066a1a..04f758d396b726c67a5e9a5797a3d65d3d26a36b 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp @@ -1,6 +1,6 @@ #include "SetUndefinedNodesBlockVisitor.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" #include "D3Q27System.h" @@ -29,7 +29,7 @@ void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block // int gl = kernel->getGhostLayerWidth(); int gl = 0; - SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray(); + SPtr<BCArray3D> bcMatrix = kernel->getBCSet()->getBCArray(); int minX1 = gl; int minX2 = gl; diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp index 6183024279ce1753f2fd78bf20b72313b84662f1..4cdcfb80bb4aa3119f1e2ca4dfcd19c2abf381dd 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp @@ -3,7 +3,7 @@ #include "LBMSystem.h" #include "BCArray3D.h" -#include "BCProcessor.h" +#include "BCSet.h" #include "Block3D.h" #include "D3Q27System.h" #include "Grid3D.h" @@ -58,12 +58,12 @@ void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) newKernel->setDataSet(dataSet); - SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); + SPtr<BCSet> bcProc = block->getKernel()->getBCSet(); if (!bcProc) { UB_THROW(UbException( - UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!")); + UB_EXARGS, "It is not possible to change a BCSet in kernel! Old BCSet is not exist!")); } - newKernel->setBCProcessor(bcProc); + newKernel->setBCSet(bcProc); real oldCollFactor = newKernel->getCollisionFactor(); diff --git a/utilities/DirRename.py b/utilities/DirRename.py index 3f01e630a931ec98454c9ac620c3f18d92d7e59a..2d0bd0541c5b86b1ca9746b8e7e6beb2cc7ef005 100644 --- a/utilities/DirRename.py +++ b/utilities/DirRename.py @@ -5,7 +5,7 @@ Created on Tue Dec 6 13:21:27 2022 @author: kutscher """ -filename = "d:/temp/MultiphaseNonReflectingOutflowBCAlgorithm.cpp" +filename = "d:/temp/VF/4/MultiphaseScaleDistributionLBMKernel.cpp" #read input file fin = open(filename, "rt") @@ -33,18 +33,18 @@ 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('[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]') @@ -108,33 +108,33 @@ data = data.replace('[B]', '[DIR_00M]') # 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)') # data = data.replace('REST','DIR_000') # data = data.replace('TNE', 'DIR_PPP')