diff --git a/apps/cpu/CouetteFlow/cflow.cpp b/apps/cpu/CouetteFlow/cflow.cpp index 72fd03b2ffbdeb91eb1af9faaf22ec10064ab69d..874b8e17aad431799acc0b13412fa025e6254077 100644 --- a/apps/cpu/CouetteFlow/cflow.cpp +++ b/apps/cpu/CouetteFlow/cflow.cpp @@ -240,8 +240,11 @@ void bflow(string configname) //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //grid->accept(setConnsVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); grid->accept(bcVisitor); diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp b/apps/cpu/FlowAroundCylinder/cylinder.cpp index 044ef765fd5af2a25c3719d9cb4dac403c9f0ee0..3ae5f2ab511cdc1767d8497eb6a895055d5ddd48 100644 --- a/apps/cpu/FlowAroundCylinder/cylinder.cpp +++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp @@ -289,10 +289,15 @@ void run(string configname) } //set connectors - InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nueLB, iProcessor); + grid->accept(setInterConnsVisitor); + SPtr<UbScheduler> stepSch(new UbScheduler(outTime)); SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm)); diff --git a/apps/cpu/HerschelBulkleyModel/hbflow.cpp b/apps/cpu/HerschelBulkleyModel/hbflow.cpp index 10381afe2bd95ca7df043e20ab92d4d40553244d..7371c782edcacae5d4db566a37248c40c0eb2853 100644 --- a/apps/cpu/HerschelBulkleyModel/hbflow.cpp +++ b/apps/cpu/HerschelBulkleyModel/hbflow.cpp @@ -275,8 +275,11 @@ void bflow(string configname) //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //grid->accept(setConnsVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); grid->accept(bcVisitor); diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp index bfbf4d9ab58f168d9383c42b36aec614e8b85831..3b6ddb814140f1b0e756deef1443577fa79aaf68 100644 --- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp +++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp @@ -314,9 +314,12 @@ void bflow(string configname) omp_set_num_threads(numOfThreads); //set connectors - InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor()); - static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor()); + //static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); + //grid->accept(setConnsVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); grid->accept(bcVisitor); diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp index f11526f0ebab646430028615e98e8f1a5710ec3b..22fb488a3b9965dab4fc7283bf00a89293c6bcb8 100644 --- a/apps/cpu/LaminarTubeFlow/ltf.cpp +++ b/apps/cpu/LaminarTubeFlow/ltf.cpp @@ -287,11 +287,13 @@ void run(string configname) if (myid == 0) UBLOG(logINFO, "Restart - end"); } - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor); + grid->accept(setInterConnsVisitor); + SPtr<UbScheduler> visSch(new UbScheduler(outTime)); SPtr<CoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm)); diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp index 89b2cea5d8d26d2c3920ee5e118b06a84fede5d9..1973ae061c02118c3a08210ece90f1b6905ef81a 100644 --- a/apps/cpu/Multiphase/Multiphase.cpp +++ b/apps/cpu/Multiphase/Multiphase.cpp @@ -412,11 +412,12 @@ void run(string configname) grid->accept(initVisitor); // set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); // InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); // ConnectorFactoryPtr factory(new Block3DConnectorFactory()); // ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); + TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); // domain decomposition for threads @@ -458,13 +459,17 @@ void run(string configname) // set connectors // InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); - grid->accept(setConnsVisitor); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //grid->accept(setConnsVisitor); if (myid == 0) UBLOG(logINFO, "Restart - end"); } + + TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + SPtr<UbScheduler> visSch(new UbScheduler(outTime)); SPtr<WriteMacroscopicQuantitiesCoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor( grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm)); diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp index fba3d72356ec2e37bace1f7ad46c80ec1f45301c..7ab66c19addd54f8d77b9f90e6f420df4382b4a6 100644 --- a/apps/cpu/rheometer/rheometer.cpp +++ b/apps/cpu/rheometer/rheometer.cpp @@ -348,9 +348,12 @@ void bflow(string configname) omp_set_num_threads(numOfThreads); //set connectors - InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor()); - static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //InterpolationProcessorPtr iProcessor(new ThixotropyInterpolationProcessor()); + //static_pointer_cast<ThixotropyInterpolationProcessor>(iProcessor)->setOmegaMin(thix->getOmegaMin()); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //grid->accept(setConnsVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); grid->accept(bcVisitor); diff --git a/apps/cpu/sphere/sphere.cpp b/apps/cpu/sphere/sphere.cpp index e5647049cf0ebb6cf3e2a8606a77186e340d85f4..310766ad05f6a3a1d8c08d8ead69c9f48bb6ce11 100644 --- a/apps/cpu/sphere/sphere.cpp +++ b/apps/cpu/sphere/sphere.cpp @@ -265,10 +265,17 @@ void run(string configname) UBLOG(logINFO, "SetConnectors - start, id=" << myid); //set connectors - SPtr<InterpolationProcessor> iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //SPtr<InterpolationProcessor> iProcessor(new IncompressibleOffsetInterpolationProcessor()); //SPtr<CompressibleOffsetMomentsInterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); + + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor); + grid->accept(setInterConnsVisitor); + UBLOG(logINFO, "SetConnectors - end, id=" << myid); SPtr<UbScheduler> stepSch(new UbScheduler(outstep)); diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index caa205abb1984cfa5c73f4277cc5fd6a9be09241..fd9eefa1bf2ecb2fe025047e08eb8d8f56e791a8 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -151,6 +151,8 @@ #include <Connectors/FineToCoarseNodeSetBlock3DConnector.h> #include <Connectors/LocalBlock3DConnector.h> #include <Connectors/RemoteBlock3DConnector.h> +#include <Connectors/TwoDistributionsFullDirectConnector.h> +#include <Connectors/TwoDistributionsFullVectorConnector.h> #include <Data/D3Q27EsoTwist3DSplittedVector.h> #include <Data/D3Q27EsoTwist3DSplittedVectorEx.h> @@ -330,6 +332,7 @@ #include <Visitors/MultiphaseSetKernelBlockVisitor.h> #include <Visitors/MultiphaseBoundaryConditionsBlockVisitor.h> #include <Visitors/MultiphaseInitDistributionsBlockVisitor.h> +#include <Visitors/SetInterpolationConnectorsBlockVisitor.h> #include <RefineAroundGbObjectHelper.h> #include <Visitors/RefineCrossAndInsideGbObjectHelper.h> diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h index a429384138f5183ba6853c18ed8a3e1a638bf932..baeac4b00ad2fd94d9cd9debfa9cf9fcba34a228 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelNoSlipBCAlgorithm.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file BinghamModelNoSlipBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef BinghamModelNoSlipBCAlgorithm_h__ #define BinghamModelNoSlipBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h index 0155babfc1d77427c9a18b7b295ad0ba1c05d793..9dfaef4bcfb452cebb13d22c074d0cae09be99af 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BinghamModelVelocityBCAlgorithm.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file BinghamModelVelocityBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef BinghamModelVelocityBCAlgorithm_h__ #define BinghamModelVelocityBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp index 33af827c68499c6c9454438290fadc5780c5eb93..905a8e3384afaca755b4f92ef21ff21395b2422b 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file DensityAndThixotropyBCAlgorithm.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= + #include "DensityAndThixotropyBCAlgorithm.h" #include "DistributionArray3D.h" #include "BoundaryConditions.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h index 069b6f1c697eda27821e6c213e1a961f62e292f0..79cb1c633272137476f32815ba5223dbc30d6ee3 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityAndThixotropyBCAlgorithm.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file DensityAndThixotropyBCAlgorithm.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef DensityAndThixotropyBCAlgorithm_h__ #define DensityAndThixotropyBCAlgorithm_h__ diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp index 49a4960a1ccee39475f4a7149a7ba819294681eb..b11e303d82f67b107b7c9b9f427d7fa3fb71eb79 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file DensityBCAdapter.cpp +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= #include "DensityBCAdapter.h" #include "basics/utilities/UbInfinity.h" #include "basics/utilities/UbLogger.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h index a52e06060cdaa3ec3057d9cdbdfda5ac35c53e77..5425d9fcbb57f18ca5e5e57d02133ef8f2a9b8f2 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file DensityBCAdapter.h +//! \ingroup BoundarConditions +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef DensityBCAdapter_H #define DensityBCAdapter_H diff --git a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h index dd99637063f48a38ddf8c0a15a301688b0ab3c59..0985242ba6b79dc03e7940498f24c542f475a64a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/MultiphaseCumulantLBMKernel.h @@ -54,7 +54,7 @@ public: double getCalculationTime() override { return .0; } protected: virtual void initDataSet(); - void swapDistributions(); + void swapDistributions() override; LBMReal f1[D3Q27System::ENDF+1]; CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp index 6a5cdbf82b2ec37ce11224a6416beeaab5e9d558..89b76aa946a42d848b4bf9e5e4dcf67726b2404b 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CreateTransmittersHelper.cpp +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + #include "CreateTransmittersHelper.h" #include <Communicator.h> #include <D3Q27System.h> diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h index f34adb32658db0214b8247788a2570e7dbac0761..353bb31229841c7b61fea4d2a4d7fca272e39135 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h +++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CreateTransmittersHelper.h +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + #ifndef CREATETRANSMITTERSHELPER_H #define CREATETRANSMITTERSHELPER_H @@ -12,7 +45,6 @@ //! \brief The class helps to create Transmitters. //! \details It is created two types of Transmitters: MPI and BOND -//! \author K. Kucher class CreateTransmittersHelper { public: diff --git a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h index 19b68dd0d99940365593815bd0cc64db4611bcf4..e6cbc69c8bb2431e552d01210c73e450661961c3 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/MultiphaseBoundaryConditionsBlockVisitor.h @@ -52,4 +52,4 @@ protected: private: std::map<char, SPtr<BCAlgorithm>> bcMap; }; -#endif // BoundaryConditionBlockVisitor_h__ +#endif // MultiphaseBoundaryConditionsBlockVisitor_h__ diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp index 9d63bdbd2ded14cadd62c13c622ed330953bca74..81746c66764f44b6e048c738b6fed9e798e621a7 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp @@ -32,474 +32,11 @@ //======================================================================================= #include "SetConnectorsBlockVisitor.h" +#include "Communicator.h" #include "D3Q27ETFullDirectConnector.h" #include "D3Q27ETFullVectorConnector.h" -#include "D3Q27ETCFOffVectorConnector.h" -#include "D3Q27ETFCOffVectorConnector.h" #include "TwoDistributionsFullDirectConnector.h" #include "TwoDistributionsFullVectorConnector.h" -#include "Grid3DSystem.h" #include <basics/transmitter/TbTransmitterLocal.h> -#include "Communicator.h" -#include "InterpolationProcessor.h" - -SetConnectorsBlockVisitor::SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, - LBMReal nue, InterpolationProcessorPtr iProcessor) : -Block3DVisitor(0, Grid3DSystem::MAXLEVEL), - comm(comm), - fullConnector(fullConnector), - dirs(dirs), - nue(nue), - iProcessor(iProcessor) -{ -} -////////////////////////////////////////////////////////////////////////// -SetConnectorsBlockVisitor::~SetConnectorsBlockVisitor(void) -{ -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - if(!block) return; - - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - start"); - UBLOG(logDEBUG5, block->toString()); - - gridRank = comm->getProcessID(); - grid->setRank(gridRank); - - setSameLevelConnectors(grid, block); - - if(grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel()) - setInterpolationConnectors(grid, block); - - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - start"); - int blockRank = block->getRank(); - if (gridRank == blockRank && block->isActive()) - { - block->clearWeight(); - std::vector<SPtr<Block3D>> neighbors; - int ix1 = block->getX1(); - int ix2 = block->getX2(); - int ix3 = block->getX3(); - int level = block->getLevel(); - - for( int dir = 0; dir < dirs; dir++) - { - SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - if(neighBlock) - { - int neighBlockRank = neighBlock->getRank(); - if(blockRank == neighBlockRank && neighBlock->isActive()) - { - SPtr<Block3DConnector> connector; - //connector = SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector( block, neighBlock, dir)); - connector = SPtr<Block3DConnector>(new TwoDistributionsFullDirectConnector( block, neighBlock, dir)); - block->setConnector(connector); - } - else if(blockRank != neighBlockRank && neighBlock->isActive()) - { - setRemoteConnectors(block, neighBlock, dir, fullConnector); - - if(dir >=0 && dir<=5) - { - int weight = block->getWeight(neighBlockRank); - weight++; - block->setWeight(neighBlockRank, weight); - } - } - } - } - - int weight = block->getNumberOfLocalConnectorsForSurfaces(); - weight = 6 - weight; - block->addWeightForAll(weight); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - start"); - CreateTransmittersHelper helper; - CreateTransmittersHelper::TransmitterPtr sender, receiver; - helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI); - - - SPtr<Block3DConnector> connector; - //connector = SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir)); - connector = SPtr<Block3DConnector>(new TwoDistributionsFullVectorConnector(sblock, sender, receiver, dir)); - sblock->setConnector(connector); - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - start"); - - //search for all blocks with different ranks - if (block->hasInterpolationFlagCF() && block->isActive()) - { - int fbx1 = block->getX1() << 1; - int fbx2 = block->getX2() << 1; - int fbx3 = block->getX3() << 1; - int level = block->getLevel() + 1; - - if( block->hasInterpolationFlagCF(D3Q27System::E)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E); - } - if( block->hasInterpolationFlagCF(D3Q27System::W)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W); - } - if( block->hasInterpolationFlagCF(D3Q27System::N)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N); - } - if( block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S); - } - if( block->hasInterpolationFlagCF(D3Q27System::T)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T); - } - if( block->hasInterpolationFlagCF(D3Q27System::B)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B); - } - - //////NE-NW-SE-SW - if( block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NE); - } - if( block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SW); - } - if( block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SE); - } - if( block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NW); - } - - /////////TE-BW-BE-TW 1-0 - if( block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TE); - } - if( block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BW); - } - if( block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BE); - } - if( block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TW); - } - - //////TN-BS-BN-TS - if( block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TN); - } - if( block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BS); - } - if( block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BN); - } - if( block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level); - SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TS); - } - - - - - //////corners - if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSW); - } - if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSE); - } - if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) - { - SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level); - SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); - SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); - - setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNW); - } - - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - start"); - int fBlockSWRank = -999, fBlockSERank = -999, fBlockNWRank = -999, fBlockNERank = -999; - if(fBlockSW) fBlockSWRank = fBlockSW->getRank(); - if(fBlockNW) fBlockNWRank = fBlockNW->getRank(); - if(fBlockSE) fBlockSERank = fBlockSE->getRank(); - if(fBlockNE) fBlockNERank = fBlockNE->getRank(); - int cBlockRank = cBlock->getRank(); - - LBMReal omegaF; - if(fBlockSW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSW->getLevel()); - if(fBlockNW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNW->getLevel()); - if(fBlockSE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSE->getLevel()); - if(fBlockNE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNE->getLevel()); - LBMReal omegaC = LBMSystem::calcCollisionFactor(nue, cBlock->getLevel()); - iProcessor->setOmegas(omegaC, omegaF); - - InterpolationProcessorPtr cIProcessor(iProcessor->clone()); - InterpolationProcessorPtr fIProcessorSW(iProcessor->clone()); - InterpolationProcessorPtr fIProcessorSE(iProcessor->clone()); - InterpolationProcessorPtr fIProcessorNW(iProcessor->clone()); - InterpolationProcessorPtr fIProcessorNE(iProcessor->clone()); - - CreateTransmittersHelper::TransmitterPtr senderCFevenEvenSW, receiverCFevenEvenSW, - senderCFevenOddNW, receiverCFevenOddNW, - senderCFoddEvenSE, receiverCFoddEvenSE, - senderCFoddOddNE, receiverCFoddOddNE, - senderFCevenEvenSW, receiverFCevenEvenSW, - senderFCevenOddNW, receiverFCevenOddNW, - senderFCoddEvenSE, receiverFCoddEvenSE, - senderFCoddOddNE, receiverFCoddOddNE; - - if(fBlockSW) createTransmitters(cBlock, fBlockSW, dir, CreateTransmittersHelper::SW, senderCFevenEvenSW, receiverCFevenEvenSW, senderFCevenEvenSW, receiverFCevenEvenSW); - if(fBlockNW) createTransmitters(cBlock, fBlockNW, dir, CreateTransmittersHelper::NW, senderCFevenOddNW, receiverCFevenOddNW, senderFCevenOddNW, receiverFCevenOddNW); - if(fBlockSE) createTransmitters(cBlock, fBlockSE, dir, CreateTransmittersHelper::SE, senderCFoddEvenSE, receiverCFoddEvenSE, senderFCoddEvenSE, receiverFCoddEvenSE); - if(fBlockNE) createTransmitters(cBlock, fBlockNE, dir, CreateTransmittersHelper::NE, senderCFoddOddNE, receiverCFoddOddNE, senderFCoddOddNE, receiverFCoddOddNE); - - if(cBlockRank == gridRank) - { - SPtr<Block3DConnector> connector(new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock, - senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW, receiverCFevenOddNW, - senderCFoddEvenSE, receiverCFoddEvenSE, senderCFoddOddNE, receiverCFoddOddNE, - dir, cIProcessor) ); - cBlock->setConnector(connector); - } - if(fBlockSW && fBlockSWRank == gridRank) - { - SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, - senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) ); - fBlockSW->setConnector(connector); - } - if(fBlockNW && fBlockNWRank == gridRank) - { - SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, - senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) ); - fBlockNW->setConnector(connector); - } - if(fBlockSE && fBlockSERank == gridRank) - { - SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, - senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) ); - fBlockSE->setConnector(connector); - } - if(fBlockNE && fBlockNERank == gridRank) - { - SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, - senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) ); - fBlockNE->setConnector(connector); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - end"); -} -////////////////////////////////////////////////////////////////////////// -void SetConnectorsBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, - CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr& senderCF, - CreateTransmittersHelper::TransmitterPtr& receiverCF, - CreateTransmittersHelper::TransmitterPtr& senderFC, - CreateTransmittersHelper::TransmitterPtr& receiverFC) -{ - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - start"); - CreateTransmittersHelper helper; - int fBlockRank = fBlock->getRank(); - int cBlockRank = cBlock->getRank(); - if(fBlockRank == cBlockRank && fBlockRank == gridRank) - { - senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); - } - else if(cBlockRank == gridRank) - { - helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI); - } - else if(fBlockRank == gridRank) - { - helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI); - } - UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - end"); -} diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h index 9d855de05e419cbec8cb98422bbefcb851d3ddde..d3d13f834d91a3afe1c64c2f8bea5ff164e0e61a 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h @@ -38,40 +38,126 @@ #include "Block3DVisitor.h" #include "D3Q27System.h" - +#include "Grid3DSystem.h" +#include "Grid3D.h" #include "CreateTransmittersHelper.h" - -class Grid3D; -class Block3D; -class Communicator; -class InterpolationProcessor; +#include "Communicator.h" +#include "D3Q27ETFullDirectConnector.h" +#include "D3Q27ETFullVectorConnector.h" +#include "TwoDistributionsFullDirectConnector.h" +#include "TwoDistributionsFullVectorConnector.h" +#include <basics/transmitter/TbTransmitterLocal.h> //! \brief A class sets connectors between blocks. +template <class T1, class T2> class SetConnectorsBlockVisitor : public Block3DVisitor { public: - SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, LBMReal nue, - SPtr<InterpolationProcessor> iProcessor); + using LocalConnector = T1; + using RemoteConnector = T2; +public: + SetConnectorsBlockVisitor(SPtr<Communicator> comm); ~SetConnectorsBlockVisitor() override; void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; ////////////////////////////////////////////////////////////////////////// protected: void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); - void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector); - void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); - void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, - SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir); - void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, CreateTransmittersHelper::IBlock ib, - CreateTransmittersHelper::TransmitterPtr &senderCF, - CreateTransmittersHelper::TransmitterPtr &receiverCF, - CreateTransmittersHelper::TransmitterPtr &senderFC, - CreateTransmittersHelper::TransmitterPtr &receiverFC); + void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir); SPtr<Communicator> comm; - bool fullConnector; int dirs; int gridRank; - LBMReal nue; - SPtr<InterpolationProcessor> iProcessor; }; +template <class T1, class T2> +SetConnectorsBlockVisitor<T1, T2>::SetConnectorsBlockVisitor(SPtr<Communicator> comm) + : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), comm(comm) +{ +} +////////////////////////////////////////////////////////////////////////// +template <class T1, class T2> +SetConnectorsBlockVisitor<T1, T2>::~SetConnectorsBlockVisitor(void) +{ +} +////////////////////////////////////////////////////////////////////////// +template <class T1, class T2> +void SetConnectorsBlockVisitor<T1, T2>::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) +{ + if (!block) + return; + + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::visit() - start"); + UBLOG(logDEBUG5, block->toString()); + + gridRank = comm->getProcessID(); + grid->setRank(gridRank); + + setSameLevelConnectors(grid, block); + + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::visit() - end"); +} +////////////////////////////////////////////////////////////////////////// +template <class T1, class T2> +void SetConnectorsBlockVisitor<T1, T2>::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) +{ + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::setSameLevelConnectors() - start"); + int blockRank = block->getRank(); + if (gridRank == blockRank && block->isActive()) { + block->clearWeight(); + std::vector<SPtr<Block3D>> neighbors; + int ix1 = block->getX1(); + int ix2 = block->getX2(); + int ix3 = block->getX3(); + int level = block->getLevel(); + + for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) { + SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); + + if (neighBlock) { + int neighBlockRank = neighBlock->getRank(); + if (blockRank == neighBlockRank && neighBlock->isActive()) { + SPtr<Block3DConnector> connector; + // connector = SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector( block, neighBlock, dir)); + //connector = SPtr<Block3DConnector>(new TwoDistributionsFullDirectConnector(block, neighBlock, dir)); + connector = SPtr<Block3DConnector>(new LocalConnector(block, neighBlock, dir)); + block->setConnector(connector); + } else if (blockRank != neighBlockRank && neighBlock->isActive()) { + setRemoteConnectors(block, neighBlock, dir); + + if (dir >= 0 && dir <= 5) { + int weight = block->getWeight(neighBlockRank); + weight++; + block->setWeight(neighBlockRank, weight); + } + } + } + } + + int weight = block->getNumberOfLocalConnectorsForSurfaces(); + weight = 6 - weight; + block->addWeightForAll(weight); + } + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::setSameLevelConnectors() - end"); +} +////////////////////////////////////////////////////////////////////////// +template <class T1, class T2> +void SetConnectorsBlockVisitor<T1, T2>::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir) +{ + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::setRemoteConnectors() - start"); + CreateTransmittersHelper helper; + CreateTransmittersHelper::TransmitterPtr sender, receiver; + helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, + CreateTransmittersHelper::MPI); + + SPtr<Block3DConnector> connector; + // connector = SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir)); + //connector = SPtr<Block3DConnector>(new TwoDistributionsFullVectorConnector(sblock, sender, receiver, dir)); + connector = SPtr<Block3DConnector>(new RemoteConnector(sblock, sender, receiver, dir)); + sblock->setConnector(connector); + UBLOG(logDEBUG5, "SetConnectorsBlockVisitor::setRemoteConnectors() - end"); +} +// + +using OneDistributionSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<D3Q27ETFullDirectConnector, D3Q27ETFullVectorConnector>; +using TwoDistributionsSetConnectorsBlockVisitor = SetConnectorsBlockVisitor<TwoDistributionsFullDirectConnector, TwoDistributionsFullVectorConnector>; + #endif // SETCONNECTORSBLOCKVISITOR_H diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c1ba14ba5170bae5177f63d1a0be01153d0335e --- /dev/null +++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp @@ -0,0 +1,435 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file SetInterpolationConnectorsBlockVisitor.cpp +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + +#include "SetInterpolationConnectorsBlockVisitor.h" +#include "D3Q27ETCFOffVectorConnector.h" +#include "D3Q27ETFCOffVectorConnector.h" +#include "TwoDistributionsFullDirectConnector.h" +#include "TwoDistributionsFullVectorConnector.h" +#include "Grid3DSystem.h" +#include <basics/transmitter/TbTransmitterLocal.h> + +#include "Communicator.h" +#include "InterpolationProcessor.h" + +SetInterpolationConnectorsBlockVisitor::SetInterpolationConnectorsBlockVisitor(SPtr<Communicator> comm, LBMReal nue, SPtr<InterpolationProcessor> iProcessor) : +Block3DVisitor(0, Grid3DSystem::MAXLEVEL), + comm(comm), + nue(nue), + iProcessor(iProcessor) +{ +} +////////////////////////////////////////////////////////////////////////// +SetInterpolationConnectorsBlockVisitor::~SetInterpolationConnectorsBlockVisitor(void) +{ +} +////////////////////////////////////////////////////////////////////////// +void SetInterpolationConnectorsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) +{ + if(!block) return; + + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::visit() - start"); + UBLOG(logDEBUG5, block->toString()); + + gridRank = comm->getProcessID(); + grid->setRank(gridRank); + + if(grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel()) + setInterpolationConnectors(grid, block); + + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::visit() - end"); +} +////////////////////////////////////////////////////////////////////////// +void SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block) +{ + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors() - start"); + + //search for all blocks with different ranks + if (block->hasInterpolationFlagCF() && block->isActive()) + { + int fbx1 = block->getX1() << 1; + int fbx2 = block->getX2() << 1; + int fbx3 = block->getX3() << 1; + int level = block->getLevel() + 1; + + if( block->hasInterpolationFlagCF(D3Q27System::E)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E); + } + if( block->hasInterpolationFlagCF(D3Q27System::W)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W); + } + if( block->hasInterpolationFlagCF(D3Q27System::N)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N); + } + if( block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S); + } + if( block->hasInterpolationFlagCF(D3Q27System::T)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T); + } + if( block->hasInterpolationFlagCF(D3Q27System::B)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); + SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B); + } + + //////NE-NW-SE-SW + if( block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NE); + } + if( block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SW); + } + if( block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SE); + } + if( block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NW); + } + + /////////TE-BW-BE-TW 1-0 + if( block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TE); + } + if( block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B)) + { + + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BW); + } + if( block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BE); + } + if( block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TW); + } + + //////TN-BS-BN-TS + if( block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TN); + } + if( block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BS); + } + if( block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BN); + } + if( block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level); + SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TS); + } + + + + + //////corners + if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNE); + } + if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSW); + } + if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSE); + } + if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNW); + } + if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNE); + } + if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSW); + } + if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSE); + } + if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W)) + { + SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level); + SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level); + SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level); + + setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNW); + } + + } + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors() - end"); +} +////////////////////////////////////////////////////////////////////////// +void SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir) +{ + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(...) - start"); + int fBlockSWRank = -999, fBlockSERank = -999, fBlockNWRank = -999, fBlockNERank = -999; + if(fBlockSW) fBlockSWRank = fBlockSW->getRank(); + if(fBlockNW) fBlockNWRank = fBlockNW->getRank(); + if(fBlockSE) fBlockSERank = fBlockSE->getRank(); + if(fBlockNE) fBlockNERank = fBlockNE->getRank(); + int cBlockRank = cBlock->getRank(); + + LBMReal omegaF; + if(fBlockSW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSW->getLevel()); + if(fBlockNW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNW->getLevel()); + if(fBlockSE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSE->getLevel()); + if(fBlockNE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNE->getLevel()); + LBMReal omegaC = LBMSystem::calcCollisionFactor(nue, cBlock->getLevel()); + iProcessor->setOmegas(omegaC, omegaF); + + InterpolationProcessorPtr cIProcessor(iProcessor->clone()); + InterpolationProcessorPtr fIProcessorSW(iProcessor->clone()); + InterpolationProcessorPtr fIProcessorSE(iProcessor->clone()); + InterpolationProcessorPtr fIProcessorNW(iProcessor->clone()); + InterpolationProcessorPtr fIProcessorNE(iProcessor->clone()); + + CreateTransmittersHelper::TransmitterPtr senderCFevenEvenSW, receiverCFevenEvenSW, + senderCFevenOddNW, receiverCFevenOddNW, + senderCFoddEvenSE, receiverCFoddEvenSE, + senderCFoddOddNE, receiverCFoddOddNE, + senderFCevenEvenSW, receiverFCevenEvenSW, + senderFCevenOddNW, receiverFCevenOddNW, + senderFCoddEvenSE, receiverFCoddEvenSE, + senderFCoddOddNE, receiverFCoddOddNE; + + if(fBlockSW) createTransmitters(cBlock, fBlockSW, dir, CreateTransmittersHelper::SW, senderCFevenEvenSW, receiverCFevenEvenSW, senderFCevenEvenSW, receiverFCevenEvenSW); + if(fBlockNW) createTransmitters(cBlock, fBlockNW, dir, CreateTransmittersHelper::NW, senderCFevenOddNW, receiverCFevenOddNW, senderFCevenOddNW, receiverFCevenOddNW); + if(fBlockSE) createTransmitters(cBlock, fBlockSE, dir, CreateTransmittersHelper::SE, senderCFoddEvenSE, receiverCFoddEvenSE, senderFCoddEvenSE, receiverFCoddEvenSE); + if(fBlockNE) createTransmitters(cBlock, fBlockNE, dir, CreateTransmittersHelper::NE, senderCFoddOddNE, receiverCFoddOddNE, senderFCoddOddNE, receiverFCoddOddNE); + + if(cBlockRank == gridRank) + { + SPtr<Block3DConnector> connector(new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock, + senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW, receiverCFevenOddNW, + senderCFoddEvenSE, receiverCFoddEvenSE, senderCFoddOddNE, receiverCFoddOddNE, + dir, cIProcessor) ); + cBlock->setConnector(connector); + } + if(fBlockSW && fBlockSWRank == gridRank) + { + SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, + senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) ); + fBlockSW->setConnector(connector); + } + if(fBlockNW && fBlockNWRank == gridRank) + { + SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, + senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) ); + fBlockNW->setConnector(connector); + } + if(fBlockSE && fBlockSERank == gridRank) + { + SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, + senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) ); + fBlockSE->setConnector(connector); + } + if(fBlockNE && fBlockNERank == gridRank) + { + SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, + senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) ); + fBlockNE->setConnector(connector); + } + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::setInterpolationConnectors(...) - end"); +} +////////////////////////////////////////////////////////////////////////// +void SetInterpolationConnectorsBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, + CreateTransmittersHelper::IBlock ib, + CreateTransmittersHelper::TransmitterPtr& senderCF, + CreateTransmittersHelper::TransmitterPtr& receiverCF, + CreateTransmittersHelper::TransmitterPtr& senderFC, + CreateTransmittersHelper::TransmitterPtr& receiverFC) +{ + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::createTransmitters(...) - start"); + CreateTransmittersHelper helper; + int fBlockRank = fBlock->getRank(); + int cBlockRank = cBlock->getRank(); + if(fBlockRank == cBlockRank && fBlockRank == gridRank) + { + senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); + senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >()); + } + else if(cBlockRank == gridRank) + { + helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI); + } + else if(fBlockRank == gridRank) + { + helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI); + } + UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::createTransmitters(...) - end"); +} + diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h new file mode 100644 index 0000000000000000000000000000000000000000..972a878bf210d0532126c0c6fb481f3ed936db7a --- /dev/null +++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h @@ -0,0 +1,72 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file SetInterpolationConnectorsBlockVisitor.h +//! \ingroup Visitors +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef SetInterpolationConnectorsBlockVisitor_H +#define SetInterpolationConnectorsBlockVisitor_H + +#include <PointerDefinitions.h> + +#include "Block3DVisitor.h" +#include "D3Q27System.h" + +#include "CreateTransmittersHelper.h" + +class Grid3D; +class Block3D; +class Communicator; +class InterpolationProcessor; + +//! \brief A class sets connectors between blocks. +class SetInterpolationConnectorsBlockVisitor : public Block3DVisitor +{ +public: + SetInterpolationConnectorsBlockVisitor(SPtr<Communicator> comm, LBMReal nue, SPtr<InterpolationProcessor> iProcessor); + ~SetInterpolationConnectorsBlockVisitor() override; + void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; + ////////////////////////////////////////////////////////////////////////// +protected: + void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); + void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, + SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir); + void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, CreateTransmittersHelper::IBlock ib, + CreateTransmittersHelper::TransmitterPtr &senderCF, + CreateTransmittersHelper::TransmitterPtr &receiverCF, + CreateTransmittersHelper::TransmitterPtr &senderFC, + CreateTransmittersHelper::TransmitterPtr &receiverFC); + SPtr<Communicator> comm; + int gridRank; + LBMReal nue; + SPtr<InterpolationProcessor> iProcessor; +}; + +#endif // SetInterpolationConnectorsBlockVisitor_H diff --git a/src/cpu/simulationconfig/src/Simulation.cpp b/src/cpu/simulationconfig/src/Simulation.cpp index c9a5884e8ef76fa9801a935c2f05b31a606977b8..6d80a1cfa2cc62d2575d1e8f67193b879f217b90 100644 --- a/src/cpu/simulationconfig/src/Simulation.cpp +++ b/src/cpu/simulationconfig/src/Simulation.cpp @@ -133,12 +133,15 @@ void Simulation::run() intHelper.setBC(); double bulkViscosity = physicalParameters->latticeViscosity * physicalParameters->bulkViscosityFactor; - auto iProcessor = std::make_shared<CompressibleOffsetMomentsInterpolationProcessor>(); - iProcessor->setBulkViscosity(physicalParameters->latticeViscosity, bulkViscosity); + //auto iProcessor = std::make_shared<CompressibleOffsetMomentsInterpolationProcessor>(); + //iProcessor->setBulkViscosity(physicalParameters->latticeViscosity, bulkViscosity); - SetConnectorsBlockVisitor setConnsVisitor(communicator, true, - lbmSystem->getNumberOfDirections(), - physicalParameters->latticeViscosity, iProcessor); + //SetConnectorsBlockVisitor setConnsVisitor(communicator, true, + // lbmSystem->getNumberOfDirections(), + // physicalParameters->latticeViscosity, iProcessor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(communicator); + grid->accept(setConnsVisitor); InitDistributionsBlockVisitor initVisitor; grid->accept(initVisitor);