diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp index 4ea38e31c7ec3b29f157bcb66d0b0d885bcc12af..89b2cea5d8d26d2c3920ee5e118b06a84fede5d9 100644 --- a/apps/cpu/Multiphase/Multiphase.cpp +++ b/apps/cpu/Multiphase/Multiphase.cpp @@ -77,7 +77,7 @@ void run(string configname) SPtr<LBMUnitConverter> conv(new LBMUnitConverter()); - const int baseLevel = 0; + //const int baseLevel = 0; SPtr<LBMKernel> kernel; @@ -214,10 +214,10 @@ void run(string configname) // BC Adapter ////////////////////////////////////////////////////////////////////////////// SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter()); - noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithmMultiphase())); + noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNoSlipBCAlgorithm())); SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB)); - denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithmMultiphase())); + denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseNonReflectingOutflowBCAlgorithm())); // double r = 5.0; //boost::dynamic_pointer_cast<GbCylinder3D>(cylinder)->getRadius(); // double cx1 = g_minX1; @@ -241,19 +241,19 @@ void run(string configname) // BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); SPtr<BCAdapter> velBCAdapterF1( - new VelocityBCAdapterMultiphase(false, true, false, fctF1, phiH, 0.0, endTime)); + new MultiphaseVelocityBCAdapter(false, true, false, fctF1, phiH, 0.0, endTime)); - // BCAdapterPtr velBCAdapterF2_1_init(new VelocityBCAdapterMultiphase(false, false, true, fctF2_1, phiH, - // 0.0, endTime)); BCAdapterPtr velBCAdapterF2_2_init(new VelocityBCAdapterMultiphase(false, false, true, + // BCAdapterPtr velBCAdapterF2_1_init(new MultiphaseVelocityBCAdapter(false, false, true, fctF2_1, phiH, + // 0.0, endTime)); BCAdapterPtr velBCAdapterF2_2_init(new MultiphaseVelocityBCAdapter(false, false, true, // fctF2_2, phiH, 0.0, endTime)); - // BCAdapterPtr velBCAdapterF2_1_init(new VelocityBCAdapterMultiphase(false, false, true, fctvel_F2_init, - // phiL, 0.0, endTime)); BCAdapterPtr velBCAdapterF2_2_init(new VelocityBCAdapterMultiphase(false, false, + // BCAdapterPtr velBCAdapterF2_1_init(new MultiphaseVelocityBCAdapter(false, false, true, fctvel_F2_init, + // phiL, 0.0, endTime)); BCAdapterPtr velBCAdapterF2_2_init(new MultiphaseVelocityBCAdapter(false, false, // true, fctvel_F2_init, phiL, 0.0, endTime)); - velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithmMultiphase())); - // velBCAdapterF2_1_init->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithmMultiphase())); - // velBCAdapterF2_2_init->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithmMultiphase())); + velBCAdapterF1->setBcAlgorithm(SPtr<BCAlgorithm>(new MultiphaseVelocityBCAlgorithm())); + // velBCAdapterF2_1_init->setBcAlgorithm(BCAlgorithmPtr(new MultiphaseVelocityBCAlgorithm())); + // velBCAdapterF2_2_init->setBcAlgorithm(BCAlgorithmPtr(new MultiphaseVelocityBCAlgorithm())); // velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityWithDensityBCAlgorithm())); // mu::Parser fct; @@ -264,7 +264,7 @@ void run(string configname) ////////////////////////////////////////////////////////////////////////////////// // BC visitor - BoundaryConditionsBlockVisitorMultiphase bcVisitor; + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; bcVisitor.addBC(noSlipBCAdapter); bcVisitor.addBC(denBCAdapter); bcVisitor.addBC(velBCAdapterF1); @@ -352,7 +352,7 @@ void run(string configname) // kernel->setBCProcessor(bcProc); - SetKernelBlockVisitorMultiphase kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem, + MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, densityRatio, beta, kappa, theta, availMem, needMem); grid->accept(kernelVisitor); @@ -406,7 +406,7 @@ void run(string configname) fct2.DefineConst("radius", radius); fct2.DefineConst("interfaceThickness", interfaceThickness);*/ - InitDistributionsBlockVisitorMultiphase initVisitor(densityRatio, interfaceThickness, radius); + MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio, interfaceThickness, radius); initVisitor.setPhi(fct1); // initVisitor.setVx1(fct2); grid->accept(initVisitor); diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index 0a666a932f8b3e3fba0e5f24d5220becb603b564..caa205abb1984cfa5c73f4277cc5fd6a9be09241 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -133,10 +133,10 @@ #include <BoundaryConditions/SimpleSlipBCAlgorithm.h> #include <BoundaryConditions/PowellEyringModelNoSlipBCAlgorithm.h> #include <BoundaryConditions/BinghamModelVelocityBCAlgorithm.h> -#include <BoundaryConditions/NoSlipBCAlgorithmMultiphase.h> -#include <BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.h> -#include <BoundaryConditions/VelocityBCAdapterMultiphase.h> -#include <BoundaryConditions/VelocityBCAlgorithmMultiphase.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> @@ -327,9 +327,9 @@ #include <CheckRatioBlockVisitor.h> #include <SpongeLayerBlockVisitor.h> #include <ZoltanPartitioningGridVisitor.h> -#include <Visitors/SetKernelBlockVisitorMultiphase.h> -#include <Visitors/BoundaryConditionsBlockVisitorMultiphase.h> -#include <Visitors/InitDistributionsBlockVisitorMultiphase.h> +#include <Visitors/MultiphaseSetKernelBlockVisitor.h> +#include <Visitors/MultiphaseBoundaryConditionsBlockVisitor.h> +#include <Visitors/MultiphaseInitDistributionsBlockVisitor.h> #include <RefineAroundGbObjectHelper.h> #include <Visitors/RefineCrossAndInsideGbObjectHelper.h> diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h index 518ea9fac1898912f16d3c83d18bb1ff722c21a3..3bbc01cd9c488970df865f420b84a76d21c6ac9a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h @@ -67,7 +67,7 @@ public: static const char SimpleSlipBCAlgorithm = 17; static const char PowellEyringModelNoSlipBCAlgorithm = 18; static const char BinghamModelVelocityBCAlgorithm = 19; - static const char NoSlipBCAlgorithmMultiphase = 20; + static const char MultiphaseNoSlipBCAlgorithm = 20; public: diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp similarity index 73% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp index d32a42d9a362e20d6985474397268a8679be4717..51fc2d5abdfe7cfa5bafb7ae21571c684cd26b02 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.cpp @@ -26,43 +26,43 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file NoSlipBCAlgorithmMultiphase.cpp +//! \file MultiphaseNoSlipBCAlgorithm.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "NoSlipBCAlgorithmMultiphase.h" +#include "MultiphaseNoSlipBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -NoSlipBCAlgorithmMultiphase::NoSlipBCAlgorithmMultiphase() +MultiphaseNoSlipBCAlgorithm::MultiphaseNoSlipBCAlgorithm() { - BCAlgorithm::type = BCAlgorithm::NoSlipBCAlgorithmMultiphase; + BCAlgorithm::type = BCAlgorithm::MultiphaseNoSlipBCAlgorithm; BCAlgorithm::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -NoSlipBCAlgorithmMultiphase::~NoSlipBCAlgorithmMultiphase() +MultiphaseNoSlipBCAlgorithm::~MultiphaseNoSlipBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NoSlipBCAlgorithmMultiphase::clone() +SPtr<BCAlgorithm> MultiphaseNoSlipBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new NoSlipBCAlgorithmMultiphase()); + SPtr<BCAlgorithm> bc(new MultiphaseNoSlipBCAlgorithm()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithmMultiphase::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseNoSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithmMultiphase::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseNoSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void NoSlipBCAlgorithmMultiphase::applyBC() +void MultiphaseNoSlipBCAlgorithm::applyBC() { LBMReal f[D3Q27System::ENDF+1]; LBMReal h[D3Q27System::ENDF+1]; @@ -74,36 +74,18 @@ void NoSlipBCAlgorithmMultiphase::applyBC() D3Q27System::calcDensity(h, phi); - //LBMReal collFactorM = phi*collFactorL + (1-phi)*collFactorG; - //LBMReal collFactorM = collFactorL + (collFactorL - collFactorG)*(phi - phiH)/(phiH - phiL); - - //rho = phi + (1.0 - phi)*1.0/densityRatio; - LBMReal rhoH = 1.0; - LBMReal rhoL = 1.0/densityRatio; - //rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL); - calcMacrosFct(f, p1, vx1, vx2, vx3); - /*vx1/=(rho*c1o3); - vx2/=(rho*c1o3); - vx3/=(rho*c1o3);*/ - - //calcFeqFct(feq, rho, vx1, vx2, vx3); - //D3Q27System::calcMultiphaseFeq(feq, rho, p1, vx1, vx2, vx3); D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3); D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3); - //LBMReal collFactorM1 = 0.9; + 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 = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactorM)+feq[invDir])+((q/(1.0+q))*(f[invDir]+f[fdir])); LBMReal fReturn = f[invDir]; distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); - - //LBMReal hReturn = ((1.0-q)/(1.0+q))*((h[invDir]-heq[invDir])/(1.0-collFactorPh)+heq[invDir])+((q/(1.0+q))*(h[invDir]+h[fdir])); LBMReal hReturn = h[invDir]; distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h similarity index 89% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h index 037ee6f50551b7700ccd70deae7c25d1ba83a0af..a1b9642f0908fbc107e95bd59153e13828c8d3e4 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithmMultiphase.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h @@ -26,25 +26,25 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file NoSlipBCAlgorithmMultiphase.h +//! \file MultiphaseNoSlipBCAlgorithm.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef NoSlipBCAlgorithmMultiphase_h__ -#define NoSlipBCAlgorithmMultiphase_h__ +#ifndef MultiphaseNoSlipBCAlgorithm_h__ +#define MultiphaseNoSlipBCAlgorithm_h__ #include "BCAlgorithm.h" //! A class implements no-slip boundary condition for multiphase simulations -class NoSlipBCAlgorithmMultiphase : public BCAlgorithm +class MultiphaseNoSlipBCAlgorithm : public BCAlgorithm { public: - NoSlipBCAlgorithmMultiphase(); - virtual ~NoSlipBCAlgorithmMultiphase(); + MultiphaseNoSlipBCAlgorithm(); + virtual ~MultiphaseNoSlipBCAlgorithm(); SPtr<BCAlgorithm> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; void applyBC(); }; -#endif // NoSlipBCAlgorithmMultiphase_h__ +#endif // MultiphaseNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp similarity index 95% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp index e8a3fa794d579e9149f2f600027e0a30ddf0a54d..d0a3b39c83c1d828801dd442fb387c4d4d33d589 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.cpp @@ -26,50 +26,49 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file NonReflectingOutflowBCAlgorithmMultiphase.cpp +//! \file MultiphaseNonReflectingOutflowBCAlgorithm.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "NonReflectingOutflowBCAlgorithmMultiphase.h" +#include "MultiphaseNonReflectingOutflowBCAlgorithm.h" #include "D3Q27System.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -NonReflectingOutflowBCAlgorithmMultiphase::NonReflectingOutflowBCAlgorithmMultiphase() +MultiphaseNonReflectingOutflowBCAlgorithm::MultiphaseNonReflectingOutflowBCAlgorithm() { BCAlgorithm::type = BCAlgorithm::NonReflectingOutflowBCAlgorithm; BCAlgorithm::preCollision = true; } ////////////////////////////////////////////////////////////////////////// -NonReflectingOutflowBCAlgorithmMultiphase::~NonReflectingOutflowBCAlgorithmMultiphase() +MultiphaseNonReflectingOutflowBCAlgorithm::~MultiphaseNonReflectingOutflowBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> NonReflectingOutflowBCAlgorithmMultiphase::clone() +SPtr<BCAlgorithm> MultiphaseNonReflectingOutflowBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new NonReflectingOutflowBCAlgorithmMultiphase()); + SPtr<BCAlgorithm> bc(new MultiphaseNonReflectingOutflowBCAlgorithm()); return bc; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithmMultiphase::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithmMultiphase::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseNonReflectingOutflowBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void NonReflectingOutflowBCAlgorithmMultiphase::applyBC() +void MultiphaseNonReflectingOutflowBCAlgorithm::applyBC() { using namespace D3Q27System; using namespace UbMath; LBMReal f[ENDF+1]; LBMReal ftemp[ENDF+1]; LBMReal h[D3Q27System::ENDF+1]; - //LBMReal heq[D3Q27System::ENDF+1]; LBMReal htemp[ENDF+1]; int nx1 = x1; @@ -91,25 +90,11 @@ void NonReflectingOutflowBCAlgorithmMultiphase::applyBC() distributionsH->getDistribution(h, x1, x2, x3); distributionsH->getDistribution(htemp, nx1, nx2, nx3); - LBMReal phi, rho, p1, vx1, vx2, vx3; + LBMReal phi, p1, vx1, vx2, vx3; D3Q27System::calcDensity(h, phi); - //LBMReal collFactorM = phi*collFactorL + (1-phi)*collFactorG; - //LBMReal collFactorM = collFactorL + (collFactorL - collFactorG)*(phi - phiH)/(phiH - phiL); - - //rho = phi + (1.0 - phi)*1.0/densityRatio; - LBMReal rhoH = 1.0; - LBMReal rhoL = 1.0/densityRatio; - rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL); - - - calcMacrosFct(f, p1, vx1, vx2, vx3); - /*vx1/=(rho*c1o3); - vx2/=(rho*c1o3); - vx3/=(rho*c1o3);*/ - switch (direction) { diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h index 1a34c931dd87c46554ede2de27bbd1403d85424e..ee472e1664077a42e85cbc193725023a0e5edfb9 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowBCAlgorithmMultiphase.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.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 NonReflectingOutflowBCAlgorithmMultiphase.h +//! \file MultiphaseNonReflectingOutflowBCAlgorithm.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef NonReflectingOutflowBCAlgorithmMultiphase_h__ -#define NonReflectingOutflowBCAlgorithmMultiphase_h__ +#ifndef MultiphaseNonReflectingOutflowBCAlgorithm_h__ +#define MultiphaseNonReflectingOutflowBCAlgorithm_h__ #include "BCAlgorithm.h" //! A class implements non reflecting outflow boundary condition for multiphase simulations -class NonReflectingOutflowBCAlgorithmMultiphase : public BCAlgorithm +class MultiphaseNonReflectingOutflowBCAlgorithm : public BCAlgorithm { public: - NonReflectingOutflowBCAlgorithmMultiphase(); - ~NonReflectingOutflowBCAlgorithmMultiphase(); + MultiphaseNonReflectingOutflowBCAlgorithm(); + ~MultiphaseNonReflectingOutflowBCAlgorithm(); SPtr<BCAlgorithm> clone(); void addDistributions(SPtr<DistributionArray3D> distributions); void addDistributionsH(SPtr<DistributionArray3D> distributionsH); void applyBC(); }; -#endif // NonReflectingOutflowBCAlgorithmMultiphase_h__ +#endif // MultiphaseNonReflectingOutflowBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp index 436f67229dc6651915eeb7f9db9102508f9398ca..beba9a256b869a37828efe44e886bb988bf9fa71 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.cpp @@ -26,43 +26,43 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file SlipBCAlgorithmMultiphase.cpp +//! \file MultiphaseSlipBCAlgorithm.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "SlipBCAlgorithmMultiphase.h" +#include "MultiphaseSlipBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -SlipBCAlgorithmMultiphase::SlipBCAlgorithmMultiphase() +MultiphaseSlipBCAlgorithm::MultiphaseSlipBCAlgorithm() { BCAlgorithm::type = BCAlgorithm::SlipBCAlgorithm; BCAlgorithm::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -SlipBCAlgorithmMultiphase::~SlipBCAlgorithmMultiphase() +MultiphaseSlipBCAlgorithm::~MultiphaseSlipBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> SlipBCAlgorithmMultiphase::clone() +SPtr<BCAlgorithm> MultiphaseSlipBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new SlipBCAlgorithmMultiphase()); + SPtr<BCAlgorithm> bc(new MultiphaseSlipBCAlgorithm()); return bc; } ////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithmMultiphase::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseSlipBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithmMultiphase::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseSlipBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void SlipBCAlgorithmMultiphase::applyBC() +void MultiphaseSlipBCAlgorithm::applyBC() { LBMReal f[D3Q27System::ENDF+1]; LBMReal h[D3Q27System::ENDF+1]; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.h similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.h index 3d89df9279291bf8cc626560ed58efbeb19d3371..53d41d33ca333b7a7bf5515883eef697a20fb04a 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithmMultiphase.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseSlipBCAlgorithm.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 SlipBCAlgorithmMultiphase.h +//! \file MultiphaseSlipBCAlgorithm.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef SlipBCAlgorithmMultiphase_h__ -#define SlipBCAlgorithmMultiphase_h__ +#ifndef MultiphaseSlipBCAlgorithm_h__ +#define MultiphaseSlipBCAlgorithm_h__ #include "BCAlgorithm.h" //! A class implements slip boundary condition for multiphase simulation -class SlipBCAlgorithmMultiphase : public BCAlgorithm +class MultiphaseSlipBCAlgorithm : public BCAlgorithm { public: - SlipBCAlgorithmMultiphase(); - virtual ~SlipBCAlgorithmMultiphase(); + MultiphaseSlipBCAlgorithm(); + virtual ~MultiphaseSlipBCAlgorithm(); SPtr<BCAlgorithm> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp similarity index 86% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp index c288aff3e94df04f389c80204efb294d6cf22ebb..7211bc3725b4a2607dc000c739f4bf8e98865013 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.cpp @@ -26,12 +26,12 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file VelocityBCAdapterMultiphase.cpp +//! \file MultiphaseVelocityBCAdapter.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "VelocityBCAdapterMultiphase.h" +#include "MultiphaseVelocityBCAdapter.h" #include "basics/utilities/UbLogger.h" #include "basics/utilities/UbMath.h" #include "basics/utilities/UbTuple.h" @@ -39,7 +39,7 @@ using namespace std; -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC) { if(vx1) this->vx1BCs.push_back(velVxBC); if(vx2) this->vx2BCs.push_back(velVxBC); @@ -47,7 +47,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const LBMReal& phiBC, const double& startTime, const double& endTime ) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const LBMReal& phiBC, const double& startTime, const double& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(function,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(function,startTime,endTime)); @@ -58,7 +58,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const LBMReal& phiBC, const double& startTime, const double& endTime ) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const LBMReal& phiBC, const double& startTime, const double& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(function1,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(function2,startTime,endTime)); @@ -67,7 +67,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const double& startTime, const double& endTime ) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const double& startTime, const double& endTime ) { if(vx1) this->vx1BCs.push_back(BCFunction(functionstring,startTime,endTime)); if(vx2) this->vx2BCs.push_back(BCFunction(functionstring,startTime,endTime)); @@ -75,7 +75,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const bool& vx1, const this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir) { if(x1Dir) this->vx1BCs.push_back(velBC); if(x2Dir) this->vx2BCs.push_back(velBC); @@ -83,7 +83,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const BCFunction& velBC this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC) { if( velVx1BC.getEndTime()!=-Ub::inf ) this->vx1BCs.push_back(velVx1BC); if( velVx2BC.getEndTime()!=-Ub::inf ) this->vx2BCs.push_back(velVx2BC); @@ -91,7 +91,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const BCFunction& velVx this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs) +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs) { this->vx1BCs = velVx1BCs; this->vx2BCs = velVx2BCs; @@ -99,7 +99,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const vector< BCFunctio this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, const double& vx2, const double& vx2StartTime, const double& vx2EndTime, const double& vx3, const double& vx3StartTime, const double& vx3EndTime ) { @@ -109,7 +109,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const double& vx1, cons this->init(); } /*==========================================================*/ -VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const string& vx1Function, const double& vx1StartTime, const double& vx1EndTime, +MultiphaseVelocityBCAdapter::MultiphaseVelocityBCAdapter(const string& vx1Function, const double& vx1StartTime, const double& vx1EndTime, const string& vx2Function, const double& vx2StartTime, const double& vx2EndTime, const string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ) { @@ -119,7 +119,7 @@ VelocityBCAdapterMultiphase::VelocityBCAdapterMultiphase(const string& vx1Functi this->init(); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, +void MultiphaseVelocityBCAdapter::setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, const double& vx2, const double& vx2StartTime, const double& vx2EndTime, const double& vx3, const double& vx3StartTime, const double& vx3EndTime ) { @@ -130,7 +130,7 @@ void VelocityBCAdapterMultiphase::setNewVelocities(const double& vx1, const doub this->init(); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::init() +void MultiphaseVelocityBCAdapter::init() { this->unsetTimeDependent(); @@ -155,7 +155,7 @@ void VelocityBCAdapterMultiphase::init() catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } } /*==========================================================*/ -void VelocityBCAdapterMultiphase::init(std::vector<BCFunction>& vxBCs) +void MultiphaseVelocityBCAdapter::init(std::vector<BCFunction>& vxBCs) { for(size_t pos=0; pos<vxBCs.size(); ++pos) { @@ -174,7 +174,7 @@ void VelocityBCAdapterMultiphase::init(std::vector<BCFunction>& vxBCs) } } /*==========================================================*/ -void VelocityBCAdapterMultiphase::init(const D3Q27Interactor* const& interactor, const double& time) +void MultiphaseVelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time) { this->timeStep = time; this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL; @@ -236,24 +236,25 @@ void VelocityBCAdapterMultiphase::init(const D3Q27Interactor* const& interactor, if( !this->isTimePeriodic() ) this->unsetTimeDependent(); else //bei peridoic die interavalle neu setzen: { - if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) - for(size_t pos=0; pos<vx1BCs.size(); ++pos) - { - vx1BCs[pos].setStartTime( vx1BCs[pos].getStartTime() + timeStep ); - vx1BCs[pos].setEndTime( vx1BCs[pos].getEndTime() + timeStep ); - } - if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) - for(size_t pos=0; pos<vx2BCs.size(); ++pos) - { - vx2BCs[pos].setStartTime( vx2BCs[pos].getStartTime() + timeStep ); - vx2BCs[pos].setEndTime( vx2BCs[pos].getEndTime() + timeStep ); - } - if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) - for(size_t pos=0; pos<vx3BCs.size(); ++pos) - { - vx3BCs[pos].setStartTime( vx3BCs[pos].getStartTime() + timeStep ); - vx3BCs[pos].setEndTime( vx3BCs[pos].getEndTime() + timeStep ); - } + if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) { + for (size_t pos = 0; pos < vx1BCs.size(); ++pos) { + vx1BCs[pos].setStartTime(vx1BCs[pos].getStartTime() + timeStep); + vx1BCs[pos].setEndTime(vx1BCs[pos].getEndTime() + timeStep); + } + } + if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) { + for (size_t pos = 0; pos < vx2BCs.size(); ++pos) { + vx2BCs[pos].setStartTime(vx2BCs[pos].getStartTime() + timeStep); + vx2BCs[pos].setEndTime(vx2BCs[pos].getEndTime() + timeStep); + } + } + + if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) { + for (size_t pos = 0; pos < vx3BCs.size(); ++pos) { + vx3BCs[pos].setStartTime(vx3BCs[pos].getStartTime() + timeStep); + vx3BCs[pos].setEndTime(vx3BCs[pos].getEndTime() + timeStep); + } + } this->init(interactor,time); } } @@ -265,24 +266,24 @@ void VelocityBCAdapterMultiphase::init(const D3Q27Interactor* const& interactor, <<", timedependent="<<boolalpha<<this->isTimeDependent() ); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::update( const D3Q27Interactor* const& interactor, const double& time ) +void MultiphaseVelocityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) { this->init(interactor,time); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time ) +void MultiphaseVelocityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time ) { bc->setVelocityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption); bc->setQ((float)q,fdirection); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time ) +void MultiphaseVelocityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time ) { this->setNodeVelocity(interactor,bc,worldX1,worldX2,worldX3,time); bc->setBcAlgorithmType(algorithmType); } /*==========================================================*/ -void VelocityBCAdapterMultiphase::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) +void MultiphaseVelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) { //Geschwindigkeiten setzen try @@ -303,7 +304,7 @@ void VelocityBCAdapterMultiphase::setNodeVelocity( const D3Q27Interactor& intera catch(...) { throw UbException(UB_EXARGS,"unknown exception" ); } } /*==========================================================*/ -UbTupleDouble3 VelocityBCAdapterMultiphase::getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const +UbTupleDouble3 MultiphaseVelocityBCAdapter::getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const { double vx1 = 0.0; double vx2 = 0.0; @@ -320,7 +321,7 @@ UbTupleDouble3 VelocityBCAdapterMultiphase::getVelocity(const double& x1, const return UbTupleDouble3(vx1,vx2,vx3); } /*==========================================================*/ -string VelocityBCAdapterMultiphase::toString() +string MultiphaseVelocityBCAdapter::toString() { stringstream info; info<<"D3Q27VelocityBCAdapter:\n"; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h similarity index 91% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h index 29025a89d7f100f2f5c8de36cf772c47ebf90d07..998462398294d23725ec9985a8fcbd06fe9f65ad 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapterMultiphase.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAdapter.h @@ -26,12 +26,12 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file VelocityBCAdapterMultiphase.h +//! \file MultiphaseVelocityBCAdapter.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef VelocityBCAdapterMultiphase_H -#define VelocityBCAdapterMultiphase_H +#ifndef MultiphaseVelocityBCAdapter_H +#define MultiphaseVelocityBCAdapter_H #include <iostream> #include <string> @@ -84,31 +84,31 @@ class UbFileInput; //! VelocityBCAdapter velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); //! \endcode -class VelocityBCAdapterMultiphase : public BCAdapter +class MultiphaseVelocityBCAdapter : public BCAdapter { public: //constructors - VelocityBCAdapterMultiphase() { this->init(); } + MultiphaseVelocityBCAdapter() { this->init(); } - VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC ); + MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC ); - VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const LBMReal& phiBC, const double& startTime, const double& endTime ); + MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const LBMReal& phiBC, const double& startTime, const double& endTime ); - VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const LBMReal& phiBC, const double& startTime, const double& endTime ); + MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const LBMReal& phiBC, const double& startTime, const double& endTime ); - VelocityBCAdapterMultiphase(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const double& startTime, const double& endTime ); + MultiphaseVelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const double& startTime, const double& endTime ); - VelocityBCAdapterMultiphase(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir); + MultiphaseVelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir); - VelocityBCAdapterMultiphase(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC); + MultiphaseVelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC); - VelocityBCAdapterMultiphase(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs); + MultiphaseVelocityBCAdapter(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs); - VelocityBCAdapterMultiphase(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, + MultiphaseVelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime, const double& vx2, const double& vx2StartTime, const double& vx2EndTime, const double& vx3, const double& vx3StartTime, const double& vx3EndTime); - VelocityBCAdapterMultiphase(const std::string& vx1Function, const double& vx1StartTime, const double& vx1EndTime, + MultiphaseVelocityBCAdapter(const std::string& vx1Function, const double& vx1StartTime, const double& vx1EndTime, const std::string& vx2Function, const double& vx2StartTime, const double& vx2EndTime, const std::string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp similarity index 73% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.cpp rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp index c840f1cb8489d58fe1726a5b599590d3663f079f..80c1bc6518e5cfe27a4c1af9ca6bd2233d1b89d6 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.cpp @@ -26,42 +26,42 @@ // 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 VelocityBCAlgorithmMultiphase.cpp +//! \file MultiphaseVelocityBCAlgorithm.cpp //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#include "VelocityBCAlgorithmMultiphase.h" +#include "MultiphaseVelocityBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" -VelocityBCAlgorithmMultiphase::VelocityBCAlgorithmMultiphase() +MultiphaseVelocityBCAlgorithm::MultiphaseVelocityBCAlgorithm() { BCAlgorithm::type = BCAlgorithm::VelocityBCAlgorithm; BCAlgorithm::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -VelocityBCAlgorithmMultiphase::~VelocityBCAlgorithmMultiphase() +MultiphaseVelocityBCAlgorithm::~MultiphaseVelocityBCAlgorithm() { } ////////////////////////////////////////////////////////////////////////// -SPtr<BCAlgorithm> VelocityBCAlgorithmMultiphase::clone() +SPtr<BCAlgorithm> MultiphaseVelocityBCAlgorithm::clone() { - SPtr<BCAlgorithm> bc(new VelocityBCAlgorithmMultiphase()); + SPtr<BCAlgorithm> bc(new MultiphaseVelocityBCAlgorithm()); return bc; } ////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithmMultiphase::addDistributions(SPtr<DistributionArray3D> distributions) +void MultiphaseVelocityBCAlgorithm::addDistributions(SPtr<DistributionArray3D> distributions) { this->distributions = distributions; } ////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithmMultiphase::addDistributionsH(SPtr<DistributionArray3D> distributionsH) +void MultiphaseVelocityBCAlgorithm::addDistributionsH(SPtr<DistributionArray3D> distributionsH) { this->distributionsH = distributionsH; } ////////////////////////////////////////////////////////////////////////// -void VelocityBCAlgorithmMultiphase::applyBC() +void MultiphaseVelocityBCAlgorithm::applyBC() { LBMReal f[D3Q27System::ENDF+1]; LBMReal h[D3Q27System::ENDF+1]; @@ -71,27 +71,11 @@ void VelocityBCAlgorithmMultiphase::applyBC() distributions->getDistributionInv(f, x1, x2, x3); distributionsH->getDistributionInv(h, x1, x2, x3); - LBMReal phi, rho, vx1, vx2, vx3, p1, phiBC; + LBMReal phi, vx1, vx2, vx3, p1, phiBC; D3Q27System::calcDensity(h, phi); - - //LBMReal collFactorM = phi*collFactorL + (1-phi)*collFactorG; - //LBMReal collFactorM = collFactorL + (collFactorL - collFactorG)*(phi - phiH)/(phiH - phiL); - - - - //rho = phi + (1.0 - phi)*1.0/densityRatio; - LBMReal rhoH = 1.0; - LBMReal rhoL = 1.0/densityRatio; - rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL); - calcMacrosFct(f, p1, vx1, vx2, vx3); - /*vx1/=(rho*c1o3); - vx2/=(rho*c1o3); - vx3/=(rho*c1o3);*/ - - //D3Q27System::calcMultiphaseFeq(feq, rho, p1, vx1, vx2, vx3); D3Q27System::calcMultiphaseFeqVB(feq, p1, vx1, vx2, vx3); D3Q27System::calcMultiphaseHeq(heq, phi, vx1, vx2, vx3); @@ -100,14 +84,14 @@ void VelocityBCAlgorithmMultiphase::applyBC() int nx1 = x1; int nx2 = x2; int nx3 = x3; - int direction = -1; + //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; direction = D3Q27System::E; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; direction = D3Q27System::W; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; direction = D3Q27System::N; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; direction = D3Q27System::S; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; direction = D3Q27System::T; } - else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; direction = D3Q27System::B; } + if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::E)) { nx1 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::W)) { nx1 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::N)) { nx2 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::S)) { nx2 += 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::T)) { nx3 -= 1; } + else if (bcPtr->hasVelocityBoundaryFlag(D3Q27System::B)) { nx3 += 1; } else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); phiBC = bcPtr->getBoundaryPhaseField(); @@ -122,11 +106,6 @@ void VelocityBCAlgorithmMultiphase::applyBC() distributionsH->setDistributionForDirection(hReturn, nx1, nx2, nx3, fdir); } } - - ////////////////////////////////// - - - for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { @@ -135,12 +114,8 @@ void VelocityBCAlgorithmMultiphase::applyBC() 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-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho*c1o3)/(1.0+q)); LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity)/(1.0+q)); distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); - - //LBMReal hReturn = ((1.0-q)/(1.0+q))*((h[invDir]-heq[invDir])/(1.0-collFactorM)+heq[invDir])+((q/(1.0+q))*(h[invDir]+h[fdir])); - //distributionsH->setDistributionForDirection(hReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h similarity index 88% rename from src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.h rename to src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h index 869940099429c1bcf3f178644835e154c489e29f..c1820b264dc6c5728bf13dfff47f9331899b2302 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithmMultiphase.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/MultiphaseVelocityBCAlgorithm.h @@ -26,26 +26,26 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file VelocityBCAlgorithmMultiphase.h +//! \file MultiphaseVelocityBCAlgorithm.h //! \ingroup BoundarConditions //! \author Hesameddin Safari //======================================================================================= -#ifndef VelocityBoundaryConditionMultiphase_h__ -#define VelocityBoundaryConditionMultiphase_h__ +#ifndef MultiphaseVelocityBCAlgorithm_h__ +#define MultiphaseVelocityBCAlgorithm_h__ #include "BCAlgorithm.h" //! A class implements velocity boundary condition for multiphase simulations -class VelocityBCAlgorithmMultiphase : public BCAlgorithm +class MultiphaseVelocityBCAlgorithm : public BCAlgorithm { public: - VelocityBCAlgorithmMultiphase(); - ~VelocityBCAlgorithmMultiphase(); + MultiphaseVelocityBCAlgorithm(); + ~MultiphaseVelocityBCAlgorithm(); SPtr<BCAlgorithm> clone() override; void addDistributions(SPtr<DistributionArray3D> distributions) override; void addDistributionsH(SPtr<DistributionArray3D> distributionsH) override; void applyBC() override; }; -#endif // VelocityBoundaryConditionMultiphase_h__ +#endif // MultiphaseVelocityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp index 09c43e97b9b9f4ba46fb741b5f2cc2b1299d109c..f219a432a0535e4045cda7ef224485b97efc4282 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.cpp @@ -85,49 +85,18 @@ void MultiphaseCumulantLBMKernel::calculate(int step) using namespace D3Q27System; using namespace UbMath; - // initializing of forcing stuff - /*if (withForcing) - { - muForcingX1.DefineVar("x1",&muX1); muForcingX1.DefineVar("x2",&muX2); muForcingX1.DefineVar("x3",&muX3); - muForcingX2.DefineVar("x1",&muX1); muForcingX2.DefineVar("x2",&muX2); muForcingX2.DefineVar("x3",&muX3); - muForcingX3.DefineVar("x1",&muX1); muForcingX3.DefineVar("x2",&muX2); muForcingX3.DefineVar("x3",&muX3); - - muDeltaT = deltaT; - - muForcingX1.DefineVar("dt",&muDeltaT); - muForcingX2.DefineVar("dt",&muDeltaT); - muForcingX3.DefineVar("dt",&muDeltaT); - - muNu = (1.0/3.0)*(1.0/collFactor - 1.0/2.0); - - muForcingX1.DefineVar("nu",&muNu); - muForcingX2.DefineVar("nu",&muNu); - muForcingX3.DefineVar("nu",&muNu); - - LBMReal forcingX1 = 0; - LBMReal forcingX2 = 0; - LBMReal forcingX3 = 0; - }*/ forcingX1 = 0.0; forcingX2 = 0.0; forcingX3 = 0.0; ///////////////////////////////////// - localDistributionsF = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributionsF = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - zeroDistributionsF = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - - localDistributionsH = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions(); - nonLocalDistributionsH = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); - zeroDistributionsH = - dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); + localDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); + nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); + zeroDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); - // phaseField = dataSet->getPhaseField(); + localDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions(); + nonLocalDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); + zeroDistributionsH = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); SPtr<BCArray3D> bcArray = this->getBCProcessor()->getBCArray(); @@ -142,19 +111,11 @@ void MultiphaseCumulantLBMKernel::calculate(int step) int maxX2 = bcArrayMaxX2 - ghostLayerWidth; int maxX3 = bcArrayMaxX3 - ghostLayerWidth; - //#pragma omp parallel num_threads(8) - { - // int i = omp_get_thread_num(); - // printf_s("Hello from thread %d\n", i); - //} - //#pragma omp for - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr phaseField( new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, -999.0)); CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr divU( new CbArray3D<LBMReal, IndexerX3X2X1>(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3, 0.0)); - // CbArray3D<LBMReal> phaseField(bcArrayMaxX1, bcArrayMaxX2, bcArrayMaxX3,-999); for (int x3 = 0; x3 <= maxX3; x3++) { for (int x2 = 0; x2 <= maxX2; x2++) { @@ -192,10 +153,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal mfcca = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p); LBMReal mfbbb = (*this->zeroDistributionsH)(x1, x2, x3); - // LBMReal phase = h[REST] + h[E] + h[W] + h[N] + h[S] + h[T] + h[B] + h[NE] + h[SW] + h[SE] + - // h[NW] + h[TE] + h[BW] + h[BE] + h[TW] + h[TN] + h[BS] + h[BN] + h[TS] + h[TNE] + h[TNW] + - //h[TSE] + h[TSW] + h[BNE] + h[BNW] + h[BSE] + h[BSW]; if (phase > 1.0) phase = 1.0e0; - //(*phaseField)(x1,x2,x3) = phase; (*phaseField)(x1, x2, x3) = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + @@ -207,31 +164,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal collFactorM; LBMReal forcingTerm[D3Q27System::ENDF + 1]; - // LBMReal m000, m100, m010, m001, m110, m101, m011, m200, m020, m002, m120, m102, m210, m012, m201, m021, m111, - // m220, m202, m022, m211, m121, m112, m221, m212, m122, m222; LBMReal k000, k100, k010, k001, k110, k101, k011, - // k200, k020, k002, k120, k102, k210, k012, k201, k021, k111, k220, k202, k022, k211, k121, k112, k221, k212, - // k122, k222; LBMReal c000, c100, c010, c001, c110, c101, c011, c200, c020, c002, c120, c102, c210, c012, c201, - // c021, c111, c220, c202, c022, c211, c121, c112, c221, c212, c122, c222; - - // LBMReal k200_pl_k020_pl_k002, k200_mi_k020, k200_mi_k002, k210_pl_k012, k210_mi_k012, k201_pl_k021, - // k201_mi_k021, k120_pl_k102, k120_mi_k102, k220_pl_k202_pl_k022, - // k220_mi2_k202_pl_k022, k220_pl_k202_mi2_k022; - - // LBMReal c200_pl_c020_pl_c002, c200_mi_c020, c200_mi_c002, c210_pl_c012, c210_mi_c012, c201_pl_c021, - // c201_mi_c021, c120_pl_c102, c120_mi_c102, c220_pl_c202_pl_c022, - // c220_mi2_c202_pl_c022, c220_pl_c202_mi2_c022; - - LBMReal w1, w2, w3, w4, w5, w6, w7, w8, w9, w10; - - w2 = 1.0; - w3 = 1.0; - w4 = 1.0; - w5 = 1.0; - w6 = 1.0; - w7 = 1.0; - w8 = 1.0; - w9 = 1.0; - w10 = 1.0; for (int x3 = minX3; x3 < maxX3; x3++) { for (int x2 = minX2; x2 < maxX2; x2++) { @@ -262,35 +194,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) // a b c //-1 0 1 - /* - phi[REST] = (phaseField)(x1,x2,x3); - phi[E ] = (phaseField)(x1 + DX1[E ], x2 + DX2[E ], x3 + DX3[E ]); - phi[N ] = (phaseField)(x1 + DX1[N ], x2 + DX2[N ], x3 + DX3[N ]); - phi[T ] = (phaseField)(x1 + DX1[T ], x2 + DX2[T ], x3 + DX3[T ]); - phi[W ] = (phaseField)(x1 + DX1[W ], x2 + DX2[W ], x3 + DX3[W ]); - phi[S ] = (phaseField)(x1 + DX1[S ], x2 + DX2[S ], x3 + DX3[S ]); - phi[B ] = (phaseField)(x1 + DX1[B ], x2 + DX2[B ], x3 + DX3[B ]); - phi[NE ] = (phaseField)(x1 + DX1[NE ], x2 + DX2[NE ], x3 + DX3[NE ]); - phi[NW ] = (phaseField)(x1 + DX1[NW ], x2 + DX2[NW ], x3 + DX3[NW ]); - phi[TE ] = (phaseField)(x1 + DX1[TE ], x2 + DX2[TE ], x3 + DX3[TE ]); - phi[TW ] = (phaseField)(x1 + DX1[TW ], x2 + DX2[TW ], x3 + DX3[TW ]); - phi[TN ] = (phaseField)(x1 + DX1[TN ], x2 + DX2[TN ], x3 + DX3[TN ]); - phi[TS ] = (phaseField)(x1 + DX1[TS ], x2 + DX2[TS ], x3 + DX3[TS ]); - phi[SW ] = (phaseField)(x1 + DX1[SW ], x2 + DX2[SW ], x3 + DX3[SW ]); - phi[SE ] = (phaseField)(x1 + DX1[SE ], x2 + DX2[SE ], x3 + DX3[SE ]); - phi[BW ] = (phaseField)(x1 + DX1[BW ], x2 + DX2[BW ], x3 + DX3[BW ]); - phi[BE ] = (phaseField)(x1 + DX1[BE ], x2 + DX2[BE ], x3 + DX3[BE ]); - phi[BS ] = (phaseField)(x1 + DX1[BS ], x2 + DX2[BS ], x3 + DX3[BS ]); - phi[BN ] = (phaseField)(x1 + DX1[BN ], x2 + DX2[BN ], x3 + DX3[BN ]); - phi[BSW] = (phaseField)(x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW]); - phi[BSE] = (phaseField)(x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE]); - phi[BNW] = (phaseField)(x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW]); - phi[BNE] = (phaseField)(x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE]); - phi[TNE] = (phaseField)(x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE]); - phi[TNW] = (phaseField)(x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW]); - phi[TSE] = (phaseField)(x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE]); - phi[TSW] = (phaseField)(x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW]); - */ findNeighbors(phaseField, x1, x2, x3); LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); @@ -325,62 +228,20 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal rhoH = 1.0; LBMReal rhoL = 1.0 / densityRatio; - // LBMReal rhoToPhi = (1.0 - 1.0/densityRatio); LBMReal rhoToPhi = (rhoH - rhoL) / (phiH - phiL); - // collFactorM = phi[REST]*collFactorL + (1-phi[REST])*collFactorG; - // collFactorM = phi[REST]*collFactorG + (1-phi[REST])*collFactorL; - - // LBMReal tauH = 1.0; - // LBMReal di = sqrt(8*kappa/beta); - LBMReal dX1_phi = gradX1_phi(); LBMReal dX2_phi = gradX2_phi(); LBMReal dX3_phi = gradX3_phi(); LBMReal denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1e-9; - // LBMReal normX1 = dX1_phi/denom; - // LBMReal normX2 = dX2_phi/denom; - // LBMReal normX3 = dX3_phi/denom; - collFactorM = collFactorL + (collFactorL - collFactorG) * (phi[REST] - phiH) / (phiH - phiL); - /*if ((phi[REST] > 0.1)||(phi[REST] < 0.9)) - { - collFactorM*=(1.0-denom); - }*/ - - w1 = collFactorM; - - /*dX1_phi = -normX1*((phi[REST]>phiH || phi[REST]<phiL) ? 0.0 : 4*(phi[REST] - phiL)*(phi[REST] - - phiH)/di); dX2_phi = -normX2*((phi[REST]>phiH || phi[REST]<phiL) ? 0.0 : 4*(phi[REST] - - phiL)*(phi[REST] - phiH)/di); dX3_phi = -normX3*((phi[REST]>phiH || phi[REST]<phiL) ? 0.0 : - 4*(phi[REST] - phiL)*(phi[REST] - phiH)/di);*/ - // UbTupleDouble3 coords = grid->getNodeCoordinates(block, x1, x2, x3); - /*Block3D bl = this->block(); - - int wX1 = bl->getX1() + x1; - int wX2 = bl->getX2() + x2; - int wX3 = bl->getX3() + x3;*/ - - /*if (wX3 >= 30.0) - { - dX1_phi = 0.0; - dX2_phi = 0.0; - dX3_phi = 0.0; - }*/ - - LBMReal mu = - 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi(); - - // LBMReal rhoToPhi = (1.0/densityRatio - 1.0); + LBMReal mu = 2 * beta * phi[REST] * (phi[REST] - 1) * (2 * phi[REST] - 1) - kappa * nabla2_phi(); //----------- Calculating Macroscopic Values ------------- - - // LBMReal rho = phi[REST] + (1.0 - phi[REST])*1.0/densityRatio; LBMReal rho = rhoH + rhoToPhi * (phi[REST] - phiH); - // LBMReal rho = phi[REST]*1.0/densityRatio + (1.0 - phi[REST]); if (withForcing) { // muX1 = static_cast<double>(x1-1+ix1*maxX1); @@ -419,62 +280,19 @@ void MultiphaseCumulantLBMKernel::calculate(int step) (rho * c1o3) + (mu * dX3_phi + forcingX3) / (2 * rho); - // LBMReal p1 = (mfaaa+mfaac+mfaca+mfcaa+mfacc+mfcac+mfccc+mfcca) - // +(mfaab+mfacb+mfcab+mfccb)+(mfaba+mfabc+mfcba+mfcbc)+(mfbaa+mfbac+mfbca+mfbcc) - // +(mfabb+mfcbb)+(mfbab+mfbcb)+(mfbba+mfbbc)+mfbbb + - //(ux*rhoToPhi*dX1_phi*c1o3 + uy*rhoToPhi*dX2_phi*c1o3 + uz*rhoToPhi*dX3_phi*c1o3)/2.0; - - // vvx = 0.0; vvy = 0.0; vvz = 0.0; //-------------------------------------------------------- LBMReal ux2 = ux * ux; LBMReal uy2 = uy * uy; LBMReal uz2 = uz * uz; - // LBMReal ux_uy = ux*uy; - // LBMReal ux_uz = ux*uz; - // LBMReal uy_uz = uy*uz; - // LBMReal ux_uy_uz = ux*uy*uz; - - /* - //----------- Calculating Forcing Terms ------------- - LBMReal forcingTerm1 = (ux*mu*dX1_phi + uy*mu*dX2_phi + uz*mu*dX3_phi); - for (int dir = STARTF; dir < (ENDF+1); dir++) - { - if (dir != REST) - { - LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]])/2.0; - forcingTerm[dir] = (c1o3*rhoToPhi*dirGrad_phi + - mu*dirGrad_phi)*(DX1[dir]*ux + DX2[dir]*uy + DX3[dir]*uz)*WEIGTH[dir]/c1o3 + - mu*dirGrad_phi*WEIGTH[dir] - (forcingTerm1)*WEIGTH[dir]; - } - else - { - forcingTerm[REST] = -(forcingTerm1)*WEIGTH[REST]; - } - } - //-------------------------------------------------------- - */ //----------- Calculating Forcing Terms * ------------- - // LBMReal forcingTerm1 = (ux*mu*dX1_phi + uy*mu*dX2_phi + uz*mu*dX3_phi); for (int dir = STARTF; dir <= (FENDDIR); dir++) { LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz; LBMReal velSq1 = velProd * velProd; LBMReal gamma = WEIGTH[dir] * (1.0 + 3 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)); - // forcingTerm[dir] = (DX1[dir] - ux)*((gamma - WEIGTH[dir])*c1o3*rhoToPhi*dX1_phi + - // gamma*mu*dX1_phi) + - // (DX2[dir] - uy)*((gamma - WEIGTH[dir])*c1o3*rhoToPhi*dX2_phi + gamma*mu*dX2_phi) + - // (DX3[dir] - uz)*((gamma - WEIGTH[dir])*c1o3*rhoToPhi*dX3_phi + gamma*mu*dX3_phi); - LBMReal fac1 = (gamma - WEIGTH[dir]) * c1o3 * rhoToPhi; - // LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]])/2.0; - // LBMReal dirGrad_phi = DX1[dir]*dX1_phi + DX2[dir]*dX2_phi + DX3[dir]*dX3_phi; - - /*forcingTerm[dir] = (- (ux)*(fac1*dX1_phi + gamma*mu*dX1_phi) - - (uy)*(fac1*dX2_phi + gamma*mu*dX2_phi) - - (uz)*(fac1*dX3_phi + gamma*mu*dX3_phi)) + (fac1*dirGrad_phi + gamma*mu*dirGrad_phi + - DX1[dir]*forcingX1 + DX2[dir]*forcingX2 + DX3[dir]*forcingX3);*/ forcingTerm[dir] = ((-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) + (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) + @@ -485,9 +303,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) } LBMReal gamma = WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2)); - /*forcingTerm[REST] = -(ux)*((gamma - WEIGTH[REST])*c1o3*rhoToPhi*dX1_phi + gamma*mu*dX1_phi) - - (uy)*((gamma - WEIGTH[REST])*c1o3*rhoToPhi*dX2_phi + gamma*mu*dX2_phi) - - (uz)*((gamma - WEIGTH[REST])*c1o3*rhoToPhi*dX3_phi + gamma*mu*dX3_phi);*/ LBMReal fac1 = (gamma - WEIGTH[REST]) * c1o3 * rhoToPhi; forcingTerm[REST] = (-ux) * (fac1 * dX1_phi + gamma * (mu * dX1_phi + forcingX1)) + (-uy) * (fac1 * dX2_phi + gamma * (mu * dX2_phi + forcingX2)) + @@ -495,37 +310,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) //-------------------------------------------------------- - /* - f1[E ] = (g[E ] + 0.5*forcingTerm[E ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[E ]/c1o3; - f1[N ] = (g[N ] + 0.5*forcingTerm[N ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[N ]/c1o3; - f1[T ] = (g[T ] + 0.5*forcingTerm[T ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[T ]/c1o3; - f1[NE ] = (g[NE ] + 0.5*forcingTerm[NE ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[NE - ]/c1o3; f1[NW ] = (g[NW ] + 0.5*forcingTerm[NW ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[NW ]/c1o3; - f1[TE ] = (g[TE ] + 0.5*forcingTerm[TE ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[TE - ]/c1o3; f1[TW ] = (g[TW ] + 0.5*forcingTerm[TW ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[TW ]/c1o3; - f1[TN ] = (g[TN ] + 0.5*forcingTerm[TN ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[TN - ]/c1o3; f1[TS ] = (g[TS ] + 0.5*forcingTerm[TS ])/c1o3 - (p1 - rho*c1o3)*WEIGTH[TS ]/c1o3; - f1[TNE] = (g[TNE] + 0.5*forcingTerm[TNE])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[TNE]/c1o3; f1[TNW] = (g[TNW] + 0.5*forcingTerm[TNW])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[TNW]/c1o3; f1[TSE] = (g[TSE] + 0.5*forcingTerm[TSE])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[TSE]/c1o3; f1[TSW] = (g[TSW] + 0.5*forcingTerm[TSW])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[TSW]/c1o3; f1[W ] = (g[W ] + 0.5*forcingTerm[W ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[W ]/c1o3; f1[S ] = (g[S ] + 0.5*forcingTerm[S ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[S ]/c1o3; f1[B ] = (g[B ] + 0.5*forcingTerm[B ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[B ]/c1o3; f1[SW ] = (g[SW ] + 0.5*forcingTerm[SW ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[SW ]/c1o3; f1[SE ] = (g[SE ] + 0.5*forcingTerm[SE ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[SE ]/c1o3; f1[BW ] = (g[BW ] + 0.5*forcingTerm[BW ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BW ]/c1o3; f1[BE ] = (g[BE ] + 0.5*forcingTerm[BE ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BE ]/c1o3; f1[BS ] = (g[BS ] + 0.5*forcingTerm[BS ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BS ]/c1o3; f1[BN ] = (g[BN ] + 0.5*forcingTerm[BN ])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BN ]/c1o3; f1[BSW] = (g[BSW] + 0.5*forcingTerm[BSW])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BSW]/c1o3; f1[BSE] = (g[BSE] + 0.5*forcingTerm[BSE])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BSE]/c1o3; f1[BNW] = (g[BNW] + 0.5*forcingTerm[BNW])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BNW]/c1o3; f1[BNE] = (g[BNE] + 0.5*forcingTerm[BNE])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[BNE]/c1o3; f1[REST] = (g[REST] + 0.5*forcingTerm[REST])/c1o3 - (p1 - - rho*c1o3)*WEIGTH[REST]/c1o3; - */ - mfcbb = 3.0 * (mfcbb + 0.5 * forcingTerm[E]) / rho; //-(3.0*p1 - rho)*WEIGTH[E ]; mfbcb = 3.0 * (mfbcb + 0.5 * forcingTerm[N]) / rho; //-(3.0*p1 - rho)*WEIGTH[N ]; mfbbc = 3.0 * (mfbbc + 0.5 * forcingTerm[T]) / rho; //-(3.0*p1 - rho)*WEIGTH[T ]; @@ -559,25 +343,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb; - /* - //forcing - /////////////////////////////////////////////////////////////////////////////////////////// - if (withForcing) - { - muX1 = static_cast<double>(x1-1+ix1*maxX1); - muX2 = static_cast<double>(x2-1+ix2*maxX2); - muX3 = static_cast<double>(x3-1+ix3*maxX3); - - forcingX1 = muForcingX1.Eval(); - forcingX2 = muForcingX2.Eval(); - forcingX3 = muForcingX3.Eval(); - - vvx += forcingX1*deltaT*0.5; // X - vvy += forcingX2*deltaT*0.5; // Y - vvz += forcingX3*deltaT*0.5; // Z - } - /////////////////////////////////////////////////////////////////////////////////////////// - */ LBMReal oMdrho, m0, m1, m2; @@ -849,11 +614,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal O6 = 1.; // Cum 4. - // LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // - // till 18.05.2015 LBMReal CUMbcb = mfbcb - ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * - // mfabb); // till 18.05.2015 LBMReal CUMbbc = mfbbc - ((mfaac + c1o3 * oMdrho) * mfbba + 2. * - // mfbab * mfabb); // till 18.05.2015 - LBMReal CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); LBMReal CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); LBMReal CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); @@ -865,12 +625,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho); - // LBMReal CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * - // oMdrho + c1o9*(-p1/c1o3)*oMdrho); LBMReal CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * - // mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9*(-p1/c1o3)*oMdrho); LBMReal CUMacc = mfacc - - // ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + - // c1o9*(-p1/c1o3)*oMdrho); - // Cum 5. LBMReal CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + @@ -911,14 +665,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) LBMReal dyuy = dxux + collFactorM * c3o2 * mxxMyy; LBMReal dzuz = dxux + collFactorM * c3o2 * mxxMzz; - /*LBMReal Dxy =-three*collFactorM*mfbba; - LBMReal Dxz =-three*collFactorM*mfbab; - LBMReal Dyz =-three*collFactorM*mfabb; - - LBMReal strainMag = sqrt(2*(dxux*dxux + dyuy*dyuy + dzuz*dzuz) + Dxy*Dxy + Dxz*Dxz + Dyz*Dyz); - LBMReal intVis = 3*abs(denom - 1e-9)*strainMag; - LBMReal fluidVis = (1.0/collFactorM - 0.5)/3.0; - collFactorM = 1.0/((fluidVis + intVis)*3.0 + 0.5);*/ (*divU)(x1, x2, x3) = dxux + dyuy + dzuz; // relax @@ -990,10 +736,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) // back cumulants to central moments // 4. - // mfcbb = CUMcbb + ((mfcaa + c1o3 * oMdrho) * mfabb + 2. * mfbba * mfbab); // till 18.05.2015 - // mfbcb = CUMbcb + ((mfaca + c1o3 * oMdrho) * mfbab + 2. * mfbba * mfabb); // till 18.05.2015 - // mfbbc = CUMbbc + ((mfaac + c1o3 * oMdrho) * mfbba + 2. * mfbab * mfabb); // till 18.05.2015 - mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); @@ -1005,11 +747,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - 1) * oMdrho; - // mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + - // c1o9*(-p1/c1o3)*oMdrho; mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa - // + mfaac) * oMdrho + c1o9*(-p1/c1o3)*oMdrho; mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * - // mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9*(-p1/c1o3)*oMdrho; - // 5. mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + @@ -1266,10 +1003,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb; - /*LBMReal rho_post = f1[REST] + f1[E] + f1[W] + f1[N] + f1[S] + f1[T] + f1[B] + f1[NE] + f1[SW] - + f1[SE] + f1[NW] + f1[TE] + f1[BW] + f1[BE] + f1[TW] + f1[TN] + f1[BS] + f1[BN] + f1[TS] + - f1[TNE] + f1[TNW] + f1[TSE] + f1[TSW] + f1[BNE] + f1[BNW] + f1[BSE] + f1[BSW]; */ - // LBMReal dif = fabs(rho - rho_post); LBMReal dif = rho1 - rho_post; #ifdef SINGLEPRECISION if (dif > 10.0E-7 || dif < -10.0E-7) @@ -1282,9 +1015,6 @@ void MultiphaseCumulantLBMKernel::calculate(int step) UbSystem::toString(rho_post) + " dif=" + UbSystem::toString(dif) + " rho is not correct for node " + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3))); - // UBLOG(logERROR,"LBMKernelETD3Q27CCLB::collideAll(): rho is not correct for node - // "+UbSystem::toString(x1)+","+UbSystem::toString(x2)+","+UbSystem::toString(x3)); - // exit(EXIT_FAILURE); } #endif @@ -1385,41 +1115,22 @@ void MultiphaseCumulantLBMKernel::calculate(int step) h[REST] = (*this->zeroDistributionsH)(x1, x2, x3); - // LBMReal denom = sqrt(dX1_phi*dX1_phi + dX2_phi*dX2_phi + dX3_phi*dX3_phi) + 1e-15; - // LBMReal di = sqrt(8*kappa/beta); - // LBMReal tauH1 = 3.0*mob + 0.5; for (int dir = STARTF; dir < (ENDF + 1); dir++) { LBMReal velProd = DX1[dir] * ux + DX2[dir] * uy + DX3[dir] * uz; LBMReal velSq1 = velProd * velProd; LBMReal hEq; //, gEq; if (dir != REST) { - // LBMReal dirGrad_phi = DX1[dir]*dX1_phi+DX2[dir]*dX2_phi+DX3[dir]*dX3_phi; LBMReal dirGrad_phi = (phi[dir] - phi[INVDIR[dir]]) / 2.0; - LBMReal hSource = (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST]) * (dirGrad_phi) / - denom; // + phi[REST]*(dxux + dyuy + dzuz); - - // LBMReal hSource =((phi[REST]>phiH || phi[REST]<phiL) ? 0.1 : 1.0) - // * 3.0*mob*(-4.0)/di*(phi[REST] - phiL)*(phi[REST] - phiH)*(dirGrad_phi)/denom; LBMReal - // hSource = 3.0*mob*(-4.0)/di*(phi[REST] - phiL)*(phi[REST] - phiH)*(dirGrad_phi)/denom; - hEq = phi[REST] * WEIGTH[dir] * - (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) + - hSource * WEIGTH[dir]; - // gEq = rho*WEIGTH[dir]*(1 + 3*velProd + 4.5*velSq1 - 1.5*(vx2+vy2+vz2))*c1o3 + - // (p1-rho*c1o3)*WEIGTH[dir]; h[dir] = hEq; //h[dir] - (h[dir] - hEq)/(tauH + 0.5)); /// + LBMReal hSource = (tauH - 0.5) * (1.0 - phi[REST]) * (phi[REST]) * (dirGrad_phi) / denom; + hEq = phi[REST] * WEIGTH[dir] * (1.0 + 3.0 * velProd + 4.5 * velSq1 - 1.5 * (ux2 + uy2 + uz2)) + hSource * WEIGTH[dir]; + // This corresponds with the collision factor of 1.0 which equals (tauH + 0.5). - h[dir] = - h[dir] - (h[dir] - hEq) / (tauH); // + WEIGTH[dir]*phi[REST]*(dxux + dyuy + dzuz); - // h[dir] = h[dir] - (h[dir] - hEq)/(tauH1); - // g[dir] = g[dir] - collFactorM*(g[dir]-gEq) + 0.5*forcingTerm[dir]; + h[dir] = h[dir] - (h[dir] - hEq) / (tauH); } else { hEq = phi[REST] * WEIGTH[REST] * (1.0 - 1.5 * (ux2 + uy2 + uz2)); - // gEq = rho*WEIGTH[dir]*(1 + 3*velProd + 4.5*velSq1 - 1.5*(vx2+vy2+vz2))*c1o3 + - // (p1-rho*c1o3)*WEIGTH[dir]; h[dir] = hEq; - h[REST] = h[REST] - - (h[REST] - hEq) / (tauH); // + WEIGTH[REST]*phi[REST]*(dxux + dyuy + dzuz); - // g[dir] = g[dir] - collFactorM*(g[dir]-gEq) + 0.5*forcingTerm[dir]; + h[REST] = h[REST] - (h[REST] - hEq) / (tauH); } } @@ -1460,7 +1171,7 @@ void MultiphaseCumulantLBMKernel::calculate(int step) } dataSet->setPhaseField(divU); } -} + ////////////////////////////////////////////////////////////////////////// LBMReal MultiphaseCumulantLBMKernel::gradX1_phi() @@ -1502,17 +1213,12 @@ LBMReal MultiphaseCumulantLBMKernel::nabla2_phi() } return 6.0 * sum; } -///// Commnets neeeded //////// void MultiphaseCumulantLBMKernel::computePhasefield() { using namespace D3Q27System; SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions(); - // const int bcArrayMaxX1 = (int)distributionsH->getNX1(); - // const int bcArrayMaxX2 = (int)distributionsH->getNX2(); - // const int bcArrayMaxX3 = (int)distributionsH->getNX3(); - int minX1 = ghostLayerWidth; int minX2 = ghostLayerWidth; int minX3 = ghostLayerWidth; @@ -1559,61 +1265,10 @@ void MultiphaseCumulantLBMKernel::computePhasefield() h[BNE] = (*this->nonLocalDistributionsH)(D3Q27System::ET_BNE, x1, x2, x3p); h[REST] = (*this->zeroDistributionsH)(x1, x2, x3); - - /*(*this->phaseField)(x1,x2,x3) = h[REST] + h[E] + h[W] + h[N] + h[S] + h[T] + h[B] + h[NE] + h[SW] - + h[SE] + h[NW] + h[TE] + h[BW] + - h[BE] + h[TW] + h[TN] + h[BS] + h[BN] + h[TS] + h[TNE] + h[TNW] + h[TSE] + h[TSW] + h[BNE] + - h[BNW] + h[BSE] + h[BSW];*/ } } } } - //---------------------------------------------------------- - - /* - /////// Filling ghost nodes for FD computations ////////// - for(int x1 = minX1; x1 < maxX1; x1++) - { - for(int x2 = minX2; x2 < maxX2; x2++) - { - int x3 = 0; - (*phaseField)(x1, x2, x3) = (*phaseField)(x1, x2, maxX3-1); - x3 = maxX3; - (*phaseField)(x1, x2, x3) = (*phaseField)(x1, x2, minX3); - } - } - for(int x2 = minX2; x2 < maxX2; x2++) - { - for(int x3 = minX3; x3 < maxX3; x3++) - { - int x1 = 0; - (*phaseField)(x1, x2, x3) = (*phaseField)(maxX1-1, x2, x3); - x1 = maxX1; - (*phaseField)(x1, x2, x3) = (*phaseField)(minX1, x2, x3); - } - } - for(int x1 = minX1; x1 < maxX1; x1++) - { - for(int x3 = minX3; x3 < maxX3; x3++) - { - int x2 = 0; - (*phaseField)(x1, x2, x3) = (*phaseField)(x1, maxX2-1, x3); - x2 = maxX2; - (*phaseField)(x1, x2, x3) = (*phaseField)(x1, minX2, x3); - } - } - (*phaseField)(0, 0, 0 ) = (*phaseField)(maxX1-1, maxX2-1, maxX3-1); - (*phaseField)(0, 0, maxX3) = (*phaseField)(maxX1-1, maxX2-1, minX3 ); - (*phaseField)(0, maxX2, 0 ) = (*phaseField)(maxX1-1, minX2, maxX3-1 ); - (*phaseField)(0, maxX2, maxX3) = (*phaseField)(maxX1-1, minX2, minX3 ); - - (*phaseField)(maxX1, 0, 0 ) = (*phaseField)(minX1, maxX2-1, maxX3-1); - (*phaseField)(maxX1, 0, maxX3) = (*phaseField)(minX1, maxX2-1, minX3 ); - (*phaseField)(maxX1, maxX2, 0 ) = (*phaseField)(minX1, minX2, maxX3-1 ); - (*phaseField)(maxX1, maxX2, maxX3) = (*phaseField)(minX1, minX2, minX3 ); - - ///////////////////////////////////////////////////////// - */ } void MultiphaseCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, @@ -1625,124 +1280,17 @@ void MultiphaseCumulantLBMKernel::findNeighbors(CbArray3D<LBMReal, IndexerX3X2X1 phi[REST] = (*ph)(x1, x2, x3); - // LBMReal a = -0.5*sqrt(2*beta/kappa)*cos(contactAngle*UbMath::PI/180); - // LBMReal a1 = 1 + a; - for (int k = FSTARTDIR; k <= FENDDIR; k++) { if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) { phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); } else { - /* - if (phi[REST] < 1e-2) - { - phi[k] = (*ph)(x1 + DX1[INVDIR[k]], x2 + DX2[INVDIR[k]], x3 + DX3[INVDIR[k]]); - } - else - { - LBMReal phi_f = (*ph)(x1 + DX1[k], x2, x3 + DX3[k]); - phi[k] = (a1 - sqrt(a1*a1 - 4*a*phi_f) )/a - phi_f; - } - */ - - phi[k] = (*ph)(x1, x2, x3); - - // if (bcArray->isSolid(x1 + DX1[k], x2, x3)) - //{ - // phi[k] = (*ph)(x1, x2, x3); - // //if (!bcArray->isSolid(x1 , x2 + DX2[k], x3 + DX3[k])) - // //{ - // // //phi[k] = (*ph)(x1 , x2 + DX2[k], x3 + DX3[k]); - // // LBMReal phi_f = (*ph)(x1 , x2 + DX2[k], x3 + DX3[k]); - // // phi[k] = (a1 - sqrt(a1*a1 - 4*a*phi_f) )/a - phi_f; - // //} - // //else - // //{ - // // phi[k] = (*ph)(x1, x2, x3); - // //} - //} - // - // if (bcArray->isSolid(x1 , x2 + DX2[k], x3)) - //{ - // phi[k] = (*ph)(x1, x2, x3); - // //if (!bcArray->isSolid(x1 + DX1[k], x2 , x3 + DX3[k])) - // //{ - // // //phi[k] = (*ph)(x1 + DX1[k], x2 , x3 + DX3[k]); - // // LBMReal phi_f = (*ph)(x1 + DX1[k], x2 , x3 + DX3[k]); - // // phi[k] = (a1 - sqrt(a1*a1 - 4*a*phi_f) )/a - phi_f; - // //} - // //else - // //{ - // // phi[k] = (*ph)(x1, x2, x3); - // //} - //} - - // if (bcArray->isSolid(x1 , x2, x3+ DX3[k])) - //{ - // if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3)) - // { - // //phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3); - // LBMReal phi_f = (*ph)(x1 + DX1[k], x2 + DX2[k], x3); - // phi[k] = (a1 - sqrt(a1*a1 - 4*a*phi_f) )/a - phi_f; - // } - // else - // { - // phi[k] = (*ph)(x1, x2, x3); - // } - //} - - /*if (bcArray->isSolid(x1 + DX1[k], x2, x3)) phi[k] = (*ph)(x1 , x2 + DX2[k], x3 + DX3[k]); - if (bcArray->isSolid(x1 , x2 + DX2[k], x3)) phi[k] = (*ph)(x1 + DX1[k], x2 , x3 + DX3[k]); - if (bcArray->isSolid(x1 , x2, x3+ DX3[k])) phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 );*/ - - /*if (phi[REST] < 0.00001) - { - phi[k] = 0.0; - } - else - { - phi[k] = 0.5; - }*/ - - // phi[k] = 0.5; - // phi[k] = (*ph)(x1, x2, x3); - // phi[k] = (*ph)(x1 + DX1[INVDIR[k]], x2 + DX2[INVDIR[k]], x3 + DX3[INVDIR[k]]); - } + } } - - /* - phi[E ] = (*ph)(x1 + DX1[E ], x2 + DX2[E ], x3 + DX3[E ]); - phi[N ] = (*ph)(x1 + DX1[N ], x2 + DX2[N ], x3 + DX3[N ]); - phi[T ] = (*ph)(x1 + DX1[T ], x2 + DX2[T ], x3 + DX3[T ]); - phi[W ] = (*ph)(x1 + DX1[W ], x2 + DX2[W ], x3 + DX3[W ]); - phi[S ] = (*ph)(x1 + DX1[S ], x2 + DX2[S ], x3 + DX3[S ]); - phi[B ] = (*ph)(x1 + DX1[B ], x2 + DX2[B ], x3 + DX3[B ]); - phi[NE ] = (*ph)(x1 + DX1[NE ], x2 + DX2[NE ], x3 + DX3[NE ]); - phi[NW ] = (*ph)(x1 + DX1[NW ], x2 + DX2[NW ], x3 + DX3[NW ]); - phi[TE ] = (*ph)(x1 + DX1[TE ], x2 + DX2[TE ], x3 + DX3[TE ]); - phi[TW ] = (*ph)(x1 + DX1[TW ], x2 + DX2[TW ], x3 + DX3[TW ]); - phi[TN ] = (*ph)(x1 + DX1[TN ], x2 + DX2[TN ], x3 + DX3[TN ]); - phi[TS ] = (*ph)(x1 + DX1[TS ], x2 + DX2[TS ], x3 + DX3[TS ]); - phi[SW ] = (*ph)(x1 + DX1[SW ], x2 + DX2[SW ], x3 + DX3[SW ]); - phi[SE ] = (*ph)(x1 + DX1[SE ], x2 + DX2[SE ], x3 + DX3[SE ]); - phi[BW ] = (*ph)(x1 + DX1[BW ], x2 + DX2[BW ], x3 + DX3[BW ]); - phi[BE ] = (*ph)(x1 + DX1[BE ], x2 + DX2[BE ], x3 + DX3[BE ]); - phi[BS ] = (*ph)(x1 + DX1[BS ], x2 + DX2[BS ], x3 + DX3[BS ]); - phi[BN ] = (*ph)(x1 + DX1[BN ], x2 + DX2[BN ], x3 + DX3[BN ]); - phi[BSW] = (*ph)(x1 + DX1[BSW], x2 + DX2[BSW], x3 + DX3[BSW]); - phi[BSE] = (*ph)(x1 + DX1[BSE], x2 + DX2[BSE], x3 + DX3[BSE]); - phi[BNW] = (*ph)(x1 + DX1[BNW], x2 + DX2[BNW], x3 + DX3[BNW]); - phi[BNE] = (*ph)(x1 + DX1[BNE], x2 + DX2[BNE], x3 + DX3[BNE]); - phi[TNE] = (*ph)(x1 + DX1[TNE], x2 + DX2[TNE], x3 + DX3[TNE]); - phi[TNW] = (*ph)(x1 + DX1[TNW], x2 + DX2[TNW], x3 + DX3[TNW]); - phi[TSE] = (*ph)(x1 + DX1[TSE], x2 + DX2[TSE], x3 + DX3[TSE]); - phi[TSW] = (*ph)(x1 + DX1[TSW], x2 + DX2[TSW], x3 + DX3[TSW]); - */ } void MultiphaseCumulantLBMKernel::swapDistributions() { LBMKernel::swapDistributions(); dataSet->getHdistributions()->swap(); - // computePhasefield(); } \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp similarity index 93% rename from src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.cpp rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp index f3bd4f9540bb35e1ccac4b618cab492ff8c331d1..c8f14da81100666d0e45f137cded5c20928318a8 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.cpp @@ -26,12 +26,12 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file BoundaryConditionsBlockVisitorMultiphase.cpp +//! \file MultiphaseBoundaryConditionsBlockVisitor.cpp //! \ingroup Visitors //! \author Hesameddin Safari //======================================================================================= -#include "BoundaryConditionsBlockVisitorMultiphase.h" +#include "MultiphaseBoundaryConditionsBlockVisitor.h" #include "BCAdapter.h" #include "BCArray3D.h" #include "BCProcessor.h" @@ -45,18 +45,18 @@ #include "BCArray3D.h" #include "LBMKernel.h" -BoundaryConditionsBlockVisitorMultiphase::BoundaryConditionsBlockVisitorMultiphase() : +MultiphaseBoundaryConditionsBlockVisitor::MultiphaseBoundaryConditionsBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) { } ////////////////////////////////////////////////////////////////////////// -BoundaryConditionsBlockVisitorMultiphase::~BoundaryConditionsBlockVisitorMultiphase() +MultiphaseBoundaryConditionsBlockVisitor::~MultiphaseBoundaryConditionsBlockVisitor() { } ////////////////////////////////////////////////////////////////////////// -void BoundaryConditionsBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) +void MultiphaseBoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) { if (block->getRank() == grid->getRank()) { @@ -136,7 +136,7 @@ void BoundaryConditionsBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Blo } } ////////////////////////////////////////////////////////////////////////// -void BoundaryConditionsBlockVisitorMultiphase::addBC(SPtr<BCAdapter> bc) +void MultiphaseBoundaryConditionsBlockVisitor::addBC(SPtr<BCAdapter> bc) { bcMap.insert(std::make_pair(bc->getBcAlgorithmType(), bc->getAlgorithm())); } diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h similarity index 88% rename from src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.h rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h index 7ff93af25d527db5d468111c5cc7f160c98802d0..19b68dd0d99940365593815bd0cc64db4611bcf4 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitorMultiphase.h +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h @@ -26,13 +26,13 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file BoundaryConditionsBlockVisitorMultiphase.h +//! \file MultiphaseBoundaryConditionsBlockVisitor.h //! \ingroup Visitors //! \author Hesameddin Safari //======================================================================================= -#ifndef BoundaryConditionBlockVisitorMultiphase_h__ -#define BoundaryConditionBlockVisitorMultiphase_h__ +#ifndef MultiphaseBoundaryConditionsBlockVisitor_h__ +#define MultiphaseBoundaryConditionsBlockVisitor_h__ #include "Block3DVisitor.h" #include <map> @@ -40,11 +40,11 @@ class BCAdapter; class BCAlgorithm; -class BoundaryConditionsBlockVisitorMultiphase : public Block3DVisitor +class MultiphaseBoundaryConditionsBlockVisitor : public Block3DVisitor { public: - BoundaryConditionsBlockVisitorMultiphase(); - virtual ~BoundaryConditionsBlockVisitorMultiphase(); + MultiphaseBoundaryConditionsBlockVisitor(); + virtual ~MultiphaseBoundaryConditionsBlockVisitor(); void visit(SPtr<Grid3D> grid, SPtr<Block3D> block); void addBC(SPtr<BCAdapter> bc); diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp similarity index 55% rename from src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.cpp rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp index f609d7af154d96a5c4e5e76fb06583de712ec77b..508442c867797c460490a41ef46e6f4d87599c2a 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.cpp @@ -26,12 +26,12 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file InitDistributionsBlockVisitorMultiphase.cpp +//! \file MultiphaseInitDistributionsBlockVisitor.cpp //! \ingroup Visitors //! \author Hesameddin Safari //======================================================================================= -#include "InitDistributionsBlockVisitorMultiphase.h" +#include "MultiphaseInitDistributionsBlockVisitor.h" #include "BCArray3D.h" #include "BCProcessor.h" #include "Block3D.h" @@ -41,7 +41,7 @@ #include "Grid3DSystem.h" #include "LBMKernel.h" -InitDistributionsBlockVisitorMultiphase::InitDistributionsBlockVisitorMultiphase() +MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor() : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) { this->setVx1(0.0); @@ -50,127 +50,110 @@ InitDistributionsBlockVisitorMultiphase::InitDistributionsBlockVisitorMultiphase this->setRho(0.0); } ////////////////////////////////////////////////////////////////////////// -//D3Q27ETInitDistributionsBlockVisitor::D3Q27ETInitDistributionsBlockVisitor(LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3) -// : Block3DVisitor(0, Grid3DSystem::MAXLEVEL) -//{ -// this->setVx1(vx1); -// this->setVx2(vx2); -// this->setVx3(vx3); -// this->setRho(rho); -//} -////////////////////////////////////////////////////////////////////////// -InitDistributionsBlockVisitorMultiphase::InitDistributionsBlockVisitorMultiphase( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3) +MultiphaseInitDistributionsBlockVisitor::MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1, LBMReal vx2, LBMReal vx3) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), densityRatio(densityRatio), intThickness(intThickness), radius(radius) { this->setVx1(vx1); this->setVx2(vx2); this->setVx3(vx3); - //this->setRho(rho); - //this->setNu(nu); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx1( const mu::Parser& parser) +void MultiphaseInitDistributionsBlockVisitor::setVx1( const mu::Parser& parser) { this->checkFunction(parser); this->muVx1 = parser; } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx2( const mu::Parser& parser) +void MultiphaseInitDistributionsBlockVisitor::setVx2( const mu::Parser& parser) { this->checkFunction(parser); this->muVx2 = parser; } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx3( const mu::Parser& parser) +void MultiphaseInitDistributionsBlockVisitor::setVx3( const mu::Parser& parser) { this->checkFunction(parser); this->muVx3 = parser; } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setRho( const mu::Parser& parser) +void MultiphaseInitDistributionsBlockVisitor::setRho( const mu::Parser& parser) { this->checkFunction(parser); this->muRho = parser; } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setPhi( const mu::Parser& parser) +void MultiphaseInitDistributionsBlockVisitor::setPhi( const mu::Parser& parser) { this->checkFunction(parser); this->muPhi = parser; } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx1( const std::string& muParserString) +void MultiphaseInitDistributionsBlockVisitor::setVx1( const std::string& muParserString) { this->muVx1.SetExpr(muParserString); this->checkFunction(muVx1); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx2( const std::string& muParserString) +void MultiphaseInitDistributionsBlockVisitor::setVx2( const std::string& muParserString) { this->muVx2.SetExpr(muParserString); this->checkFunction(muVx2); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx3( const std::string& muParserString) +void MultiphaseInitDistributionsBlockVisitor::setVx3( const std::string& muParserString) { this->muVx3.SetExpr(muParserString); this->checkFunction(muVx3); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setRho( const std::string& muParserString) +void MultiphaseInitDistributionsBlockVisitor::setRho( const std::string& muParserString) { this->muRho.SetExpr(muParserString); this->checkFunction(muRho); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setPhi( const std::string& muParserString) +void MultiphaseInitDistributionsBlockVisitor::setPhi( const std::string& muParserString) { this->muPhi.SetExpr(muParserString); this->checkFunction(muPhi); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx1( LBMReal vx1 ) +void MultiphaseInitDistributionsBlockVisitor::setVx1( LBMReal vx1 ) { this->muVx1.SetExpr( UbSystem::toString(vx1,D3Q27RealLim::digits10) ); this->checkFunction(muVx1); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx2( LBMReal vx2 ) +void MultiphaseInitDistributionsBlockVisitor::setVx2( LBMReal vx2 ) { this->muVx2.SetExpr( UbSystem::toString(vx2,D3Q27RealLim::digits10) ); this->checkFunction(muVx2); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setVx3( LBMReal vx3 ) +void MultiphaseInitDistributionsBlockVisitor::setVx3( LBMReal vx3 ) { this->muVx3.SetExpr( UbSystem::toString(vx3,D3Q27RealLim::digits10) ); this->checkFunction(muVx3); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setRho( LBMReal rho ) +void MultiphaseInitDistributionsBlockVisitor::setRho( LBMReal rho ) { this->muRho.SetExpr( UbSystem::toString(rho,D3Q27RealLim::digits10) ); this->checkFunction(muRho); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setPhi( LBMReal phi ) +void MultiphaseInitDistributionsBlockVisitor::setPhi( LBMReal phi ) { this->muPhi.SetExpr( UbSystem::toString(phi,D3Q27RealLim::digits10) ); this->checkFunction(muPhi); } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block) +void MultiphaseInitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block) { using namespace D3Q27System; if(!block) UB_THROW( UbException(UB_EXARGS,"block is not exist") ); - //UbTupleDouble3 blockLengths = grid->getBlockLengths(block); - //UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); - //double dx = grid->getDeltaX(block); - //LBMReal o = LBMSystem::calcCollisionFactor(nu, block->getLevel()); - - //define vars for functions mu::value_type x1,x2,x3; this->muVx1.DefineVar("x1",&x1); this->muVx1.DefineVar("x2",&x2); this->muVx1.DefineVar("x3",&x3); @@ -179,10 +162,6 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt this->muRho.DefineVar("x1",&x1); this->muRho.DefineVar("x2",&x2); this->muRho.DefineVar("x3",&x3); this->muPhi.DefineVar("x1",&x1); this->muPhi.DefineVar("x2",&x2); this->muPhi.DefineVar("x3",&x3); - //Funktionszeiger - typedef void (*CalcFeqsFct)(LBMReal* const& /*feq[27]*/,const LBMReal& /*(d)rho*/,const LBMReal& /*vx1*/,const LBMReal& /*vx2*/,const LBMReal& /*vx3*/); - CalcFeqsFct calcFeqsFct = NULL; - LBMReal vx1, vx2, vx3, rho, p1, phi; int gridRank = grid->getRank(); @@ -194,30 +173,18 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt if (!kernel) throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString()); - if(kernel->getCompressible()) - calcFeqsFct = &D3Q27System::calcCompFeq; - else - calcFeqsFct = &D3Q27System::calcIncompFeq; - - //UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); SPtr<EsoTwist3D> distributionsF = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getFdistributions()); SPtr<EsoTwist3D> distributionsH = dynamicPointerCast<EsoTwist3D>(kernel->getDataSet()->getHdistributions()); - //PhaseFieldArray3DPtr phaseField = kernel->getDataSet()->getPhaseField(); + LBMReal phiL = kernel->getPhiL(); LBMReal phiH = kernel->getPhiH(); LBMReal f[D3Q27System::ENDF+1]; - //LBMReal h[D3Q27System::ENDF+1]; - - //size_t nx1 = distributionsF->getNX1(); - //size_t nx2 = distributionsF->getNX2(); - //size_t nx3 = distributionsF->getNX3(); - for(int ix3=0; ix3<bcArray->getNX3(); ix3++) - for(int ix2=0; ix2<bcArray->getNX2(); ix2++) - for(int ix1=0; ix1<bcArray->getNX1(); ix1++) + for(int ix3=0; ix3<(int)bcArray->getNX3(); ix3++) + for (int ix2 = 0; ix2 < (int)bcArray->getNX2(); ix2++) + for (int ix1 = 0; ix1 < (int)bcArray->getNX1(); ix1++) { Vector3D coords = grid->getNodeCoordinates(block, ix1, ix2, ix3); x1 = coords[0]; @@ -237,69 +204,7 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt LBMReal rhoL = 1.0/densityRatio; rho = rhoH + (rhoH - rhoL)*(phi - phiH)/(phiH - phiL); - //vx1 = 0.0; //0.02*phi; - //vx2 = 0.0; - //vx3 = 0.0; - //(*phaseField)(ix1,ix2,ix3) = phi; - - - /* - vx1 = muVx1.Eval(); - vx2 = muVx2.Eval(); - vx3 = muVx3.Eval(); - rho = muRho.Eval(); - - //x-derivative - double deltaX=dx*0.5; - x1 = val<1>(coords)+deltaX; - double vx1Plusx1 = muVx1.Eval(); - double vx2Plusx1 = muVx2.Eval(); - double vx3Plusx1 = muVx3.Eval(); - - x1 = val<1>(coords)-deltaX; - double vx1Minusx1 = muVx1.Eval(); - double vx2Minusx1 = muVx2.Eval(); - double vx3Minusx1 = muVx3.Eval(); - - //y-derivative - x1 = val<1>(coords); - x2 = val<2>(coords)+deltaX; - double vx1Plusx2 = muVx1.Eval(); - double vx2Plusx2 = muVx2.Eval(); - double vx3Plusx2 = muVx3.Eval(); - - x2 = val<2>(coords)-deltaX; - double vx1Minusx2 = muVx1.Eval(); - double vx2Minusx2 = muVx2.Eval(); - double vx3Minusx2 = muVx3.Eval(); - - //z-derivative - x2 = val<2>(coords); - x3 = val<3>(coords)+deltaX; - double vx1Plusx3 = muVx1.Eval(); - double vx2Plusx3 = muVx2.Eval(); - double vx3Plusx3 = muVx3.Eval(); - - x3 = val<3>(coords)-deltaX; - double vx1Minusx3 = muVx1.Eval(); - double vx2Minusx3 = muVx2.Eval(); - double vx3Minusx3 = muVx3.Eval(); - - double ax=(vx1Plusx1-vx1Minusx1)/(2.0*deltaX)*dx; - double bx=(vx2Plusx1-vx2Minusx1)/(2.0*deltaX)*dx; - double cx=(vx3Plusx1-vx3Minusx1)/(2.0*deltaX)*dx; - - double ay=(vx1Plusx2-vx1Minusx2)/(2.0*deltaX)*dx; - double by=(vx2Plusx2-vx2Minusx2)/(2.0*deltaX)*dx; - double cy=(vx3Plusx2-vx3Minusx2)/(2.0*deltaX)*dx; - - double az=(vx1Plusx3-vx1Minusx3)/(2.0*deltaX)*dx; - double bz=(vx2Plusx3-vx2Minusx3)/(2.0*deltaX)*dx; - double cz=(vx3Plusx3-vx3Minusx3)/(2.0*deltaX)*dx; - double eps_new=1.0; - LBMReal op = 1.; - */ - + LBMReal feq[27]; LBMReal geq[27]; @@ -319,80 +224,6 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt } - - /*double f_E = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op)); - double f_N = f_E + eps_new *((2.*(ax - by))/(9.*o)); - double f_T = f_E + eps_new *((2.*(ax - cz))/(9.*o)); - double f_NE = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op)); - double f_SE = f_NE + eps_new *(( ay + bx )/(9.*o)); - double f_TE = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op)); - double f_BE = f_TE + eps_new *(( az + cx )/(9.*o)); - double f_TN = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op)); - double f_BN = f_TN + eps_new *(( bz + cy )/(9.*o)); - double f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op)); - double f_TNE = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o)); - double f_TSW = - eps_new *((ay + bx)/(36.*o)) - f_TNE; - double f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; - double f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; - - - f[E] = f_E + feq[E]; - f[W] = f_E + feq[W]; - f[N] = f_N + feq[N]; - f[S] = f_N + feq[S]; - f[T] = f_T + feq[T]; - f[B] = f_T + feq[B]; - f[NE] = f_NE + feq[NE]; - f[SW] = f_NE + feq[SW]; - f[SE] = f_SE + feq[SE]; - f[NW] = f_SE + feq[NW]; - f[TE] = f_TE + feq[TE]; - f[BW] = f_TE + feq[BW]; - f[BE] = f_BE + feq[BE]; - f[TW] = f_BE + feq[TW]; - f[TN] = f_TN + feq[TN]; - f[BS] = f_TN + feq[BS]; - f[BN] = f_BN + feq[BN]; - f[TS] = f_BN + feq[TS]; - f[TNE] = f_TNE + feq[TNE]; - f[TNW] = f_TNW + feq[TNW]; - f[TSE] = f_TSE + feq[TSE]; - f[TSW] = f_TSW + feq[TSW]; - f[BNE] = f_TSW + feq[BNE]; - f[BNW] = f_TSE + feq[BNW]; - f[BSE] = f_TNW + feq[BSE]; - f[BSW] = f_TNE + feq[BSW]; - f[REST] = f_ZERO + feq[REST];*/ - - /*f[E] = feq[E] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[W] = feq[W] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[N] = feq[N] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[S] = feq[S] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[T] = feq[T] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[B] = feq[B] / 3.0 + (p1-rho/3.0)*UbMath::c2o27; - f[NE] = feq[NE] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[SW] = feq[SW] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[SE] = feq[SE] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[NW] = feq[NW] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[TE] = feq[TE] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[BW] = feq[BW] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[BE] = feq[BE] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[TW] = feq[TW] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[TN] = feq[TN] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[BS] = feq[BS] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[BN] = feq[BN] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[TS] = feq[TS] / 3.0 + (p1-rho/3.0)*UbMath::c1o54; - f[TNE] = feq[TNE] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[TNW] = feq[TNW] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[TSE] = feq[TSE] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[TSW] = feq[TSW] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[BNE] = feq[BNE] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[BNW] = feq[BNW] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[BSE] = feq[BSE] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[BSW] = feq[BSW] / 3.0 + (p1-rho/3.0)*UbMath::c1o216; - f[REST] = feq[REST] / 3.0 + (p1-rho/3.0)*UbMath::c8o27;*/ - - f[E] = geq[E] ; f[W] = geq[W] ; f[N] = geq[N] ; @@ -421,8 +252,6 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt f[BSW] = geq[BSW] ; f[REST] = geq[REST] ; - - //calcFeqsFct(f,rho,vx1,vx2,vx3); distributionsF->setDistribution(f, ix1, ix2, ix3); distributionsF->setDistributionInv(f, ix1, ix2, ix3); @@ -456,12 +285,6 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt distributionsH->setDistribution(f, ix1, ix2, ix3); distributionsH->setDistributionInv(f, ix1, ix2, ix3); - - //distributions->swap(); - //distributions->setDistribution(f, ix1, ix2, ix3); - //distributions->setDistributionInv(f, ix1, ix2, ix3); - //distributions->swap(); - } } @@ -473,7 +296,7 @@ void InitDistributionsBlockVisitorMultiphase::visit(const SPtr<Grid3D> grid, SPt } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::checkFunction(mu::Parser fct) +void MultiphaseInitDistributionsBlockVisitor::checkFunction(mu::Parser fct) { double x1=1.0,x2=1.0,x3=1.0; fct.DefineVar("x1",&x1); @@ -492,7 +315,7 @@ void InitDistributionsBlockVisitorMultiphase::checkFunction(mu::Parser fct) } } ////////////////////////////////////////////////////////////////////////// -void InitDistributionsBlockVisitorMultiphase::setNu( LBMReal nu ) +void MultiphaseInitDistributionsBlockVisitor::setNu( LBMReal nu ) { this->nu = nu; } diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h similarity index 92% rename from src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.h rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h index 05adc07ceda199ad04c602ea5b1d7cc75035ffb2..e6ebadfe85cf7ecb56f49a30eec3ce0c0bd10b86 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitorMultiphase.h +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseInitDistributionsBlockVisitor.h @@ -26,13 +26,13 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file InitDistributionsBlockVisitorMultiphase.h +//! \file MultiphaseInitDistributionsBlockVisitor.h //! \ingroup Visitors //! \author Hesameddin Safari //======================================================================================= -#ifndef InitDistributionsBlockVisitorMultiphase_H -#define InitDistributionsBlockVisitorMultiphase_H +#ifndef MultiphaseInitDistributionsBlockVisitor_H +#define MultiphaseInitDistributionsBlockVisitor_H #include "Block3DVisitor.h" #include "D3Q27System.h" @@ -42,13 +42,13 @@ -class InitDistributionsBlockVisitorMultiphase : public Block3DVisitor +class MultiphaseInitDistributionsBlockVisitor : public Block3DVisitor { public: typedef std::numeric_limits<LBMReal> D3Q27RealLim; public: - InitDistributionsBlockVisitorMultiphase(); + MultiphaseInitDistributionsBlockVisitor(); //D3Q27ETInitDistributionsBlockVisitor(LBMReal rho, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0); //! Constructor //! \param nu - viscosity @@ -56,7 +56,7 @@ public: //! \param vx1 - velocity in x //! \param vx2 - velocity in y //! \param vx3 - velocity in z - InitDistributionsBlockVisitorMultiphase( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0); + MultiphaseInitDistributionsBlockVisitor( LBMReal densityRatio, LBMReal intThickness, LBMReal radius, LBMReal vx1=0.0, LBMReal vx2=0.0, LBMReal vx3=0.0); ////////////////////////////////////////////////////////////////////////// //automatic vars are: x1,x2, x3 //ussage example: setVx1("x1*0.01+x2*0.003") diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.cpp b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp similarity index 85% rename from src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.cpp rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp index d3cbcb14570f1496d2f6ee3c251e4d515efc29da..733c7177dd7624ac78c6a8d30681f20cdedb456b 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.cpp @@ -1,4 +1,4 @@ -#include "SetKernelBlockVisitorMultiphase.h" +#include "MultiphaseSetKernelBlockVisitor.h" #include "Grid3DSystem.h" #include "LBMSystem.h" #include "Block3D.h" @@ -19,8 +19,8 @@ // } //} ////////////////////////////////////////////////////////////////////////// -SetKernelBlockVisitorMultiphase::SetKernelBlockVisitorMultiphase(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa, - LBMReal contactAngle, double availMem, double needMem, SetKernelBlockVisitorMultiphase::Action action /*= SetKernelBlockVisitor::New*/) : +MultiphaseSetKernelBlockVisitor::MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa, + LBMReal contactAngle, double availMem, double needMem, MultiphaseSetKernelBlockVisitor::Action action /*= SetKernelBlockVisitor::New*/) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), kernel(kernel), nuL(nuL), nuG(nuG), densityRatio(densityRatio), beta(beta), kappa(kappa), contactAngle(contactAngle), action(action), dataSetFlag(true) { if (needMem > availMem) @@ -29,7 +29,7 @@ SetKernelBlockVisitorMultiphase::SetKernelBlockVisitorMultiphase(SPtr<LBMKernel> } } ////////////////////////////////////////////////////////////////////////// -void SetKernelBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) +void MultiphaseSetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) { if(kernel && (block->getRank() == grid->getRank())) { @@ -50,10 +50,10 @@ void SetKernelBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo switch (action) { - case SetKernelBlockVisitorMultiphase::NewKernel: + case MultiphaseSetKernelBlockVisitor::NewKernel: block->setKernel(newKernel); break; - case SetKernelBlockVisitorMultiphase::ChangeKernel: + case MultiphaseSetKernelBlockVisitor::ChangeKernel: { SPtr<DataSet3D> dataSet = block->getKernel()->getDataSet(); if (!dataSet) @@ -73,7 +73,7 @@ void SetKernelBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo } break; - case SetKernelBlockVisitorMultiphase::ChangeKernelWithData: + case MultiphaseSetKernelBlockVisitor::ChangeKernelWithData: { SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor(); if (!bcProc) @@ -89,7 +89,7 @@ void SetKernelBlockVisitorMultiphase::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo } } -void SetKernelBlockVisitorMultiphase::setNoDataSetFlag(bool flag) +void MultiphaseSetKernelBlockVisitor::setNoDataSetFlag(bool flag) { dataSetFlag = flag; } diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h similarity index 87% rename from src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.h rename to src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h index 0874f665e8027a7497a775eab8517cb6376a2c0e..9f952e2dddaf67fed5fa10cd8874938e584b5114 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitorMultiphase.h +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseSetKernelBlockVisitor.h @@ -26,18 +26,18 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file SetKernelBlockVisitorMultiphase.cpp +//! \file MultiphaseSetKernelBlockVisitor.cpp //! \ingroup Visitors //! \author Hesameddin Safari //======================================================================================= -#ifndef SetKernelBlockVisitorMultiphase_h -#define SetKernelBlockVisitorMultiphase_h +#ifndef MultiphaseSetKernelBlockVisitor_h +#define MultiphaseSetKernelBlockVisitor_h #include "Block3DVisitor.h" #include "LBMKernel.h" -class SetKernelBlockVisitorMultiphase : public Block3DVisitor +class MultiphaseSetKernelBlockVisitor : public Block3DVisitor { public: enum Action { NewKernel, ChangeKernel, ChangeKernelWithData}; @@ -46,10 +46,10 @@ public: //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem); - SetKernelBlockVisitorMultiphase(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa, LBMReal contactAngle, double availMem, double needMem, - SetKernelBlockVisitorMultiphase::Action action = SetKernelBlockVisitorMultiphase::NewKernel); + MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nuL, LBMReal nuG, LBMReal densityRatio, LBMReal beta, LBMReal kappa, LBMReal contactAngle, double availMem, double needMem, + MultiphaseSetKernelBlockVisitor::Action action = MultiphaseSetKernelBlockVisitor::NewKernel); - virtual ~SetKernelBlockVisitorMultiphase() {} + virtual ~MultiphaseSetKernelBlockVisitor() {} virtual void visit(SPtr<Grid3D> grid, SPtr<Block3D> block);