diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4bf538b84b0211ada593913a556f10be0d6ed608..a0693d564438ece97e0e9bebc7262bf189a337d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,12 @@ # Contributing If you want to contribute to VirtualFluids, your help is very welcome. -To contribute use a pull request as follows: +To contribute use a merge request as follows: -### How to make a clean pull request +### How to make a clean merge request - Create a personal fork of VirtualFluids. -- Clone the fork on your local machine. Your remote repo on gitea is called `origin`. +- Clone the fork on your local machine. Your remote repo on gitlab is called `origin`. - Add the original repository as a remote called `upstream`. - If you created your fork a while ago be sure to pull upstream changes into your local repository. - Create a new branch to work on! Branch from `develop` or `open_source`. @@ -16,10 +16,10 @@ To contribute use a pull request as follows: - Write or adapt tests as needed. - Add or change the documentation as needed. - Push your branch to your fork on gitea, the remote `origin`. -- From your fork open a pull request in the correct branch. Target the project's `develop` or `open_source` branch +- From your fork open a merge request in the correct branch. Target the project's `develop` or `open_source` branch - … -- If we requests further changes just push them to your branch. The PR will be updated automatically. -- Once the pull request is approved and merged you can pull the changes from `upstream` to your local repo and delete +- If we requests further changes just push them to your branch. The MR will be updated automatically. +- Once the merge request is approved and merged you can pull the changes from `upstream` to your local repo and delete your extra branch(es). And last but not least: Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code. diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake index 2fc89f7036ba707fdd4412c702b8be626956bb86..d8dff8b8c5f776d1d27e9217d7b050ab4022d8a4 100644 --- a/apps/cpu/Applications.cmake +++ b/apps/cpu/Applications.cmake @@ -69,4 +69,5 @@ 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) diff --git a/apps/cpu/CouetteFlow/cflow.cpp b/apps/cpu/CouetteFlow/cflow.cpp index 874b8e17aad431799acc0b13412fa025e6254077..2ac32915a9348021acb2ff6e5ee70b24a8dedeb6 100644 --- a/apps/cpu/CouetteFlow/cflow.cpp +++ b/apps/cpu/CouetteFlow/cflow.cpp @@ -100,7 +100,7 @@ void bflow(string configname) double c = 10; // 1.0 / 6.0; double mu0 = 1e-4; - SPtr<Thixotropy> thix = Thixotropy::getInstance(); + SPtr<Rheology> thix = Rheology::getInstance(); //Herschel-Bulkley thix->setPowerIndex(n); thix->setViscosityParameter(k); @@ -111,9 +111,9 @@ void bflow(string configname) thix->setMu0(mu0); SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new HerschelBulkleyModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new PowellEyringModelNoSlipBCAlgorithm())); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new BinghamModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyPowellEyringModelNoSlipBCAlgorithm())); + noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; @@ -124,7 +124,7 @@ void bflow(string configname) //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 BinghamModelLBMKernel()); + SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel()); kernel->setForcingX1(forcing); kernel->setWithForcing(true); kernel->setBCProcessor(bcProc); diff --git a/apps/cpu/HerschelBulkleyModel/hbflow.cpp b/apps/cpu/HerschelBulkleyModel/hbflow.cpp index 7371c782edcacae5d4db566a37248c40c0eb2853..6de995e2af0510fcc19f985a1eb43214b1748090 100644 --- a/apps/cpu/HerschelBulkleyModel/hbflow.cpp +++ b/apps/cpu/HerschelBulkleyModel/hbflow.cpp @@ -120,7 +120,7 @@ void bflow(string configname) double c = 10; // 1.0 / 6.0; double mu0 = 1e-4; - SPtr<Thixotropy> thix = Thixotropy::getInstance(); + SPtr<Rheology> thix = Rheology::getInstance(); //Herschel-Bulkley thix->setPowerIndex(n); thix->setViscosityParameter(k); @@ -131,9 +131,9 @@ void bflow(string configname) thix->setMu0(mu0); SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new HerschelBulkleyModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new PowellEyringModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new BinghamModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyPowellEyringModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); //BS visitor BoundaryConditionsBlockVisitor bcVisitor; diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp index 3b6ddb814140f1b0e756deef1443577fa79aaf68..f4b50325da703381b9c09b36c18741f7f1c04cc5 100644 --- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp +++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp @@ -94,7 +94,7 @@ void bflow(string configname) double omegaMin = 1.0e-8; - SPtr<Thixotropy> thix = Thixotropy::getInstance(); + SPtr<Rheology> thix = Rheology::getInstance(); thix->setPowerIndex(n); thix->setViscosityParameter(k); thix->setYieldStress(tau0); @@ -102,8 +102,8 @@ void bflow(string configname) SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new HerschelBulkleyModelNoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new BinghamModelNoSlipBCAlgorithm())); + noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); diff --git a/apps/cpu/ViskomatXL/CMakeLists.txt b/apps/cpu/ViskomatXL/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b72b8765177c13a3f747b5f03e80f0ef5823ae1 --- /dev/null +++ b/apps/cpu/ViskomatXL/CMakeLists.txt @@ -0,0 +1,6 @@ +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(viskomat) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} FILES viskomat.cpp ) \ No newline at end of file diff --git a/apps/cpu/ViskomatXL/viscosity.cfg b/apps/cpu/ViskomatXL/viscosity.cfg new file mode 100644 index 0000000000000000000000000000000000000000..bf2822c7b1d6dd42fdcbc513a4e6b39264ab4180 --- /dev/null +++ b/apps/cpu/ViskomatXL/viscosity.cfg @@ -0,0 +1 @@ +nuLB = 1.5e-3 \ No newline at end of file diff --git a/apps/cpu/ViskomatXL/viskomat.cfg b/apps/cpu/ViskomatXL/viskomat.cfg new file mode 100644 index 0000000000000000000000000000000000000000..f5d9fef26c61f9756875823c4b8a809d8bbb94e8 --- /dev/null +++ b/apps/cpu/ViskomatXL/viskomat.cfg @@ -0,0 +1,31 @@ +outputPath = d:/temp/rheometer/rheometerBinghamqQBB/rheometerBingham_tau_20e-7_nu_1.5e-3_new_lim + +viscosityPath = d:/Projects/VirtualFluidsCombined/apps/cpu/rheometer + +numOfThreads = 4 +availMem = 8e9 +logToFile = false + +blocknx = 8 8 1 +#boundingBox = 32 32 1 +deltax = 1 + +#boundingBox = 0.02 0.02 0.00125 +#deltax = 0.000625 + +refineLevel = 0 + +OmegaLB = 4e-5 +tau0 = 20e-7 + +resolution = 32 +scaleFactor = 1 + +newStart = true +restartStep = 100000 + +cpStart = 10000 +cpStep = 10000 + +outTime = 10000 +endTime = 100000 \ No newline at end of file diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1c0c10e71039d58f3f17dfd522aa14583ea6c591 --- /dev/null +++ b/apps/cpu/ViskomatXL/viskomat.cpp @@ -0,0 +1,427 @@ +#include <iostream> +#include <string> + +#include <VirtualFluids.h> + +using namespace std; + + +void bflow(string configname) +{ + try + { + ConfigurationFile config; + config.load(configname); + + string outputPath = config.getValue<string>("outputPath"); + string viscosityPath = config.getValue<string>("viscosityPath"); + int numOfThreads = config.getValue<int>("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); + vector<double> boundingBox = config.getVector<double>("boundingBox"); + //double nuLB = 1.5e-3;//config.getValue<double>("nuLB"); + double endTime = config.getValue<double>("endTime"); + double outTime = config.getValue<double>("outTime"); + double availMem = config.getValue<double>("availMem"); + int refineLevel = config.getValue<int>("refineLevel"); + bool logToFile = config.getValue<bool>("logToFile"); + double restartStep = config.getValue<double>("restartStep"); + double deltax = config.getValue<double>("deltax"); + double cpStep = config.getValue<double>("cpStep"); + double cpStart = config.getValue<double>("cpStart"); + bool newStart = config.getValue<bool>("newStart"); + double OmegaLB = config.getValue<double>("OmegaLB"); + double tau0 = config.getValue<double>("tau0"); + double scaleFactor = config.getValue<double>("scaleFactor"); + double resolution = config.getValue<double>("resolution"); + + ConfigurationFile viscosity; + viscosity.load(viscosityPath + "/viscosity.cfg"); + double nuLB = viscosity.getValue<double>("nuLB"); + + outputPath = outputPath + "/rheometerBingham_" + config.getValue<string>("resolution") + "_" + config.getValue<string>("OmegaLB"); + + SPtr<Communicator> comm = MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (logToFile) + { +#if defined(__unix__) + if (myid == 0) + { + const char* str = outputPath.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) + { + stringstream logFilename; + logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + LBMReal rhoLB = 0.0; + + //akoustic + OmegaLB /= scaleFactor; + nuLB *=scaleFactor; + endTime *= scaleFactor; + //outTime = endTime; + cpStart = endTime; + cpStep = endTime; + +//diffusive + //OmegaLB /= scaleFactor * scaleFactor; + //tau0 /= scaleFactor * scaleFactor; + //endTime *= scaleFactor * scaleFactor; + //outTime = endTime; + //cpStart = endTime; + //cpStep = endTime; + + SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter()); + // double uWorld = (N * PI) / 30.0; //0.0037699111843 + // double rhoWorld = 2350.0; //kg/m^3 + //double R0 = boundingBox[0] * 0.5; + + //SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter(deltax, uWorld*R0, rhoWorld, 1.0, uLB)); + //if (myid == 0) UBLOG(logINFO, conv->toString()); + + //bounding box + + double g_minX1 = 0; + double g_minX2 = 0; + double g_minX3 = 0; + + double g_maxX1 = boundingBox[0]; + double g_maxX2 = boundingBox[1]; + double g_maxX3 = boundingBox[2]; + + //double g_minX1 = -boundingBox[0]/2.0; + //double g_minX2 = -boundingBox[1] / 2.0; + //double g_minX3 = -boundingBox[2]/2.0; + + //double g_maxX1 = boundingBox[0]/2.0; + //double g_maxX2 = boundingBox[1]/2.0; + //double g_maxX3 = boundingBox[2]/2.0; + +// double blockLength = 3.0 * deltax; + + // double d = 2.0 * radius; + // double U = uLB; + // double Gamma = U / d; + + // double muWorld = 20; //Pa*s + // double k = 0.0015; // muWorld / rhoWorld * conv->getFactorViscosityWToLb(); //(U * d) / (Re); + + // //double k = (U * d) / (Re * std::pow(Gamma, n - 1)); + // double yielStressWorld = 20; //Pa + // double tau0 = 1e-6;// 3e-6;//yielStressWorld * conv->getFactorPressureWToLb(); //Bn * k * std::pow(Gamma, n); + + //double k = 0.05; // (U * d) / (Re * std::pow(Gamma, n - 1)); + //double tau0 = 3e-6; //Bn * k * std::pow(Gamma, n); + + //double forcing = 8e-7; + + //double omegaMin = 1.0e-8; + + SPtr<Rheology> thix = Rheology::getInstance(); + //thix->setPowerIndex(n); + //thix->setViscosityParameter(k); + thix->setYieldStress(tau0); + //thix->setOmegaMin(omegaMin); + + SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); + noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); + + //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); + //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); + + mu::Parser fctVx; + //fctVx.SetExpr("omega*(r-x2)"); + fctVx.SetExpr("-Omega*(x2-r)"); + fctVx.DefineConst("Omega", OmegaLB); + //fctVx.DefineConst("r", R0); + fctVx.DefineConst("r", g_maxX1*0.5); + + mu::Parser fctVy; + fctVy.SetExpr("Omega*(x1-r)"); + fctVy.DefineConst("Omega", OmegaLB); + //fctVy.DefineConst("r", R0); + fctVy.DefineConst("r", g_maxX2 * 0.5); + + mu::Parser fctVz; + fctVz.SetExpr("0.0"); + + SPtr<BCAdapter> velocityBCAdapter(new VelocityBCAdapter(true, true, true, fctVx, fctVy, fctVz, 0, BCFunction::INFCONST)); + //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm())); + //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm())); + //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm())); + velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelVelocityBCAlgorithm())); + + //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter()); + //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); + ////densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm())); + + + //BS visitor + BoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBCAdapter); + //bcVisitor.addBC(slipBCAdapter); + bcVisitor.addBC(velocityBCAdapter); + //bcVisitor.addBC(densityBCAdapter); + + SPtr<BCProcessor> bcProc; + bcProc = SPtr<BCProcessor>(new BCProcessor()); + + //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new 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->setForcingX1(forcing); + //kernel->setWithForcing(true); + + SPtr<Grid3D> grid(new Grid3D(comm)); + grid->setPeriodicX1(false); + grid->setPeriodicX2(false); + grid->setPeriodicX3(true); + grid->setDeltaX(deltax); + grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + + SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + ////////////////////////////////////////////////////////////////////////// + //restart + SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart)); + SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, outputPath, comm)); + restartCoProcessor->setLBMKernel(kernel); + restartCoProcessor->setBCProcessor(bcProc); + //restartCoProcessor->setNu(k); + ////////////////////////////////////////////////////////////////////////// + + ////stator + 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.5 * g_maxX1)); + GbSystem3D::writeGeoObject(stator.get(), outputPath + "/geo/stator", WbWriterVtkXmlBinary::getInstance()); + + SPtr<D3Q27Interactor> statorInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(stator, grid, velocityBCAdapter, Interactor3D::INVERSESOLID)); + + ////rotor (cylinder) + SPtr<GbObject3D> rotor(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)); + GbSystem3D::writeGeoObject(rotor.get(), outputPath + "/geo/rotor", WbWriterVtkXmlBinary::getInstance()); + + SPtr<D3Q27Interactor> rotorInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(rotor, grid, noSlipBCAdapter, Interactor3D::SOLID)); + + if (myid == 0) + { + UBLOG(logINFO, "Parameters:"); + //UBLOG(logINFO, "forcing = " << forcing); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "uLB = " << OmegaLB); + UBLOG(logINFO, "nuLB = " << nuLB); + // UBLOG(logINFO, "Re = " << (U * d) / (k * std::pow(Gamma, n - 1))); + // UBLOG(logINFO, "Bn = " << tau0 /(k * std::pow(Gamma, n))); + // UBLOG(logINFO, "k = " << k); + // UBLOG(logINFO, "n = " << n); + UBLOG(logINFO, "tau0 = " << tau0); + UBLOG(logINFO, "scaleFactor = " << scaleFactor); + UBLOG(logINFO, "deltax = " << deltax); + UBLOG(logINFO, "number of levels = " << refineLevel + 1); + UBLOG(logINFO, "number of threads = " << numOfThreads); + UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses()); + UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]); + UBLOG(logINFO, "resolution = " << resolution); + // UBLOG(logINFO, "boundingBox = " << boundingBox[0] << " " << boundingBox[1] << " " << boundingBox[2]); + // UBLOG(logINFO, "sphereCenter = " << sphereCenter[0] << " " << sphereCenter[1] << " " << sphereCenter[2]); + UBLOG(logINFO, "output path = " << outputPath); + UBLOG(logINFO, "Preprozess - start"); + } + + if (newStart) + { + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + if (refineLevel > 0) + { + GbCuboid3DPtr refCube(new GbCuboid3D(-10, -10, -10, 0, 0, 0)); + if (myid == 0) GbSystem3D::writeGeoObject(refCube.get(), outputPath + "/geo/refCube", WbWriterVtkXmlASCII::getInstance()); + + if (myid == 0) UBLOG(logINFO, "Refinement - start"); + RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm); + //refineHelper.addGbObject(sphere, refineLevel); + refineHelper.addGbObject(refCube, refineLevel); + refineHelper.refine(); + if (myid == 0) UBLOG(logINFO, "Refinement - end"); + } + + + //walls + //GbCuboid3DPtr wallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3)); + //if (myid == 0) GbSystem3D::writeGeoObject(wallZmin.get(), outputPath + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance()); + + //GbCuboid3DPtr wallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength)); + //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)); + + //////////////////////////////////////////// + //METIS + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY)); + //////////////////////////////////////////// + /////delete solid blocks + if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start"); + InteractorsHelper intHelper(grid, metisVisitor); + //intHelper.addInteractor(wallZminInt); + //intHelper.addInteractor(wallZmaxInt); + intHelper.addInteractor(statorInt); + intHelper.addInteractor(rotorInt); + intHelper.selectBlocks(); + if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end"); + ////////////////////////////////////// + + SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->process(0); + + unsigned long nob = grid->getNumberOfBlocks(); + int gl = 3; + unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]); + unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]); + unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl); + double needMemAll = double(nodg * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4)); + double needMem = needMemAll / double(comm->getNumberOfProcesses()); + + if (myid == 0) + { + UBLOG(logINFO, "Number of blocks = " << nob); + UBLOG(logINFO, "Number of nodes = " << nod); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for (int level = minInitLevel; level <= maxInitLevel; level++) + { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl); + UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb); + } + UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); + } + + SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); + grid->accept(kernelVisitor); + + if (refineLevel > 0) + { + SetUndefinedNodesBlockVisitor undefNodesVisitor; + grid->accept(undefNodesVisitor); + } + + //BC + intHelper.setBC(); + + //initialization of distributions + InitDistributionsBlockVisitor initVisitor; + grid->accept(initVisitor); + + + if (myid == 0) UBLOG(logINFO, "Preprozess - end"); + } + else + { + restartCoProcessor->restart((int)restartStep); + grid->setTimeStep(restartStep); + SetBcBlocksBlockVisitor v1(rotorInt); + grid->accept(v1); + rotorInt->initInteractor(); + SetBcBlocksBlockVisitor v2(statorInt); + grid->accept(v2); + statorInt->initInteractor(); + } + + omp_set_num_threads(numOfThreads); + + //set connectors + //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor()); + //static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //grid->accept(setConnsVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + grid->accept(bcVisitor); + + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, outputPath, WbWriterVtkXmlASCII::getInstance(), comm); + ppgeo.process(0); + + SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); + SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm)); + + //write data for visualization of macroscopic quantities + SPtr<UbScheduler> visSch(new UbScheduler(outTime)); + //SPtr<UbScheduler> visSch(new UbScheduler(10,1)); + SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQCoProcessor->process(0); + + SPtr<UbScheduler> forceSch(new UbScheduler(100)); + SPtr<CalculateTorqueCoProcessor> fp = make_shared<CalculateTorqueCoProcessor>(grid, forceSch, outputPath + "/torque/TorqueRotor.txt", comm); + fp->addInteractor(rotorInt); + SPtr<CalculateTorqueCoProcessor> fp2 = make_shared<CalculateTorqueCoProcessor>(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<UbScheduler> stepGhostLayer(new UbScheduler(1)); + SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); + calculator->addCoProcessor(npr); + calculator->addCoProcessor(fp); + calculator->addCoProcessor(fp2); + calculator->addCoProcessor(writeMQCoProcessor); + calculator->addCoProcessor(writeThixotropicMQCoProcessor); + calculator->addCoProcessor(restartCoProcessor); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + calculator->calculate(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + } + catch (std::exception& e) + { + cerr << e.what() << endl << flush; + } + catch (std::string& s) + { + cerr << s << endl; + } + catch (...) + { + cerr << "unknown exception" << endl; + } + +} + +////////////////////////////////////////////////////////////////////////// +int main(int argc, char* argv[]) +{ + if (argv != NULL) + { + if (argv[1] != NULL) + { + //pflowForcing(string(argv[1])); + bflow(string(argv[1])); + } + else + { + cout << "Configuration file is missing!" << endl; + } + } + + return 0; +} diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp index 7ab66c19addd54f8d77b9f90e6f420df4382b4a6..950e6e517562462d1616040d6f8f1b06d2577f54 100644 --- a/apps/cpu/rheometer/rheometer.cpp +++ b/apps/cpu/rheometer/rheometer.cpp @@ -125,7 +125,7 @@ void bflow(string configname) //double omegaMin = 1.0e-8; - SPtr<Thixotropy> thix = Thixotropy::getInstance(); + SPtr<Rheology> thix = Rheology::getInstance(); //thix->setPowerIndex(n); //thix->setViscosityParameter(k); thix->setYieldStress(tau0); @@ -133,8 +133,8 @@ void bflow(string configname) SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm())); - //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new HerschelBulkleyModelNoSlipBCAlgorithm())); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new BinghamModelNoSlipBCAlgorithm())); + //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm())); + noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelNoSlipBCAlgorithm())); //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter()); //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleSlipBCAlgorithm())); @@ -159,7 +159,7 @@ void bflow(string configname) //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm())); //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SimpleVelocityBCAlgorithm())); //velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm())); - velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new BinghamModelVelocityBCAlgorithm())); + velocityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new RheologyBinghamModelVelocityBCAlgorithm())); //SPtr<BCAdapter> densityBCAdapter(new DensityBCAdapter()); //densityBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm())); diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index fd9eefa1bf2ecb2fe025047e08eb8d8f56e791a8..d60189b0747541e5e02fb38752df4581ee754b33 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -121,34 +121,34 @@ #include <BoundaryConditions/VelocityBCAdapter.h> #include <BoundaryConditions/VelocityBCAlgorithm.h> #include <BoundaryConditions/VelocityWithDensityBCAlgorithm.h> -#include <BoundaryConditions/DensityAndThixotropyBCAlgorithm.h> -#include <BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.h> -#include <BoundaryConditions/VelocityAndThixotropyBCAlgorithm.h> -#include <BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.h> -#include <BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.h> -#include <BoundaryConditions/SimpleVelocityBCAlgorithm.h> +#include <BoundaryConditions/ThixotropyDensityBCAlgorithm.h> #include <BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h> -#include <BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h> -#include <BoundaryConditions/HerschelBulkleyModelNoSlipBCAlgorithm.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/PowellEyringModelNoSlipBCAlgorithm.h> -#include <BoundaryConditions/BinghamModelVelocityBCAlgorithm.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 <Connectors/Block3DConnector.h> -#include <Connectors/Block3DConnectorFactory.h> -#include <Connectors/CoarseToFineBlock3DConnector.h> -#include <Connectors/CoarseToFineNodeSetBlock3DConnector.h> -#include <Connectors/ConnectorFactory.h> +//#include <Connectors/Block3DConnectorFactory.h> +//#include <Connectors/CoarseToFineBlock3DConnector.h> +//#include <Connectors/CoarseToFineNodeSetBlock3DConnector.h> +//#include <Connectors/ConnectorFactory.h> #include <Connectors/D3Q27ETCFOffVectorConnector.h> #include <Connectors/D3Q27ETFCOffVectorConnector.h> #include <Connectors/D3Q27ETFullDirectConnector.h> #include <Connectors/D3Q27ETFullVectorConnector.h> -#include <Connectors/FineToCoarseBlock3DConnector.h> -#include <Connectors/FineToCoarseNodeSetBlock3DConnector.h> +//#include <Connectors/FineToCoarseBlock3DConnector.h> +//#include <Connectors/FineToCoarseNodeSetBlock3DConnector.h> #include <Connectors/LocalBlock3DConnector.h> #include <Connectors/RemoteBlock3DConnector.h> #include <Connectors/TwoDistributionsFullDirectConnector.h> @@ -230,13 +230,14 @@ #include <LBM/ThixotropyLBMKernel.h> #include <LBM/ThixotropyExpLBMKernel.h> #include <LBM/CumulantLBMKernel.h> -#include <LBM/ThixotropyModelLBMKernel.h> -#include <LBM/ThixotropyModelLBMKernel2.h> -#include <LBM/BinghamModelLBMKernel.h> -#include <LBM/HerschelBulkleyModelLBMKernel.h> -#include <LBM/ThixotropyInterpolationProcessor.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/PowellEyringModelLBMKernel.h> +#include <LBM/RheologyPowellEyringModelLBMKernel.h> #include <LBM/MultiphaseCumulantLBMKernel.h> @@ -298,7 +299,7 @@ #include <Visitors/BoundaryConditionsBlockVisitor.h> #include <Visitors/ChangeBoundaryDensityBlockVisitor.h> #include <Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h> -#include <Visitors/ConnectorBlockVisitor.h> +//#include <Visitors/ConnectorBlockVisitor.h> #include <Visitors/CreateTransmittersHelper.h> #include <Visitors/GenBlocksGridVisitor.h> #include <Visitors/Grid3DVisitor.h> diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h index 3bbc01cd9c488970df865f420b84a76d21c6ac9a..3547b880af539bc9b12a62a6f245ab38caaac64d 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h @@ -56,17 +56,17 @@ public: static const char ThinWallNoSlipBCAlgorithm = 6; static const char VelocityWithDensityBCAlgorithm = 7; static const char NonReflectingOutflowBCAlgorithm = 8; - static const char VelocityAndThixotropyBCAlgorithm = 9; - static const char DensityAndThixotropyBCAlgorithm = 10; - static const char NoSlipAndThixotropyBCAlgorithm = 11; - static const char NonReflectingOutflowAndThixotropyBCAlgorithm = 12; - static const char VelocityWithDensityAndThixotropyBCAlgorithm = 13; - static const char BinghamModelNoSlipBCAlgorithm = 14; - static const char HerschelBulkleyModelNoSlipBCAlgorithm = 15; + 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 PowellEyringModelNoSlipBCAlgorithm = 18; - static const char BinghamModelVelocityBCAlgorithm = 19; + static const char RheologyPowellEyringModelNoSlipBCAlgorithm = 18; + static const char RheologyBinghamModelVelocityBCAlgorithm = 19; static const char MultiphaseNoSlipBCAlgorithm = 20; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp index 0f809955da3565f74a79a2e9dc8d09d520defc32..8551c4371fed0f2c5d710fcf30ecad2da80abef3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file EqDensityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "EqDensityBCAlgorithm.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h index 4d6cab77e4b04d9fdf2eaeece14e453c545e90d7..173b6b12f46fa46d021c17345b203a97862c7949 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/EqDensityBCAlgorithm.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file EqDensityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef EqDensityBCAlgorithm_h__ #define EqDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HerschelBulkleyModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/HerschelBulkleyModelNoSlipBCAlgorithm.h deleted file mode 100644 index 46bfbd19310d8d4d710581fdde212461c922b5f1..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/HerschelBulkleyModelNoSlipBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef HerschelBulkleyModelNoSlipBCAlgorithm_h__ -#define HerschelBulkleyModelNoSlipBCAlgorithm_h__ - -#include "ThixotropyNoSlipBCAlgorithm.h" -#include "Thixotropy.h" - -class HerschelBulkleyModelNoSlipBCAlgorithm : public ThixotropyNoSlipBCAlgorithm -{ -public: - HerschelBulkleyModelNoSlipBCAlgorithm() - { - BCAlgorithm::type = BCAlgorithm::HerschelBulkleyModelNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; - } - ~HerschelBulkleyModelNoSlipBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override - { - SPtr<BCAlgorithm> bc(new HerschelBulkleyModelNoSlipBCAlgorithm()); - return bc; - } -protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override - { - return Thixotropy::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); - } -}; -#endif // HerschelBulkleyModelNoSlipBCAlgorithm_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp index 2568a6467acd84d627f61fa7e37243f061fd1bc7..9d14940929d45bf70268ed415f4d02457a7c09fc 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file HighViscosityNoSlipBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "HighViscosityNoSlipBCAlgorithm.h" #include "BoundaryConditions.h" #include "DistributionArray3D.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h index 02cf215f76b0d974c12156125dd5e06958559b89..bb033d409cd84a2b419aa46599a61ca1e8d29aad 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file HighViscosityNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef HighViscosityNoSlipBCAlgorithm_h__ #define HighViscosityNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.cpp deleted file mode 100644 index cfed98d784cb70c647c9dcf45270174e29f99139..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "NoSlipAndThixotropyBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -NoSlipAndThixotropyBCAlgorithm::NoSlipAndThixotropyBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::NoSlipAndThixotropyBCAlgorithm; - BCAlgorithm::preCollision = false; - BCAlgorithm::thixotropy = true; - -} -////////////////////////////////////////////////////////////////////////// -NoSlipAndThixotropyBCAlgorithm::~NoSlipAndThixotropyBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NoSlipAndThixotropyBCAlgorithm::clone() -{ - SPtr<BCAlgorithm> bc(new NoSlipAndThixotropyBCAlgorithm()); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void NoSlipAndThixotropyBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -//void NoSlipAndThixotropyBCAlgorithm::addDistributionsF(SPtr<DistributionArray3D> distributions) -//{ -// this->distributionsf = distributions; -//} -////////////////////////////////////////////////////////////////////////// -void NoSlipAndThixotropyBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) -{ - this->distributionsH = distributions; -} -////////////////////////////////////////////////////////////////////////// -void NoSlipAndThixotropyBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal feq[D3Q27System::ENDF + 1]; - LBMReal h[D3Q27System::ENDF + 1]; - LBMReal heq[D3Q27System::ENDF + 1]; - distributions->getDistributionInv(f, x1, x2, x3); - distributionsH->getDistributionInv(h, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3;//, concentration, fl1, fl2, fl3, m100; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); - - //calcDiffusionMacrosFctPost(h, concentration, fl1, fl2, fl3, m100, collFactor); - LBMReal lambda = D3Q27System::getDensity(h); - D3Q27System::calcCompFeq(heq, lambda, 0., 0., 0.); - - for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) - { - if (bcPtr->hasNoSlipBoundaryFlag(fdir)) - { - //quadratic bounce back - const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal q = bcPtr->getQ(invDir); - LBMReal fReturnf = ((1.0 - q) / (1.0 + q))*((f[invDir] - feq[invDir]) / (1.0 - collFactor) + feq[invDir]) + ((q / (1.0 + q))*(f[invDir] + f[fdir])); - LBMReal fReturnh = ((1.0 - q) / (1.0 + q))*((h[invDir] - heq[invDir]) / (1.0 - collFactor) + heq[invDir]) + ((q / (1.0 + 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/NoSlipAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.h deleted file mode 100644 index a7225e39392efaf5ef7ebb2831ebaa515fa3dcee..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipAndThixotropyBCAlgorithm.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef NoSlipAndThixotropyBCAlgorithm_h__ -#define NoSlipAndThixotropyBCAlgorithm_h__ - -#include "BCAlgorithm.h" - -class NoSlipAndThixotropyBCAlgorithm : public BCAlgorithm -{ -public: - NoSlipAndThixotropyBCAlgorithm(); - virtual ~NoSlipAndThixotropyBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); - //void addDistributionsF(DistributionArray3DPtr distributions); - void addDistributionsH(SPtr<DistributionArray3D> distributions); - void applyBC(); -protected: - SPtr<DistributionArray3D> distributionsH; -private: - -}; -#endif // NoSlipAndThixotropyBCAlgorithm_h__ - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp index 24d2ed4ef8e1a05eddf8459eb26a836bd519c3d7..9c4e47354f0d90a310030d848aa0cc5415567761 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonEqDensityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "NonEqDensityBCAlgorithm.h" #include "BoundaryConditions.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h index ecdc70338232f2b6b42e49f9b20ec2b359c302c5..ca7d5b0432b74cf371659fee2c6da49f1ee8a9eb 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonEqDensityBCAlgorithm.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonEqDensityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef NonEqDensityBCAlgorithm_h__ #define NonEqDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.h deleted file mode 100644 index 8c096a5e522a2cf2a47d9944b16154c186dea9ca..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NonReflectingOutflowAndThixotropyBCAlgorithm_h__ -#define NonReflectingOutflowAndThixotropyBCAlgorithm_h__ - -#include "BCAlgorithm.h" - - -class NonReflectingOutflowAndThixotropyBCAlgorithm : public BCAlgorithm -{ -public: - NonReflectingOutflowAndThixotropyBCAlgorithm(); - virtual ~NonReflectingOutflowAndThixotropyBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); - //void addDistributionsF(SPtr<DistributionArray3D> distributions); - void addDistributionsH(SPtr<DistributionArray3D> distributions); - void applyBC(); - //void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } - //LBMReal getLambdaBC() { return this->lambdaBC; } -protected: - SPtr<DistributionArray3D> distributionsH; -private: - //LBMReal lambdaBC; -}; -#endif // NonReflectingOutflowAndThixotropyBCAlgorithm_h__ - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp index 0a4280c75832c4eb6c71a62682f346aed4fba64f..bb00c7bf2686628d4000c8b43ebfb8c5fd6c18ca 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonReflectingOutflowBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "NonReflectingOutflowBCAlgorithm.h" #include "BoundaryConditions.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h index e968d69b32963e064c09cbe11c75187f4876476d..d664b67fbf5f2d99258f0567f90b0dbd1e728fb5 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithm.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonReflectingOutflowBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef NonReflectingOutflowBCAlgorithm_h__ #define NonReflectingOutflowBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/PowellEyringModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/PowellEyringModelNoSlipBCAlgorithm.h deleted file mode 100644 index f94266be4d87b33fc5858e1f48263d3cdbc082c5..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/PowellEyringModelNoSlipBCAlgorithm.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef PowellEyringModelNoSlipBCAlgorithm_h__ -#define PowellEyringModelNoSlipBCAlgorithm_h__ - -#include "ThixotropyNoSlipBCAlgorithm.h" -#include "Thixotropy.h" - -class PowellEyringModelNoSlipBCAlgorithm : public ThixotropyNoSlipBCAlgorithm -{ -public: - PowellEyringModelNoSlipBCAlgorithm() - { - BCAlgorithm::type = BCAlgorithm::PowellEyringModelNoSlipBCAlgorithm; - BCAlgorithm::preCollision = true; - } - ~PowellEyringModelNoSlipBCAlgorithm() {} - SPtr<BCAlgorithm> clone() override - { - SPtr<BCAlgorithm> bc(new PowellEyringModelNoSlipBCAlgorithm()); - return bc; - } -protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override - { - return Thixotropy::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); - } -}; -#endif // PowellEyringModelNoSlipBCAlgorithm_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.cpp deleted file mode 100644 index 4ea802eb4f798526b822fc69c3b9111207973cc8..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "RheologicalVelocityBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BoundaryConditions.h" - -RheologicalVelocityBCAlgorithm::RheologicalVelocityBCAlgorithm() -{ - //BCAlgorithm::type = BCAlgorithm::RheologicalVelocityBCAlgorithm; - //BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -RheologicalVelocityBCAlgorithm::~RheologicalVelocityBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// -void RheologicalVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void RheologicalVelocityBCAlgorithm::applyBC() -{ - LBMReal f[D3Q27System::ENDF+1]; - LBMReal feq[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - calcFeqFct(feq, drho, vx1, vx2, vx3); - - LBMReal shearRate = D3Q27System::getShearRate(f, collFactor); - LBMReal collFactorF = getThyxotropyCollFactor(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]; - LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler - LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); - LBMReal 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); - } - } - -} - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.h deleted file mode 100644 index 179bf57c3450f0cdaf77a9985fd31c7f1f28f9a6..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologicalVelocityBCAlgorithm.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef RheologicalVelocityBCAlgorithm_h__ -#define RheologicalVelocityBCAlgorithm_h__ - -#include "BCAlgorithm.h" -#include <PointerDefinitions.h> - -class DistributionArray3D; - -class RheologicalVelocityBCAlgorithm : public BCAlgorithm -{ -public: - RheologicalVelocityBCAlgorithm(); - ~RheologicalVelocityBCAlgorithm(); - virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("LBMReal clone() - belongs in the derived class")); } - void addDistributions(SPtr<DistributionArray3D> distributions) override; - void applyBC() override; -protected: - virtual LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const = 0; // { UB_THROW(UbException("LBMReal getThyxotropyCollFactor() - belongs in the derived class")); } -}; - -#endif // VelocityBoundaryCondition_h__ - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h similarity index 76% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h index baeac4b00ad2fd94d9cd9debfa9cf9fcba34a228..d4a99846b6da226bf8d1d09e66763db61a90d2b0 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelNoSlipBCAlgorithm.h @@ -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 BinghamModelNoSlipBCAlgorithm.h +//! \file RheologyBinghamModelNoSlipBCAlgorithm.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef BinghamModelNoSlipBCAlgorithm_h__ -#define BinghamModelNoSlipBCAlgorithm_h__ +#ifndef RheologyBinghamModelNoSlipBCAlgorithm_h__ +#define RheologyBinghamModelNoSlipBCAlgorithm_h__ -#include "ThixotropyNoSlipBCAlgorithm.h" -#include "Thixotropy.h" +#include "RheologyNoSlipBCAlgorithm.h" +#include "Rheology.h" -class BinghamModelNoSlipBCAlgorithm : public ThixotropyNoSlipBCAlgorithm +class RheologyBinghamModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm { public: - BinghamModelNoSlipBCAlgorithm() + RheologyBinghamModelNoSlipBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::BinghamModelNoSlipBCAlgorithm; + BCAlgorithm::type = BCAlgorithm::RheologyBinghamModelNoSlipBCAlgorithm; BCAlgorithm::preCollision = true; } - ~BinghamModelNoSlipBCAlgorithm() {} + ~RheologyBinghamModelNoSlipBCAlgorithm() {} SPtr<BCAlgorithm> clone() override { - SPtr<BCAlgorithm> bc(new BinghamModelNoSlipBCAlgorithm()); + SPtr<BCAlgorithm> bc(new RheologyBinghamModelNoSlipBCAlgorithm()); return bc; } protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override { - return Thixotropy::getBinghamCollFactor(omegaInf, shearRate, drho); + return Rheology::getBinghamCollFactor(omegaInf, shearRate, drho); } }; #endif // BinghamModelNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h similarity index 79% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h index 9dfaef4bcfb452cebb13d22c074d0cae09be99af..263119401c1d2c437e8ae3962edd33bfcd3b554c 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.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 BinghamModelVelocityBCAlgorithm.h +//! \file RheologyBinghamModelVelocityBCAlgorithm.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= @@ -34,27 +34,27 @@ #ifndef BinghamModelVelocityBCAlgorithm_h__ #define BinghamModelVelocityBCAlgorithm_h__ -#include "RheologicalVelocityBCAlgorithm.h" -#include "Thixotropy.h" +#include "RheologyVelocityBCAlgorithm.h" +#include "Rheology.h" -class BinghamModelVelocityBCAlgorithm : public RheologicalVelocityBCAlgorithm +class RheologyBinghamModelVelocityBCAlgorithm : public RheologyVelocityBCAlgorithm { public: - BinghamModelVelocityBCAlgorithm() + RheologyBinghamModelVelocityBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::BinghamModelVelocityBCAlgorithm; + BCAlgorithm::type = BCAlgorithm::RheologyBinghamModelVelocityBCAlgorithm; BCAlgorithm::preCollision = false; } - ~BinghamModelVelocityBCAlgorithm() {} + ~RheologyBinghamModelVelocityBCAlgorithm() {} SPtr<BCAlgorithm> clone() override { - SPtr<BCAlgorithm> bc(new BinghamModelVelocityBCAlgorithm()); + SPtr<BCAlgorithm> bc(new RheologyBinghamModelVelocityBCAlgorithm()); return bc; } protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override { - return Thixotropy::getBinghamCollFactor(omegaInf, shearRate, drho); + return Rheology::getBinghamCollFactor(omegaInf, shearRate, drho); } }; #endif // BinghamModelVelocityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..19220dbd57f9100e71dbf611cccad7fadf8fae1e --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h @@ -0,0 +1,59 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyHerschelBulkleyModelNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ +#define RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ + +#include "RheologyNoSlipBCAlgorithm.h" +#include "Rheology.h" + +class RheologyHerschelBulkleyModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm +{ +public: + RheologyHerschelBulkleyModelNoSlipBCAlgorithm() + { + BCAlgorithm::type = BCAlgorithm::RheologyHerschelBulkleyModelNoSlipBCAlgorithm; + BCAlgorithm::preCollision = true; + } + ~RheologyHerschelBulkleyModelNoSlipBCAlgorithm() {} + SPtr<BCAlgorithm> clone() override + { + SPtr<BCAlgorithm> bc(new RheologyHerschelBulkleyModelNoSlipBCAlgorithm()); + return bc; + } +protected: + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + { + return Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); + } +}; +#endif // RheologyHerschelBulkleyModelNoSlipBCAlgorithm_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5d2ec04aac4280a141e6f3b2044c56c8eed842db --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.cpp @@ -0,0 +1,66 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyNoSlipBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#include "RheologyNoSlipBCAlgorithm.h" +#include "DistributionArray3D.h" +#include "BoundaryConditions.h" + +////////////////////////////////////////////////////////////////////////// +void RheologyNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +{ + this->distributions = distributions; +} +////////////////////////////////////////////////////////////////////////// +void RheologyNoSlipBCAlgorithm::applyBC() +{ + LBMReal f[D3Q27System::ENDF + 1]; + LBMReal feq[D3Q27System::ENDF + 1]; + distributions->getDistribution(f, x1, x2, x3); + LBMReal rho, vx1, vx2, vx3; + calcMacrosFct(f, rho, vx1, vx2, vx3); + calcFeqFct(feq, rho, vx1, vx2, vx3); + + LBMReal shearRate = D3Q27System::getShearRate(f, collFactor); + LBMReal collFactorF = getRheologyCollFactor(collFactor, shearRate, rho); + + for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) + { + if (bcPtr->hasNoSlipBoundaryFlag(fDir)) + { + //quadratic bounce back + const int invDir = D3Q27System::INVDIR[fDir]; + LBMReal q = bcPtr->getQ(invDir); + LBMReal fReturn =(f[invDir] + q * f[fDir] + q * collFactorF * (feq[invDir] - f[invDir] + feq[fDir] - f[fDir])) / (1.0 + q); + distributions->setDistributionInvForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], invDir); + } + } +} \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..71be7caf0787edb38877d6c3bb0f891c095ead05 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyNoSlipBCAlgorithm.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 RheologyNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyNoSlipBCAlgorithm_h__ +#define RheologyNoSlipBCAlgorithm_h__ + +#include "BCAlgorithm.h" +#include <PointerDefinitions.h> + +class DistributionArray3D; + +class RheologyNoSlipBCAlgorithm : public BCAlgorithm +{ +public: + RheologyNoSlipBCAlgorithm() = default; + ~RheologyNoSlipBCAlgorithm() = default; + virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("LBMReal clone() - belongs in the derived class")); } + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void applyBC() override; +protected: + virtual LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const = 0; // { UB_THROW(UbException("LBMReal getRheologyCollFactor() - belongs in the derived class")); } +}; +#endif // RheologyNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..49a7df6be41f37dd4dc2ac7a67f8d8645aa70c15 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h @@ -0,0 +1,59 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyPowellEyringModelNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyPowellEyringModelNoSlipBCAlgorithm_h__ +#define RheologyPowellEyringModelNoSlipBCAlgorithm_h__ + +#include "RheologyNoSlipBCAlgorithm.h" +#include "Rheology.h" + +class RheologyPowellEyringModelNoSlipBCAlgorithm : public RheologyNoSlipBCAlgorithm +{ +public: + RheologyPowellEyringModelNoSlipBCAlgorithm() + { + BCAlgorithm::type = BCAlgorithm::RheologyPowellEyringModelNoSlipBCAlgorithm; + BCAlgorithm::preCollision = true; + } + ~RheologyPowellEyringModelNoSlipBCAlgorithm() {} + SPtr<BCAlgorithm> clone() override + { + SPtr<BCAlgorithm> bc(new RheologyPowellEyringModelNoSlipBCAlgorithm()); + return bc; + } +protected: + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + { + return Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); + } +}; +#endif // RheologyPowellEyringModelNoSlipBCAlgorithm_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e2979d462d5ec1d166cac48c67c903cf280b5ff2 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.cpp @@ -0,0 +1,79 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyVelocityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#include "RheologyVelocityBCAlgorithm.h" +#include "DistributionArray3D.h" +#include "BoundaryConditions.h" + +RheologyVelocityBCAlgorithm::RheologyVelocityBCAlgorithm() +{ + //BCAlgorithm::type = BCAlgorithm::RheologyVelocityBCAlgorithm; + //BCAlgorithm::preCollision = false; +} +////////////////////////////////////////////////////////////////////////// +RheologyVelocityBCAlgorithm::~RheologyVelocityBCAlgorithm() +{ +} +////////////////////////////////////////////////////////////////////////// +void RheologyVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +{ + this->distributions = distributions; +} +////////////////////////////////////////////////////////////////////////// +void RheologyVelocityBCAlgorithm::applyBC() +{ + LBMReal f[D3Q27System::ENDF+1]; + LBMReal feq[D3Q27System::ENDF+1]; + distributions->getDistributionInv(f, x1, x2, x3); + LBMReal rho, vx1, vx2, vx3, drho; + calcMacrosFct(f, drho, vx1, vx2, vx3); + calcFeqFct(feq, drho, vx1, vx2, vx3); + + LBMReal shearRate = D3Q27System::getShearRate(f, collFactor); + LBMReal 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]; + LBMReal q = bcPtr->getQ(invDir);// m+m q=0 stabiler + LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); + LBMReal 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); + } + } + +} + diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..fc523c4619b8f9c804b2366b671db7475495e151 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/RheologyVelocityBCAlgorithm.h @@ -0,0 +1,54 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyVelocityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyVelocityBCAlgorithm_h__ +#define RheologyVelocityBCAlgorithm_h__ + +#include "BCAlgorithm.h" +#include <PointerDefinitions.h> + +class DistributionArray3D; + +class RheologyVelocityBCAlgorithm : public BCAlgorithm +{ +public: + RheologyVelocityBCAlgorithm(); + ~RheologyVelocityBCAlgorithm(); + virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("LBMReal clone() - belongs in the derived class")); } + void addDistributions(SPtr<DistributionArray3D> distributions) override; + void applyBC() override; +protected: + virtual LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const = 0; // { UB_THROW(UbException("LBMReal getRheologyCollFactor() - belongs in the derived class")); } +}; + +#endif // RheologyVelocityBCAlgorithm_h__ + diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp index 213b58877abc5c2e7e8492783a3cbdfce38518fb..8d9317f9dee979ff9b81616c9f7554e129af4b47 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SimpleSlipBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file SimpleSlipBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "SimpleSlipBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp index 1954a433822e576de11f4ff3a8eb1fcb7dcf4e0a..8bdc284d606fa621233fe1449801f4751cfef22a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file SlipBCAdapter.cpp +//! \ingroup BoundarConditions +//! \author Sören Freudiger +//======================================================================================= #include "SlipBCAdapter.h" #include "D3Q27Interactor.h" #include "D3Q27System.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h index f9b45299034e2cbb80a46d8e4f99ac5b597c50e9..b0f6d87bf938480b6568dcb648d5e8541a94ef4e 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h @@ -1,16 +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 SlipBCAdapter.h +//! \ingroup BoundarConditions +//! \author Sören Freudiger +//======================================================================================= #ifndef SlipBCAdapter_H #define SlipBCAdapter_H -#ifdef CAB_RCF -#include <3rdParty/rcf/RcfSerializationIncludes.h> -#endif - #include "BCAdapter.h" /*=======================================================*/ @@ -35,23 +57,6 @@ // D3Q27SlipBCAdapterCreator() : ObObjectCreator() {} //}; // -//#ifndef SWIG -// UB_AUTO_RUN_NAMED( -// D3Q27BCAdapterFactory::getInstance()->addObObjectCreator(D3Q27SlipBCAdapterCreator::getInstance()), -// CAB_D3Q27SlipBCAdapterCreator); #endif - -/*=========================================================================*/ -/* D3Q27SlipBCAdapter */ -/* */ -/** -<BR><BR> -@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A> -@version 1.0 - 06.09.06 -*/ - -/* -usage: ... -*/ class SlipBCAdapter : public BCAdapter { diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp index 1be8fea8b394f9a3e14bb53fcb680ef4d6961a1b..7d4aa93295aabe45f4dea9d13a9c5b22dfac3b2a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThinWallBCProcessor.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "ThinWallBCProcessor.h" #include "ThinWallNoSlipBCAlgorithm.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h index 6bed45c21e495e0dc9c728996e570ca961da6221..cb81e6c168748d9d4baf3cce1688f114e7d5faf8 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThinWallBCProcessor.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef ThinWallBCProcessor_H #define ThinWallBCProcessor_H diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp index c1ad04256a7967891f3cd8f5165779527e07d7ae..10c10f14f6b2bd6f4f85d7fbe0c7d9d4650cbe73 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThinWallNoSlipBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "ThinWallNoSlipBCAlgorithm.h" #include "BoundaryConditions.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h index 1ba18185e27bafa2c115639469cd7544661acbb5..e21c9b4fbb417242b0cc858afb26ddd16fffce18 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallNoSlipBCAlgorithm.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThinWallNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef ThinWallNoSlipBCAlgorithm_h__ #define ThinWallNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp similarity index 84% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.cpp index 905a8e3384afaca755b4f92ef21ff21395b2422b..ecfb98e67aa4c20603fd4b07e969ccb396c5e757 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.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 DensityAndThixotropyBCAlgorithm.cpp +//! \file ThixotropyDensityBCAlgorithm.cpp //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#include "DensityAndThixotropyBCAlgorithm.h" +#include "ThixotropyDensityBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -DensityAndThixotropyBCAlgorithm::DensityAndThixotropyBCAlgorithm() +ThixotropyDensityBCAlgorithm::ThixotropyDensityBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::DensityAndThixotropyBCAlgorithm; + BCAlgorithm::type = BCAlgorithm::ThixotropyDensityBCAlgorithm; BCAlgorithm::preCollision = false; BCAlgorithm::thixotropy = true; lambdaBC = 0.0; } ////////////////////////////////////////////////////////////////////////// -DensityAndThixotropyBCAlgorithm::~DensityAndThixotropyBCAlgorithm() +ThixotropyDensityBCAlgorithm::~ThixotropyDensityBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> DensityAndThixotropyBCAlgorithm::clone() +SPtr<BCAlgorithm> ThixotropyDensityBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new DensityAndThixotropyBCAlgorithm()); - dynamicPointerCast<DensityAndThixotropyBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + SPtr<BCAlgorithm> bc(new ThixotropyDensityBCAlgorithm()); + dynamicPointerCast<ThixotropyDensityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); return bc; } ////////////////////////////////////////////////////////////////////////// -void DensityAndThixotropyBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void DensityAndThixotropyBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyDensityBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void DensityAndThixotropyBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyDensityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void DensityAndThixotropyBCAlgorithm::applyBC() +void ThixotropyDensityBCAlgorithm::applyBC() { using namespace D3Q27System; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.h similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.h index 79cb1c633272137476f32815ba5223dbc30d6ee3..0ed191335ac05eb0e246271f577b024cc11b8de9 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyDensityBCAlgorithm.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 DensityAndThixotropyBCAlgorithm.h +//! \file ThixotropyDensityBCAlgorithm.h //! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef DensityAndThixotropyBCAlgorithm_h__ -#define DensityAndThixotropyBCAlgorithm_h__ +#ifndef ThixotropyDensityBCAlgorithm_h__ +#define ThixotropyDensityBCAlgorithm_h__ #include "BCAlgorithm.h" -class DensityAndThixotropyBCAlgorithm : public BCAlgorithm +class ThixotropyDensityBCAlgorithm : public BCAlgorithm { public: - DensityAndThixotropyBCAlgorithm(); - virtual ~DensityAndThixotropyBCAlgorithm(); + ThixotropyDensityBCAlgorithm(); + virtual ~ThixotropyDensityBCAlgorithm(); SPtr<BCAlgorithm> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); //void addDistributionsF(SPtr<DistributionArray3D> distributions); @@ -54,5 +54,5 @@ protected: private: LBMReal lambdaBC; }; -#endif // DensityAndThixotropyBCAlgorithm_h__ +#endif // ThixotropyDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp index 9fae576b70615b56e54bd673c9c26b3def83ad26..48b15fde31369a1857055263f9fc070ce9415a1b 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.cpp @@ -1,34 +1,102 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThixotropyNoSlipBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "ThixotropyNoSlipBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" +ThixotropyNoSlipBCAlgorithm::ThixotropyNoSlipBCAlgorithm() +{ + BCAlgorithm::type = BCAlgorithm::ThixotropyNoSlipBCAlgorithm; + BCAlgorithm::preCollision = false; + BCAlgorithm::thixotropy = true; + +} +////////////////////////////////////////////////////////////////////////// +ThixotropyNoSlipBCAlgorithm::~ThixotropyNoSlipBCAlgorithm() +{ + +} +////////////////////////////////////////////////////////////////////////// +SPtr<BCAlgorithm> ThixotropyNoSlipBCAlgorithm::clone() +{ + SPtr<BCAlgorithm> bc(new ThixotropyNoSlipBCAlgorithm()); + return bc; +} ////////////////////////////////////////////////////////////////////////// void ThixotropyNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { - this->distributions = distributions; + this->distributions = distributions; +} +////////////////////////////////////////////////////////////////////////// +//void ThixotropyNoSlipBCAlgorithm::addDistributionsF(SPtr<DistributionArray3D> distributions) +//{ +// this->distributionsf = distributions; +//} +////////////////////////////////////////////////////////////////////////// +void ThixotropyNoSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +{ + this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// void ThixotropyNoSlipBCAlgorithm::applyBC() { - LBMReal f[D3Q27System::ENDF + 1]; - LBMReal feq[D3Q27System::ENDF + 1]; - distributions->getDistribution(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); + LBMReal f[D3Q27System::ENDF + 1]; + LBMReal feq[D3Q27System::ENDF + 1]; + LBMReal h[D3Q27System::ENDF + 1]; + LBMReal heq[D3Q27System::ENDF + 1]; + distributions->getDistributionInv(f, x1, x2, x3); + distributionsH->getDistributionInv(h, x1, x2, x3); + LBMReal rho, vx1, vx2, vx3;//, concentration, fl1, fl2, fl3, m100; + calcMacrosFct(f, rho, vx1, vx2, vx3); + calcFeqFct(feq, rho, vx1, vx2, vx3); + + //calcDiffusionMacrosFctPost(h, concentration, fl1, fl2, fl3, m100, collFactor); + LBMReal lambda = D3Q27System::getDensity(h); + D3Q27System::calcCompFeq(heq, lambda, 0., 0., 0.); - LBMReal shearRate = D3Q27System::getShearRate(f, collFactor); - LBMReal collFactorF = getThyxotropyCollFactor(collFactor, shearRate, rho); + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) + { + if (bcPtr->hasNoSlipBoundaryFlag(fdir)) + { + //quadratic bounce back + const int invDir = D3Q27System::INVDIR[fdir]; + LBMReal q = bcPtr->getQ(invDir); + LBMReal fReturnf = ((1.0 - q) / (1.0 + q))*((f[invDir] - feq[invDir]) / (1.0 - collFactor) + feq[invDir]) + ((q / (1.0 + q))*(f[invDir] + f[fdir])); + LBMReal fReturnh = ((1.0 - q) / (1.0 + q))*((h[invDir] - heq[invDir]) / (1.0 - collFactor) + heq[invDir]) + ((q / (1.0 + q))*(h[invDir] + h[fdir])); - for (int fDir = D3Q27System::FSTARTDIR; fDir <= D3Q27System::FENDDIR; fDir++) - { - if (bcPtr->hasNoSlipBoundaryFlag(fDir)) - { - //quadratic bounce back - const int invDir = D3Q27System::INVDIR[fDir]; - LBMReal q = bcPtr->getQ(invDir); - LBMReal fReturn =(f[invDir] + q * f[fDir] + q * collFactorF * (feq[invDir] - f[invDir] + feq[fDir] - f[fDir])) / (1.0 + q); - distributions->setDistributionInvForDirection(fReturn, x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], invDir); - } - } -} \ No newline at end of file + 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/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h index 51448a836607080fd34d97fae00546d67ae0ff6e..e3e0ebc348909bd7152cdcbb9d1ede2253c80497 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNoSlipBCAlgorithm.h @@ -1,20 +1,54 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 ThixotropyNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef ThixotropyNoSlipBCAlgorithm_h__ #define ThixotropyNoSlipBCAlgorithm_h__ #include "BCAlgorithm.h" -#include <PointerDefinitions.h> - -class DistributionArray3D; class ThixotropyNoSlipBCAlgorithm : public BCAlgorithm { public: - ThixotropyNoSlipBCAlgorithm() = default; - ~ThixotropyNoSlipBCAlgorithm() = default; - virtual SPtr<BCAlgorithm> clone() override { UB_THROW(UbException("LBMReal clone() - belongs in the derived class")); } - void addDistributions(SPtr<DistributionArray3D> distributions) override; - void applyBC() override; + ThixotropyNoSlipBCAlgorithm(); + virtual ~ThixotropyNoSlipBCAlgorithm(); + SPtr<BCAlgorithm> clone(); + void addDistributions(SPtr<DistributionArray3D> distributions); + //void addDistributionsF(DistributionArray3DPtr distributions); + void addDistributionsH(SPtr<DistributionArray3D> distributions); + void applyBC(); protected: - virtual LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const = 0; // { UB_THROW(UbException("LBMReal getThyxotropyCollFactor() - belongs in the derived class")); } + SPtr<DistributionArray3D> distributionsH; +private: + }; #endif // ThixotropyNoSlipBCAlgorithm_h__ + diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp index 3c96343077f1030f7e6477bb352635c870ece4ce..2750e606acff2fb7a9f906f67c0b48975a11261c 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.cpp @@ -1,41 +1,73 @@ -#include "NonReflectingOutflowAndThixotropyBCAlgorithm.h" +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 ThixotropyNonReflectingOutflowBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#include "ThixotropyNonReflectingOutflowBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -NonReflectingOutflowAndThixotropyBCAlgorithm::NonReflectingOutflowAndThixotropyBCAlgorithm() +ThixotropyNonReflectingOutflowBCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowAndThixotropyBCAlgorithm; + BCAlgorithm::type = BCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm; BCAlgorithm::preCollision = true; BCAlgorithm::thixotropy = true; } ////////////////////////////////////////////////////////////////////////// -NonReflectingOutflowAndThixotropyBCAlgorithm::~NonReflectingOutflowAndThixotropyBCAlgorithm() +ThixotropyNonReflectingOutflowBCAlgorithm::~ThixotropyNonReflectingOutflowBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonReflectingOutflowAndThixotropyBCAlgorithm::clone() +SPtr<BCAlgorithm> ThixotropyNonReflectingOutflowBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new NonReflectingOutflowAndThixotropyBCAlgorithm()); + SPtr<BCAlgorithm> bc(new ThixotropyNonReflectingOutflowBCAlgorithm()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowAndThixotropyBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void NonReflectingOutflowAndThixotropyBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowAndThixotropyBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyNonReflectingOutflowBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowAndThixotropyBCAlgorithm::applyBC() +void ThixotropyNonReflectingOutflowBCAlgorithm::applyBC() { using namespace D3Q27System; LBMReal f[ENDF + 1]; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..cabc67bd67111b873c9c62db748d1f04eb006c56 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyNonReflectingOutflowBCAlgorithm.h @@ -0,0 +1,57 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 ThixotropyNonReflectingOutflowBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef ThixotropyNonReflectingOutflowBCAlgorithm_h__ +#define ThixotropyNonReflectingOutflowBCAlgorithm_h__ + +#include "BCAlgorithm.h" + + +class ThixotropyNonReflectingOutflowBCAlgorithm : public BCAlgorithm +{ +public: + ThixotropyNonReflectingOutflowBCAlgorithm(); + virtual ~ThixotropyNonReflectingOutflowBCAlgorithm(); + SPtr<BCAlgorithm> clone(); + void addDistributions(SPtr<DistributionArray3D> distributions); + //void addDistributionsF(SPtr<DistributionArray3D> distributions); + void addDistributionsH(SPtr<DistributionArray3D> distributions); + void applyBC(); + //void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } + //LBMReal getLambdaBC() { return this->lambdaBC; } +protected: + SPtr<DistributionArray3D> distributionsH; +private: + //LBMReal lambdaBC; +}; +#endif // ThixotropyNonReflectingOutflowBCAlgorithm_h__ + diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp similarity index 54% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp index e6a50917f2f710ee4e8f240d54021f3e67a02d57..6db2e6230560e313abcccbb08299f1928d5c0672 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.cpp @@ -1,43 +1,75 @@ -#include "VelocityAndThixotropyBCAlgorithm.h" +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 ThixotropyVelocityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#include "ThixotropyVelocityBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -VelocityAndThixotropyBCAlgorithm::VelocityAndThixotropyBCAlgorithm() +ThixotropyVelocityBCAlgorithm::ThixotropyVelocityBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::VelocityAndThixotropyBCAlgorithm; + BCAlgorithm::type = BCAlgorithm::ThixotropyVelocityBCAlgorithm; BCAlgorithm::preCollision = false; BCAlgorithm::thixotropy = true; lambdaBC = 0.0; } ////////////////////////////////////////////////////////////////////////// -VelocityAndThixotropyBCAlgorithm::~VelocityAndThixotropyBCAlgorithm() +ThixotropyVelocityBCAlgorithm::~ThixotropyVelocityBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> VelocityAndThixotropyBCAlgorithm::clone() +SPtr<BCAlgorithm> ThixotropyVelocityBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new VelocityAndThixotropyBCAlgorithm()); - dynamicPointerCast<VelocityAndThixotropyBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + SPtr<BCAlgorithm> bc(new ThixotropyVelocityBCAlgorithm()); + dynamicPointerCast<ThixotropyVelocityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); return bc; } ////////////////////////////////////////////////////////////////////////// -void VelocityAndThixotropyBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -//void VelocityAndThixotropyBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) +//void ThixotropyVelocityBCAlgorithm::addDistributionsF(DistributionArray3DPtr distributions) //{ // this->distributionsf = distributions; //} ////////////////////////////////////////////////////////////////////////// -void VelocityAndThixotropyBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +void ThixotropyVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) { this->distributionsH = distributions; } ////////////////////////////////////////////////////////////////////////// -void VelocityAndThixotropyBCAlgorithm::applyBC() +void ThixotropyVelocityBCAlgorithm::applyBC() { LBMReal f[D3Q27System::ENDF + 1]; LBMReal feq[D3Q27System::ENDF + 1]; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..86147cb21a232d8558737f28cb023ff2394a6f0d --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityBCAlgorithm.h @@ -0,0 +1,56 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ThixotropyVelocityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef ThixotropyVelocityBCAlgorithm_h__ +#define ThixotropyVelocityBCAlgorithm_h__ + +#include "BCAlgorithm.h" + + +class ThixotropyVelocityBCAlgorithm : public BCAlgorithm +{ +public: + ThixotropyVelocityBCAlgorithm(); + virtual ~ThixotropyVelocityBCAlgorithm(); + SPtr<BCAlgorithm> clone(); + void addDistributions(SPtr<DistributionArray3D> distributions); + void addDistributionsH(SPtr<DistributionArray3D> distributions); + void applyBC(); + void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } + LBMReal getLambdaBC() { return this->lambdaBC; } +protected: + SPtr<DistributionArray3D> distributionsH; +private: + LBMReal lambdaBC; +}; +#endif // ThixotropyVelocityBCAlgorithm_h__ + diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..532570386462c4dd0d6d7db118a19429bc7beff0 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.cpp @@ -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 ThixotropyVelocityWithDensityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= +#include "ThixotropyVelocityWithDensityBCAlgorithm.h" +#include "DistributionArray3D.h" +#include "BCArray3D.h" + +ThixotropyVelocityWithDensityBCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm() +{ + BCAlgorithm::type = BCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm; + BCAlgorithm::preCollision = false; +} +////////////////////////////////////////////////////////////////////////// +ThixotropyVelocityWithDensityBCAlgorithm::~ThixotropyVelocityWithDensityBCAlgorithm() +{ + +} +////////////////////////////////////////////////////////////////////////// +SPtr<BCAlgorithm> ThixotropyVelocityWithDensityBCAlgorithm::clone() +{ + SPtr<BCAlgorithm> bc(new ThixotropyVelocityWithDensityBCAlgorithm()); + dynamicPointerCast<ThixotropyVelocityWithDensityBCAlgorithm>(bc)->setLambdaBC(lambdaBC); + return bc; +} +////////////////////////////////////////////////////////////////////////// +void ThixotropyVelocityWithDensityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) +{ + this->distributions = distributions; +} +////////////////////////////////////////////////////////////////////////// +void ThixotropyVelocityWithDensityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) +{ + this->distributionsH = distributions; +} +////////////////////////////////////////////////////////////////////////// +void ThixotropyVelocityWithDensityBCAlgorithm::applyBC() +{ + //velocity bc for non reflecting pressure bc + LBMReal f[D3Q27System::ENDF+1]; + distributions->getDistributionInv(f, x1, x2, x3); + + LBMReal h[D3Q27System::ENDF + 1]; + distributionsH->getDistributionInv(h, x1, x2, x3); + + LBMReal rho, vx1, vx2, vx3, drho; + calcMacrosFct(f, drho, vx1, vx2, vx3); + + rho = 1.0+drho*compressibleFactor; + + /////////////////////////////////////////////////////////////////// + // Rheology + LBMReal lambda = D3Q27System::getDensity(h); + + int nx1 = x1; + int nx2 = x2; + int nx3 = x3; + + //flag points in direction of fluid + if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } + else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) + { + int nX1 = x1 + D3Q27System::DX1[fdir]; + int nX2 = x2 + D3Q27System::DX2[fdir]; + int nX3 = x3 + D3Q27System::DX3[fdir]; + + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; + + int maxX1 = (int)bcArray->getNX1(); + int maxX2 = (int)bcArray->getNX2(); + int maxX3 = (int)bcArray->getNX3(); + + if (minX1 <= nX1 && maxX1 > nX1 && minX2 <= nX2 && maxX2 > nX2 && minX3 <= nX3 && maxX3 > nX3) + { + if (bcArray->isSolid(nX1,nX2,nX3)) + { + const int invDir = D3Q27System::INVDIR[fdir]; + LBMReal velocity = bcPtr->getBoundaryVelocity(fdir); + + LBMReal fReturn = (f[fdir] + f[invDir] - velocity*rho) / 2.0 - drho*D3Q27System::WEIGTH[invDir]; + distributions->setDistributionForDirection(fReturn, nX1, nX2, nX3, invDir); + } + } + + if (bcPtr->hasVelocityBoundaryFlag(fdir)) + { + LBMReal htemp = D3Q27System::getCompFeqForDirection(fdir, lambda, vx1, vx2, vx3); + htemp = D3Q27System::getCompFeqForDirection(fdir, lambdaBC, vx1, vx2, vx3) + h[fdir] - htemp; + distributionsH->setDistributionForDirection(htemp, nx1, nx2, nx3, fdir); + } + } +} diff --git a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h similarity index 55% rename from src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h index 800b80604d7e7d67ab09441ad61c97ec28ca2ac8..c24b6c28e2f494ced4a85fe4d8b9d2f33125424a 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThixotropyVelocityWithDensityBCAlgorithm.h @@ -26,49 +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 SetConnectorsBlockVisitor.h -//! \ingroup Visitors +//! \file ThixotropyVelocityWithDensityBCAlgorithm.h +//! \ingroup BoundarConditions //! \author Konstantin Kutscher //======================================================================================= -#ifndef ConnectorBlockVisitor_H -#define ConnectorBlockVisitor_H +#ifndef ThixotropyVelocityWithDensityBCAlgorithm_h__ +#define ThixotropyVelocityWithDensityBCAlgorithm_h__ +#include "BCAlgorithm.h" #include <PointerDefinitions.h> -#include "Block3DVisitor.h" -#include "CreateTransmittersHelper.h" -#include "D3Q27System.h" +class DistributionArray3D; -class Grid3D; -class Block3D; -class InterpolationProcessor; -class ConnectorFactory; +//! \brief Class implements Dirichlet boundary condition for velocity. Set density in system. It is used together with non reflecting outflow. -class ConnectorBlockVisitor : public Block3DVisitor +class ThixotropyVelocityWithDensityBCAlgorithm : public BCAlgorithm { public: - ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, SPtr<InterpolationProcessor> iProcessor, - SPtr<ConnectorFactory> cFactory); - ~ConnectorBlockVisitor() override; - void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; - ////////////////////////////////////////////////////////////////////////// + ThixotropyVelocityWithDensityBCAlgorithm(); + ~ThixotropyVelocityWithDensityBCAlgorithm(); + SPtr<BCAlgorithm> clone(); + void addDistributions(SPtr<DistributionArray3D> distributions); + void addDistributionsH(SPtr<DistributionArray3D> distributions); + void applyBC(); + void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } + LBMReal getLambdaBC() { return this->lambdaBC; } protected: - void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); - void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir); - void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); - void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, - SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir); - void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr &senderCF, - CreateTransmittersHelper::TransmitterPtr &receiverCF, - CreateTransmittersHelper::TransmitterPtr &senderFC, - CreateTransmittersHelper::TransmitterPtr &receiverFC); - SPtr<Communicator> comm; - int gridRank; - LBMReal nu; - SPtr<InterpolationProcessor> iProcessor; - SPtr<ConnectorFactory> cFactory; + SPtr<DistributionArray3D> distributionsH; +private: + LBMReal lambdaBC; }; - -#endif // ConnectorBlockVisitor_H +#endif // ThixotropyVelocityWithDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.h deleted file mode 100644 index 0ab2e83c9a6bfbe525c32bcb8de243d7fcfa735b..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityAndThixotropyBCAlgorithm.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef VelocityAndThixotropyBCAlgorithm_h__ -#define VelocityAndThixotropyBCAlgorithm_h__ - -#include "BCAlgorithm.h" - - -class VelocityAndThixotropyBCAlgorithm : public BCAlgorithm -{ -public: - VelocityAndThixotropyBCAlgorithm(); - virtual ~VelocityAndThixotropyBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); - void addDistributionsH(SPtr<DistributionArray3D> distributions); - void applyBC(); - void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } - LBMReal getLambdaBC() { return this->lambdaBC; } -protected: - SPtr<DistributionArray3D> distributionsH; -private: - LBMReal lambdaBC; -}; -#endif // VelocityAndThixotropyBCAlgorithm_h__ - diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp deleted file mode 100644 index f72f9bc7fd0dc184539181e719528152c14d4dea..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "VelocityWithDensityAndThixotropyBCAlgorithm.h" -#include "DistributionArray3D.h" -#include "BCArray3D.h" - -VelocityWithDensityAndThixotropyBCAlgorithm::VelocityWithDensityAndThixotropyBCAlgorithm() -{ - BCAlgorithm::type = BCAlgorithm::VelocityWithDensityAndThixotropyBCAlgorithm; - BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -VelocityWithDensityAndThixotropyBCAlgorithm::~VelocityWithDensityAndThixotropyBCAlgorithm() -{ - -} -////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> VelocityWithDensityAndThixotropyBCAlgorithm::clone() -{ - SPtr<BCAlgorithm> bc(new VelocityWithDensityAndThixotropyBCAlgorithm()); - dynamicPointerCast<VelocityWithDensityAndThixotropyBCAlgorithm>(bc)->setLambdaBC(lambdaBC); - return bc; -} -////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityAndThixotropyBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) -{ - this->distributions = distributions; -} -////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityAndThixotropyBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributions) -{ - this->distributionsH = distributions; -} -////////////////////////////////////////////////////////////////////////// -void VelocityWithDensityAndThixotropyBCAlgorithm::applyBC() -{ - //velocity bc for non reflecting pressure bc - LBMReal f[D3Q27System::ENDF+1]; - distributions->getDistributionInv(f, x1, x2, x3); - - LBMReal h[D3Q27System::ENDF + 1]; - distributionsH->getDistributionInv(h, x1, x2, x3); - - LBMReal rho, vx1, vx2, vx3, drho; - calcMacrosFct(f, drho, vx1, vx2, vx3); - - rho = 1.0+drho*compressibleFactor; - - /////////////////////////////////////////////////////////////////// - // Thixotropy - LBMReal lambda = D3Q27System::getDensity(h); - - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - - //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } - else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); - - for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) - { - int nX1 = x1 + D3Q27System::DX1[fdir]; - int nX2 = x2 + D3Q27System::DX2[fdir]; - int nX3 = x3 + D3Q27System::DX3[fdir]; - - int minX1 = 0; - int minX2 = 0; - int minX3 = 0; - - int maxX1 = (int)bcArray->getNX1(); - int maxX2 = (int)bcArray->getNX2(); - int maxX3 = (int)bcArray->getNX3(); - - if (minX1 <= nX1 && maxX1 > nX1 && minX2 <= nX2 && maxX2 > nX2 && minX3 <= nX3 && maxX3 > nX3) - { - if (bcArray->isSolid(nX1,nX2,nX3)) - { - const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal velocity = bcPtr->getBoundaryVelocity(fdir); - - LBMReal fReturn = (f[fdir] + f[invDir] - velocity*rho) / 2.0 - drho*D3Q27System::WEIGTH[invDir]; - distributions->setDistributionForDirection(fReturn, nX1, nX2, nX3, invDir); - } - } - - if (bcPtr->hasVelocityBoundaryFlag(fdir)) - { - LBMReal htemp = D3Q27System::getCompFeqForDirection(fdir, lambda, vx1, vx2, vx3); - htemp = D3Q27System::getCompFeqForDirection(fdir, lambdaBC, vx1, vx2, vx3) + h[fdir] - htemp; - distributionsH->setDistributionForDirection(htemp, nx1, nx2, nx3, fdir); - } - } -} diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.h deleted file mode 100644 index b8cd101435a4da2f38b99a5c440f0675b6538179..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityAndThixotropyBCAlgorithm.h +++ /dev/null @@ -1,31 +0,0 @@ -//! \file VelocityWithDensityAndThixotropyBCAlgorithm.h -//! \brief Class implements velocity bc for non reflecting pressure bc. -//! \author Konstantin Kutscher - -#ifndef VelocityWithDensityAndThixotropyBCAlgorithm_h__ -#define VelocityWithDensityAndThixotropyBCAlgorithm_h__ - -#include "BCAlgorithm.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 VelocityWithDensityAndThixotropyBCAlgorithm : public BCAlgorithm -{ -public: - VelocityWithDensityAndThixotropyBCAlgorithm(); - ~VelocityWithDensityAndThixotropyBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); - void addDistributionsH(SPtr<DistributionArray3D> distributions); - void applyBC(); - void setLambdaBC(LBMReal lambda) { this->lambdaBC = lambda; } - LBMReal getLambdaBC() { return this->lambdaBC; } -protected: - SPtr<DistributionArray3D> distributionsH; -private: - LBMReal lambdaBC; -}; -#endif // VelocityWithDensityAndThixotropyBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp index 45615466c3ba40881dcf03dff27bbcb3f11adc80..c63b1559492a1258d7322e4b3b1b17f9ba9b4d13 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file VelocityWithDensityBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "VelocityWithDensityBCAlgorithm.h" #include "BCArray3D.h" #include "DistributionArray3D.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h index a8c0a47063e932616e987135a3dfa9fff3400d70..7ab57d2b892af9db0e0e42327b970b381710edf3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCAlgorithm.h @@ -1,6 +1,35 @@ -//! \file VelocityWithDensityBCAlgorithm.h -//! \brief Class implements velocity bc for non reflecting pressure bc. -//! \author Konstantin Kutscher +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 VelocityWithDensityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #ifndef VelocityWithDensityBCAlgorithm_h__ #define VelocityWithDensityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp index f12023be05f6fdabf694f7508e0c46aca96d8e15..3519c83a529314e1135f3d76e21c3b2c3c3f8cba 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp @@ -246,7 +246,7 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) // shearRate = D3Q27System::getShearRate(f, collFactor); - // LBMReal collFactorF = BinghamModelLBMKernel::getBinghamCollFactor(collFactor, yieldStress, + // LBMReal collFactorF = RheologyBinghamModelLBMKernel::getBinghamCollFactor(collFactor, yieldStress, // shearRate, rho); // data[index++].push_back(shearRate); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp index 436f6738b01c5f3fa04fc6e2779642c7fff4ad1d..8c4462066705154bad61846f5e9c147c303a3ba3 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteThixotropyQuantitiesCoProcessor.cpp @@ -11,7 +11,7 @@ #include <numeric> #include "basics/writer/WbWriterVtkXmlASCII.h" #include "ThixotropyExpLBMKernel.h" -#include "Thixotropy.h" +#include "Rheology.h" using namespace std; @@ -204,7 +204,7 @@ void WriteThixotropyQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) //LBMReal collFactorF = collFactor - 1e-6 / (gammaDot + one * 1e-9); //collFactorF = (collFactorF < 0.5) ? 0.5 : collFactorF; - //LBMReal collFactorF = Thixotropy::getBinghamCollFactor(collFactor, gammaDot, rho); + //LBMReal collFactorF = Rheology::getBinghamCollFactor(collFactor, gammaDot, rho); //data[index++].push_back(lambda); //data[index++].push_back(gammaDot); @@ -213,9 +213,9 @@ void WriteThixotropyQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) distributionsF->getDistribution(f, ix1, ix2, ix3); LBMReal rho = D3Q27System::getDensity(f); LBMReal shearRate = D3Q27System::getShearRate(f, collFactor); - //LBMReal omega = Thixotropy::getHerschelBulkleyCollFactor(collFactor, shearRate, rho); - //LBMReal omega = Thixotropy::getPowellEyringCollFactor(collFactor, shearRate, rho); - LBMReal omega = Thixotropy::getBinghamCollFactor(collFactor, shearRate, rho); + //LBMReal omega = Rheology::getHerschelBulkleyCollFactor(collFactor, shearRate, rho); + //LBMReal omega = Rheology::getPowellEyringCollFactor(collFactor, shearRate, rho); + LBMReal omega = Rheology::getBinghamCollFactor(collFactor, shearRate, rho); LBMReal viscosity = (omega == 0) ? 0 : UbMath::c1o3 * (UbMath::c1/omega-UbMath::c1o2); diff --git a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp deleted file mode 100644 index e30da27cd88b759b2f0df44774c388504d303355..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "Block3DConnectorFactory.h" -#include "CoarseToFineNodeSetBlock3DConnector.h" -#include "D3Q27ETFullDirectConnector.h" -#include "D3Q27ETFullVectorConnector.h" -#include "FineToCoarseNodeSetBlock3DConnector.h" - -Block3DConnectorFactory::Block3DConnectorFactory() = default; -////////////////////////////////////////////////////////////////////////// -Block3DConnectorFactory::~Block3DConnectorFactory() = default; -////////////////////////////////////////////////////////////////////////// -SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, - int sendDir) -{ - return SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector(from, to, sendDir)); -} -////////////////////////////////////////////////////////////////////////// -SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelVectorConnector(SPtr<Block3D> block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, - int sendDir) -{ - return SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(block, sender, receiver, sendDir)); -} -////////////////////////////////////////////////////////////////////////// -SPtr<Block3DConnector> Block3DConnectorFactory::createCoarseToFineConnector( - SPtr<Block3D> block, VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, VectorTransmitterPtr sender01, - VectorTransmitterPtr receiver01, VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, int sendDir, InterpolationProcessorPtr iprocessor) -{ - return SPtr<Block3DConnector>(new CoarseToFineNodeSetBlock3DConnector(block, sender00, receiver00, sender01, - receiver01, sender10, receiver10, sender11, - receiver11, sendDir, iprocessor)); -} -////////////////////////////////////////////////////////////////////////// -SPtr<Block3DConnector> Block3DConnectorFactory::createFineToCoarseConnector( - SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, FineToCoarseBlock3DConnector::CFconnectorType connType) -{ - return SPtr<Block3DConnector>( - new FineToCoarseNodeSetBlock3DConnector(block, sender, receiver, sendDir, iprocessor, connType)); -} diff --git a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h deleted file mode 100644 index 687f787cd3efb2c7ba64bb2e722cede59ce77f48..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef Block3DConnectorFactory_h__ -#define Block3DConnectorFactory_h__ - -#include "ConnectorFactory.h" - -#include <PointerDefinitions.h> - -class Block3DConnectorFactory : public ConnectorFactory -{ -public: - Block3DConnectorFactory(); - ~Block3DConnectorFactory() override; - - SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir) override; - - SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir) override; - - SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block, VectorTransmitterPtr sender00, - VectorTransmitterPtr receiver00, VectorTransmitterPtr sender01, - VectorTransmitterPtr receiver01, VectorTransmitterPtr sender10, - VectorTransmitterPtr receiver10, VectorTransmitterPtr sender11, - VectorTransmitterPtr receiver11, int sendDir, - InterpolationProcessorPtr iprocessor) override; - - SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, - FineToCoarseBlock3DConnector::CFconnectorType connType) override; - -private: -}; -#endif // Block3DConnectorFactory_h__ diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp deleted file mode 100644 index d9c493e5d4cf88a66e4bc26090cd6d98aa68b4a7..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include "CoarseToFineBlock3DConnector.h" - -//////////////////////////////////////////////////////////////////////////// - -CoarseToFineBlock3DConnector::CoarseToFineBlock3DConnector( - SPtr<Block3D> block, VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, VectorTransmitterPtr sender01, - VectorTransmitterPtr receiver01, VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, int sendDir, InterpolationProcessorPtr iprocessor) - : Block3DConnector(sendDir), block(block), sender00(sender00), sender01(sender01), sender10(sender10), - sender11(sender11), receiver00(receiver00), receiver01(receiver01), receiver10(receiver10), - receiver11(receiver11), iprocessor(iprocessor) -{ - if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || - sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B || - sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || - sendDir == D3Q27System::NW || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || - sendDir == D3Q27System::BE || sendDir == D3Q27System::TW || sendDir == D3Q27System::TN || - sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS || - sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || - sendDir == D3Q27System::TSW || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || - sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW)) { - throw UbException(UB_EXARGS, "invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// - -bool CoarseToFineBlock3DConnector::isLocalConnector() { return !this->isRemoteConnector(); } -////////////////////////////////////////////////////////////////////////// - -bool CoarseToFineBlock3DConnector::isRemoteConnector() -{ - return ((sender11 && sender11->isRemoteTransmitter()) || (receiver11 && receiver11->isRemoteTransmitter()) || - (sender00 && sender00->isRemoteTransmitter()) || (receiver00 && receiver00->isRemoteTransmitter()) || - (sender01 && sender01->isRemoteTransmitter()) || (receiver01 && receiver01->isRemoteTransmitter()) || - (sender10 && sender10->isRemoteTransmitter()) || (receiver10 && receiver10->isRemoteTransmitter())); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::sendTransmitterDataSize() -{ - if (sender00) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender00 " - << block.lock()->toString() << " sendDir=" << sendDir); - sender00->sendDataSize(); - } - if (sender01) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender01 " - << block.lock()->toString() << "sendDir=" << sendDir); - sender01->sendDataSize(); - } - if (sender10) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender10 " - << block.lock()->toString() + "sendDir=" << sendDir); - sender10->sendDataSize(); - } - if (sender11) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender11 " - << block.lock()->toString() << "sendDir=" << sendDir); - sender11->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::receiveTransmitterDataSize() -{ - if (receiver00) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver00 " - << block.lock()->toString() << "sendDir=" << sendDir); - receiver00->receiveDataSize(); - } - if (receiver01) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver01 " - << block.lock()->toString() << "sendDir=" << sendDir); - receiver01->receiveDataSize(); - } - if (receiver10) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver10 " - << block.lock()->toString() << "sendDir=" << sendDir); - receiver10->receiveDataSize(); - } - if (receiver11) { - UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver11 " - << block.lock()->toString() << "sendDir=" << sendDir); - receiver11->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::prepareForSend() -{ - if (sender00) - sender00->prepareForSend(); - if (sender01) - sender01->prepareForSend(); - if (sender10) - sender10->prepareForSend(); - if (sender11) - sender11->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::sendVectors() -{ - if (sender00) - sender00->sendData(); - if (sender01) - sender01->sendData(); - if (sender10) - sender10->sendData(); - if (sender11) - sender11->sendData(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::prepareForReceive() -{ - if (receiver00) - receiver00->prepareForReceive(); - if (receiver01) - receiver01->prepareForReceive(); - if (receiver10) - receiver10->prepareForReceive(); - if (receiver11) - receiver11->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineBlock3DConnector::receiveVectors() -{ - if (receiver00) - receiver00->receiveData(); - if (receiver01) - receiver01->receiveData(); - if (receiver10) - receiver10->receiveData(); - if (receiver11) - receiver11->receiveData(); -} diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h deleted file mode 100644 index 6ca7c40bfaf22ebfed0c13b23e7973926a805427..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h +++ /dev/null @@ -1,94 +0,0 @@ -//! \file CoarseToFineBlock3DConnector.h -//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. -//! \author Konstantin Kutscher -//! \date 18.05.2015 - -#ifndef CoarseToFineBlock3DConnector_H -#define CoarseToFineBlock3DConnector_H - -#include "Block3D.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "InterpolationProcessor.h" -#include "TransmitterType.h" -#include <PointerDefinitions.h> - -class Block3D; - -//! \class CoarseToFineBlock3DConnector -//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. -//! \details The data is copied in a vector (this is located in the transmitter). -//! The vector is transmitted via transmitter. -//! The transmitter can be a local, MPI, RCG, CTL or whatever -//! which a transmitter that is derived from transmitter base class. -//! -//! four fine blocks inside a coarse block: -//! -//! | | | -//! |:--:|:---| -//! | 01 | 11 | -//! | 00 | 10 | -//! -//! send direction: -//! -//! |E<->W | N<->S | T<->B | -//! |--------|---------|--------| -//! | x3 | x3 | x2 | -//! | ^ | ^ | ^ | -//! | +->x2 | +->x1 | +->x1| - -class CoarseToFineBlock3DConnector : public Block3DConnector -{ -public: - CoarseToFineBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, int sendDir, - InterpolationProcessorPtr iprocessor); - - ~CoarseToFineBlock3DConnector() override = default; - - bool isLocalConnector() override; - bool isRemoteConnector() override; - - void init() override = 0; - - void sendTransmitterDataSize() override; - void receiveTransmitterDataSize() override; - - void prepareForSend() override; - void sendVectors() override; - - void prepareForReceive() override; - void receiveVectors() override; - - void fillSendVectors() override = 0; - void distributeReceiveVectors() override = 0; - - bool isInterpolationConnectorCF() override { return true; } - bool isInterpolationConnectorFC() override { return false; } - - void prepareForSendX1() override {} - void prepareForSendX2() override {} - void prepareForSendX3() override {} - - void sendVectorsX1() override {} - void sendVectorsX2() override {} - void sendVectorsX3() override {} - - void prepareForReceiveX1() override {} - void prepareForReceiveX2() override {} - void prepareForReceiveX3() override {} - - void receiveVectorsX1() override {} - void receiveVectorsX2() override {} - void receiveVectorsX3() override {} - -protected: - WPtr<Block3D> block; // dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet - VectorTransmitterPtr sender00, receiver00, sender01, receiver01, sender10, receiver10, sender11, receiver11; - - InterpolationProcessorPtr iprocessor; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp deleted file mode 100644 index 36553307d937c07c19f792a7a6e40166d5d04723..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp +++ /dev/null @@ -1,1293 +0,0 @@ -#include "CoarseToFineNodeSetBlock3DConnector.h" -#include "DataSet3D.h" - -//////////////////////////////////////////////////////////////////////////// -CoarseToFineNodeSetBlock3DConnector::CoarseToFineNodeSetBlock3DConnector( - SPtr<Block3D> block, VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, VectorTransmitterPtr sender01, - VectorTransmitterPtr receiver01, VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, int sendDir, InterpolationProcessorPtr iprocessor) - : CoarseToFineBlock3DConnector(block, sender00, receiver00, sender01, receiver01, sender10, receiver10, sender11, - receiver11, sendDir, iprocessor) -{ -} -////////////////////////////////////////////////////////////////////////// -void CoarseToFineNodeSetBlock3DConnector::init() -{ - bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - minX1 = 0; - minX2 = 0; - minX3 = 0; - maxX1 = bMaxX1 - 1; - maxX2 = bMaxX2 - 1; - maxX3 = bMaxX3 - 1; - - minHalfX1 = 0; - minHalfX2 = 0; - minHalfX3 = 0; - - maxHalfX1 = 0; - maxHalfX2 = 0; - maxHalfX3 = 0; - - if (Utilities::isEven(bMaxX1)) { - minHalfX1 = bMaxX1 / 2 - 1; - maxHalfX1 = bMaxX1 / 2 - 1; - } else if (Utilities::isOdd(bMaxX1)) { - minHalfX1 = bMaxX1 / 2; - maxHalfX1 = bMaxX1 / 2 - 1; - } - - if (Utilities::isEven(bMaxX2)) { - minHalfX2 = bMaxX2 / 2 - 1; - maxHalfX2 = bMaxX2 / 2 - 1; - } else if (Utilities::isOdd(bMaxX2)) { - minHalfX2 = bMaxX2 / 2; - maxHalfX2 = bMaxX2 / 2 - 1; - } - - if (Utilities::isEven(bMaxX3)) { - minHalfX3 = bMaxX3 / 2 - 1; - maxHalfX3 = bMaxX3 / 2 - 1; - } else if (Utilities::isOdd(bMaxX3)) { - minHalfX3 = bMaxX3 / 2; - maxHalfX3 = bMaxX3 / 2 - 1; - } - - // int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27 /*f*/; - int iCellSize = 8; // size of interpolation cell - - findCFCells(); - findFCCells(); - - ////////////////////////////////////////////////////// - // Debug - ////////////////////////////////////////////////////// - // if (block.lock()->getGlobalID() == 2234) - // { - // int test = 0; - // } - - if (sender00) - sender00->getData().resize(iNodeSetSender00.size() * iCellSize * sendDataPerNode, initValue); - else - sender00 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (sender01) - sender01->getData().resize(iNodeSetSender01.size() * iCellSize * sendDataPerNode, initValue); - else - sender01 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (sender10) - sender10->getData().resize(iNodeSetSender10.size() * iCellSize * sendDataPerNode, initValue); - else - sender10 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (sender11) - sender11->getData().resize(iNodeSetSender11.size() * iCellSize * sendDataPerNode, initValue); - else - sender11 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - - if (!receiver00) - receiver00 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (!receiver01) - receiver01 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (!receiver10) - receiver10 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - if (!receiver11) - receiver11 = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, - int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - LBMReal x1off, x2off, x3off; - - SPtr<DistributionArray3D> fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3 <= lMaxX3; ix3++) { - for (ix2 = lMinX2; ix2 <= lMaxX2; ix2++) { - for (ix1 = lMinX1; ix1 <= lMaxX1; ix1++) { - D3Q27ICell icellC; - - int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) { - x1off = 0.0; - x2off = 0.0; - x3off = 0.0; - } else { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, - x1off, x2off, x3off)) { - std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + - ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) + - " interpolation is not implemented for other direction" + - " by using in: " + (std::string) typeid(*this).name() + - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - INodeVector inv; - inv.push_back(ix1 + (int)x1off); - inv.push_back(ix2 + (int)x2off); - inv.push_back(ix3 + (int)x3off); - inv.push_back((int)x1off); - inv.push_back((int)x2off); - inv.push_back((int)x3off); - // inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -// template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::findCFCells() -{ - using namespace D3Q27System; - - int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3; - - switch (sendDir) { - // faces - case E: - case W: - if (sendDir == E) { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1; - } else if (sendDir == W) { - lMinX1 = 1; - lMaxX1 = lMinX1; - } - - if (sender00) { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - case N: - case S: - if (sendDir == N) { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2; - } else if (sendDir == S) { - lMinX2 = 1; - lMaxX2 = lMinX2; - } - - if (sender00) { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - case T: - case B: - if (sendDir == T) { - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3; - } else if (sendDir == B) { - lMinX3 = 1; - lMaxX3 = lMinX3; - } - - if (sender00) { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - if (sender01) { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01); - } - if (sender11) { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11); - } - break; - // edges - // N-S-E-W - case NE: - case SW: - case SE: - case NW: - if (sendDir == NE) { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - } else if (sendDir == SW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - } else if (sendDir == SE) { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - } else if (sendDir == NW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - } - - if (sender00) { - lMinX3 = minX3; - lMaxX3 = maxHalfX3; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX3 = minHalfX3; - lMaxX3 = maxX3 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - // T-B-E-W - case TE: - case BW: - case BE: - case TW: - if (sendDir == TE) { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } else if (sendDir == BW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == BE) { - lMinX1 = maxX1 - 2; - lMaxX1 = lMinX1 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } else if (sendDir == TW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } - - if (sender00) { - lMinX2 = minX2; - lMaxX2 = maxHalfX2; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX2 = minHalfX2; - lMaxX2 = maxX2 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - // T-B-N-S - case TN: - case BS: - case BN: - case TS: - if (sendDir == TN) { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 1; - } else if (sendDir == BS) { - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } else if (sendDir == BN) { - lMinX2 = maxX2 - 2; - lMaxX2 = lMinX2 + 1; - lMinX3 = 0; - lMaxX3 = lMinX3 + 1; - } else if (sendDir == TS) { - lMinX2 = 0; - lMaxX2 = lMinX2 + 1; - lMinX3 = maxX3 - 2; - lMaxX3 = lMinX3 + 1; - } - - if (sender00) { - lMinX1 = minX1; - lMaxX1 = maxHalfX1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - if (sender10) { - lMinX1 = minHalfX1; - lMaxX1 = maxX1 - 1; - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10); - } - break; - // corners - case TNE: - case TNW: - case TSE: - case TSW: - case BNE: - case BNW: - case BSE: - case BSW: - if (sendDir == TNE) { - lMinX1 = maxX1 - 2; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 2; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 2; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TNW) { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = maxX2 - 2; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 2; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TSE) { - lMinX1 = maxX1 - 2; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = maxX3 - 2; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TSW) { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = maxX3 - 2; - lMaxX3 = maxX3 - 1; - } else if (sendDir == BNE) { - lMinX1 = maxX1 - 2; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 2; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 1; - } else if (sendDir == BNW) { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = maxX2 - 2; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 1; - } else if (sendDir == BSE) { - lMinX1 = maxX1 - 2; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = 0; - lMaxX3 = 1; - } else if (sendDir == BSW) { - lMinX1 = 0; - lMaxX1 = 1; - lMinX2 = 0; - lMaxX2 = 1; - lMinX3 = 0; - lMaxX3 = 1; - } - if (sender00) { - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00); - } - break; - } -} -////////////////////////////////////////////////////////////////////////// -// template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::fillSendVectors() -{ - using namespace D3Q27System; - - SPtr<DistributionArray3D> fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index00 = 0; - int index01 = 0; - int index10 = 0; - int index11 = 0; - - vector_type &data00 = this->sender00->getData(); - vector_type &data01 = this->sender01->getData(); - vector_type &data10 = this->sender10->getData(); - vector_type &data11 = this->sender11->getData(); - - for (INodeVector inode : iNodeSetSender00) { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data00, index00, icellF); - } - for (INodeVector inode : iNodeSetSender01) { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data01, index01, icellF); - } - for (INodeVector inode : iNodeSetSender10) { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data10, index10, icellF); - } - for (INodeVector inode : iNodeSetSender11) { - D3Q27ICell icellC; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]); - iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]); - writeICellFtoData(data11, index11, icellF); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::writeICellFtoData(vector_type &data, int &index, D3Q27ICell &icellF) -{ - writeNodeToVector(data, index, icellF.BSW); - writeNodeToVector(data, index, icellF.BSE); - writeNodeToVector(data, index, icellF.BNW); - writeNodeToVector(data, index, icellF.BNE); - writeNodeToVector(data, index, icellF.TSW); - writeNodeToVector(data, index, icellF.TSE); - writeNodeToVector(data, index, icellF.TNW); - writeNodeToVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::writeNodeToVector(vector_type &data, int &index, LBMReal *inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) { - data[index++] = inode[i]; - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, - int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - - for (ix3 = lMinX3; ix3 <= lMaxX3; ix3++) { - for (ix2 = lMinX2; ix2 <= lMaxX2; ix2++) { - for (ix1 = lMinX1; ix1 <= lMaxX1; ix1++) { - INodeVector inv; - inv.push_back(ix1); - inv.push_back(ix2); - inv.push_back(ix3); - // inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -// template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::findFCCells() -{ - using namespace D3Q27System; - - int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3; - int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3; - int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3; - int dummy; - - switch (sendDir) { - - ////////////////////////////////////////////////////// - // Debug - ////////////////////////////////////////////////////// - // if (block.lock()->getGlobalID() == 2234) - // { - // int test = 0; - // } - - // faces - case E: - case W: - if (sendDir == E) { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1; - } else if (sendDir == W) { - lMin1X1 = 3; - lMax1X1 = lMin1X1; - } - - // int TminX1 = lMinX1; int TminX2 = lMinX2; int TminX3 = lMinX3; int TmaxX1 = lMaxX1; int TmaxX2 = lMaxX2; - // int TmaxX3 = lMaxX3; - - // if (block.lock()->hasInterpolationFlagCF(E)) - //{ - // if (maxX1==TmaxX1) maxX1 -= 2; - //} - // if (block.lock()->hasInterpolationFlagCF(W)) - //{ - // if (minX1==TminX1) minX1 += 2; - //} - // if (block.lock()->hasInterpolationFlagCF(N)) - //{ - // if (maxX2==TmaxX2) maxX2 -= 2; - //} - // if (block.lock()->hasInterpolationFlagCF(S)) - //{ - // if (minX2==TminX2) minX2 += 2; - //} - // if (block.lock()->hasInterpolationFlagCF(T)) - //{ - // if (maxX3==TmaxX3) maxX3 -= 2; - //} - // if (block.lock()->hasInterpolationFlagCF(B)) - //{ - // if (minX3==TminX3) minX3 += 2; - //} - if (receiver00) { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - getLocalMinMax(dummy, lMin1X2, lMin1X3, dummy, dummy, dummy); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - getLocalMinMax(dummy, dummy, lMin1X3, dummy, lMax1X2, dummy); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - getLocalMinMax(dummy, lMin1X2, dummy, dummy, dummy, lMax1X3); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - getLocalMinMax(dummy, dummy, dummy, dummy, lMax1X2, lMax1X3); - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - case N: - case S: - if (sendDir == N) { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - } else if (sendDir == S) { - lMin1X2 = 3; - lMax1X2 = lMin1X2; - } - - if (receiver00) { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - case T: - case B: - if (sendDir == T) { - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - } else if (sendDir == B) { - lMin1X3 = 3; - lMax1X3 = lMin1X3; - } - - if (receiver00) { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - if (receiver01) { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01); - } - if (receiver11) { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11); - } - break; - // edges - // N-S-E-W - case NE: - case SW: - case SE: - case NW: - if (sendDir == NE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2 + 2; - } else if (sendDir == SW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = 3; - lMax1X2 = lMin1X2; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 2; - } else if (sendDir == SE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = 3; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 2; - } else if (sendDir == NW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2 + 2; - } - - if (receiver00) { - lMin1X3 = minX3; - lMax1X3 = maxHalfX3; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X3 = minHalfX3; - lMax1X3 = maxX3 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) { - lMin2X3 = minX3; - lMax2X3 = maxHalfX3; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin2X3 = minHalfX3; - lMax2X3 = maxX3 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - // T-B-E-W - case TE: - case BW: - case BE: - case TW: - if (sendDir == TE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == BW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == BE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == TW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X1 = 3; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - - if (receiver00) { - lMin1X2 = minX2; - lMax1X2 = maxHalfX2; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X2 = minHalfX2; - lMax1X2 = maxX2 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) { - lMin2X2 = minX2; - lMax2X2 = maxHalfX2; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin2X2 = minHalfX2; - lMax2X2 = maxX2 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - // T-B-N-S - case TN: - case BS: - case BN: - case TS: - if (sendDir == TN) { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == BS) { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X2 = 3; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == BN) { - lMin1X2 = maxX2 - 3; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = 3; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 3; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 2; - } else if (sendDir == TS) { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 2; - lMin1X3 = maxX3 - 3; - lMax1X3 = lMin1X3; - - lMin2X2 = 3; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 3; - lMax2X3 = lMin2X3 + 2; - } - - if (receiver00) { - lMin1X1 = minX1; - lMax1X1 = maxHalfX1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin1X1 = minHalfX1; - lMax1X1 = maxX1 - 1; - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10); - } - - if (receiver00) { - lMin2X1 = minX1; - lMax2X1 = maxHalfX1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver10) { - lMin2X1 = minHalfX1; - lMax2X1 = maxX1 - 1; - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10); - } - break; - // corners - case TNE: - case TNW: - case TSE: - case TSW: - case BNE: - case BNW: - case BSE: - case BSW: - if (sendDir == TNE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3 - 1; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } else if (sendDir == TNW) { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } else if (sendDir == TSE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } else if (sendDir == TSW) { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = maxX3 - 3; - lMax1X3 = maxX3 - 1; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = maxX3 - 3; - lMax2X3 = maxX3 - 1; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = maxX3 - 3; - lMax3X3 = maxX3 - 2; - } else if (sendDir == BNE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = 3; - lMax3X3 = 3; - } else if (sendDir == BNW) { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = maxX2 - 3; - lMax1X2 = maxX2 - 1; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = maxX2 - 3; - lMax2X2 = maxX2 - 2; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = maxX2 - 3; - lMax3X2 = maxX2 - 1; - lMin3X3 = 3; - lMax3X3 = 3; - } else if (sendDir == BSE) { - lMin1X1 = maxX1 - 3; - lMax1X1 = maxX1 - 2; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = maxX1 - 3; - lMax2X1 = maxX1 - 1; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = maxX1 - 3; - lMax3X1 = maxX1 - 1; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = 3; - lMax3X3 = 3; - } else if (sendDir == BSW) { - lMin1X1 = 3; - lMax1X1 = 3; - lMin1X2 = 1; - lMax1X2 = 3; - lMin1X3 = 1; - lMax1X3 = 3; - - lMin2X1 = 1; - lMax2X1 = 3; - lMin2X2 = 3; - lMax2X2 = 3; - lMin2X3 = 1; - lMax2X3 = 3; - - lMin3X1 = 1; - lMax3X1 = 3; - lMin3X2 = 1; - lMax3X2 = 3; - lMin3X3 = 3; - lMax3X3 = 3; - } - if (receiver00) { - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00); - } - if (receiver00) { - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00); - } - if (receiver00) { - findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetReceiver00); - } - break; - } -} -////////////////////////////////////////////////////////////////////////// -// template< typename VectorTransmitter > -void CoarseToFineNodeSetBlock3DConnector::distributeReceiveVectors() -{ - using namespace D3Q27System; - - SPtr<DistributionArray3D> fTo = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index00 = 0; - int index01 = 0; - int index10 = 0; - int index11 = 0; - - vector_type &data00 = this->receiver00->getData(); - vector_type &data01 = this->receiver01->getData(); - vector_type &data10 = this->receiver10->getData(); - vector_type &data11 = this->receiver11->getData(); - - for (INodeVector inode : iNodeSetReceiver00) { - LBMReal icellC[27]; - this->readICellCfromData(data00, index00, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for (INodeVector inode : iNodeSetReceiver01) { - LBMReal icellC[27]; - this->readICellCfromData(data01, index01, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for (INodeVector inode : iNodeSetReceiver10) { - LBMReal icellC[27]; - this->readICellCfromData(data10, index10, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } - for (INodeVector inode : iNodeSetReceiver11) { - LBMReal icellC[27]; - this->readICellCfromData(data11, index11, icellC); - iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]); - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::readICellCfromData(vector_type &data, int &index, LBMReal *icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) { - icellC[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// - -void CoarseToFineNodeSetBlock3DConnector::getLocalMinMax(int &minX1, int &minX2, int &minX3, int &maxX1, int &maxX2, - int &maxX3) -{ - using namespace D3Q27System; - int TminX1 = minX1; - int TminX2 = minX2; - int TminX3 = minX3; - int TmaxX1 = maxX1; - int TmaxX2 = maxX2; - int TmaxX3 = maxX3; - - if (block.lock()->hasInterpolationFlagCF(E)) { - if (maxX1 == TmaxX1) - maxX1 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(W)) { - if (minX1 == TminX1) - minX1 += 2; - } - if (block.lock()->hasInterpolationFlagCF(N)) { - if (maxX2 == TmaxX2) - maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(S)) { - if (minX2 == TminX2) - minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(T)) { - if (maxX3 == TmaxX3) - maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(B)) { - if (minX3 == TminX3) - minX3 += 2; - } - - // E-W-N-S - if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && - !block.lock()->hasInterpolationFlagCF(E)) { - if (maxX1 == TmaxX1) - maxX1 -= 2; - if (maxX2 == TmaxX2) - maxX2 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && - !block.lock()->hasInterpolationFlagCF(S)) { - if (minX1 == TminX1) - minX1 += 2; - if (minX2 == TminX2) - minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && - !block.lock()->hasInterpolationFlagCF(S)) { - if (maxX1 == TmaxX1) - maxX1 -= 2; - if (minX2 == TminX2) - minX2 += 2; - } - if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && - !block.lock()->hasInterpolationFlagCF(W)) { - if (minX1 == TminX1) - minX1 += 2; - if (maxX2 == TmaxX2) - maxX2 -= 2; - } - - // ////T-B-E-W - if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && - !block.lock()->hasInterpolationFlagCF(T)) { - if (maxX1 == TmaxX1) - maxX1 -= 2; - if (maxX3 == TmaxX3) - maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && - !block.lock()->hasInterpolationFlagCF(B)) { - if (minX1 == TminX1) - minX1 += 2; - if (minX3 == TminX3) - minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && - !block.lock()->hasInterpolationFlagCF(B)) { - if (maxX1 == TmaxX1) - maxX1 -= 2; - if (minX3 == TminX3) - minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && - !block.lock()->hasInterpolationFlagCF(T)) { - if (minX1 == TminX1) - minX1 += 2; - if (maxX3 == TmaxX3) - maxX3 -= 2; - } - - ////T-B-N-S - if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && - !block.lock()->hasInterpolationFlagCF(T)) { - if (maxX2 == TmaxX2) - maxX2 -= 2; - if (maxX3 == TmaxX3) - maxX3 -= 2; - } - if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && - !block.lock()->hasInterpolationFlagCF(B)) { - if (minX2 == TminX2) - minX2 += 2; - if (minX3 == TminX3) - minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && - !block.lock()->hasInterpolationFlagCF(B)) { - if (maxX2 == TmaxX2) - maxX2 -= 2; - if (minX3 == TminX3) - minX3 += 2; - } - if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && - !block.lock()->hasInterpolationFlagCF(T)) { - if (minX2 == TminX2) - minX2 += 2; - if (maxX3 == TmaxX3) - maxX3 -= 2; - } -} diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h deleted file mode 100644 index 4e71916d4a489a7d834c360c21caafa5bb42526d..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h +++ /dev/null @@ -1,98 +0,0 @@ -//! \file CoarseToFineNodeSetBlock3DConnector.h -//! \class CoarseToFineNodeSetBlock3DConnector -//! \brief Connector interpolates and sends data from coarse level to fine. -//! \author Konstantin Kutscher -//! \date 18.05.2015 - -#ifndef CoarseToFineNodeSetBlock3DConnector_H -#define CoarseToFineNodeSetBlock3DConnector_H - -#include <set> -#include <vector> - -//#include "basics/transmitter/TbTransmitter.h" -//#include "basics/transmitter/TbTransmitterLocal.h" -//#include "basics/container/CbVector.h" -#include "BCProcessor.h" -#include "Block3D.h" -#include "CoarseToFineBlock3DConnector.h" -#include "D3Q27System.h" -#include "Grid3D.h" -#include "InterpolationProcessor.h" -#include "LBMKernel.h" -#include "MathUtil.hpp" -#include <PointerDefinitions.h> - -class Block3D; - -// daten werden in einen vector (dieser befindet sich im transmitter) kopiert -// der vector wird via transmitter uebertragen -// transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -// transmitter sein, der von Transmitter abgeleitet ist ;-) - -// send direction: E<->W N<->S T<->B -// --------- x3 x3 x2 -// | 01 | 11 | ^ ^ ^ -// |----+----| +-> x2 +->x1 +->x1 -// | 00 | 10 | -// --------- - -class CoarseToFineNodeSetBlock3DConnector : public CoarseToFineBlock3DConnector -{ -public: - CoarseToFineNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender00, - VectorTransmitterPtr receiver00, VectorTransmitterPtr sender01, - VectorTransmitterPtr receiver01, VectorTransmitterPtr sender10, - VectorTransmitterPtr receiver10, VectorTransmitterPtr sender11, - VectorTransmitterPtr receiver11, int sendDir, - InterpolationProcessorPtr iprocessor); - - void init() override; - - void fillSendVectors() override; - void distributeReceiveVectors() override; - -protected: - typedef std::vector<int> INodeVector; - using INodeSet = std::vector<INodeVector>; - INodeSet iNodeSetSender00; - INodeSet iNodeSetSender01; - INodeSet iNodeSetSender10; - INodeSet iNodeSetSender11; - INodeSet iNodeSetReceiver00; - INodeSet iNodeSetReceiver01; - INodeSet iNodeSetReceiver10; - INodeSet iNodeSetReceiver11; - - void writeICellFtoData(vector_type &data, int &index, D3Q27ICell &icellF); - void writeNodeToVector(vector_type &data, int &index, LBMReal *inode); - void readICellCfromData(vector_type &data, int &index, LBMReal *icellC); - - void findCFCells(); - void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void findFCCells(); - void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void getLocalMinMax(int &minX1, int &minX2, int &minX3, int &maxX1, int &maxX2, int &maxX3); - - int bMaxX1, bMaxX2, bMaxX3; - - int minX1; - int minX2; - int minX3; - - int maxX1; - int maxX2; - int maxX3; - - int minHalfX1; - int minHalfX2; - int minHalfX3; - - int maxHalfX1; - int maxHalfX2; - int maxHalfX3; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h deleted file mode 100644 index 3e8828639bebfabbacf62793de954afd17b86026..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef ConnectorFactory_h__ -#define ConnectorFactory_h__ - -#include "Block3DConnector.h" -#include "FineToCoarseBlock3DConnector.h" -#include "InterpolationProcessor.h" -#include "TransmitterType.h" - -#include <PointerDefinitions.h> - -class ConnectorFactory -{ -public: - ConnectorFactory() = default; - - virtual ~ConnectorFactory() = default; - - - virtual SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, - int sendDir) = 0; - virtual SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir) = 0; - virtual SPtr<Block3DConnector> - createCoarseToFineConnector(SPtr<Block3D> block, VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, - VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, - VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, - VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, int sendDir, - InterpolationProcessorPtr iprocessor) = 0; - virtual SPtr<Block3DConnector> - createFineToCoarseConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, - int sendDir, InterpolationProcessorPtr iprocessor, - FineToCoarseBlock3DConnector::CFconnectorType connType) = 0; - -protected: -private: -}; -#endif // ConnectorFactory_h__ diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp deleted file mode 100644 index fdeb0e5569c49e82b4f7c7bbafb07a41ab07aecd..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//#include "D3Q27ETOffConnectorFactory.h" -//#include "TransmitterType.h" -//#include "D3Q27ETCFOffVectorConnector.h" -//#include "D3Q27ETFCOffVectorConnector.h" -//#include "D3Q27ETFCVectorConnector.h" -//#include "FineToCoarseBlock3DConnector.h" -// -// D3Q27ETOffConnectorFactory::D3Q27ETOffConnectorFactory() -//{ -//} -//////////////////////////////////////////////////////////////////////////// -// D3Q27ETOffConnectorFactory::~D3Q27ETOffConnectorFactory() -//{ -//} -//////////////////////////////////////////////////////////////////////////// -// SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createCoarseToFineConnector(SPtr<Block3D> block, -// VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, -// VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, -// VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, -// VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, -// int sendDir, D3Q27InterpolationProcessorPtr iprocessor) -//{ -// return SPtr<Block3DConnector>(new D3Q27ETCFOffVectorConnector<VectorTransmitter>(block, -// sender00, receiver00, sender01, receiver01, -// sender10, receiver10, sender11, receiver11, -// sendDir, iprocessor)); -//} -//////////////////////////////////////////////////////////////////////////// -// SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createFineToCoarseConnector(SPtr<Block3D> block, -// VectorTransmitterPtr sender, -// VectorTransmitterPtr receiver, -// int sendDir, -// D3Q27InterpolationProcessorPtr iprocessor, -// FineToCoarseBlock3DConnector::CFconnectorType connType) -//{ -// return SPtr<Block3DConnector>(new D3Q27ETFCOffVectorConnector<VectorTransmitter>(block, -// sender, receiver, sendDir, iprocessor, connType)); -//} diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h deleted file mode 100644 index 8ed08c80aa56ff71db5c6fff2b9bfeaeca962646..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h +++ /dev/null @@ -1,33 +0,0 @@ -//#ifndef D3Q27ETOffConnectorFactory_h__ -//#define D3Q27ETOffConnectorFactory_h__ -// -//#include "Block3DConnectorFactory.h" -// -//#include <PointerDefinitions.h> -// class D3Q27ETOffConnectorFactory; -// typedef SPtr<D3Q27ETOffConnectorFactory> D3Q27ETOffSPtr<ConnectorFactory>; -// -// class D3Q27ETOffConnectorFactory : public Block3DConnectorFactory -//{ -// public: -// D3Q27ETOffConnectorFactory(); -// virtual ~D3Q27ETOffConnectorFactory(); -// -// virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block, -// VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00, -// VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01, -// VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10, -// VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11, -// int sendDir, D3Q27InterpolationProcessorPtr iprocessor); -// -// virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block, -// VectorTransmitterPtr sender, -// VectorTransmitterPtr receiver, -// int sendDir, -// D3Q27InterpolationProcessorPtr iprocessor, -// FineToCoarseBlock3DConnector::CFconnectorType connType); -// -// private: -// -//}; -//#endif // D3Q27ETOffConnectorFactory_h__ diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp deleted file mode 100644 index ca6d017a59e4c322ab70f42deaa4575cba97a2db..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "FineToCoarseBlock3DConnector.h" - -//////////////////////////////////////////////////////////////////////////// -FineToCoarseBlock3DConnector::FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : Block3DConnector(sendDir), block(block), sender(sender), receiver(receiver), iprocessor(iprocessor), - connType(connType) -{ - if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || - sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B || - sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || - sendDir == D3Q27System::NW || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || - sendDir == D3Q27System::BE || sendDir == D3Q27System::TW || sendDir == D3Q27System::TN || - sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS - - || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || - sendDir == D3Q27System::TSW || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || - sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW - - )) { - throw UbException(UB_EXARGS, "invalid constructor for this direction"); - } -} -////////////////////////////////////////////////////////////////////////// -bool FineToCoarseBlock3DConnector::isLocalConnector() { return !this->isRemoteConnector(); } -////////////////////////////////////////////////////////////////////////// -bool FineToCoarseBlock3DConnector::isRemoteConnector() -{ - return sender->isRemoteTransmitter() || receiver->isRemoteTransmitter(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::sendTransmitterDataSize() -{ - if (sender) { - UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()" - << block.lock()->toString() + "sendDir=" << sendDir); - sender->sendDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::receiveTransmitterDataSize() -{ - if (receiver) { - UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()" - << block.lock()->toString() << "sendDir=" << sendDir); - receiver->receiveDataSize(); - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::prepareForSend() -{ - if (sender) - sender->prepareForSend(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::sendVectors() -{ - if (sender) - sender->sendData(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::prepareForReceive() -{ - if (receiver) - receiver->prepareForReceive(); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseBlock3DConnector::receiveVectors() -{ - if (receiver) - receiver->receiveData(); -} diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h deleted file mode 100644 index 5e988887c427f34ddbae70f1c8fd16b1de75367c..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h +++ /dev/null @@ -1,93 +0,0 @@ -//! \file FineToCoarseBlock3DConnector.h -//! \brief Base class for connectors that interpolates and sends data from fine level to coarse. -//! \author Konstantin Kutscher -//! \date 21.05.2015 - -#ifndef FineToCoarseBlock3DConnector_H -#define FineToCoarseBlock3DConnector_H - -#include "Block3D.h" -#include "Block3DConnector.h" -#include "D3Q27System.h" -#include "InterpolationProcessor.h" -#include "LBMKernel.h" -#include "TransmitterType.h" - -#include <PointerDefinitions.h> - -class Block3D; - -//! \class FineToCoarseBlock3DConnector -//! \brief Base class for connectors that interpolates and sends data from fine level to coarse. -//! \details The data is copied in a vector (this is located in the transmitter). -//! The vector is transmitted via transmitter. -//! The transmitter can be a local, MPI, RCG, CTL or whatever -//! which a transmitter that is derived from transmitter base class. -//! -//! four fine blocks inside a coarse block: -//! -//! | | | -//! |:--:|:---| -//! | 01 | 11 | -//! | 00 | 10 | -//! -//! send direction: -//! -//! |E<->W | N<->S | T<->B | -//! |--------|---------|--------| -//! | x3 | x3 | x2 | -//! | ^ | ^ | ^ | -//! | +->x2 | +->x1 | +->x1| - -class FineToCoarseBlock3DConnector : public Block3DConnector -{ -public: - enum CFconnectorType { Type00, Type10, Type01, Type11 }; - -public: - FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, - int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType); - - bool isLocalConnector() override; - bool isRemoteConnector() override; - - void sendTransmitterDataSize() override; - void receiveTransmitterDataSize() override; - - void prepareForSend() override; - void sendVectors() override; - - void prepareForReceive() override; - void receiveVectors() override; - - void init() override = 0; - void fillSendVectors() override = 0; - void distributeReceiveVectors() override = 0; - - bool isInterpolationConnectorCF() override { return false; } - bool isInterpolationConnectorFC() override { return true; } - - void prepareForSendX1() override {} - void prepareForSendX2() override {} - void prepareForSendX3() override {} - - void sendVectorsX1() override {} - void sendVectorsX2() override {} - void sendVectorsX3() override {} - - void prepareForReceiveX1() override {} - void prepareForReceiveX2() override {} - void prepareForReceiveX3() override {} - - void receiveVectorsX1() override {} - void receiveVectorsX2() override {} - void receiveVectorsX3() override {} - -protected: - WPtr<Block3D> block; - VectorTransmitterPtr sender, receiver; - InterpolationProcessorPtr iprocessor; - CFconnectorType connType; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp deleted file mode 100644 index d40c5276c7c2e1ac6ede9233cf46c27f4331a24f..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp +++ /dev/null @@ -1,1121 +0,0 @@ -#include "FineToCoarseNodeSetBlock3DConnector.h" -#include "BCProcessor.h" -#include "DataSet3D.h" - -////////////////////////////////////////////////////////////////////////// -FineToCoarseNodeSetBlock3DConnector::FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, - VectorTransmitterPtr sender, - VectorTransmitterPtr receiver, int sendDir, - InterpolationProcessorPtr iprocessor, - CFconnectorType connType) - : FineToCoarseBlock3DConnector(block, sender, receiver, sendDir, iprocessor, connType) -{ -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::init() -{ - bMaxX1 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1(); - bMaxX2 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2(); - bMaxX3 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3(); - - minX1 = 0; - minX2 = 0; - minX3 = 0; - maxX1 = bMaxX1 - 1; - maxX2 = bMaxX2 - 1; - maxX3 = bMaxX3 - 1; - - minOffX1 = 0; - minOffX2 = 0; - minOffX3 = 0; - - maxOffX1 = 0; - maxOffX2 = 0; - maxOffX3 = 0; - - if (Utilities::isEven(bMaxX1)) { - minOffX1 = 0; - maxOffX1 = 0; - } else if (Utilities::isOdd(bMaxX1)) { - minOffX1 = 1; - maxOffX1 = -1; - } - - if (Utilities::isEven(bMaxX2)) { - minOffX2 = 0; - maxOffX2 = 0; - } else if (Utilities::isOdd(bMaxX2)) { - minOffX2 = 1; - maxOffX2 = -1; - } - - if (Utilities::isEven(bMaxX3)) { - minOffX3 = 0; - maxOffX3 = 0; - } else if (Utilities::isOdd(bMaxX3)) { - minOffX3 = 1; - maxOffX3 = -1; - } - - // int sendSize = 0; - LBMReal initValue = -999.0; - - int sendDataPerNode = 27 /*f*/; - int iCellSize = 1; // size of interpolation cell - - findFCCells(); - findCFCells(); - - ////////////////////////////////////////////////////// - // Debug - ////////////////////////////////////////////////////// - // if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183) - // { - // int test = 0; - // } - - if (FineToCoarseBlock3DConnector::sender) - FineToCoarseBlock3DConnector::sender->getData().resize(iNodeSetSender.size() * iCellSize * sendDataPerNode, - initValue); - else - FineToCoarseBlock3DConnector::sender = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - - if (!FineToCoarseBlock3DConnector::receiver) - FineToCoarseBlock3DConnector::receiver = VectorTransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, - int lMaxX3, INodeSet &inodes) -{ - ////////////////////////////////////////////////////// - // Debug - ////////////////////////////////////////////////////// - // if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183) - // { - // int test = 0; - // } - - int ix1, ix2, ix3; - LBMReal x1off, x2off, x3off; - - SPtr<DistributionArray3D> fFrom = - FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions(); - SPtr<BCArray3D> bcArray = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getBCProcessor()->getBCArray(); - - for (ix3 = lMinX3; ix3 <= lMaxX3; ix3 += 2) { - for (ix2 = lMinX2; ix2 <= lMaxX2; ix2 += 2) { - for (ix1 = lMinX1; ix1 <= lMaxX1; ix1 += 2) { - D3Q27ICell icellC; - - int howManySolids = - FineToCoarseBlock3DConnector::iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3); - - if (howManySolids == 0 || howManySolids == 8) { - x1off = 0.0; - x2off = 0.0; - x3off = 0.0; - } else { - if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, - x1off, x2off, x3off)) { - std::string err = "For " + FineToCoarseBlock3DConnector::block.lock()->toString() + - " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + - ", x3=" + UbSystem::toString(ix3) + - " interpolation is not implemented for other direction" + - " by using in: " + (std::string) typeid(*this).name() + - " or maybe you have a solid on the block boundary"; - UB_THROW(UbException(UB_EXARGS, err)); - } - } - - INodeVector inv; - inv.push_back(ix1 + (int)x1off); - inv.push_back(ix2 + (int)x2off); - inv.push_back(ix3 + (int)x3off); - inv.push_back((int)x1off); - inv.push_back((int)x2off); - inv.push_back((int)x3off); - // inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// - -void FineToCoarseNodeSetBlock3DConnector::findFCCells() -{ - using namespace D3Q27System; - - int lMin1X1 = 0, lMin1X2 = 0, lMin1X3 = 0, lMax1X1 = 0, lMax1X2 = 0, lMax1X3 = 0; - int lMin2X1 = 0, lMin2X2 = 0, lMin2X3 = 0, lMax2X1 = 0, lMax2X2 = 0, lMax2X3 = 0; - int lMin3X1 = 0, lMin3X2 = 0, lMin3X3 = 0, lMax3X1 = 0, lMax3X2 = 0, lMax3X3 = 0; - - // lMin1X1 = minX1+1; lMin1X2 = minX2+1; lMin1X3 = minX3+1; - // lMax1X1 = maxX1-1; lMax1X2 = maxX2-1; lMax1X3 = maxX3-1; - // getLocalMinMax(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3); - - // lMin2X1 = minX1+1; lMin2X2 = minX2+1; lMin2X3 = minX3+1; - // lMax2X1 = maxX1-1; lMax2X2 = maxX2-1; lMax2X3 = maxX3-1; - // getLocalMinMax(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3); - - // lMin3X1 = minX1+1; lMin3X2 = minX2+1; lMin3X3 = minX3+1; - // lMax3X1 = maxX1-1; lMax3X2 = maxX2-1; lMax3X3 = maxX3-1; - // getLocalMinMax(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3); - - switch (sendDir) { - // faces - case E: - case W: - if (sendDir == E) { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1; - } else if (sendDir == W) { - lMin1X1 = 5; - lMax1X1 = lMin1X1; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - case N: - case S: - if (sendDir == N) { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - } else if (sendDir == S) { - lMin1X2 = 5; - lMax1X2 = lMin1X2; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - case T: - case B: - if (sendDir == T) { - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - } else if (sendDir == B) { - lMin1X3 = 5; - lMax1X3 = lMin1X3; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - break; - // edges - // N-S-E-W - case NE: - case SW: - case SE: - case NW: - if (sendDir == NE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2 + 4; - } else if (sendDir == SW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = 5; - lMax1X2 = lMin1X2; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 4; - } else if (sendDir == SE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = 5; - lMax1X2 = lMin1X2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X2 = 1; - lMax2X2 = lMin2X2 + 4; - } else if (sendDir == NW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2 + 4; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X3 = minX3; - lMax1X3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X3 = minX3 + minOffX3; - lMax1X3 = maxX3 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin2X2, lMin1X3, lMax2X1, lMax2X2, lMax1X3, iNodeSetSender); - - break; - // T-B-E-W - case TE: - case BW: - case BE: - case TW: - if (sendDir == TE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == BW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == BE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = lMin1X1 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X1 = maxX1 - 6; - lMax2X1 = lMin2X1; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == TW) { - lMin1X1 = 1; - lMax1X1 = lMin1X1 + 5; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X1 = 5; - lMax2X1 = lMin2X1; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X2 = minX2; - lMax1X2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X2 = minX2 + minOffX2; - lMax1X2 = maxX2 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin1X2, lMin2X3, lMax2X1, lMax1X2, lMax2X3, iNodeSetSender); - break; - // T-B-N-S - case TN: - case BS: - case BN: - case TS: - if (sendDir == TN) { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == BS) { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X2 = 5; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == BN) { - lMin1X2 = maxX2 - 6; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = 5; - lMax1X3 = lMin1X3; - - lMin2X2 = maxX2 - 6; - lMax2X2 = lMin2X2; - lMin2X3 = 1; - lMax2X3 = lMin2X3 + 4; - } else if (sendDir == TS) { - lMin1X2 = 1; - lMax1X2 = lMin1X2 + 4; - lMin1X3 = maxX3 - 6; - lMax1X3 = lMin1X3; - - lMin2X2 = 5; - lMax2X2 = lMin2X2; - lMin2X3 = maxX3 - 6; - lMax2X3 = lMin2X3 + 4; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMin1X1 = minX1; - lMax1X1 = maxX1 + maxOffX1 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMin1X1 = minX1 + minOffX1; - lMax1X1 = maxX1 - 1; - } - - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin1X1, lMin2X2, lMin2X3, lMax1X1, lMax2X2, lMax2X3, iNodeSetSender); - break; - // corners - case TNE: - case TNW: - case TSE: - case TSW: - case BNE: - case BNW: - case BSE: - case BSW: - if (sendDir == TNE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = maxX1 - 6; - lMin1X2 = maxX2 - 6; - lMax1X2 = maxX2 - 2; - lMin1X3 = maxX3 - 6; - lMax1X3 = maxX3 - 2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = maxX1 - 2; - lMin2X2 = maxX2 - 6; - lMax2X2 = maxX2 - 6; - lMin2X3 = maxX3 - 6; - lMax2X3 = maxX3 - 1; - - lMin3X1 = maxX1 - 6; - lMax3X1 = maxX1 - 2; - lMin3X2 = maxX2 - 6; - lMax3X2 = maxX2 - 2; - lMin3X3 = maxX3 - 6; - lMax3X3 = maxX3 - 5; - } else if (sendDir == TNW) { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = maxX2 - 6; - lMax1X2 = maxX2 - 2; - lMin1X3 = maxX3 - 6; - lMax1X3 = maxX3 - 2; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = maxX2 - 6; - lMax2X2 = maxX2 - 6; - lMin2X3 = maxX3 - 6; - lMax2X3 = maxX3 - 2; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = maxX2 - 6; - lMax3X2 = maxX2 - 2; - lMin3X3 = maxX3 - 6; - lMax3X3 = maxX3 - 6; - } else if (sendDir == TSE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = maxX1 - 6; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = maxX3 - 6; - lMax1X3 = maxX3 - 2; - - lMin2X1 = maxX1 - 6; - lMax2X1 = maxX1 - 2; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = maxX3 - 6; - lMax2X3 = maxX3 - 2; - - lMin3X1 = maxX1 - 6; - lMax3X1 = maxX1 - 2; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = maxX3 - 6; - lMax3X3 = maxX3 - 6; - } else if (sendDir == TSW) { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = maxX3 - 6; - lMax1X3 = maxX3 - 2; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = maxX3 - 6; - lMax2X3 = maxX3 - 2; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = maxX3 - 6; - lMax3X3 = maxX3 - 6; - } else if (sendDir == BNE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = maxX1 - 6; - lMin1X2 = maxX2 - 6; - lMax1X2 = maxX2 - 2; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = maxX1 - 6; - lMax2X1 = maxX1 - 2; - lMin2X2 = maxX2 - 6; - lMax2X2 = maxX2 - 6; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = maxX1 - 6; - lMax3X1 = maxX1 - 2; - lMin3X2 = maxX2 - 6; - lMax3X2 = maxX2 - 2; - lMin3X3 = 5; - lMax3X3 = 5; - } else if (sendDir == BNW) { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = maxX2 - 6; - lMax1X2 = maxX2 - 2; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = maxX2 - 6; - lMax2X2 = maxX2 - 6; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = maxX2 - 6; - lMax3X2 = maxX2 - 2; - lMin3X3 = 5; - lMax3X3 = 5; - } else if (sendDir == BSE) { - lMin1X1 = maxX1 - 6; - lMax1X1 = maxX1 - 6; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = maxX1 - 6; - lMax2X1 = maxX1 - 2; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = maxX1 - 5; - lMax3X1 = maxX1 - 2; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = 5; - lMax3X3 = 5; - } else if (sendDir == BSW) { - lMin1X1 = 5; - lMax1X1 = 5; - lMin1X2 = 1; - lMax1X2 = 5; - lMin1X3 = 1; - lMax1X3 = 5; - - lMin2X1 = 1; - lMax2X1 = 5; - lMin2X2 = 5; - lMax2X2 = 5; - lMin2X3 = 1; - lMax2X3 = 5; - - lMin3X1 = 1; - lMax3X1 = 5; - lMin3X2 = 1; - lMax3X2 = 5; - lMin3X3 = 5; - lMax3X3 = 5; - } - findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender); - findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetSender); - findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetSender); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::fillSendVectors() -{ - using namespace D3Q27System; - - SPtr<DistributionArray3D> fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index = 0; - - vector_type &data = this->sender->getData(); - - for (INodeVector inode : iNodeSetSender) { - LBMReal icellC[27]; - D3Q27ICell icellF; - iprocessor->readICell(fFrom, icellF, inode[0], inode[1], inode[2]); - iprocessor->interpolateFineToCoarse(icellF, icellC, inode[3], inode[4], inode[5]); - writeICellCtoData(data, index, icellC); - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::readICellFfromData(vector_type &data, int &index, D3Q27ICell &icellF) -{ - readNodeFromVector(data, index, icellF.BSW); - readNodeFromVector(data, index, icellF.BSE); - readNodeFromVector(data, index, icellF.BNW); - readNodeFromVector(data, index, icellF.BNE); - readNodeFromVector(data, index, icellF.TSW); - readNodeFromVector(data, index, icellF.TSE); - readNodeFromVector(data, index, icellF.TNW); - readNodeFromVector(data, index, icellF.TNE); -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::readNodeFromVector(vector_type &data, int &index, LBMReal *inode) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) { - inode[i] = data[index++]; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::writeICellCtoData(vector_type &data, int &index, LBMReal *icellC) -{ - for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++) { - data[index++] = icellC[i]; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, - int lMaxX3, INodeSet &inodes) -{ - int ix1, ix2, ix3; - - for (ix3 = lMinX3; ix3 <= lMaxX3; ix3 += 2) { - for (ix2 = lMinX2; ix2 <= lMaxX2; ix2 += 2) { - for (ix1 = lMinX1; ix1 <= lMaxX1; ix1 += 2) { - INodeVector inv; - inv.push_back(ix1); - inv.push_back(ix2); - inv.push_back(ix3); - // inodes.insert(inv); - inodes.push_back(inv); - } - } - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::findCFCells() -{ - using namespace D3Q27System; - - int lMinX1 = 0, lMinX2 = 0, lMinX3 = 0, lMaxX1 = 0, lMaxX2 = 0, lMaxX3 = 0; - - ////////////////////////////////////////////////////// - // Debug - ////////////////////////////////////////////////////// - // if (block.lock()->getGlobalID() == 2183) - // { - // int test = 0; - // } - - switch (sendDir) { - // faces - case E: - case W: - if (sendDir == E) { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1; - } else if (sendDir == W) { - lMinX1 = 2; - lMaxX1 = lMinX1; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - case N: - case S: - if (sendDir == N) { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2; - } else if (sendDir == S) { - lMinX2 = 2; - lMaxX2 = lMinX2; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1; - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - case T: - case B: - if (sendDir == T) { - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3; - } else if (sendDir == B) { - lMinX3 = 2; - lMaxX3 = lMinX3; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type01) { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type11) { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - - // edges - // N-S-E-W - case NE: - case SW: - case SE: - case NW: - if (sendDir == NE) { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - } else if (sendDir == SW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 3; - lMinX2 = 0; - lMaxX2 = lMinX2 + 3; - } else if (sendDir == SE) { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - } else if (sendDir == NW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX3 = minX3; - lMaxX3 = maxX3 + maxOffX3 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX3 = minX3 + minOffX3; - lMaxX3 = maxX3 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - // T-B-E-W - case TE: - case BW: - case BE: - case TW: - if (sendDir == TE) { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == BW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == BE) { - lMinX1 = maxX1 - 3; - lMaxX1 = lMinX1 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == TW) { - lMinX1 = 0; - lMaxX1 = lMinX1 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX2 = minX2; - lMaxX2 = maxX2 + maxOffX2 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX2 = minX2 + minOffX2; - lMaxX2 = maxX2 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - // T-B-N-S - case TN: - case BS: - case BN: - case TS: - if (sendDir == TN) { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == BS) { - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == BN) { - lMinX2 = maxX2 - 3; - lMaxX2 = lMinX2 + 2; - lMinX3 = 0; - lMaxX3 = lMinX3 + 2; - } else if (sendDir == TS) { - lMinX2 = 0; - lMaxX2 = lMinX2 + 2; - lMinX3 = maxX3 - 3; - lMaxX3 = lMinX3 + 2; - } - - if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type00) { - lMinX1 = minX1; - lMaxX1 = maxX1 + maxOffX1 - 1; - } else if (FineToCoarseBlock3DConnector::connType == FineToCoarseBlock3DConnector::Type10) { - lMinX1 = minX1 + minOffX1; - lMaxX1 = maxX1 - 1; - } - - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - // corners - case TNE: - case TNW: - case TSE: - case TSW: - case BNE: - case BNW: - case BSE: - case BSW: - if (sendDir == TNE) { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TNW) { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TSE) { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } else if (sendDir == TSW) { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = maxX3 - 3; - lMaxX3 = maxX3 - 1; - } else if (sendDir == BNE) { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - } else if (sendDir == BNW) { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = maxX2 - 3; - lMaxX2 = maxX2 - 1; - lMinX3 = 0; - lMaxX3 = 2; - } else if (sendDir == BSE) { - lMinX1 = maxX1 - 3; - lMaxX1 = maxX1 - 1; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - } else if (sendDir == BSW) { - lMinX1 = 0; - lMaxX1 = 2; - lMinX2 = 0; - lMaxX2 = 2; - lMinX3 = 0; - lMaxX3 = 2; - } - findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver); - break; - } -} -////////////////////////////////////////////////////////////////////////// -void FineToCoarseNodeSetBlock3DConnector::distributeReceiveVectors() -{ - using namespace D3Q27System; - - SPtr<DistributionArray3D> fTo = - FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions(); - - int index = 0; - - vector_type &data = this->receiver->getData(); - - for (INodeVector inode : iNodeSetReceiver) { - D3Q27ICell icellF; - this->readICellFfromData(data, index, icellF); - iprocessor->writeICellInv(fTo, icellF, inode[0], inode[1], inode[2]); - } -} -////////////////////////////////////////////////////////////////////////// -// -// void FineToCoarseNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, -// int& maxX3) -//{ -// using namespace D3Q27System; -// int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = -// maxX3; -// -// if (block.lock()->hasInterpolationFlagFC(E)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(W)) -// { -// if (minX1==TminX1) minX1 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(N)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(S)) -// { -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX3==TminX3) minX3 += 4; -// } -// -// //////////// -// /////E-W-N-S -// if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && -// !block.lock()->hasInterpolationFlagFC(E)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && -// !block.lock()->hasInterpolationFlagFC(S)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && -// !block.lock()->hasInterpolationFlagFC(S)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (minX2==TminX2) minX2 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && -// !block.lock()->hasInterpolationFlagFC(W)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (maxX2==TmaxX2) maxX2 -= 2; -// } -// -// //////T-B-E-W -// if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && -// !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && -// !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && -// !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (maxX1==TmaxX1) maxX1 -= 2; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && -// !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (minX1==TminX1) minX1 += 4; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// -// -// ////T-B-N-S -// if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && -// !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -// if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && -// !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (minX2==TminX2) minX2 += 4; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && -// !block.lock()->hasInterpolationFlagFC(B)) -// { -// if (maxX2==TmaxX2) maxX2 -= 2; -// if (minX3==TminX3) minX3 += 4; -// } -// if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && -// !block.lock()->hasInterpolationFlagFC(T)) -// { -// if (minX2==TminX2) minX2 += 4; -// if (maxX3==TmaxX3) maxX3 -= 2; -// } -//} -////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h deleted file mode 100644 index bcf29041e06c85611fd478704c09491c0c0a67da..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h +++ /dev/null @@ -1,74 +0,0 @@ -/// \file CoarseToFineNodeSetBlock3DConnector.h -/// \class CoarseToFineNodeSetBlock3DConnector -/// \brief Connector interpolates and sends data from coarse level to fine. -/// \author Konstantin Kutscher -/// \date 21.05.2015 - -#ifndef FineToCoarseNodeSetBlock3DConnector_H -#define FineToCoarseNodeSetBlock3DConnector_H - -#include "Block3D.h" -#include "D3Q27System.h" -#include "FineToCoarseBlock3DConnector.h" -#include "Grid3D.h" -#include "InterpolationProcessor.h" -#include "LBMKernel.h" -#include "MathUtil.hpp" -#include <PointerDefinitions.h> -#include <vector> - -class Block3D; - -// daten werden in einen vector (dieser befindet sich im transmitter) kopiert -// der vector wird via transmitter uebertragen -// transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein -// transmitter sein, der von Transmitter abgeleitet ist ;-) - -class FineToCoarseNodeSetBlock3DConnector : public FineToCoarseBlock3DConnector -{ -public: - FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, - int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType); - void init() override; - void fillSendVectors() override; - void distributeReceiveVectors() override; - -protected: - using INodeVector = std::vector<int>; - using INodeSet = std::vector<INodeVector>; - INodeSet iNodeSetSender; - INodeSet iNodeSetReceiver; - - void readICellFfromData(vector_type &data, int &index, D3Q27ICell &icellF); - void readNodeFromVector(vector_type &data, int &index, LBMReal *inode); - - void writeICellCtoData(vector_type &data, int &index, LBMReal *icellC); - - void findFCCells(); - void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - void findCFCells(); - void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes); - - // void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3); - - int bMaxX1, bMaxX2, bMaxX3; - - int minX1; - int minX2; - int minX3; - - int maxX1; - int maxX2; - int maxX3; - - int minOffX1; - int minOffX2; - int minOffX3; - - int maxOffX1; - int maxOffX2; - int maxOffX3; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/BinghamModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/BinghamModelLBMKernel.h deleted file mode 100644 index 8a3f1e58fd8209c96bbc82f71cfbf3316fa2cf6c..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/BinghamModelLBMKernel.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef BinghamModelLBMKernel_H -#define BinghamModelLBMKernel_H - -#include "ThixotropyModelLBMKernel.h" -#include "Thixotropy.h" - -//! \brief Cumulant LBM kernel + Bingham plastic model -//! \author K. Kutscher, M. Geier -class BinghamModelLBMKernel : public ThixotropyModelLBMKernel -{ -public: - BinghamModelLBMKernel() {}; - ~BinghamModelLBMKernel() {}; - SPtr<LBMKernel> clone() override - { - SPtr<LBMKernel> kernel(new BinghamModelLBMKernel()); - kernel->setNX(nx); - kernel->setCollisionFactor(collFactor); - dynamicPointerCast<BinghamModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - - return kernel; - } -protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override - { - return Thixotropy::getBinghamCollFactor(omegaInf, shearRate, drho); - } -}; - - -#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/HerschelBulkleyModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/HerschelBulkleyModelLBMKernel.h deleted file mode 100644 index c5cff32aab78c8a207143fb81b58f1ca0cba856b..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/HerschelBulkleyModelLBMKernel.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef HerschelBulkleyModelLBMKernel_H -#define HerschelBulkleyModelLBMKernel_H - -#include "ThixotropyModelLBMKernel.h" -#include "Thixotropy.h" - -//! \brief Cumulant LBM kernel + Herschel-Bulkley plastic model -//! \author K. Kutscher, M. Geier -class HerschelBulkleyModelLBMKernel : public ThixotropyModelLBMKernel -{ -public: - HerschelBulkleyModelLBMKernel() {}; - ~HerschelBulkleyModelLBMKernel() {}; - SPtr<LBMKernel> clone() override - { - SPtr<LBMKernel> kernel(new HerschelBulkleyModelLBMKernel()); - kernel->setNX(nx); - kernel->setCollisionFactor(collFactor); - dynamicPointerCast<HerschelBulkleyModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - - return kernel; - } -protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override - { - return Thixotropy::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); - } -}; - - -#endif \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/PowellEyringModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/PowellEyringModelLBMKernel.h deleted file mode 100644 index 02932d808e2cbc242617405979435c78fd6386d9..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/PowellEyringModelLBMKernel.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef PowellEyringModelLBMKernel_H -#define PowellEyringModelLBMKernel_H - -#include "ThixotropyModelLBMKernel.h" -#include "Thixotropy.h" - -//! \brief Cumulant LBM kernel + Herschel-Bulkley plastic model -//! \author K. Kutscher, M. Geier -class PowellEyringModelLBMKernel : public ThixotropyModelLBMKernel -{ -public: - PowellEyringModelLBMKernel() {}; - ~PowellEyringModelLBMKernel() {}; - SPtr<LBMKernel> clone() override - { - SPtr<LBMKernel> kernel(new PowellEyringModelLBMKernel()); - kernel->setNX(nx); - kernel->setCollisionFactor(collFactor); - dynamicPointerCast<PowellEyringModelLBMKernel>(kernel)->initDataSet(); - kernel->setBCProcessor(bcProcessor->clone(kernel)); - kernel->setWithForcing(withForcing); - kernel->setForcingX1(muForcingX1); - kernel->setForcingX2(muForcingX2); - kernel->setForcingX3(muForcingX3); - kernel->setIndex(ix1, ix2, ix3); - kernel->setDeltaT(deltaT); - - return kernel; - } -protected: - LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override - { - return Thixotropy::getPowellEyringCollFactor(omegaInf, shearRate, drho); - } -}; - - -#endif \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/Rheology.cpp b/src/cpu/VirtualFluidsCore/LBM/Rheology.cpp new file mode 100644 index 0000000000000000000000000000000000000000..55f8bba509d53392c804b44e43e54970f3cf1157 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/Rheology.cpp @@ -0,0 +1,118 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 Rheology.cpp +//! \ingroup LBM +//! \author Konstantin Kutscher, Martin Geier +//======================================================================================= +#include "Rheology.h" + +SPtr<Rheology> Rheology::instance = SPtr<Rheology>(); +LBMReal Rheology::tau0 = 0; +LBMReal Rheology::k = 0; +LBMReal Rheology::n = 1; +LBMReal Rheology::omegaMin = 0; +LBMReal Rheology::beta = 0; +LBMReal Rheology::c = 0; +LBMReal Rheology::mu0 = 0; + +////////////////////////////////////////////////////////////////////////// +SPtr<Rheology> Rheology::getInstance() +{ + if (!instance) + instance = SPtr<Rheology>(new Rheology()); + return instance; +} + +void Rheology::setYieldStress(LBMReal yieldStress) +{ + tau0 = yieldStress; +} +LBMReal Rheology::getYieldStress() const +{ + return tau0; +} +void Rheology::setViscosityParameter(LBMReal kParameter) +{ + k = kParameter; +} +LBMReal Rheology::getViscosityParameter() const +{ + return k; +} +void Rheology::setPowerIndex(LBMReal index) +{ + n = index; +} +LBMReal Rheology::getPowerIndex() const +{ + return n; +} + +void Rheology::setOmegaMin(LBMReal omega) +{ + omegaMin = omega; +} +LBMReal Rheology::getOmegaMin() const +{ + return omegaMin; +} + +void Rheology::setBeta(LBMReal PowellEyringBeta) +{ + beta = PowellEyringBeta; +} + +LBMReal Rheology::getBeta() const +{ + return beta; +} + +void Rheology::setC(LBMReal PowellEyringC) +{ + c = PowellEyringC; +} + +LBMReal Rheology::getC() const +{ + return c; +} + +void Rheology::setMu0(LBMReal mu) +{ + mu0 = mu; +} + +LBMReal Rheology::getMu0() const +{ + return mu0; +} + +Rheology::Rheology() +{ +} \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/Thixotropy.h b/src/cpu/VirtualFluidsCore/LBM/Rheology.h similarity index 58% rename from src/cpu/VirtualFluidsCore/LBM/Thixotropy.h rename to src/cpu/VirtualFluidsCore/LBM/Rheology.h index d54e2ac5b598eb2b01e27beb9c9e9410592cf266..b1aa22478a69a77be2aa0275ddb7a44b6e626305 100644 --- a/src/cpu/VirtualFluidsCore/LBM/Thixotropy.h +++ b/src/cpu/VirtualFluidsCore/LBM/Rheology.h @@ -1,17 +1,50 @@ -#ifndef Thixotropy_H -#define Thixotropy_H +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 Rheology.h +//! \ingroup LBM +//! \author Konstantin Kutscher, Martin Geier +//======================================================================================= + +#ifndef Rheology_H +#define Rheology_H #include <PointerDefinitions.h> #include <LBMSystem.h> #include <UbMath.h> #include <math.h> -class Thixotropy +class Rheology { public: - Thixotropy(Thixotropy const&) = delete; - Thixotropy& operator=(Thixotropy const&) = delete; - static SPtr<Thixotropy> getInstance(); + Rheology(Rheology const&) = delete; + Rheology& operator=(Rheology const&) = delete; + static SPtr<Rheology> getInstance(); void setYieldStress(LBMReal tau0); LBMReal getYieldStress() const; @@ -39,9 +72,9 @@ public: static LBMReal getHerschelBulkleyCollFactorBackward(LBMReal shearRate, LBMReal drho); static LBMReal getPowellEyringCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho); private: - Thixotropy(); + Rheology(); - static SPtr<Thixotropy> instance; + static SPtr<Rheology> instance; static LBMReal tau0; static LBMReal k; @@ -53,11 +86,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline LBMReal Thixotropy::getBinghamCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) +inline LBMReal Rheology::getBinghamCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) { LBMReal cs2 = UbMath::one_over_sqrt3 * UbMath::one_over_sqrt3; LBMReal rho = UbMath::one + drho; - //LBMReal omega = omegaInf * (UbMath::one - (omegaInf * tau0) / (shearRate * cs2 * rho + UbMath::Epsilon<LBMReal>::val())); + //analytical solution + LBMReal omega = omegaInf * (UbMath::one - (omegaInf * tau0) / (shearRate * cs2 * rho + UbMath::Epsilon<LBMReal>::val())); //LBMReal omega = cs2 * cs2 * shearRate * shearRate * omegaInf * rho * rho / (cs2 * cs2 * shearRate * shearRate * rho * rho + cs2 * shearRate * omegaInf * rho * tau0+omegaInf*omegaInf*tau0*tau0); @@ -66,24 +100,24 @@ inline LBMReal Thixotropy::getBinghamCollFactor(LBMReal omegaInf, LBMReal shearR //LBMReal omega = omegaInf / (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a)))))))))); //20 iterations - //LBMReal omega = omegaInf / (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a)))))))))))))))))))); - - LBMReal omega = omegaInf*cs2 * shearRate * rho / (cs2 * shearRate * rho + omegaInf * tau0); - LBMReal shearRateNew = shearRate * (omega / omegaInf); - - for (int i = 0; i < 20; i++) - { - omega = omegaInf * cs2 * shearRateNew * rho / (cs2 * shearRateNew * rho + omegaInf * tau0); - shearRateNew = shearRate * (omega / omegaInf); - } - omega = omegaInf * cs2 * shearRateNew * rho / (cs2 * shearRateNew * rho + omegaInf * tau0); - - //if (omega < 0.2) - // omega = 0.2; + ////LBMReal omega = omegaInf / (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a * (1 + a)))))))))))))))))))); + // + //LBMReal omega = omegaInf*cs2 * shearRate * rho / (cs2 * shearRate * rho + omegaInf * tau0); + //LBMReal shearRateNew = shearRate * (omega / omegaInf); + + //for (int i = 0; i < 20; i++) + //{ + // omega = omegaInf * cs2 * shearRateNew * rho / (cs2 * shearRateNew * rho + omegaInf * tau0); + // shearRateNew = shearRate * (omega / omegaInf); + //} + //omega = omegaInf * cs2 * shearRateNew * rho / (cs2 * shearRateNew * rho + omegaInf * tau0); + // + ////if (omega < 0.2) + //// omega = 0.2; return omega; } -inline LBMReal Thixotropy::getBinghamCollFactorOld(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) +inline LBMReal Rheology::getBinghamCollFactorOld(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) { const LBMReal cs2 = UbMath::c1o3; // UbMath::one_over_sqrt3* UbMath::one_over_sqrt3; LBMReal rho = UbMath::one + drho; @@ -94,7 +128,7 @@ inline LBMReal Thixotropy::getBinghamCollFactorOld(LBMReal omegaInf, LBMReal she return omegaInf; } ////////////////////////////////////////////////////////////////////////// -inline LBMReal Thixotropy::getHerschelBulkleyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) +inline LBMReal Rheology::getHerschelBulkleyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) { LBMReal cs2 = UbMath::one_over_sqrt3 * UbMath::one_over_sqrt3; LBMReal rho = UbMath::one + drho; @@ -125,7 +159,7 @@ inline LBMReal Thixotropy::getHerschelBulkleyCollFactor(LBMReal omegaInf, LBMRea return omega; } ////////////////////////////////////////////////////////////////////////// -inline LBMReal Thixotropy::getHerschelBulkleyCollFactorBackward(LBMReal shearRate, LBMReal drho) +inline LBMReal Rheology::getHerschelBulkleyCollFactorBackward(LBMReal shearRate, LBMReal drho) { LBMReal rho = UbMath::one + drho; LBMReal gamma = shearRate + UbMath::Epsilon<LBMReal>::val(); @@ -134,7 +168,7 @@ inline LBMReal Thixotropy::getHerschelBulkleyCollFactorBackward(LBMReal shearRat return 1.0 / ((tau0 + k * std::pow(gamma, n)) / (cs2 * rho * gamma) + UbMath::c1o2); } ////////////////////////////////////////////////////////////////////////// -inline LBMReal Thixotropy::getPowellEyringCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) +inline LBMReal Rheology::getPowellEyringCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) { using namespace UbMath; LBMReal cs2 = c1o3; // UbMath::one_over_sqrt3* UbMath::one_over_sqrt3; diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..5bd2601dad811be6433eaea1d6acafc0a3e54f4c --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyBinghamModelLBMKernel.h @@ -0,0 +1,71 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyBinghamModelLBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef RheologyBinghamModelLBMKernel_H +#define RheologyBinghamModelLBMKernel_H + +#include "RheologyK17LBMKernel.h" +#include "Rheology.h" + +//! \brief Cumulant LBM kernel + Bingham plastic model + +class RheologyBinghamModelLBMKernel : public RheologyK17LBMKernel +{ +public: + RheologyBinghamModelLBMKernel() {}; + ~RheologyBinghamModelLBMKernel() {}; + SPtr<LBMKernel> clone() override + { + SPtr<LBMKernel> kernel(new RheologyBinghamModelLBMKernel()); + kernel->setNX(nx); + kernel->setCollisionFactor(collFactor); + dynamicPointerCast<RheologyBinghamModelLBMKernel>(kernel)->initDataSet(); + kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setWithForcing(withForcing); + kernel->setForcingX1(muForcingX1); + kernel->setForcingX2(muForcingX2); + kernel->setForcingX3(muForcingX3); + kernel->setIndex(ix1, ix2, ix3); + kernel->setDeltaT(deltaT); + + return kernel; + } +protected: + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + { + return Rheology::getBinghamCollFactor(omegaInf, shearRate, drho); + } +}; + + +#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..57478041e04e6a07579be53d58b688866e964e75 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyHerschelBulkleyModelLBMKernel.h @@ -0,0 +1,70 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyHerschelBulkleyModelLBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyHerschelBulkleyModelLBMKernel_H +#define RheologyHerschelBulkleyModelLBMKernel_H + +#include "RheologyK17LBMKernel.h" +#include "Rheology.h" + +//! \brief Cumulant LBM kernel + Herschel-Bulkley plastic model + +class RheologyHerschelBulkleyModelLBMKernel : public RheologyK17LBMKernel +{ +public: + RheologyHerschelBulkleyModelLBMKernel() {}; + ~RheologyHerschelBulkleyModelLBMKernel() {}; + SPtr<LBMKernel> clone() override + { + SPtr<LBMKernel> kernel(new RheologyHerschelBulkleyModelLBMKernel()); + kernel->setNX(nx); + kernel->setCollisionFactor(collFactor); + dynamicPointerCast<RheologyHerschelBulkleyModelLBMKernel>(kernel)->initDataSet(); + kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setWithForcing(withForcing); + kernel->setForcingX1(muForcingX1); + kernel->setForcingX2(muForcingX2); + kernel->setForcingX3(muForcingX3); + kernel->setIndex(ix1, ix2, ix3); + kernel->setDeltaT(deltaT); + + return kernel; + } +protected: + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + { + return Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, drho); + } +}; + + +#endif \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.cpp rename to src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.cpp index 26355a6f8a5d83b48365f1c287597a65e5876ef3..7ee35063f0cfeb9379313a38b9eeb6f0e6388d49 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.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 ThixotropyInterpolationProcessor.cpp -//! \ingroup BoundarConditions +//! \file RheologyInterpolationProcessor.cpp +//! \ingroup LBM //! \author Konstantin Kutscher //======================================================================================= -#include "ThixotropyInterpolationProcessor.h" +#include "RheologyInterpolationProcessor.h" #include "D3Q27System.h" -#include "Thixotropy.h" +#include "Rheology.h" -ThixotropyInterpolationProcessor::ThixotropyInterpolationProcessor() +RheologyInterpolationProcessor::RheologyInterpolationProcessor() : omegaC(0.0), omegaF(0.0), omegaMin(0.0) { } ////////////////////////////////////////////////////////////////////////// -ThixotropyInterpolationProcessor::ThixotropyInterpolationProcessor(LBMReal omegaC, LBMReal omegaF, LBMReal omegaMin) +RheologyInterpolationProcessor::RheologyInterpolationProcessor(LBMReal omegaC, LBMReal omegaF, LBMReal omegaMin) : omegaC(omegaC), omegaF(omegaF), omegaMin(omegaMin) { } ////////////////////////////////////////////////////////////////////////// -ThixotropyInterpolationProcessor::~ThixotropyInterpolationProcessor() +RheologyInterpolationProcessor::~RheologyInterpolationProcessor() { } ////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr ThixotropyInterpolationProcessor::clone() +InterpolationProcessorPtr RheologyInterpolationProcessor::clone() { - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new ThixotropyInterpolationProcessor(this->omegaC, this->omegaF, this->omegaMin)); + InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new RheologyInterpolationProcessor(this->omegaC, this->omegaF, this->omegaMin)); return iproc; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF ) +void RheologyInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF ) { this->omegaC = omegaC; this->omegaF = omegaF; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::setOmegaMin( LBMReal omegaMin ) +void RheologyInterpolationProcessor::setOmegaMin( LBMReal omegaMin ) { this->omegaMin = omegaMin; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) +void RheologyInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) { this->xoff = xoff; this->yoff = yoff; @@ -80,7 +80,7 @@ void ThixotropyInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LB this->zoff_sq = zoff * zoff; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) +void RheologyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets_intern(icellC, omegaC, 0.5, 0.25, -0.25, -0.25, -1, -1, -1); @@ -101,14 +101,14 @@ void ThixotropyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icell calcInterpolatedNode(icellF.TNE, /*omegaF,*/ 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) +void RheologyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets_intern(icellF, omegaF, 2.0, 0, 0, 0, 0, 0, 0); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omegaInf, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz) +void RheologyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omegaInf, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz) { using namespace D3Q27System; @@ -117,7 +117,7 @@ void ThixotropyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMRe shearRate = D3Q27System::getShearRate(f, omegaInf); - LBMReal omega = Thixotropy::getHerschelBulkleyCollFactor(omegaInf, shearRate, rho); + LBMReal omega = Rheology::getHerschelBulkleyCollFactor(omegaInf, shearRate, rho); press = rho; //interpolate rho! @@ -128,7 +128,7 @@ void ThixotropyInterpolationProcessor::calcMoments(const LBMReal* const f, LBMRe kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell, +void RheologyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new, LBMReal x, @@ -320,7 +320,7 @@ void ThixotropyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const shearRate = sqrt(dxux * dxux + dyuy * dyuy + dzuz * dzuz + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); - LBMReal o = Thixotropy::getHerschelBulkleyCollFactorBackward(shearRate, rho); //omega; + LBMReal o = Rheology::getHerschelBulkleyCollFactorBackward(shearRate, rho); //omega; if (o < omegaMin) o = omegaMin; @@ -431,7 +431,7 @@ void ThixotropyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMReal omega,*/ LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs) +void RheologyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMReal omega,*/ LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs) { using namespace D3Q27System; @@ -473,7 +473,7 @@ void ThixotropyInterpolationProcessor::calcInterpolatedNode(LBMReal* f, /*LBMRea } ////////////////////////////////////////////////////////////////////////// //Position SWB -0.25, -0.25, -0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressBSW() +LBMReal RheologyInterpolationProcessor::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) + @@ -486,7 +486,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressBSW() } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressTSW() +LBMReal RheologyInterpolationProcessor::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) + @@ -499,7 +499,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressTSW() } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressTSE() +LBMReal RheologyInterpolationProcessor::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) + @@ -512,7 +512,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressTSE() } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressBSE() +LBMReal RheologyInterpolationProcessor::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) + @@ -525,7 +525,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressBSE() } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressBNW() +LBMReal RheologyInterpolationProcessor::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) + @@ -538,7 +538,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressBNW() } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressTNW() +LBMReal RheologyInterpolationProcessor::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) + @@ -551,7 +551,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressTNW() } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressTNE() +LBMReal RheologyInterpolationProcessor::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) + @@ -564,7 +564,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressTNE() } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 -LBMReal ThixotropyInterpolationProcessor::calcPressBNE() +LBMReal RheologyInterpolationProcessor::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) + @@ -577,7 +577,7 @@ LBMReal ThixotropyInterpolationProcessor::calcPressBNE() } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 -void ThixotropyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega) +void RheologyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega) { using namespace D3Q27System; @@ -612,7 +612,7 @@ void ThixotropyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMRea shearRate = sqrt(dxux * dxux + dyuy * dyuy + dzuz * dzuz + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); - LBMReal o = Thixotropy::getHerschelBulkleyCollFactorBackward(shearRate, rho); //omega; + LBMReal o = Rheology::getHerschelBulkleyCollFactorBackward(shearRate, rho); //omega; if (o < omegaMin) o = omegaMin; @@ -661,14 +661,14 @@ void ThixotropyInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMRea f[REST] = f_ZERO + feq[REST]; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) +void RheologyInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3) { vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; } ////////////////////////////////////////////////////////////////////////// -void ThixotropyInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz) +void RheologyInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& 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; diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.h similarity index 89% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.h rename to src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.h index daaa6449ea8a37d16aa9d359cf72ab58d6d872f0..bce0c3d89e137738d9169fab5dbe15cd3c91f8ad 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyInterpolationProcessor.h +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyInterpolationProcessor.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 ThixotropyInterpolationProcessor.h -//! \ingroup BoundarConditions +//! \file RheologyInterpolationProcessor.h +//! \ingroup LBM //! \author Konstantin Kutscher //======================================================================================= -#ifndef ThixotropyInterpolationProcessor_H_ -#define ThixotropyInterpolationProcessor_H_ +#ifndef RheologyInterpolationProcessor_H_ +#define RheologyInterpolationProcessor_H_ #include "InterpolationProcessor.h" #include "D3Q27System.h" //! \brief A class implements an interpolation function of grid refinement for thixotropic fluid. -class ThixotropyInterpolationProcessor : public InterpolationProcessor +class RheologyInterpolationProcessor : public InterpolationProcessor { public: - ThixotropyInterpolationProcessor(); - ThixotropyInterpolationProcessor(LBMReal omegaC, LBMReal omegaF, LBMReal omegaMin); - virtual ~ThixotropyInterpolationProcessor(); + RheologyInterpolationProcessor(); + RheologyInterpolationProcessor(LBMReal omegaC, LBMReal omegaF, LBMReal omegaMin); + virtual ~RheologyInterpolationProcessor(); InterpolationProcessorPtr clone(); void setOmegas(LBMReal omegaC, LBMReal omegaF); void setOmegaMin(LBMReal omegaMin); @@ -94,12 +94,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline void ThixotropyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) +inline void RheologyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) { this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// -inline void ThixotropyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) +inline void RheologyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) { this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); } diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp index c1fc395c77d84e601e1eb89a081c4978362821ba..94fbad358b16d923ddc5425e6476ff3892bbbf3c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file RheologyK17LBMKernel.cpp +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + #include "RheologyK17LBMKernel.h" #include "D3Q27System.h" #include "InterpolationProcessor.h" @@ -6,7 +39,7 @@ #include "DataSet3D.h" #include "LBMKernel.h" #include "Block3D.h" -#include "Thixotropy.h" +#include "Rheology.h" #define PROOF_CORRECTNESS @@ -615,9 +648,9 @@ void RheologyK17LBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //non Newtonian fluid collision factor LBMReal shearRate = sqrt(c2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz) / (drho + c1); - //omega = getThyxotropyCollFactor(omega, shearRate, rho); - //omega = Thixotropy::getHerschelBulkleyCollFactor(omega, shearRate, drho); - omega = Thixotropy::getBinghamCollFactor(omega, shearRate, drho); + omega = getRheologyCollFactor(omega, shearRate, rho); + //omega = Rheology::getHerschelBulkleyCollFactor(omega, shearRate, drho); + //omega = Rheology::getBinghamCollFactor(omega, shearRate, drho); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz);// +c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h index f9838ba2e73e8d49a5d637b50a871faf751b4e7c..77bb5ce84557c87210932f8fd76b6ae846414545 100644 --- a/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyK17LBMKernel.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file RheologyK17LBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef RheologyK17LBMKernel_h__ #define RheologyK17LBMKernel_h__ @@ -26,6 +59,12 @@ public: void setBulkViscosity(LBMReal value); protected: virtual void initDataSet(); + + virtual LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const + { + UB_THROW(UbException("LBMReal getRheologyCollFactor() - belongs in the derived class")); + } + LBMReal f[D3Q27System::ENDF+1]; UbTimer timer; diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.cpp rename to src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp index 1685eb6e1393055f0e04f7f4289fd295e805c33f..f399a00065d3cfd2be13f4184057f8223de38573 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.cpp @@ -1,4 +1,37 @@ -#include "ThixotropyModelLBMKernel.h" +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyModelLBMKernel.cpp +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + +#include "RheologyModelLBMKernel.h" #include "D3Q27System.h" #include "BCArray3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" @@ -10,17 +43,17 @@ using namespace UbMath; -ThixotropyModelLBMKernel::ThixotropyModelLBMKernel() : forcingX1(0), forcingX2(0), forcingX3(0) +RheologyModelLBMKernel::RheologyModelLBMKernel() : forcingX1(0), forcingX2(0), forcingX3(0) { compressible = false; OxyyMxzz = 1.0; } -ThixotropyModelLBMKernel::~ThixotropyModelLBMKernel() +RheologyModelLBMKernel::~RheologyModelLBMKernel() { } -void ThixotropyModelLBMKernel::calculate(int step) +void RheologyModelLBMKernel::calculate(int step) { using namespace D3Q27System; @@ -483,7 +516,7 @@ void ThixotropyModelLBMKernel::calculate(int step) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //non Newtonian fluid collision factor LBMReal shearRate = sqrt(c2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz) / (rho + one); - collFactorF = getThyxotropyCollFactor(collFactorF, shearRate, rho); + collFactorF = getRheologyCollFactor(collFactorF, shearRate, rho); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //relax @@ -862,13 +895,13 @@ void ThixotropyModelLBMKernel::calculate(int step) } } -//SPtr<LBMKernel> ThixotropyModelLBMKernel::clone() +//SPtr<LBMKernel> RheologyModelLBMKernel::clone() //{ -// SPtr<LBMKernel> kernel(new ThixotropyModelLBMKernel()); +// SPtr<LBMKernel> kernel(new RheologyModelLBMKernel()); // kernel->setNX(nx); // kernel->setCollisionFactor(collFactor); // collFactorF = collFactor; -// dynamicPointerCast<ThixotropyModelLBMKernel>(kernel)->initDataSet(); +// dynamicPointerCast<RheologyModelLBMKernel>(kernel)->initDataSet(); // kernel->setBCProcessor(bcProcessor->clone(kernel)); // kernel->setWithForcing(withForcing); // kernel->setForcingX1(muForcingX1); @@ -880,17 +913,17 @@ void ThixotropyModelLBMKernel::calculate(int step) // return kernel; //} -double ThixotropyModelLBMKernel::getCalculationTime() +double RheologyModelLBMKernel::getCalculationTime() { return timer.getTotalTime(); } -void ThixotropyModelLBMKernel::swapDistributions() +void RheologyModelLBMKernel::swapDistributions() { LBMKernel::swapDistributions(); } -void ThixotropyModelLBMKernel::initDataSet() +void RheologyModelLBMKernel::initDataSet() { SPtr<DistributionArray3D> df(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.0)); dataSet->setFdistributions(df); diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..0aba5a273536feab9ce892b09ae1837df4fd6a7f --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel.h @@ -0,0 +1,83 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyModelLBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyModelLBMKernel_H +#define RheologyModelLBMKernel_H + +#include "LBMKernel.h" +#include "BCProcessor.h" +#include "D3Q27System.h" +#include "basics/utilities/UbTiming.h" +#include "basics/container/CbArray4D.h" +#include "basics/container/CbArray3D.h" + +class RheologyModelLBMKernel; + +//! \brief Base class for model of thixotropy based on K16. Use Template Method design pattern for Implementation of different models. +//! \author K. Kutscher, M. Geier +class RheologyModelLBMKernel : public LBMKernel +{ +public: + RheologyModelLBMKernel(); + virtual ~RheologyModelLBMKernel(); + void calculate(int step); + virtual SPtr<LBMKernel> clone() { UB_THROW(UbException("SPtr<LBMKernel> clone() - belongs in the derived class")); }; + double getCalculationTime(); + + void swapDistributions(); + +protected: + void initDataSet(); + + virtual LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const { UB_THROW(UbException("LBMReal getRheologyCollFactor() - belongs in the derived class")); } + + LBMReal f[D3Q27System::ENDF + 1]; + + UbTimer timer; + + LBMReal OxyyMxzz; + + CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF; + + mu::value_type muX1, muX2, muX3; + mu::value_type muDeltaT; + mu::value_type muNu; + LBMReal forcingX1; + LBMReal forcingX2; + LBMReal forcingX3; + + bool test; +}; + +#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.cpp b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp similarity index 97% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.cpp rename to src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp index 44decadb7a4fb720ce0785373f9acd00106cbe10..2ab87c0b648b48fe56cff8380afdafb7deed08d4 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.cpp @@ -1,28 +1,28 @@ -#include "ThixotropyModelLBMKernel2.h" +#include "RheologyModelLBMKernel2.h" #include "D3Q27System.h" #include "BCArray3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include "DataSet3D.h" #include "LBMKernel.h" -#include "Thixotropy.h" +#include "Rheology.h" #define PROOF_CORRECTNESS using namespace UbMath; -ThixotropyModelLBMKernel2::ThixotropyModelLBMKernel2() : forcingX1(0), forcingX2(0), forcingX3(0) +RheologyModelLBMKernel2::RheologyModelLBMKernel2() : forcingX1(0), forcingX2(0), forcingX3(0) { compressible = false; OxyyMxzz = 1.0; } -ThixotropyModelLBMKernel2::~ThixotropyModelLBMKernel2() +RheologyModelLBMKernel2::~RheologyModelLBMKernel2() { } -void ThixotropyModelLBMKernel2::calculate(int step) +void RheologyModelLBMKernel2::calculate(int step) { using namespace D3Q27System; @@ -488,23 +488,23 @@ void ThixotropyModelLBMKernel2::calculate(int step) LBMReal shearFactor = sqrt(c1o2 * ((mfcaa - mfaaa * c1o3) * (mfcaa - mfaaa * c1o3) + (mfaca - mfaaa * c1o3) * (mfaca - mfaaa * c1o3) + (mfaac - mfaaa * c1o3) * (mfaac - mfaaa * c1o3)) + mfbba * mfbba + mfbab * mfbab + mfabb * mfabb) + UbMath::Epsilon<LBMReal>::val(); - //collFactorF = getThyxotropyCollFactor(collFactorF, shearRate, rho); + //collFactorF = getRheologyCollFactor(collFactorF, shearRate, rho); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //relax //mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); // - //LBMReal collFactorFyy = getThyxotropyCollFactor(collFactorF, std::sqrt(dxux*dxux + dyuy*dyuy) / (rho + one), rho); + //LBMReal collFactorFyy = getRheologyCollFactor(collFactorF, std::sqrt(dxux*dxux + dyuy*dyuy) / (rho + one), rho); //mxxMyy += collFactorFyy * (-mxxMyy) - 3. * (1. - c1o2 * collFactorFyy) * (vx2 * dxux - vy2 * dyuy); // - //LBMReal collFactorFzz = getThyxotropyCollFactor(collFactorF, std::sqrt(dxux*dxux + dzuz*dzuz) / (rho + one), rho); + //LBMReal collFactorFzz = getRheologyCollFactor(collFactorF, std::sqrt(dxux*dxux + dzuz*dzuz) / (rho + one), rho); //mxxMzz += collFactorFzz * (-mxxMzz) - 3. * (1. - c1o2 * collFactorFzz) * (vx2 * dxux - vz2 * dzuz); - //mfabb += getThyxotropyCollFactor(collFactorF, std::abs(Dyz) / (rho + one), rho) * (-mfabb); - //mfbab += getThyxotropyCollFactor(collFactorF, std::abs(Dxz) / (rho + one), rho) * (-mfbab); - //mfbba += getThyxotropyCollFactor(collFactorF, std::abs(Dxy) / (rho + one), rho) * (-mfbba); + //mfabb += getRheologyCollFactor(collFactorF, std::abs(Dyz) / (rho + one), rho) * (-mfabb); + //mfbab += getRheologyCollFactor(collFactorF, std::abs(Dxz) / (rho + one), rho) * (-mfbab); + //mfbba += getRheologyCollFactor(collFactorF, std::abs(Dxy) / (rho + one), rho) * (-mfbba); - SPtr<Thixotropy> thix = Thixotropy::getInstance(); + SPtr<Rheology> thix = Rheology::getInstance(); LBMReal tau0 = thix->getYieldStress(); mxxPyyPzz += OxxPyyPzz * (mfaaa - mxxPyyPzz /*+ ((mxxPyyPzz-mfaaa)/shearFactor*tau0)*/) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); @@ -893,13 +893,13 @@ void ThixotropyModelLBMKernel2::calculate(int step) } } -//SPtr<LBMKernel> ThixotropyModelLBMKernel2::clone() +//SPtr<LBMKernel> RheologyModelLBMKernel2::clone() //{ -// SPtr<LBMKernel> kernel(new ThixotropyModelLBMKernel2()); +// SPtr<LBMKernel> kernel(new RheologyModelLBMKernel2()); // kernel->setNX(nx); // kernel->setCollisionFactor(collFactor); // collFactorF = collFactor; -// dynamicPointerCast<ThixotropyModelLBMKernel2>(kernel)->initDataSet(); +// dynamicPointerCast<RheologyModelLBMKernel2>(kernel)->initDataSet(); // kernel->setBCProcessor(bcProcessor->clone(kernel)); // kernel->setWithForcing(withForcing); // kernel->setForcingX1(muForcingX1); @@ -911,17 +911,17 @@ void ThixotropyModelLBMKernel2::calculate(int step) // return kernel; //} -double ThixotropyModelLBMKernel2::getCalculationTime() +double RheologyModelLBMKernel2::getCalculationTime() { return timer.getTotalTime(); } -void ThixotropyModelLBMKernel2::swapDistributions() +void RheologyModelLBMKernel2::swapDistributions() { LBMKernel::swapDistributions(); } -void ThixotropyModelLBMKernel2::initDataSet() +void RheologyModelLBMKernel2::initDataSet() { SPtr<DistributionArray3D> df(new D3Q27EsoTwist3DSplittedVector(nx[0] + 2, nx[1] + 2, nx[2] + 2, -999.0)); dataSet->setFdistributions(df); diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h similarity index 72% rename from src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.h rename to src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h index b0f492a170a886d23ab1f56d897ac9adf698d8d9..c3a20a11038f74586266c8338027a6187ef2fea5 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyModelLBMKernel2.h @@ -1,5 +1,5 @@ -#ifndef ThixotropyModelLBMKernel_H -#define ThixotropyModelLBMKernel_H +#ifndef RheologyModelLBMKernel2_H +#define RheologyModelLBMKernel2_H #include "LBMKernel.h" #include "BCProcessor.h" @@ -8,15 +8,15 @@ #include "basics/container/CbArray4D.h" #include "basics/container/CbArray3D.h" -class ThixotropyModelLBMKernel; +class RheologyModelLBMKernel2; //! \brief Base class for model of thixotropy based on K16. Use Template Method design pattern for Implementation of different models. //! \author K. Kutscher, M. Geier -class ThixotropyModelLBMKernel : public LBMKernel +class RheologyModelLBMKernel2 : public LBMKernel { public: - ThixotropyModelLBMKernel(); - virtual ~ThixotropyModelLBMKernel(); + RheologyModelLBMKernel2(); + virtual ~RheologyModelLBMKernel2(); void calculate(int step); virtual SPtr<LBMKernel> clone() { UB_THROW(UbException("SPtr<LBMKernel> clone() - belongs in the derived class")); }; double getCalculationTime(); @@ -26,7 +26,7 @@ public: protected: void initDataSet(); - virtual LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const { UB_THROW(UbException("LBMReal getThyxotropyCollFactor() - belongs in the derived class")); } + virtual LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const { UB_THROW(UbException("LBMReal getRheologyCollFactor() - belongs in the derived class")); } LBMReal f[D3Q27System::ENDF + 1]; diff --git a/src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..a68eca9cd627be7b56bcfebfd429d80c3f924aa8 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/RheologyPowellEyringModelLBMKernel.h @@ -0,0 +1,70 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// 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 RheologyPowellEyringModelLBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef RheologyPowellEyringModelLBMKernel_H +#define RheologyPowellEyringModelLBMKernel_H + +#include "RheologyK17LBMKernel.h" +#include "Rheology.h" + +//! \brief Cumulant LBM kernel + Herschel-Bulkley plastic model +//! \author K. Kutscher, M. Geier +class RheologyPowellEyringModelLBMKernel : public RheologyK17LBMKernel +{ +public: + RheologyPowellEyringModelLBMKernel() {}; + ~RheologyPowellEyringModelLBMKernel() {}; + SPtr<LBMKernel> clone() override + { + SPtr<LBMKernel> kernel(new RheologyPowellEyringModelLBMKernel()); + kernel->setNX(nx); + kernel->setCollisionFactor(collFactor); + dynamicPointerCast<RheologyPowellEyringModelLBMKernel>(kernel)->initDataSet(); + kernel->setBCProcessor(bcProcessor->clone(kernel)); + kernel->setWithForcing(withForcing); + kernel->setForcingX1(muForcingX1); + kernel->setForcingX2(muForcingX2); + kernel->setForcingX3(muForcingX3); + kernel->setIndex(ix1, ix2, ix3); + kernel->setDeltaT(deltaT); + + return kernel; + } +protected: + LBMReal getRheologyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const override + { + return Rheology::getPowellEyringCollFactor(omegaInf, shearRate, drho); + } +}; + + +#endif \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/Thixotropy.cpp b/src/cpu/VirtualFluidsCore/LBM/Thixotropy.cpp deleted file mode 100644 index f28c34f0ddc8be17807a32118074a0c07f36bcfa..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/Thixotropy.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "Thixotropy.h" - -SPtr<Thixotropy> Thixotropy::instance = SPtr<Thixotropy>(); -LBMReal Thixotropy::tau0 = 0; -LBMReal Thixotropy::k = 0; -LBMReal Thixotropy::n = 1; -LBMReal Thixotropy::omegaMin = 0; -LBMReal Thixotropy::beta = 0; -LBMReal Thixotropy::c = 0; -LBMReal Thixotropy::mu0 = 0; - -////////////////////////////////////////////////////////////////////////// -SPtr<Thixotropy> Thixotropy::getInstance() -{ - if (!instance) - instance = SPtr<Thixotropy>(new Thixotropy()); - return instance; -} - -void Thixotropy::setYieldStress(LBMReal yieldStress) -{ - tau0 = yieldStress; -} -LBMReal Thixotropy::getYieldStress() const -{ - return tau0; -} -void Thixotropy::setViscosityParameter(LBMReal kParameter) -{ - k = kParameter; -} -LBMReal Thixotropy::getViscosityParameter() const -{ - return k; -} -void Thixotropy::setPowerIndex(LBMReal index) -{ - n = index; -} -LBMReal Thixotropy::getPowerIndex() const -{ - return n; -} - -void Thixotropy::setOmegaMin(LBMReal omega) -{ - omegaMin = omega; -} -LBMReal Thixotropy::getOmegaMin() const -{ - return omegaMin; -} - -void Thixotropy::setBeta(LBMReal PowellEyringBeta) -{ - beta = PowellEyringBeta; -} - -LBMReal Thixotropy::getBeta() const -{ - return beta; -} - -void Thixotropy::setC(LBMReal PowellEyringC) -{ - c = PowellEyringC; -} - -LBMReal Thixotropy::getC() const -{ - return c; -} - -void Thixotropy::setMu0(LBMReal mu) -{ - mu0 = mu; -} - -LBMReal Thixotropy::getMu0() const -{ - return mu0; -} - -Thixotropy::Thixotropy() -{ -} \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.h b/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.h deleted file mode 100644 index 17fa477977bdfa997c0be0ef2254b139bb1cc1fe..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/ThixotropyModelLBMKernel2.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef ThixotropyModelLBMKernel2_H -#define ThixotropyModelLBMKernel2_H - -#include "LBMKernel.h" -#include "BCProcessor.h" -#include "D3Q27System.h" -#include "basics/utilities/UbTiming.h" -#include "basics/container/CbArray4D.h" -#include "basics/container/CbArray3D.h" - -class ThixotropyModelLBMKernel2; - -//! \brief Base class for model of thixotropy based on K16. Use Template Method design pattern for Implementation of different models. -//! \author K. Kutscher, M. Geier -class ThixotropyModelLBMKernel2 : public LBMKernel -{ -public: - ThixotropyModelLBMKernel2(); - virtual ~ThixotropyModelLBMKernel2(); - void calculate(int step); - virtual SPtr<LBMKernel> clone() { UB_THROW(UbException("SPtr<LBMKernel> clone() - belongs in the derived class")); }; - double getCalculationTime(); - - void swapDistributions(); - -protected: - void initDataSet(); - - virtual LBMReal getThyxotropyCollFactor(LBMReal omegaInf, LBMReal shearRate, LBMReal drho) const { UB_THROW(UbException("LBMReal getThyxotropyCollFactor() - belongs in the derived class")); } - - LBMReal f[D3Q27System::ENDF + 1]; - - UbTimer timer; - - LBMReal OxyyMxzz; - - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributionsF; - - mu::value_type muX1, muX2, muX3; - mu::value_type muDeltaT; - mu::value_type muNu; - LBMReal forcingX1; - LBMReal forcingX2; - LBMReal forcingX3; - - bool test; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp index 60e0b41cb666583e198bb692a189b734f4f11ab1..b4eafda902448564800bb1479f7ac60f74c4b77d 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp @@ -45,11 +45,11 @@ #include "BCArray3D.h" #include "ILBMKernel.h" -#include "DensityAndThixotropyBCAlgorithm.h" -#include "VelocityAndThixotropyBCAlgorithm.h" -#include "NoSlipAndThixotropyBCAlgorithm.h" -#include "NonReflectingOutflowAndThixotropyBCAlgorithm.h" -#include "VelocityWithDensityAndThixotropyBCAlgorithm.h" +#include "ThixotropyDensityBCAlgorithm.h" +#include "ThixotropyVelocityBCAlgorithm.h" +#include "ThixotropyNoSlipBCAlgorithm.h" +#include "ThixotropyNonReflectingOutflowBCAlgorithm.h" +#include "ThixotropyVelocityWithDensityBCAlgorithm.h" BoundaryConditionsBlockVisitor::BoundaryConditionsBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) {} @@ -102,20 +102,20 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc bca->setBcPointer(bcPtr); bca->addDistributions(distributions); - if (alg == BCAlgorithm::VelocityAndThixotropyBCAlgorithm) - std::static_pointer_cast<VelocityAndThixotropyBCAlgorithm>(bca)->addDistributionsH( + if (alg == BCAlgorithm::ThixotropyVelocityBCAlgorithm) + std::static_pointer_cast<ThixotropyVelocityBCAlgorithm>(bca)->addDistributionsH( kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::DensityAndThixotropyBCAlgorithm) - std::static_pointer_cast<DensityAndThixotropyBCAlgorithm>(bca)->addDistributionsH( + if (alg == BCAlgorithm::ThixotropyDensityBCAlgorithm) + std::static_pointer_cast<ThixotropyDensityBCAlgorithm>(bca)->addDistributionsH( kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::NoSlipAndThixotropyBCAlgorithm) - std::static_pointer_cast<NoSlipAndThixotropyBCAlgorithm>(bca)->addDistributionsH( + if (alg == BCAlgorithm::ThixotropyNoSlipBCAlgorithm) + std::static_pointer_cast<ThixotropyNoSlipBCAlgorithm>(bca)->addDistributionsH( kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::NonReflectingOutflowAndThixotropyBCAlgorithm) - std::static_pointer_cast<NonReflectingOutflowAndThixotropyBCAlgorithm>(bca) + if (alg == BCAlgorithm::ThixotropyNonReflectingOutflowBCAlgorithm) + std::static_pointer_cast<ThixotropyNonReflectingOutflowBCAlgorithm>(bca) ->addDistributionsH(kernel->getDataSet()->getHdistributions()); - if (alg == BCAlgorithm::VelocityWithDensityAndThixotropyBCAlgorithm) - std::static_pointer_cast<VelocityWithDensityAndThixotropyBCAlgorithm>(bca) + if (alg == BCAlgorithm::ThixotropyVelocityWithDensityBCAlgorithm) + std::static_pointer_cast<ThixotropyVelocityWithDensityBCAlgorithm>(bca) ->addDistributionsH(kernel->getDataSet()->getHdistributions()); bca->setCollFactor(collFactor); diff --git a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp deleted file mode 100644 index af78f95185f3f24bd669bd75aad656fe205fbc5c..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp +++ /dev/null @@ -1,484 +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 SetConnectorsBlockVisitor.cpp -//! \ingroup Visitors -//! \author Konstantin Kutscher -//======================================================================================= - -#include "ConnectorBlockVisitor.h" -#include "Communicator.h" -#include "ConnectorFactory.h" -#include "Grid3D.h" -#include "Grid3DSystem.h" -#include "InterpolationProcessor.h" - -ConnectorBlockVisitor::ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, InterpolationProcessorPtr iProcessor, - SPtr<ConnectorFactory> cFactory) - : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), comm(comm), nu(nu), iProcessor(iProcessor), cFactory(cFactory) -{ -} -////////////////////////////////////////////////////////////////////////// -ConnectorBlockVisitor::~ConnectorBlockVisitor(void) = default; -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - if (!block) - return; - - UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - start"); - UBLOG(logDEBUG5, block->toString()); - - gridRank = comm->getProcessID(); - grid->setRank(gridRank); - - setSameLevelConnectors(grid, block); - - if (grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel()) - setInterpolationConnectors(grid, block); - - UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - start"); - int blockRank = block->getRank(); - if (gridRank == blockRank && block->isActive()) { - block->clearWeight(); - std::vector<SPtr<Block3D>> neighbors; - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - - for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) { - SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - if (neighBlock) { - int neighBlockRank = neighBlock->getRank(); - if (blockRank == neighBlockRank && neighBlock->isActive()) { - SPtr<Block3DConnector> connector; - connector = cFactory->createSameLevelDirectConnector(block, neighBlock, dir); - block->setConnector(connector); - } else if (blockRank != neighBlockRank && neighBlock->isActive()) { - setRemoteConnectors(block, neighBlock, dir); - } - } - } - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - start"); - CreateTransmittersHelper helper; - CreateTransmittersHelper::TransmitterPtr sender, receiver; - helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, - CreateTransmittersHelper::MPI); - - SPtr<Block3DConnector> connector; - connector = cFactory->createSameLevelVectorConnector(sblock, sender, receiver, dir); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - start"); - // int blockRank = block->getRank(); - - // search for all blocks with different ranks - if (block->hasInterpolationFlagCF() && block->isActive()) { - int fbx1 = block->getX1() << 1; - int fbx2 = block->getX2() << 1; - int fbx3 = block->getX3() << 1; - int level = block->getLevel() + 1; - - if (block->hasInterpolationFlagCF(D3Q27System::E)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::E); - } - if (block->hasInterpolationFlagCF(D3Q27System::W)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::W); - } - if (block->hasInterpolationFlagCF(D3Q27System::N)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::N); - } - if (block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::S); - } - if (block->hasInterpolationFlagCF(D3Q27System::T)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::T); - } - if (block->hasInterpolationFlagCF(D3Q27System::B)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3, level); - SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock11 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::B); - } - - //////NE-NW-SE-SW - if (block->hasInterpolationFlagCF(D3Q27System::NE) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::E)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 0, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NE); - } - if (block->hasInterpolationFlagCF(D3Q27System::SW) && !block->hasInterpolationFlagCF(D3Q27System::W) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SW); - } - if (block->hasInterpolationFlagCF(D3Q27System::SE) && !block->hasInterpolationFlagCF(D3Q27System::E) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 0, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SE); - } - if (block->hasInterpolationFlagCF(D3Q27System::NW) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::W)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NW); - } - - /////////TE-BW-BE-TW 1-0 - if (block->hasInterpolationFlagCF(D3Q27System::TE) && !block->hasInterpolationFlagCF(D3Q27System::E) && - !block->hasInterpolationFlagCF(D3Q27System::T)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2 + 0, fbx3 + 1, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BW) && !block->hasInterpolationFlagCF(D3Q27System::W) && - !block->hasInterpolationFlagCF(D3Q27System::B)) { - - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 0, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BE) && !block->hasInterpolationFlagCF(D3Q27System::E) && - !block->hasInterpolationFlagCF(D3Q27System::B)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2 + 0, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TW) && !block->hasInterpolationFlagCF(D3Q27System::W) && - !block->hasInterpolationFlagCF(D3Q27System::T)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 0, fbx3 + 1, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TW); - } - - //////TN-BS-BN-TS - if (block->hasInterpolationFlagCF(D3Q27System::TN) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::T)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 0, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TN); - } - if (block->hasInterpolationFlagCF(D3Q27System::BS) && !block->hasInterpolationFlagCF(D3Q27System::S) && - !block->hasInterpolationFlagCF(D3Q27System::B)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 0, fbx2, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BS); - } - if (block->hasInterpolationFlagCF(D3Q27System::BN) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::B)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 0, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BN); - } - if (block->hasInterpolationFlagCF(D3Q27System::TS) && !block->hasInterpolationFlagCF(D3Q27System::S) && - !block->hasInterpolationFlagCF(D3Q27System::T)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 0, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock10 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock01; - SPtr<Block3D> fblock11; - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TS); - } - - //////corners - if (block->hasInterpolationFlagCF(D3Q27System::TNE) && !block->hasInterpolationFlagCF(D3Q27System::TE) && - !block->hasInterpolationFlagCF(D3Q27System::TN) && !block->hasInterpolationFlagCF(D3Q27System::NE) && - !block->hasInterpolationFlagCF(D3Q27System::T) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::E)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSW) && !block->hasInterpolationFlagCF(D3Q27System::TW) && - !block->hasInterpolationFlagCF(D3Q27System::TS) && !block->hasInterpolationFlagCF(D3Q27System::SW) && - !block->hasInterpolationFlagCF(D3Q27System::T) && !block->hasInterpolationFlagCF(D3Q27System::W) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSE) && !block->hasInterpolationFlagCF(D3Q27System::TE) && - !block->hasInterpolationFlagCF(D3Q27System::TS) && !block->hasInterpolationFlagCF(D3Q27System::SE) && - !block->hasInterpolationFlagCF(D3Q27System::T) && !block->hasInterpolationFlagCF(D3Q27System::E) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2, fbx3 + 1, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TNW) && !block->hasInterpolationFlagCF(D3Q27System::TW) && - !block->hasInterpolationFlagCF(D3Q27System::TN) && !block->hasInterpolationFlagCF(D3Q27System::NW) && - !block->hasInterpolationFlagCF(D3Q27System::T) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::W)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 1, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1, fbx2+1, fbx3, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNE) && !block->hasInterpolationFlagCF(D3Q27System::BE) && - !block->hasInterpolationFlagCF(D3Q27System::BN) && !block->hasInterpolationFlagCF(D3Q27System::NE) && - !block->hasInterpolationFlagCF(D3Q27System::B) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::E)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2 + 1, fbx3 + 0, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSW) && !block->hasInterpolationFlagCF(D3Q27System::BS) && - !block->hasInterpolationFlagCF(D3Q27System::BW) && !block->hasInterpolationFlagCF(D3Q27System::SW) && - !block->hasInterpolationFlagCF(D3Q27System::B) && !block->hasInterpolationFlagCF(D3Q27System::W) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3 + 0, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSE) && !block->hasInterpolationFlagCF(D3Q27System::BS) && - !block->hasInterpolationFlagCF(D3Q27System::BE) && !block->hasInterpolationFlagCF(D3Q27System::SE) && - !block->hasInterpolationFlagCF(D3Q27System::B) && !block->hasInterpolationFlagCF(D3Q27System::E) && - !block->hasInterpolationFlagCF(D3Q27System::S)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1 + 1, fbx2, fbx3, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNW) && !block->hasInterpolationFlagCF(D3Q27System::BN) && - !block->hasInterpolationFlagCF(D3Q27System::BW) && !block->hasInterpolationFlagCF(D3Q27System::NW) && - !block->hasInterpolationFlagCF(D3Q27System::B) && !block->hasInterpolationFlagCF(D3Q27System::N) && - !block->hasInterpolationFlagCF(D3Q27System::W)) { - SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2 + 1, fbx3 + 0, level); - SPtr<Block3D> fblock10; // = grid->getBlock(fbx1, fbx2+1, fbx3, level); - SPtr<Block3D> fblock01; // = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblock11; // = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNW); - } - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// - -void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fblock00, SPtr<Block3D> fblock10, - SPtr<Block3D> fblock01, SPtr<Block3D> fblock11, - SPtr<Block3D> cBlock, int dir) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - start"); - int fblock00Rank = -999, fblock10Rank = -999, fblock01Rank = -999, fblock11Rank = -999; - if (fblock00) - fblock00Rank = fblock00->getRank(); - if (fblock01) - fblock01Rank = fblock01->getRank(); - if (fblock10) - fblock10Rank = fblock10->getRank(); - if (fblock11) - fblock11Rank = fblock11->getRank(); - int cBlockRank = cBlock->getRank(); - - LBMReal omegaF; - if (fblock00) - omegaF = LBMSystem::calcCollisionFactor(nu, fblock00->getLevel()); - if (fblock01) - omegaF = LBMSystem::calcCollisionFactor(nu, fblock01->getLevel()); - if (fblock10) - omegaF = LBMSystem::calcCollisionFactor(nu, fblock10->getLevel()); - if (fblock11) - omegaF = LBMSystem::calcCollisionFactor(nu, fblock11->getLevel()); - LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, cBlock->getLevel()); - iProcessor->setOmegas(omegaC, omegaF); - - InterpolationProcessorPtr cIProcessor(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor00(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor10(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor01(iProcessor->clone()); - InterpolationProcessorPtr fIProcessor11(iProcessor->clone()); - - CreateTransmittersHelper::TransmitterPtr senderCF00, receiverCF00, senderCF01, receiverCF01, senderCF10, - receiverCF10, senderCF11, receiverCF11, senderFC00, receiverFC00, senderFC01, receiverFC01, senderFC10, - receiverFC10, senderFC11, receiverFC11; - - if (fblock00) - createTransmitters(cBlock, fblock00, dir, CreateTransmittersHelper::SW, senderCF00, receiverCF00, senderFC00, - receiverFC00); - if (fblock01) - createTransmitters(cBlock, fblock01, dir, CreateTransmittersHelper::NW, senderCF01, receiverCF01, senderFC01, - receiverFC01); - if (fblock10) - createTransmitters(cBlock, fblock10, dir, CreateTransmittersHelper::SE, senderCF10, receiverCF10, senderFC10, - receiverFC10); - if (fblock11) - createTransmitters(cBlock, fblock11, dir, CreateTransmittersHelper::NE, senderCF11, receiverCF11, senderFC11, - receiverFC11); - - if (cBlockRank == gridRank) { - SPtr<Block3DConnector> connector = - cFactory->createCoarseToFineConnector(cBlock, senderCF00, receiverCF00, senderCF01, receiverCF01, - senderCF10, receiverCF10, senderCF11, receiverCF11, dir, cIProcessor); - cBlock->setConnector(connector); - } - if (fblock00 && fblock00Rank == gridRank) { - SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector( - fblock00, senderFC00, receiverFC00, dir, fIProcessor00, FineToCoarseBlock3DConnector::Type00); - fblock00->setConnector(connector); - } - if (fblock01 && fblock01Rank == gridRank) { - SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector( - fblock01, senderFC01, receiverFC01, dir, fIProcessor01, FineToCoarseBlock3DConnector::Type01); - fblock01->setConnector(connector); - } - if (fblock10 && fblock10Rank == gridRank) { - SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector( - fblock10, senderFC10, receiverFC10, dir, fIProcessor10, FineToCoarseBlock3DConnector::Type10); - fblock10->setConnector(connector); - } - if (fblock11 && fblock11Rank == gridRank) { - SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector( - fblock11, senderFC11, receiverFC11, dir, fIProcessor11, FineToCoarseBlock3DConnector::Type11); - fblock11->setConnector(connector); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - end"); -} -////////////////////////////////////////////////////////////////////////// -void ConnectorBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, - CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr &senderCF, - CreateTransmittersHelper::TransmitterPtr &receiverCF, - CreateTransmittersHelper::TransmitterPtr &senderFC, - CreateTransmittersHelper::TransmitterPtr &receiverFC) -{ - UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - start"); - CreateTransmittersHelper helper; - // bool MPIpool = true; - // bool orthogonal = false; - int fBlockRank = fBlock->getRank(); - int cBlockRank = cBlock->getRank(); - if (fBlockRank == cBlockRank && fBlockRank == gridRank) { - senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter<CbVector<LBMReal>>()); - } else if (cBlockRank == gridRank) { - helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI); - } else if (fBlockRank == gridRank) { - helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI); - } - UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - end"); -}